Skip to content

Commit

Permalink
Client.get_head_time()` seems unsupported for forex?
Browse files Browse the repository at this point in the history
  • Loading branch information
goodboy committed Nov 17, 2022
1 parent 3e98166 commit d3f5347
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions piker/brokers/ib/feed.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,12 @@ async def open_history_client(
mean: float = 0
count: int = 0

head_dt = await proxy.get_head_time(fqsn=fqsn)
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)

async def get_hist(
timeframe: float,
Expand Down Expand Up @@ -170,7 +175,9 @@ async def get_hist(
)

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}')

Expand Down Expand Up @@ -895,7 +902,9 @@ async def reset_on_feed():
# last = time.time()
async for ticker in stream:
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
ticker.ticks = []
Expand Down

0 comments on commit d3f5347

Please sign in to comment.