Skip to content

Commit

Permalink
Workaround binance's latest API schema bs..
Browse files Browse the repository at this point in the history
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
  • Loading branch information
goodboy committed Jan 3, 2024
1 parent d3e7b5c commit 2669db7
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion piker/brokers/binance/venues.py
Original file line number Diff line number Diff line change
Expand Up @@ -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('_')
Expand All @@ -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}'
Expand All @@ -237,6 +242,7 @@ def venue(self) -> str:

case (
'CURRENT_QUARTER'
| 'CURRENT_QUARTER DELIVERING'
| 'NEXT_QUARTER' # su madre binance..
):
_, _, expiry = symbol.partition('_')
Expand All @@ -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..
Expand Down

0 comments on commit 2669db7

Please sign in to comment.