'ohlc' pubsub message has period
This commit is contained in:
@@ -505,10 +505,11 @@ def save_json(obj, filename):
|
|||||||
def pub_ohlc(_series:str, key: OHLCKey, bars: list[NativeOHLC]):
|
def pub_ohlc(_series:str, key: OHLCKey, bars: list[NativeOHLC]):
|
||||||
pool_addr, period = key
|
pool_addr, period = key
|
||||||
chain_id = current_chain.get().chain_id
|
chain_id = current_chain.get().chain_id
|
||||||
|
period = period_name(period)
|
||||||
return (
|
return (
|
||||||
f'{chain_id}|{pool_addr}|{period_name(period)}', # channel name is like 0x...|1m
|
f'{chain_id}|{pool_addr}|{period}', # channel name is like 0x...|1m
|
||||||
'ohlc',
|
'ohlc',
|
||||||
(chain_id, pool_addr, [b.ohlc for b in bars])
|
(chain_id, pool_addr, period, [b.ohlc for b in bars])
|
||||||
)
|
)
|
||||||
|
|
||||||
def ohlc_key_to_str(k):
|
def ohlc_key_to_str(k):
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ async def load_pool(address: str) -> PoolDict:
|
|||||||
decimals = token0['decimals'] - token1['decimals']
|
decimals = token0['decimals'] - token1['decimals']
|
||||||
found = PoolDict(type='Pool', chain=chain_id, address=address, exchange=Exchange.UniswapV3.value,
|
found = PoolDict(type='Pool', chain=chain_id, address=address, exchange=Exchange.UniswapV3.value,
|
||||||
base=t0, quote=t1, fee=fee, decimals=decimals)
|
base=t0, quote=t1, fee=fee, decimals=decimals)
|
||||||
log.debug(f'new UniswapV3 pool {token0["symbol"]}/{token1["symbol"]} '
|
log.debug(f'new UniswapV3 pool {token0["symbol"]}/{token1["symbol"]} {fee/1_000_000:.2%}'
|
||||||
f'{("."+str(decimals)) if decimals >= 0 else (str(-decimals)+".")} {address}')
|
f'{("."+str(decimals)) if decimals >= 0 else (str(-decimals)+".")} {address}')
|
||||||
except ContractLogicError:
|
except ContractLogicError:
|
||||||
pass
|
pass
|
||||||
|
|||||||
Reference in New Issue
Block a user