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