차트 설정 수정
This commit is contained in:
@@ -1,4 +1,11 @@
|
||||
import { loadStrategy, loadStrategyTimeframes, repairStrategyTimeframes, saveStrategy, type StrategyDto } from './backendApi';
|
||||
import {
|
||||
isStrategyMissingOnServer,
|
||||
loadStrategy,
|
||||
loadStrategyTimeframes,
|
||||
repairStrategyTimeframes,
|
||||
saveStrategy,
|
||||
type StrategyDto,
|
||||
} from './backendApi';
|
||||
import {
|
||||
alignBuySellStartCandleTypesForSave,
|
||||
collectDslBranches,
|
||||
@@ -143,9 +150,10 @@ function buildEditorStateFromStrategy(
|
||||
*/
|
||||
export async function syncStrategyTimeframesFromLayoutIfNeeded(
|
||||
strategyId: number,
|
||||
strategy?: StrategyDto | null,
|
||||
_strategy?: StrategyDto | null,
|
||||
): Promise<boolean> {
|
||||
const strat = (await loadStrategy(strategyId)) ?? strategy ?? null;
|
||||
if (isStrategyMissingOnServer(strategyId)) return false;
|
||||
const strat = await loadStrategy(strategyId);
|
||||
if (!strat) return false;
|
||||
|
||||
const uiTfs = collectUiEvaluationTimeframes(strategyId, strat);
|
||||
@@ -162,13 +170,10 @@ export async function syncStrategyTimeframesFromLayoutIfNeeded(
|
||||
|
||||
const layout = strat.flowLayout;
|
||||
if (!layout) {
|
||||
try {
|
||||
await repairStrategyTimeframes(strategyId);
|
||||
const repaired = await loadStrategyTimeframes(strategyId);
|
||||
return evaluationTimeframesMatch(uiTfs, repaired);
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
const repaired = await repairStrategyTimeframes(strategyId);
|
||||
if (!repaired) return false;
|
||||
const tfs = await loadStrategyTimeframes(strategyId);
|
||||
return evaluationTimeframesMatch(uiTfs, tfs);
|
||||
}
|
||||
|
||||
const buyState = buildEditorStateFromStrategy(strat, layout, 'buy');
|
||||
|
||||
Reference in New Issue
Block a user