Exclude crypto futes from `without_src` sym key
Extend the `col_sym_key` asset-type check in `start_backfill()` to also exclude crypto-denominated futures (where `src` is `'crypto_currency'` and `dst` is `'future'`) from the `without_src=True` fqme path. Also in `.brokers.binance` backend (it being the guilty culprit in the discovery of this bug; and why i touched styling this code), - reformat `make_sub()` fn sig to multiline style in `.binance.feed`. - add backtick around `dict` in `make_sub()` docstring. - reformat `or` conditionals to multiline style in `.binance.feed.get_mkt_info()`. (this commit msg was generated in some part by [`claude-code`][claude-code-gh]) [claude-code-gh]: https://github.com/anthropics/claude-codegap_annotator
parent
796a831c6e
commit
b5a33e1217
|
|
@ -203,9 +203,13 @@ async def stream_messages(
|
||||||
yield 'trade', piker_quote
|
yield 'trade', piker_quote
|
||||||
|
|
||||||
|
|
||||||
def make_sub(pairs: list[str], sub_name: str, uid: int) -> dict[str, str]:
|
def make_sub(
|
||||||
|
pairs: list[str],
|
||||||
|
sub_name: str,
|
||||||
|
uid: int,
|
||||||
|
) -> dict[str, str]:
|
||||||
'''
|
'''
|
||||||
Create a request subscription packet dict.
|
Create a request subscription packet `dict`.
|
||||||
|
|
||||||
- spot:
|
- spot:
|
||||||
https://binance-docs.github.io/apidocs/spot/en/#live-subscribing-unsubscribing-to-streams
|
https://binance-docs.github.io/apidocs/spot/en/#live-subscribing-unsubscribing-to-streams
|
||||||
|
|
@ -332,7 +336,8 @@ async def get_mkt_info(
|
||||||
# TODO: handle coinm futes which have a margin asset that
|
# TODO: handle coinm futes which have a margin asset that
|
||||||
# is some crypto token!
|
# is some crypto token!
|
||||||
# https://binance-docs.github.io/apidocs/delivery/en/#exchange-information
|
# https://binance-docs.github.io/apidocs/delivery/en/#exchange-information
|
||||||
or 'btc' in venue_lower
|
or
|
||||||
|
'btc' in venue_lower
|
||||||
):
|
):
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
@ -343,12 +348,14 @@ async def get_mkt_info(
|
||||||
|
|
||||||
if (
|
if (
|
||||||
venue
|
venue
|
||||||
and 'spot' not in venue_lower
|
and
|
||||||
|
'spot' not in venue_lower
|
||||||
|
|
||||||
# XXX: catch all in case user doesn't know which
|
# XXX: catch all in case user doesn't know which
|
||||||
# venue they want (usdtm vs. coinm) and we can choose
|
# venue they want (usdtm vs. coinm) and we can choose
|
||||||
# a default (via config?) once we support coin-m APIs.
|
# a default (via config?) once we support coin-m APIs.
|
||||||
or 'perp' in venue_lower
|
or
|
||||||
|
'perp' in venue_lower
|
||||||
):
|
):
|
||||||
if not mkt_mode:
|
if not mkt_mode:
|
||||||
mkt_mode: str = f'{venue_lower}_futes'
|
mkt_mode: str = f'{venue_lower}_futes'
|
||||||
|
|
|
||||||
|
|
@ -739,12 +739,21 @@ async def start_backfill(
|
||||||
# including the dst[/src] source asset token. SO,
|
# including the dst[/src] source asset token. SO,
|
||||||
# 'tsla.nasdaq.ib' over 'tsla/usd.nasdaq.ib' for
|
# 'tsla.nasdaq.ib' over 'tsla/usd.nasdaq.ib' for
|
||||||
# historical reasons ONLY.
|
# historical reasons ONLY.
|
||||||
if mkt.dst.atype not in {
|
if (
|
||||||
|
mkt.dst.atype not in {
|
||||||
'crypto',
|
'crypto',
|
||||||
'crypto_currency',
|
'crypto_currency',
|
||||||
'fiat', # a "forex pair"
|
'fiat', # a "forex pair"
|
||||||
'perpetual_future', # stupid "perps" from cex land
|
'perpetual_future', # stupid "perps" from cex land
|
||||||
}:
|
}
|
||||||
|
and not (
|
||||||
|
mkt.src.atype == 'crypto_currency'
|
||||||
|
and
|
||||||
|
mkt.dst.atype in {
|
||||||
|
'future',
|
||||||
|
}
|
||||||
|
)
|
||||||
|
):
|
||||||
col_sym_key: str = mkt.get_fqme(
|
col_sym_key: str = mkt.get_fqme(
|
||||||
delim_char='',
|
delim_char='',
|
||||||
without_src=True,
|
without_src=True,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue