This commit is contained in:
tim
2024-08-04 20:35:18 -04:00
parent 4bcbcaf09e
commit 96f57ceebd
3 changed files with 2 additions and 11 deletions

View File

@@ -3,3 +3,4 @@ rpc_url = '${rpc_urls.finaldata}'
ws_url = '' ws_url = ''
redis_url = '' redis_url = ''
ohlc_dir = '/ohlc' ohlc_dir = '/ohlc'
walker_flush_interval=25

View File

@@ -42,19 +42,10 @@ async def handle_backfill_uniswap_swaps(swaps: list[EventData]):
async def flush_callback(): async def flush_callback():
# start = now()
# log.info("finalizing OHLC's")
# log.info(f'\ttook {(now() - start).total_seconds():.1f} seconds')
confirms = (config.confirms if config.confirms is not None else current_chain.get().confirms) - 1
chain_id = current_chain.get().id chain_id = current_chain.get().id
fork = current_fork.get() fork = current_fork.get()
block = await get_block(fork.height, chain_id=chain_id) block = await get_block(fork.height, chain_id=chain_id)
time = from_timestamp(block.timestamp) time = from_timestamp(block.timestamp)
if latest_block[chain_id].height - fork.height <= 2*confirms:
log.info(f'forward filling to present time')
for addr, data in address_metadata.items():
if data['type'] == 'Pool' and data['exchange'] >= 0:
ohlcs.update(addr, time, None)
log.info("flushing OHLC's") log.info("flushing OHLC's")
ohlcs.flush() ohlcs.flush()
log.info(f'backfill completed through block {block.height} {time:%Y-%m-%d %H:%M:%S} {hexstr(block.hash)}') log.info(f'backfill completed through block {block.height} {time:%Y-%m-%d %H:%M:%S} {hexstr(block.hash)}')

View File

@@ -12,7 +12,6 @@ from decimal import InvalidOperation
from typing import Optional, NamedTuple, Reversible, Union from typing import Optional, NamedTuple, Reversible, Union
from cachetools import LFUCache from cachetools import LFUCache
from typing_extensions import deprecated
from dexorder import dec, config, from_timestamp, timestamp, now, minutely from dexorder import dec, config, from_timestamp, timestamp, now, minutely
from dexorder.base.chain import current_chain from dexorder.base.chain import current_chain