전략 시간봉 오류 수정
This commit is contained in:
@@ -161,7 +161,6 @@ export function encodeConditionForSave(state: EditorConditionState): LogicNode |
|
||||
if (branches.length === 0) return null;
|
||||
if (branches.length === 1) {
|
||||
const { candleType, root } = branches[0];
|
||||
if (normalizeStartCandleType(candleType) === DEFAULT_START_CANDLE) return root;
|
||||
return wrapTimeframe(candleType, root);
|
||||
}
|
||||
|
||||
@@ -257,3 +256,20 @@ export function collectEditorBranches(state: EditorConditionState): ConditionBra
|
||||
export function collectDslBranches(dsl: LogicNode | null): ConditionBranch[] {
|
||||
return collectEditorBranches(decodeConditionForEditor(dsl));
|
||||
}
|
||||
|
||||
/**
|
||||
* 전략 로드 시 startMeta 병합 — DB DSL에서 복원한 시간봉이 localStorage보다 우선.
|
||||
*/
|
||||
export function mergeStartMetaForLoad(
|
||||
decoded: Record<string, StartNodeMeta>,
|
||||
stored?: Record<string, StartNodeMeta> | null,
|
||||
): Record<string, StartNodeMeta> {
|
||||
const merged: Record<string, StartNodeMeta> = {
|
||||
...defaultStartMeta(),
|
||||
...stored,
|
||||
};
|
||||
for (const [startId, meta] of Object.entries(decoded)) {
|
||||
merged[startId] = { candleType: normalizeStartCandleType(meta.candleType) };
|
||||
}
|
||||
return merged;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user