일목균형표 수정
This commit is contained in:
@@ -3,6 +3,8 @@ import type { LogicNode, ConditionDSL } from './strategyTypes';
|
||||
import { nodeToText, type DefType } from './strategyEditorShared';
|
||||
import {
|
||||
START_NODE_ID,
|
||||
defaultStartMeta,
|
||||
getStartCandleTypes,
|
||||
isStartNodeId,
|
||||
normalizeStartCandleType,
|
||||
STRATEGY_CANDLE_TYPES,
|
||||
@@ -30,12 +32,15 @@ export type StrategyFlowNodeData = {
|
||||
def?: DefType;
|
||||
signalTab?: 'buy' | 'sell';
|
||||
selected?: boolean;
|
||||
/** START 노드 — 조건 판별 시간봉 */
|
||||
/** START 노드 — 조건 판별 시간봉 (표시용 대표) */
|
||||
candleType?: string;
|
||||
onStartCandleTypeChange?: (startId: string, candleType: string) => void;
|
||||
candleTypes?: string[];
|
||||
onStartCandleTypesChange?: (startId: string, candleTypes: string[]) => void;
|
||||
onDeleteStart?: (startId: string) => void;
|
||||
onDelete?: (id: string) => void;
|
||||
onUpdateCondition?: (nodeId: string, condition: ConditionDSL) => void;
|
||||
/** AND ↔ OR 전환 */
|
||||
onChangeLogicGateType?: (nodeId: string, gateType: 'AND' | 'OR') => void;
|
||||
onDropTarget?: (targetId: string, data: { type: string; value: string; label: string }, flowPos: { x: number; y: number }) => void;
|
||||
onDragOverTarget?: (targetId: string, flowPos: { x: number; y: number }) => void;
|
||||
onDragLeaveTarget?: (targetId: string) => void;
|
||||
@@ -353,8 +358,8 @@ export type EdgeHandleBinding = {
|
||||
|
||||
export const FLOW_NODE_W = 200;
|
||||
export const FLOW_NODE_H = 72;
|
||||
export const FLOW_START_W = 168;
|
||||
export const FLOW_START_H = 56;
|
||||
export const FLOW_START_W = 200;
|
||||
export const FLOW_START_H = 78;
|
||||
|
||||
function nodeCenter(
|
||||
id: string,
|
||||
@@ -464,7 +469,11 @@ function layoutTree(
|
||||
positions: Map<string, { x: number; y: number }>,
|
||||
def: DefType,
|
||||
signalTab: 'buy' | 'sell',
|
||||
callbacks: Pick<StrategyFlowNodeData, 'onDelete' | 'onUpdateCondition' | 'onDropTarget' | 'onDragOverTarget' | 'onDragLeaveTarget'>,
|
||||
callbacks: Pick<
|
||||
StrategyFlowNodeData,
|
||||
'onDelete' | 'onUpdateCondition' | 'onChangeLogicGateType'
|
||||
| 'onDropTarget' | 'onDragOverTarget' | 'onDragLeaveTarget'
|
||||
>,
|
||||
dragOverId: string | null,
|
||||
): void {
|
||||
const yBase = 220;
|
||||
@@ -484,6 +493,7 @@ function layoutTree(
|
||||
signalTab,
|
||||
onDelete: callbacks.onDelete,
|
||||
onUpdateCondition: callbacks.onUpdateCondition,
|
||||
onChangeLogicGateType: callbacks.onChangeLogicGateType,
|
||||
onDropTarget: callbacks.onDropTarget,
|
||||
onDragOverTarget: callbacks.onDragOverTarget,
|
||||
onDragLeaveTarget: callbacks.onDragLeaveTarget,
|
||||
@@ -610,7 +620,11 @@ function appendOrphanFlowNodes(
|
||||
positions: Map<string, { x: number; y: number }>,
|
||||
def: DefType,
|
||||
signalTab: 'buy' | 'sell',
|
||||
callbacks: Pick<StrategyFlowNodeData, 'onDelete' | 'onUpdateCondition' | 'onDropTarget' | 'onDragOverTarget' | 'onDragLeaveTarget'>,
|
||||
callbacks: Pick<
|
||||
StrategyFlowNodeData,
|
||||
'onDelete' | 'onUpdateCondition' | 'onChangeLogicGateType'
|
||||
| 'onDropTarget' | 'onDragOverTarget' | 'onDragLeaveTarget'
|
||||
>,
|
||||
): void {
|
||||
let orphanY = 80;
|
||||
for (const node of orphans) {
|
||||
@@ -630,6 +644,7 @@ function appendOrphanFlowNodes(
|
||||
signalTab,
|
||||
onDelete: callbacks.onDelete,
|
||||
onUpdateCondition: callbacks.onUpdateCondition,
|
||||
onChangeLogicGateType: callbacks.onChangeLogicGateType,
|
||||
onDropTarget: callbacks.onDropTarget,
|
||||
onDragOverTarget: callbacks.onDragOverTarget,
|
||||
onDragLeaveTarget: callbacks.onDragLeaveTarget,
|
||||
@@ -655,12 +670,13 @@ export function logicNodeToFlow(
|
||||
| 'onDropTarget'
|
||||
| 'onDragOverTarget'
|
||||
| 'onDragLeaveTarget'
|
||||
| 'onStartCandleTypeChange'
|
||||
| 'onStartCandleTypesChange'
|
||||
| 'onDeleteStart'
|
||||
| 'onChangeLogicGateType'
|
||||
>,
|
||||
dragOverId: string | null = null,
|
||||
orphans: LogicNode[] = [],
|
||||
startMeta: Record<string, StartNodeMeta> = { [START_NODE_ID]: { candleType: '1m' } },
|
||||
startMeta: Record<string, StartNodeMeta> = defaultStartMeta(),
|
||||
extraStartIds: string[] = [],
|
||||
extraRoots: Record<string, LogicNode | null> = {},
|
||||
): { nodes: Node[]; edges: Edge[] } {
|
||||
@@ -668,7 +684,7 @@ export function logicNodeToFlow(
|
||||
const edges: Edge[] = [];
|
||||
|
||||
const appendStart = (startId: string, branchRoot: LogicNode | null, defaultY: number) => {
|
||||
const candleType = normalizeStartCandleType(startMeta[startId]?.candleType);
|
||||
const candleTypes = getStartCandleTypes(startMeta[startId]);
|
||||
nodes.push({
|
||||
id: startId,
|
||||
type: 'start',
|
||||
@@ -676,8 +692,9 @@ export function logicNodeToFlow(
|
||||
data: {
|
||||
label: 'START',
|
||||
signalTab,
|
||||
candleType,
|
||||
onStartCandleTypeChange: callbacks.onStartCandleTypeChange,
|
||||
candleType: candleTypes[0],
|
||||
candleTypes,
|
||||
onStartCandleTypesChange: callbacks.onStartCandleTypesChange,
|
||||
onDeleteStart: startId === START_NODE_ID ? undefined : callbacks.onDeleteStart,
|
||||
onDropTarget: callbacks.onDropTarget,
|
||||
onDragOverTarget: callbacks.onDragOverTarget,
|
||||
|
||||
Reference in New Issue
Block a user