From 45c87ea2b59536702f31bb24745b8482f7b351ea Mon Sep 17 00:00:00 2001 From: Tim Date: Tue, 19 Mar 2024 18:27:38 -0400 Subject: [PATCH] 'ohlc' pubsub message has period --- src/dexorder/ohlc.py | 5 +++-- src/dexorder/pools.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/dexorder/ohlc.py b/src/dexorder/ohlc.py index f0bdaf2..7897035 100644 --- a/src/dexorder/ohlc.py +++ b/src/dexorder/ohlc.py @@ -505,10 +505,11 @@ def save_json(obj, filename): def pub_ohlc(_series:str, key: OHLCKey, bars: list[NativeOHLC]): pool_addr, period = key chain_id = current_chain.get().chain_id + period = period_name(period) 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', - (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): diff --git a/src/dexorder/pools.py b/src/dexorder/pools.py index c918c2b..e5fc920 100644 --- a/src/dexorder/pools.py +++ b/src/dexorder/pools.py @@ -44,7 +44,7 @@ async def load_pool(address: str) -> PoolDict: decimals = token0['decimals'] - token1['decimals'] found = PoolDict(type='Pool', chain=chain_id, address=address, exchange=Exchange.UniswapV3.value, 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}') except ContractLogicError: pass