From 2669db785c013ec8a3152888f7fe90d49554a327 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Wed, 3 Jan 2024 17:47:54 -0500 Subject: [PATCH] Workaround `binance`'s latest API schema bs.. Apparently publishing futures contracts that aren't yet trading AND changing their contract type `str` format/schema was necessary (such that's there's a f@#$in space in it..)? I honestly have no idea where they found their "data engineers" XD TO CHERRY to #520 --- piker/brokers/binance/venues.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/piker/brokers/binance/venues.py b/piker/brokers/binance/venues.py index a82c33246..2529e520a 100644 --- a/piker/brokers/binance/venues.py +++ b/piker/brokers/binance/venues.py @@ -201,6 +201,7 @@ def expiry(self) -> str: match contype: case ( 'CURRENT_QUARTER' + | 'CURRENT_QUARTER DELIVERING' | 'NEXT_QUARTER' # su madre binance.. ): pair, _, expiry = symbol.partition('_') @@ -220,6 +221,10 @@ def expiry(self) -> str: case ['DEFI']: return 'PERP' + # wow, just wow you binance guys suck.. + if self.status == 'PENDING_TRADING': + return 'PENDING' + # XXX: yeah no clue then.. raise ValueError( f'Bad .expiry token match: {contype} for {symbol}' @@ -237,6 +242,7 @@ def venue(self) -> str: case ( 'CURRENT_QUARTER' + | 'CURRENT_QUARTER DELIVERING' | 'NEXT_QUARTER' # su madre binance.. ): _, _, expiry = symbol.partition('_') @@ -249,7 +255,10 @@ def venue(self) -> str: return f'{margin}M' match subtype: - case ['DEFI']: + case ( + ['DEFI'] + | ['USDC'] + ): return f'{subtype[0]}' # XXX: yeah no clue then..