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
distribute_dis
Tyler Goodlet 2024-01-03 17:47:54 -05:00
parent d3e7b5cd0e
commit 2669db785c
1 changed files with 10 additions and 1 deletions

View File

@ -201,6 +201,7 @@ class FutesPair(Pair):
match contype: match contype:
case ( case (
'CURRENT_QUARTER' 'CURRENT_QUARTER'
| 'CURRENT_QUARTER DELIVERING'
| 'NEXT_QUARTER' # su madre binance.. | 'NEXT_QUARTER' # su madre binance..
): ):
pair, _, expiry = symbol.partition('_') pair, _, expiry = symbol.partition('_')
@ -220,6 +221,10 @@ class FutesPair(Pair):
case ['DEFI']: case ['DEFI']:
return 'PERP' return 'PERP'
# wow, just wow you binance guys suck..
if self.status == 'PENDING_TRADING':
return 'PENDING'
# XXX: yeah no clue then.. # XXX: yeah no clue then..
raise ValueError( raise ValueError(
f'Bad .expiry token match: {contype} for {symbol}' f'Bad .expiry token match: {contype} for {symbol}'
@ -237,6 +242,7 @@ class FutesPair(Pair):
case ( case (
'CURRENT_QUARTER' 'CURRENT_QUARTER'
| 'CURRENT_QUARTER DELIVERING'
| 'NEXT_QUARTER' # su madre binance.. | 'NEXT_QUARTER' # su madre binance..
): ):
_, _, expiry = symbol.partition('_') _, _, expiry = symbol.partition('_')
@ -249,7 +255,10 @@ class FutesPair(Pair):
return f'{margin}M' return f'{margin}M'
match subtype: match subtype:
case ['DEFI']: case (
['DEFI']
| ['USDC']
):
return f'{subtype[0]}' return f'{subtype[0]}'
# XXX: yeah no clue then.. # XXX: yeah no clue then..