mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
optimizer: front end kline url
This commit is contained in:
parent
7ffe010c57
commit
99c4dc9eaa
|
@ -209,9 +209,9 @@ const removeDuplicatedKLines = (klines: Array<KLine>): Array<KLine> => {
|
|||
return newK;
|
||||
}
|
||||
|
||||
function fetchKLines(basePath: string, runID: string, symbol: string, interval: string) {
|
||||
function fetchKLines(basePath: string, runID: string, symbol: string, interval: string, duration: string) {
|
||||
return fetch(
|
||||
`${basePath}/shared/klines/${symbol}-${interval}.tsv`,
|
||||
`${basePath}/shared/klines_${duration}/${symbol}-${interval}.tsv`,
|
||||
)
|
||||
.then((response) => response.text())
|
||||
.then((data) => tsvParse(data, parseKline()))
|
||||
|
@ -399,7 +399,15 @@ const TradingViewChart = (props: TradingViewChartProps) => {
|
|||
}
|
||||
}
|
||||
|
||||
const kLinesFetcher = fetchKLines(props.basePath, props.runID, props.symbol, currentInterval).then((klines) => {
|
||||
var startTime = new Date(props.reportSummary.startTime);
|
||||
var endTime = new Date(props.reportSummary.endTime);
|
||||
var mm = startTime.getMonth() + 1;
|
||||
var dd = startTime.getDate();
|
||||
var duration = [startTime.getFullYear(), (mm>9 ? '' : '0') + mm, (dd>9 ? '' : '0') + dd].join('');
|
||||
mm = endTime.getMonth() + 1;
|
||||
dd = endTime.getDate();
|
||||
duration = [duration, '-', endTime.getFullYear(), (mm>9 ? '' : '0') + mm, (dd>9 ? '' : '0') + dd].join('');
|
||||
const kLinesFetcher = fetchKLines(props.basePath, props.runID, props.symbol, currentInterval, duration).then((klines) => {
|
||||
chartData.klines = removeDuplicatedKLines(klines as Array<KLine>)
|
||||
});
|
||||
fetchers.push(kLinesFetcher);
|
||||
|
|
Loading…
Reference in New Issue
Block a user