From 0030abfd3b3c251d74ff9187d85e2e0bf8a15080 Mon Sep 17 00:00:00 2001 From: c9s Date: Wed, 18 May 2022 02:15:34 +0800 Subject: [PATCH] pass symbol property into the TradingViewChart --- .../components/ReportDetails.tsx | 13 ++++++++++++- .../components/TradingViewChart.js | 4 ++-- apps/bbgo-backtest-report/types/report.ts | 2 +- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/apps/bbgo-backtest-report/components/ReportDetails.tsx b/apps/bbgo-backtest-report/components/ReportDetails.tsx index 47c3d6e80..9fb580703 100644 --- a/apps/bbgo-backtest-report/components/ReportDetails.tsx +++ b/apps/bbgo-backtest-report/components/ReportDetails.tsx @@ -29,10 +29,21 @@ const ReportDetails = (props: ReportDetailsProps) => { }) }, [props.runID]) + if (!reportSummary) { + return +

Loading {props.runID}

+
; + } + return

Back-test Run {props.runID}

- + { + reportSummary.symbols.map((symbol: string) => { + return + }) + } +
; }; diff --git a/apps/bbgo-backtest-report/components/TradingViewChart.js b/apps/bbgo-backtest-report/components/TradingViewChart.js index f1056bb26..3d0dc054b 100644 --- a/apps/bbgo-backtest-report/components/TradingViewChart.js +++ b/apps/bbgo-backtest-report/components/TradingViewChart.js @@ -77,7 +77,7 @@ const parsePosition = () => { }; } -const fetchPositionHistory = (basePath, runID, setter) => { +const fetchPositionHistory = (basePath, runID) => { // TODO: load the filename from the manifest return fetch( `${basePath}/${runID}/bollmaker:ETHUSDT-position.tsv`, @@ -311,7 +311,7 @@ const TradingViewChart = (props) => { }); Promise.all([ordersFetcher, positionHistoryFetcher]).then(() => { - fetchKLines(props.basePath, props.runID, 'ETHUSDT', currentInterval).then((data) => { + fetchKLines(props.basePath, props.runID, props.symbol, currentInterval).then((data) => { setData(removeDuplicatedKLines(data)); }) }); diff --git a/apps/bbgo-backtest-report/types/report.ts b/apps/bbgo-backtest-report/types/report.ts index f2d6fee21..d01d14726 100644 --- a/apps/bbgo-backtest-report/types/report.ts +++ b/apps/bbgo-backtest-report/types/report.ts @@ -27,7 +27,7 @@ export interface ReportSummary { startTime: Date; endTime: Date; sessions: string[]; - symbols: null; + symbols: string[]; initialTotalBalances: BalanceMap; finalTotalBalances: BalanceMap; symbolReports: SymbolReport[];