ignore ohlcs message with null ohlcs
This commit is contained in:
@@ -190,12 +190,12 @@ export function lookupBaseQuote(baseAddr, quoteAddr) {
|
|||||||
return _symbols[`${baseAddr}${quoteAddr}`]
|
return _symbols[`${baseAddr}${quoteAddr}`]
|
||||||
}
|
}
|
||||||
|
|
||||||
function poolIsInverted(pool) {
|
function poolIsInverted() {
|
||||||
return useChartOrderStore().selectedSymbol.inverted
|
return useChartOrderStore().selectedSymbol.inverted
|
||||||
}
|
}
|
||||||
|
|
||||||
export function maybeInvertBar (pool, bar) {
|
export function maybeInvertBar (bar) {
|
||||||
if (poolIsInverted(pool)) {
|
if (poolIsInverted()) {
|
||||||
bar.open = 1/bar.open
|
bar.open = 1/bar.open
|
||||||
let high = bar.high
|
let high = bar.high
|
||||||
bar.high = 1/bar.low
|
bar.high = 1/bar.low
|
||||||
@@ -357,9 +357,13 @@ export const DataFeed = {
|
|||||||
poolCallbackState : {lastBar: null},
|
poolCallbackState : {lastBar: null},
|
||||||
|
|
||||||
poolCallback(chainId, pool, ohlcs) {
|
poolCallback(chainId, pool, ohlcs) {
|
||||||
console.log("poolCallback: chainId, pool:", chainId, pool)
|
console.log("poolCallback: chainId, pool, ohlcs:", chainId, pool, ohlcs)
|
||||||
|
if (ohlcs == null) {
|
||||||
|
console.log("poolCallback: ohlcs == null, nothing to do.")
|
||||||
|
return;
|
||||||
|
}
|
||||||
let ohlc = ohlcs.at(-1);
|
let ohlc = ohlcs.at(-1);
|
||||||
console.log("poolCallBack ohlc:", ohlc)
|
console.log("poolCallBack ohlc:", new Date(Number(ohlc[0])*1000).toGMTString(), ohlc)
|
||||||
for (let i = 0; i<ohlc.length; i++) if (ohlc[i]!=null) ohlc[i] = Number(ohlc[i])
|
for (let i = 0; i<ohlc.length; i++) if (ohlc[i]!=null) ohlc[i] = Number(ohlc[i])
|
||||||
// for (const ohlc of ohlcs) {
|
// for (const ohlc of ohlcs) {
|
||||||
let date = new Date(ohlc[0]*1000)
|
let date = new Date(ohlc[0]*1000)
|
||||||
@@ -372,7 +376,7 @@ export const DataFeed = {
|
|||||||
close: close,
|
close: close,
|
||||||
}
|
}
|
||||||
checkBar(bar, "poolCallback, before inversion:")
|
checkBar(bar, "poolCallback, before inversion:")
|
||||||
bar = maybeInvertBar(pool, bar)
|
bar = maybeInvertBar(bar)
|
||||||
checkBar(bar, "poolCallback, after inversion:")
|
checkBar(bar, "poolCallback, after inversion:")
|
||||||
console.log('DataFeed.poolCallback', date.toGMTString(), ohlcs, bar)
|
console.log('DataFeed.poolCallback', date.toGMTString(), ohlcs, bar)
|
||||||
let lastBar = DataFeed.poolCallbackState.lastBar
|
let lastBar = DataFeed.poolCallbackState.lastBar
|
||||||
|
|||||||
Reference in New Issue
Block a user