historical bars fill fix
This commit is contained in:
@@ -121,10 +121,10 @@ export async function loadOHLC (symbol, contract, from, to, tvRes) {
|
||||
|
||||
function fill(end, period) {
|
||||
if (latest===null) return
|
||||
const [start, price] = latest
|
||||
const periodSecs = period * 60
|
||||
end = ohlcStart(end, periodSecs)
|
||||
for (let now=ohlcStart(start+periodSecs, periodSecs); now < end; now += periodSecs ) {
|
||||
const [latestTime, price] = latest
|
||||
end = ohlcStart(end, period)
|
||||
const start = ohlcStart(latestTime+period, period);
|
||||
for (let now= start; now < end; now += period ) {
|
||||
bars.push({time:now * 1000, open:price, high:price, low:price, close:price})
|
||||
latest = [now, price]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user