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 a82c3324..2529e520 100644 --- a/piker/brokers/binance/venues.py +++ b/piker/brokers/binance/venues.py @@ -201,6 +201,7 @@ class FutesPair(Pair): match contype: case ( 'CURRENT_QUARTER' + | 'CURRENT_QUARTER DELIVERING' | 'NEXT_QUARTER' # su madre binance.. ): pair, _, expiry = symbol.partition('_') @@ -220,6 +221,10 @@ class FutesPair(Pair): 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 @@ class FutesPair(Pair): case ( 'CURRENT_QUARTER' + | 'CURRENT_QUARTER DELIVERING' | 'NEXT_QUARTER' # su madre binance.. ): _, _, expiry = symbol.partition('_') @@ -249,7 +255,10 @@ class FutesPair(Pair): return f'{margin}M' match subtype: - case ['DEFI']: + case ( + ['DEFI'] + | ['USDC'] + ): return f'{subtype[0]}' # XXX: yeah no clue then..