Skip to content

Commit 2669db7

Browse files
committed
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
1 parent d3e7b5c commit 2669db7

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

piker/brokers/binance/venues.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ def expiry(self) -> str:
201201
match contype:
202202
case (
203203
'CURRENT_QUARTER'
204+
| 'CURRENT_QUARTER DELIVERING'
204205
| 'NEXT_QUARTER' # su madre binance..
205206
):
206207
pair, _, expiry = symbol.partition('_')
@@ -220,6 +221,10 @@ def expiry(self) -> str:
220221
case ['DEFI']:
221222
return 'PERP'
222223

224+
# wow, just wow you binance guys suck..
225+
if self.status == 'PENDING_TRADING':
226+
return 'PENDING'
227+
223228
# XXX: yeah no clue then..
224229
raise ValueError(
225230
f'Bad .expiry token match: {contype} for {symbol}'
@@ -237,6 +242,7 @@ def venue(self) -> str:
237242

238243
case (
239244
'CURRENT_QUARTER'
245+
| 'CURRENT_QUARTER DELIVERING'
240246
| 'NEXT_QUARTER' # su madre binance..
241247
):
242248
_, _, expiry = symbol.partition('_')
@@ -249,7 +255,10 @@ def venue(self) -> str:
249255
return f'{margin}M'
250256

251257
match subtype:
252-
case ['DEFI']:
258+
case (
259+
['DEFI']
260+
| ['USDC']
261+
):
253262
return f'{subtype[0]}'
254263

255264
# XXX: yeah no clue then..

0 commit comments

Comments
 (0)