41
41
42
42
class RestAuthEndpoints (Interface ):
43
43
def get_user_info (self ) -> UserInfo :
44
- return serializers .UserInfo .parse (* self ._post ("auth/r/info/user" ))
44
+ return serializers .UserInfo .parse (* self ._m . post ("auth/r/info/user" ))
45
45
46
46
def get_login_history (self ) -> List [LoginHistory ]:
47
47
return [
48
48
serializers .LoginHistory .parse (* sub_data )
49
- for sub_data in self ._post ("auth/r/logins/hist" )
49
+ for sub_data in self ._m . post ("auth/r/logins/hist" )
50
50
]
51
51
52
52
def get_balance_available_for_orders_or_offers (
@@ -61,13 +61,13 @@ def get_balance_available_for_orders_or_offers(
61
61
body = {"symbol" : symbol , "type" : type , "dir" : dir , "rate" : rate , "lev" : lev }
62
62
63
63
return serializers .BalanceAvailable .parse (
64
- * self ._post ("auth/calc/order/avail" , body = body )
64
+ * self ._m . post ("auth/calc/order/avail" , body = body )
65
65
)
66
66
67
67
def get_wallets (self ) -> List [Wallet ]:
68
68
return [
69
69
serializers .Wallet .parse (* sub_data )
70
- for sub_data in self ._post ("auth/r/wallets" )
70
+ for sub_data in self ._m . post ("auth/r/wallets" )
71
71
]
72
72
73
73
def get_orders (
@@ -80,7 +80,7 @@ def get_orders(
80
80
81
81
return [
82
82
serializers .Order .parse (* sub_data )
83
- for sub_data in self ._post (endpoint , body = {"id" : ids })
83
+ for sub_data in self ._m . post (endpoint , body = {"id" : ids })
84
84
]
85
85
86
86
def submit_order (
@@ -115,7 +115,7 @@ def submit_order(
115
115
}
116
116
117
117
return _Notification [Order ](serializers .Order ).parse (
118
- * self ._post ("auth/w/order/submit" , body = body )
118
+ * self ._m . post ("auth/w/order/submit" , body = body )
119
119
)
120
120
121
121
def update_order (
@@ -150,7 +150,7 @@ def update_order(
150
150
}
151
151
152
152
return _Notification [Order ](serializers .Order ).parse (
153
- * self ._post ("auth/w/order/update" , body = body )
153
+ * self ._m . post ("auth/w/order/update" , body = body )
154
154
)
155
155
156
156
def cancel_order (
@@ -161,7 +161,7 @@ def cancel_order(
161
161
cid_date : Optional [str ] = None ,
162
162
) -> Notification [Order ]:
163
163
return _Notification [Order ](serializers .Order ).parse (
164
- * self ._post (
164
+ * self ._m . post (
165
165
"auth/w/order/cancel" , body = {"id" : id , "cid" : cid , "cid_date" : cid_date }
166
166
)
167
167
)
@@ -177,7 +177,7 @@ def cancel_order_multi(
177
177
body = {"id" : id , "cid" : cid , "gid" : gid , "all" : all }
178
178
179
179
return _Notification [List [Order ]](serializers .Order , is_iterable = True ).parse (
180
- * self ._post ("auth/w/order/cancel/multi" , body = body )
180
+ * self ._m . post ("auth/w/order/cancel/multi" , body = body )
181
181
)
182
182
183
183
def get_orders_history (
@@ -198,13 +198,13 @@ def get_orders_history(
198
198
199
199
return [
200
200
serializers .Order .parse (* sub_data )
201
- for sub_data in self ._post (endpoint , body = body )
201
+ for sub_data in self ._m . post (endpoint , body = body )
202
202
]
203
203
204
204
def get_order_trades (self , symbol : str , id : int ) -> List [OrderTrade ]:
205
205
return [
206
206
serializers .OrderTrade .parse (* sub_data )
207
- for sub_data in self ._post (f"auth/r/order/{ symbol } :{ id } /trades" )
207
+ for sub_data in self ._m . post (f"auth/r/order/{ symbol } :{ id } /trades" )
208
208
]
209
209
210
210
def get_trades_history (
@@ -225,7 +225,7 @@ def get_trades_history(
225
225
226
226
return [
227
227
serializers .Trade .parse (* sub_data )
228
- for sub_data in self ._post (endpoint , body = body )
228
+ for sub_data in self ._m . post (endpoint , body = body )
229
229
]
230
230
231
231
def get_ledgers (
@@ -241,43 +241,43 @@ def get_ledgers(
241
241
242
242
return [
243
243
serializers .Ledger .parse (* sub_data )
244
- for sub_data in self ._post (f"auth/r/ledgers/{ currency } /hist" , body = body )
244
+ for sub_data in self ._m . post (f"auth/r/ledgers/{ currency } /hist" , body = body )
245
245
]
246
246
247
247
def get_base_margin_info (self ) -> BaseMarginInfo :
248
248
return serializers .BaseMarginInfo .parse (
249
- * (self ._post ("auth/r/info/margin/base" )[1 ])
249
+ * (self ._m . post ("auth/r/info/margin/base" )[1 ])
250
250
)
251
251
252
252
def get_symbol_margin_info (self , symbol : str ) -> SymbolMarginInfo :
253
253
return serializers .SymbolMarginInfo .parse (
254
- * self ._post (f"auth/r/info/margin/{ symbol } " )
254
+ * self ._m . post (f"auth/r/info/margin/{ symbol } " )
255
255
)
256
256
257
257
def get_all_symbols_margin_info (self ) -> List [SymbolMarginInfo ]:
258
258
return [
259
259
serializers .SymbolMarginInfo .parse (* sub_data )
260
- for sub_data in self ._post ("auth/r/info/margin/sym_all" )
260
+ for sub_data in self ._m . post ("auth/r/info/margin/sym_all" )
261
261
]
262
262
263
263
def get_positions (self ) -> List [Position ]:
264
264
return [
265
265
serializers .Position .parse (* sub_data )
266
- for sub_data in self ._post ("auth/r/positions" )
266
+ for sub_data in self ._m . post ("auth/r/positions" )
267
267
]
268
268
269
269
def claim_position (
270
270
self , id : int , * , amount : Optional [Union [str , float , Decimal ]] = None
271
271
) -> Notification [PositionClaim ]:
272
272
return _Notification [PositionClaim ](serializers .PositionClaim ).parse (
273
- * self ._post ("auth/w/position/claim" , body = {"id" : id , "amount" : amount })
273
+ * self ._m . post ("auth/w/position/claim" , body = {"id" : id , "amount" : amount })
274
274
)
275
275
276
276
def increase_position (
277
277
self , symbol : str , amount : Union [str , float , Decimal ]
278
278
) -> Notification [PositionIncrease ]:
279
279
return _Notification [PositionIncrease ](serializers .PositionIncrease ).parse (
280
- * self ._post (
280
+ * self ._m . post (
281
281
"auth/w/position/increase" , body = {"symbol" : symbol , "amount" : amount }
282
282
)
283
283
)
@@ -286,7 +286,7 @@ def get_increase_position_info(
286
286
self , symbol : str , amount : Union [str , float , Decimal ]
287
287
) -> PositionIncreaseInfo :
288
288
return serializers .PositionIncreaseInfo .parse (
289
- * self ._post (
289
+ * self ._m . post (
290
290
"auth/r/position/increase/info" ,
291
291
body = {"symbol" : symbol , "amount" : amount },
292
292
)
@@ -301,7 +301,7 @@ def get_positions_history(
301
301
) -> List [PositionHistory ]:
302
302
return [
303
303
serializers .PositionHistory .parse (* sub_data )
304
- for sub_data in self ._post (
304
+ for sub_data in self ._m . post (
305
305
"auth/r/positions/hist" ,
306
306
body = {"start" : start , "end" : end , "limit" : limit },
307
307
)
@@ -316,7 +316,7 @@ def get_positions_snapshot(
316
316
) -> List [PositionSnapshot ]:
317
317
return [
318
318
serializers .PositionSnapshot .parse (* sub_data )
319
- for sub_data in self ._post (
319
+ for sub_data in self ._m . post (
320
320
"auth/r/positions/snap" ,
321
321
body = {"start" : start , "end" : end , "limit" : limit },
322
322
)
@@ -334,15 +334,15 @@ def get_positions_audit(
334
334
335
335
return [
336
336
serializers .PositionAudit .parse (* sub_data )
337
- for sub_data in self ._post ("auth/r/positions/audit" , body = body )
337
+ for sub_data in self ._m . post ("auth/r/positions/audit" , body = body )
338
338
]
339
339
340
340
def set_derivative_position_collateral (
341
341
self , symbol : str , collateral : Union [str , float , Decimal ]
342
342
) -> DerivativePositionCollateral :
343
343
return serializers .DerivativePositionCollateral .parse (
344
344
* (
345
- self ._post (
345
+ self ._m . post (
346
346
"auth/w/deriv/collateral/set" ,
347
347
body = {"symbol" : symbol , "collateral" : collateral },
348
348
)[0 ]
@@ -353,7 +353,7 @@ def get_derivative_position_collateral_limits(
353
353
self , symbol : str
354
354
) -> DerivativePositionCollateralLimits :
355
355
return serializers .DerivativePositionCollateralLimits .parse (
356
- * self ._post ("auth/calc/deriv/collateral/limit" , body = {"symbol" : symbol })
356
+ * self ._m . post ("auth/calc/deriv/collateral/limit" , body = {"symbol" : symbol })
357
357
)
358
358
359
359
def get_funding_offers (self , * , symbol : Optional [str ] = None ) -> List [FundingOffer ]:
@@ -364,7 +364,7 @@ def get_funding_offers(self, *, symbol: Optional[str] = None) -> List[FundingOff
364
364
365
365
return [
366
366
serializers .FundingOffer .parse (* sub_data )
367
- for sub_data in self ._post (endpoint )
367
+ for sub_data in self ._m . post (endpoint )
368
368
]
369
369
370
370
def submit_funding_offer (
@@ -387,22 +387,24 @@ def submit_funding_offer(
387
387
}
388
388
389
389
return _Notification [FundingOffer ](serializers .FundingOffer ).parse (
390
- * self ._post ("auth/w/funding/offer/submit" , body = body )
390
+ * self ._m . post ("auth/w/funding/offer/submit" , body = body )
391
391
)
392
392
393
393
def cancel_funding_offer (self , id : int ) -> Notification [FundingOffer ]:
394
394
return _Notification [FundingOffer ](serializers .FundingOffer ).parse (
395
- * self ._post ("auth/w/funding/offer/cancel" , body = {"id" : id })
395
+ * self ._m . post ("auth/w/funding/offer/cancel" , body = {"id" : id })
396
396
)
397
397
398
398
def cancel_all_funding_offers (self , currency : str ) -> Notification [Literal [None ]]:
399
399
return _Notification [Literal [None ]](None ).parse (
400
- * self ._post ("auth/w/funding/offer/cancel/all" , body = {"currency" : currency })
400
+ * self ._m .post (
401
+ "auth/w/funding/offer/cancel/all" , body = {"currency" : currency }
402
+ )
401
403
)
402
404
403
405
def submit_funding_close (self , id : int ) -> Notification [Literal [None ]]:
404
406
return _Notification [Literal [None ]](None ).parse (
405
- * self ._post ("auth/w/funding/close" , body = {"id" : id })
407
+ * self ._m . post ("auth/w/funding/close" , body = {"id" : id })
406
408
)
407
409
408
410
def toggle_auto_renew (
@@ -423,7 +425,7 @@ def toggle_auto_renew(
423
425
}
424
426
425
427
return _Notification [FundingAutoRenew ](serializers .FundingAutoRenew ).parse (
426
- * self ._post ("auth/w/funding/auto" , body = body )
428
+ * self ._m . post ("auth/w/funding/auto" , body = body )
427
429
)
428
430
429
431
def toggle_keep_funding (
@@ -434,7 +436,7 @@ def toggle_keep_funding(
434
436
changes : Optional [Dict [int , Literal [1 , 2 ]]] = None ,
435
437
) -> Notification [Literal [None ]]:
436
438
return _Notification [Literal [None ]](None ).parse (
437
- * self ._post (
439
+ * self ._m . post (
438
440
"auth/w/funding/keep" ,
439
441
body = {"type" : type , "id" : ids , "changes" : changes },
440
442
)
@@ -455,7 +457,7 @@ def get_funding_offers_history(
455
457
456
458
return [
457
459
serializers .FundingOffer .parse (* sub_data )
458
- for sub_data in self ._post (
460
+ for sub_data in self ._m . post (
459
461
endpoint , body = {"start" : start , "end" : end , "limit" : limit }
460
462
)
461
463
]
@@ -468,7 +470,7 @@ def get_funding_loans(self, *, symbol: Optional[str] = None) -> List[FundingLoan
468
470
469
471
return [
470
472
serializers .FundingLoan .parse (* sub_data )
471
- for sub_data in self ._post (endpoint )
473
+ for sub_data in self ._m . post (endpoint )
472
474
]
473
475
474
476
def get_funding_loans_history (
@@ -486,7 +488,7 @@ def get_funding_loans_history(
486
488
487
489
return [
488
490
serializers .FundingLoan .parse (* sub_data )
489
- for sub_data in self ._post (
491
+ for sub_data in self ._m . post (
490
492
endpoint , body = {"start" : start , "end" : end , "limit" : limit }
491
493
)
492
494
]
@@ -501,7 +503,7 @@ def get_funding_credits(
501
503
502
504
return [
503
505
serializers .FundingCredit .parse (* sub_data )
504
- for sub_data in self ._post (endpoint )
506
+ for sub_data in self ._m . post (endpoint )
505
507
]
506
508
507
509
def get_funding_credits_history (
@@ -519,7 +521,7 @@ def get_funding_credits_history(
519
521
520
522
return [
521
523
serializers .FundingCredit .parse (* sub_data )
522
- for sub_data in self ._post (
524
+ for sub_data in self ._m . post (
523
525
endpoint , body = {"start" : start , "end" : end , "limit" : limit }
524
526
)
525
527
]
@@ -542,12 +544,12 @@ def get_funding_trades_history(
542
544
543
545
return [
544
546
serializers .FundingTrade .parse (* sub_data )
545
- for sub_data in self ._post (endpoint , body = body )
547
+ for sub_data in self ._m . post (endpoint , body = body )
546
548
]
547
549
548
550
def get_funding_info (self , key : str ) -> FundingInfo :
549
551
return serializers .FundingInfo .parse (
550
- * (self ._post (f"auth/r/info/funding/{ key } " )[2 ])
552
+ * (self ._m . post (f"auth/r/info/funding/{ key } " )[2 ])
551
553
)
552
554
553
555
def transfer_between_wallets (
@@ -567,7 +569,7 @@ def transfer_between_wallets(
567
569
}
568
570
569
571
return _Notification [Transfer ](serializers .Transfer ).parse (
570
- * self ._post ("auth/w/transfer" , body = body )
572
+ * self ._m . post ("auth/w/transfer" , body = body )
571
573
)
572
574
573
575
def submit_wallet_withdrawal (
@@ -581,14 +583,14 @@ def submit_wallet_withdrawal(
581
583
}
582
584
583
585
return _Notification [Withdrawal ](serializers .Withdrawal ).parse (
584
- * self ._post ("auth/w/withdraw" , body = body )
586
+ * self ._m . post ("auth/w/withdraw" , body = body )
585
587
)
586
588
587
589
def get_deposit_address (
588
590
self , wallet : str , method : str , op_renew : bool = False
589
591
) -> Notification [DepositAddress ]:
590
592
return _Notification [DepositAddress ](serializers .DepositAddress ).parse (
591
- * self ._post (
593
+ * self ._m . post (
592
594
"auth/w/deposit/address" ,
593
595
body = {"wallet" : wallet , "method" : method , "op_renew" : op_renew },
594
596
)
@@ -598,7 +600,7 @@ def generate_deposit_invoice(
598
600
self , wallet : str , currency : str , amount : Union [str , float , Decimal ]
599
601
) -> LightningNetworkInvoice :
600
602
return serializers .LightningNetworkInvoice .parse (
601
- * self ._post (
603
+ * self ._m . post (
602
604
"auth/w/deposit/invoice" ,
603
605
body = {"wallet" : wallet , "currency" : currency , "amount" : amount },
604
606
)
@@ -619,7 +621,7 @@ def get_movements(
619
621
620
622
return [
621
623
serializers .Movement .parse (* sub_data )
622
- for sub_data in self ._post (
624
+ for sub_data in self ._m . post (
623
625
endpoint , body = {"start" : start , "end" : end , "limit" : limit }
624
626
)
625
627
]
0 commit comments