pass symbol property into the TradingViewChart

This commit is contained in:
c9s 2022-05-18 02:15:34 +08:00
parent f9a1d37d63
commit 0030abfd3b
No known key found for this signature in database
GPG Key ID: 7385E7E464CB0A54
3 changed files with 15 additions and 4 deletions

View File

@ -29,10 +29,21 @@ const ReportDetails = (props: ReportDetailsProps) => {
})
}, [props.runID])
if (!reportSummary) {
return <Container>
<h2>Loading {props.runID}</h2>
</Container>;
}
return <Container>
<h2>Back-test Run {props.runID}</h2>
<div>
<TradingViewChart basePath={props.basePath} runID={props.runID} intervals={["1m", "5m", "1h"]}/>
{
reportSummary.symbols.map((symbol: string) => {
return <TradingViewChart basePath={props.basePath} runID={props.runID} symbol={symbol} intervals={["1m", "5m", "1h"]}/>
})
}
</div>
</Container>;
};

View File

@ -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));
})
});

View File

@ -27,7 +27,7 @@ export interface ReportSummary {
startTime: Date;
endTime: Date;
sessions: string[];
symbols: null;
symbols: string[];
initialTotalBalances: BalanceMap;
finalTotalBalances: BalanceMap;
symbolReports: SymbolReport[];