Client.get_head_time()` seems unsupported for forex?

ib_contract_updates
Tyler Goodlet 2022-11-17 13:34:21 -05:00
parent a0ce9ecc0d
commit 243d0329f6
1 changed files with 12 additions and 3 deletions

View File

@ -130,6 +130,11 @@ async def open_history_client(
mean: float = 0 mean: float = 0
count: int = 0 count: int = 0
head_dt: None | datetime = None
if (
# fx cons seem to not provide this endpoint?
'idealpro' not in fqsn
):
head_dt = await proxy.get_head_time(fqsn=fqsn) head_dt = await proxy.get_head_time(fqsn=fqsn)
async def get_hist( async def get_hist(
@ -170,7 +175,9 @@ async def open_history_client(
) )
if ( if (
end_dt and end_dt <= head_dt end_dt
and head_dt
and end_dt <= head_dt
): ):
raise DataUnavailable(f'First timestamp is {head_dt}') raise DataUnavailable(f'First timestamp is {head_dt}')
@ -895,7 +902,9 @@ async def stream_quotes(
# last = time.time() # last = time.time()
async for ticker in stream: async for ticker in stream:
quote = normalize(ticker) quote = normalize(ticker)
await send_chan.send({quote['fqsn']: quote}) fqsn = quote['fqsn']
# print(f'sending {fqsn}:\n{quote}')
await send_chan.send({fqsn: quote})
# ugh, clear ticks since we've consumed them # ugh, clear ticks since we've consumed them
ticker.ticks = [] ticker.ticks = []