From 01a43763ed20b910be98a91b20f8aac8e1d31f35 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Tue, 11 Feb 2025 21:36:14 -0500 Subject: [PATCH] binance: pass `MktPair` to `Client.bars()` To get futures feeds correctly loading when selected from search (like 'XMRUSDT.USDTM.PERP'), expect a `MktPair` input to `Client.bars()` such that the exact venue-key can be looked up (via a new `.pair2venuekey()` meth) and then passed to `._api()`. --- piker/brokers/binance/feed.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/piker/brokers/binance/feed.py b/piker/brokers/binance/feed.py index 1416d6a7..cfd8751c 100644 --- a/piker/brokers/binance/feed.py +++ b/piker/brokers/binance/feed.py @@ -252,13 +252,16 @@ async def open_history_client( else: client.mkt_mode = 'spot' - # NOTE: always query using their native symbology! - mktid: str = mkt.bs_mktid - array = await client.bars( - mktid, + array: np.ndarray = await client.bars( + mkt=mkt, start_dt=start_dt, end_dt=end_dt, ) + if array.size == 0: + raise NoData( + f'No frame for {start_dt} -> {end_dt}\n' + ) + times = array['time'] if ( end_dt is None