tv DataFeed rework

This commit is contained in:
tim
2024-08-28 18:57:58 -04:00
parent 55397c2b1c
commit 79a6822fd5
7 changed files with 468 additions and 403 deletions

View File

@@ -15,7 +15,7 @@ socket.on('disconnect', () => {
})
socket.on('p', async (chainId, pool, price) => {
// console.log('pool price from message', chainId, pool, price)
console.log('pool price from message', chainId, pool, price)
const s = useStore()
if( s.chainId !== chainId )
return
@@ -27,7 +27,7 @@ socket.on('ohlc', async (chainId, poolPeriod, ohlcs) => {
if (ohlcs && ohlcs.length) {
const split = poolPeriod.indexOf('|')
const pool = poolPeriod.slice(0,split)
useStore().poolPrices[[chainId, pool]] = ohlcs[ohlcs.length - 1][4] // closing price
useStore().poolPrices[[chainId, pool]] = parseFloat(ohlcs[ohlcs.length - 1][4]) // closing price
}
DataFeed.poolCallback(chainId, poolPeriod, ohlcs)
})