ccxt 4.3.67__py2.py3-none-any.whl → 4.3.68__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ccxt/__init__.py +1 -1
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/base/exchange.py +1 -1
- ccxt/async_support/bingx.py +317 -142
- ccxt/async_support/bitget.py +3 -2
- ccxt/base/exchange.py +5 -4
- ccxt/bingx.py +317 -142
- ccxt/bitget.py +3 -2
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/krakenfutures.py +7 -6
- {ccxt-4.3.67.dist-info → ccxt-4.3.68.dist-info}/METADATA +4 -4
- {ccxt-4.3.67.dist-info → ccxt-4.3.68.dist-info}/RECORD +15 -15
- {ccxt-4.3.67.dist-info → ccxt-4.3.68.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.3.67.dist-info → ccxt-4.3.68.dist-info}/WHEEL +0 -0
- {ccxt-4.3.67.dist-info → ccxt-4.3.68.dist-info}/top_level.txt +0 -0
ccxt/bingx.py
CHANGED
@@ -62,6 +62,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
62
62
|
'createTrailingPercentOrder': True,
|
63
63
|
'createTriggerOrder': True,
|
64
64
|
'fetchBalance': True,
|
65
|
+
'fetchCanceledOrders': True,
|
65
66
|
'fetchClosedOrders': True,
|
66
67
|
'fetchCurrencies': True,
|
67
68
|
'fetchDepositAddress': True,
|
@@ -2841,8 +2842,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
2841
2842
|
# "clientOrderID": ""
|
2842
2843
|
# }
|
2843
2844
|
#
|
2844
|
-
# inverse swap cancelAllOrders, cancelOrder
|
2845
|
-
# inverse swap cancelAllOrders, cancelOrder, fetchOpenOrders
|
2845
|
+
# inverse swap cancelAllOrders, cancelOrder, fetchOrder, fetchOpenOrders, fetchClosedOrders, fetchCanceledOrders
|
2846
2846
|
#
|
2847
2847
|
# {
|
2848
2848
|
# "symbol": "SOL-USD",
|
@@ -2900,7 +2900,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
2900
2900
|
side = self.safe_string_lower_2(order, 'side', 'S')
|
2901
2901
|
timestamp = self.safe_integer_n(order, ['time', 'transactTime', 'E'])
|
2902
2902
|
lastTradeTimestamp = self.safe_integer_2(order, 'updateTime', 'T')
|
2903
|
-
statusId = self.
|
2903
|
+
statusId = self.safe_string_upper_2(order, 'status', 'X')
|
2904
2904
|
feeCurrencyCode = self.safe_string_2(order, 'feeAsset', 'N')
|
2905
2905
|
feeCost = self.safe_string_n(order, ['fee', 'commission', 'n'])
|
2906
2906
|
if (feeCurrencyCode is None):
|
@@ -3399,11 +3399,12 @@ class bingx(Exchange, ImplicitAPI):
|
|
3399
3399
|
def fetch_order(self, id: str, symbol: Str = None, params={}):
|
3400
3400
|
"""
|
3401
3401
|
fetches information on an order made by the user
|
3402
|
-
:see: https://bingx-api.github.io/docs/#/spot/trade-api.html#Query%
|
3403
|
-
:see: https://bingx-api.github.io/docs/#/swapV2/trade-api.html#Query%20Order
|
3402
|
+
:see: https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Query%20Order%20details
|
3403
|
+
:see: https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20Order%20details
|
3404
|
+
:see: https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Query%20Order
|
3404
3405
|
:param str symbol: unified symbol of the market the order was made in
|
3405
3406
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
3406
|
-
:returns dict:
|
3407
|
+
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
3407
3408
|
"""
|
3408
3409
|
if symbol is None:
|
3409
3410
|
raise ArgumentsRequired(self.id + ' fetchOrder() requires a symbol argument')
|
@@ -3413,66 +3414,120 @@ class bingx(Exchange, ImplicitAPI):
|
|
3413
3414
|
'symbol': market['id'],
|
3414
3415
|
'orderId': id,
|
3415
3416
|
}
|
3417
|
+
type = None
|
3418
|
+
subType = None
|
3416
3419
|
response = None
|
3417
|
-
|
3418
|
-
|
3419
|
-
|
3420
|
+
type, params = self.handle_market_type_and_params('fetchOrder', market, params)
|
3421
|
+
subType, params = self.handle_sub_type_and_params('fetchOrder', market, params)
|
3422
|
+
if type == 'spot':
|
3423
|
+
response = self.spotV1PrivateGetTradeQuery(self.extend(request, params))
|
3424
|
+
#
|
3425
|
+
# {
|
3426
|
+
# "code": 0,
|
3427
|
+
# "msg": "",
|
3428
|
+
# "data": {
|
3429
|
+
# "symbol": "XRP-USDT",
|
3430
|
+
# "orderId": 1514087361158316032,
|
3431
|
+
# "price": "0.5",
|
3432
|
+
# "origQty": "10",
|
3433
|
+
# "executedQty": "0",
|
3434
|
+
# "cummulativeQuoteQty": "0",
|
3435
|
+
# "status": "CANCELED",
|
3436
|
+
# "type": "LIMIT",
|
3437
|
+
# "side": "BUY",
|
3438
|
+
# "time": 1649821532000,
|
3439
|
+
# "updateTime": 1649821543000,
|
3440
|
+
# "origQuoteOrderQty": "0",
|
3441
|
+
# "fee": "0",
|
3442
|
+
# "feeAsset": "XRP"
|
3443
|
+
# }
|
3444
|
+
# }
|
3445
|
+
#
|
3420
3446
|
else:
|
3421
|
-
|
3422
|
-
|
3423
|
-
|
3424
|
-
|
3425
|
-
|
3426
|
-
|
3427
|
-
|
3428
|
-
|
3429
|
-
|
3430
|
-
|
3431
|
-
|
3432
|
-
|
3433
|
-
|
3434
|
-
|
3435
|
-
|
3436
|
-
|
3437
|
-
|
3438
|
-
|
3439
|
-
|
3440
|
-
|
3441
|
-
|
3442
|
-
|
3443
|
-
|
3444
|
-
|
3445
|
-
|
3446
|
-
|
3447
|
-
|
3448
|
-
|
3449
|
-
|
3450
|
-
|
3451
|
-
|
3452
|
-
|
3453
|
-
|
3454
|
-
|
3455
|
-
|
3456
|
-
|
3457
|
-
|
3458
|
-
|
3459
|
-
|
3460
|
-
|
3461
|
-
|
3462
|
-
|
3463
|
-
|
3464
|
-
|
3465
|
-
|
3466
|
-
|
3467
|
-
|
3468
|
-
|
3469
|
-
|
3470
|
-
|
3471
|
-
|
3472
|
-
|
3473
|
-
|
3474
|
-
|
3475
|
-
|
3447
|
+
if subType == 'inverse':
|
3448
|
+
response = self.cswapV1PrivateGetTradeOrderDetail(self.extend(request, params))
|
3449
|
+
#
|
3450
|
+
# {
|
3451
|
+
# "code": 0,
|
3452
|
+
# "msg": "",
|
3453
|
+
# "data": {
|
3454
|
+
# "order": {
|
3455
|
+
# "symbol": "SOL-USD",
|
3456
|
+
# "orderId": "1816342420721254400",
|
3457
|
+
# "side": "BUY",
|
3458
|
+
# "positionSide": "Long",
|
3459
|
+
# "type": "LIMIT",
|
3460
|
+
# "quantity": 1,
|
3461
|
+
# "origQty": "",
|
3462
|
+
# "price": "150",
|
3463
|
+
# "executedQty": "0",
|
3464
|
+
# "avgPrice": "0.000",
|
3465
|
+
# "cumQuote": "",
|
3466
|
+
# "stopPrice": "",
|
3467
|
+
# "profit": "0.0000",
|
3468
|
+
# "commission": "0.0000",
|
3469
|
+
# "status": "Pending",
|
3470
|
+
# "time": 1721884753767,
|
3471
|
+
# "updateTime": 1721884753786,
|
3472
|
+
# "clientOrderId": "",
|
3473
|
+
# "leverage": "",
|
3474
|
+
# "takeProfit": {
|
3475
|
+
# "type": "TAKE_PROFIT",
|
3476
|
+
# "quantity": 0,
|
3477
|
+
# "stopPrice": 0,
|
3478
|
+
# "price": 0,
|
3479
|
+
# "workingType": "MARK_PRICE",
|
3480
|
+
# "stopGuaranteed": ""
|
3481
|
+
# },
|
3482
|
+
# "stopLoss": {
|
3483
|
+
# "type": "STOP",
|
3484
|
+
# "quantity": 0,
|
3485
|
+
# "stopPrice": 0,
|
3486
|
+
# "price": 0,
|
3487
|
+
# "workingType": "MARK_PRICE",
|
3488
|
+
# "stopGuaranteed": ""
|
3489
|
+
# },
|
3490
|
+
# "advanceAttr": 0,
|
3491
|
+
# "positionID": 0,
|
3492
|
+
# "takeProfitEntrustPrice": 0,
|
3493
|
+
# "stopLossEntrustPrice": 0,
|
3494
|
+
# "orderType": "",
|
3495
|
+
# "workingType": "MARK_PRICE"
|
3496
|
+
# }
|
3497
|
+
# }
|
3498
|
+
# }
|
3499
|
+
#
|
3500
|
+
else:
|
3501
|
+
response = self.swapV2PrivateGetTradeOrder(self.extend(request, params))
|
3502
|
+
#
|
3503
|
+
# {
|
3504
|
+
# "code": 0,
|
3505
|
+
# "msg": "",
|
3506
|
+
# "data": {
|
3507
|
+
# "order": {
|
3508
|
+
# "symbol": "BTC-USDT",
|
3509
|
+
# "orderId": 1597597642269917184,
|
3510
|
+
# "side": "SELL",
|
3511
|
+
# "positionSide": "LONG",
|
3512
|
+
# "type": "TAKE_PROFIT_MARKET",
|
3513
|
+
# "origQty": "1.0000",
|
3514
|
+
# "price": "0.0",
|
3515
|
+
# "executedQty": "0.0000",
|
3516
|
+
# "avgPrice": "0.0",
|
3517
|
+
# "cumQuote": "",
|
3518
|
+
# "stopPrice": "16494.0",
|
3519
|
+
# "profit": "",
|
3520
|
+
# "commission": "",
|
3521
|
+
# "status": "FILLED",
|
3522
|
+
# "time": 1669731935000,
|
3523
|
+
# "updateTime": 1669752524000
|
3524
|
+
# }
|
3525
|
+
# }
|
3526
|
+
# }
|
3527
|
+
#
|
3528
|
+
data = self.safe_dict(response, 'data', {})
|
3529
|
+
order = self.safe_dict(data, 'order', data)
|
3530
|
+
return self.parse_order(order, market)
|
3476
3531
|
|
3477
3532
|
def fetch_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
3478
3533
|
"""
|
@@ -3708,8 +3763,47 @@ class bingx(Exchange, ImplicitAPI):
|
|
3708
3763
|
def fetch_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
3709
3764
|
"""
|
3710
3765
|
fetches information on multiple closed orders made by the user
|
3711
|
-
:see: https://bingx-api.github.io/docs/#/spot/trade-api.html#Query%20Order%
|
3712
|
-
:see: https://bingx-api.github.io/docs/#/swapV2/trade-api.html#
|
3766
|
+
:see: https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Query%20Order%20history
|
3767
|
+
:see: https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20Order%20history
|
3768
|
+
:see: https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#User's%20History%20Orders
|
3769
|
+
:see: https://bingx-api.github.io/docs/#/standard/contract-interface.html#Historical%20order
|
3770
|
+
:param str symbol: unified market symbol of the closed orders
|
3771
|
+
:param int [since]: timestamp in ms of the earliest order
|
3772
|
+
:param int [limit]: the max number of closed orders to return
|
3773
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
3774
|
+
:param int [params.until]: the latest time in ms to fetch orders for
|
3775
|
+
:param boolean [params.standard]: whether to fetch standard contract orders
|
3776
|
+
:returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
3777
|
+
"""
|
3778
|
+
self.load_markets()
|
3779
|
+
orders = self.fetch_canceled_and_closed_orders(symbol, since, limit, params)
|
3780
|
+
return self.filter_by(orders, 'status', 'closed')
|
3781
|
+
|
3782
|
+
def fetch_canceled_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
3783
|
+
"""
|
3784
|
+
fetches information on multiple canceled orders made by the user
|
3785
|
+
:see: https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Query%20Order%20history
|
3786
|
+
:see: https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20Order%20history
|
3787
|
+
:see: https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#User's%20History%20Orders
|
3788
|
+
:see: https://bingx-api.github.io/docs/#/standard/contract-interface.html#Historical%20order
|
3789
|
+
:param str symbol: unified market symbol of the canceled orders
|
3790
|
+
:param int [since]: timestamp in ms of the earliest order
|
3791
|
+
:param int [limit]: the max number of canceled orders to return
|
3792
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
3793
|
+
:param int [params.until]: the latest time in ms to fetch orders for
|
3794
|
+
:param boolean [params.standard]: whether to fetch standard contract orders
|
3795
|
+
:returns dict: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
3796
|
+
"""
|
3797
|
+
self.load_markets()
|
3798
|
+
orders = self.fetch_canceled_and_closed_orders(symbol, since, limit, params)
|
3799
|
+
return self.filter_by(orders, 'status', 'canceled')
|
3800
|
+
|
3801
|
+
def fetch_canceled_and_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
3802
|
+
"""
|
3803
|
+
fetches information on multiple closed orders made by the user
|
3804
|
+
:see: https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Query%20Order%20history
|
3805
|
+
:see: https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20Order%20history
|
3806
|
+
:see: https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#User's%20History%20Orders
|
3713
3807
|
:see: https://bingx-api.github.io/docs/#/standard/contract-interface.html#Historical%20order
|
3714
3808
|
:param str [symbol]: unified market symbol of the market orders were made in
|
3715
3809
|
:param int [since]: the earliest time in ms to fetch orders for
|
@@ -3726,72 +3820,128 @@ class bingx(Exchange, ImplicitAPI):
|
|
3726
3820
|
request: dict = {
|
3727
3821
|
'symbol': market['id'],
|
3728
3822
|
}
|
3729
|
-
|
3823
|
+
type = None
|
3824
|
+
subType = None
|
3730
3825
|
standard = None
|
3826
|
+
response = None
|
3827
|
+
type, params = self.handle_market_type_and_params('fetchClosedOrders', market, params)
|
3828
|
+
subType, params = self.handle_sub_type_and_params('fetchClosedOrders', market, params)
|
3731
3829
|
standard, params = self.handle_option_and_params(params, 'fetchClosedOrders', 'standard', False)
|
3732
|
-
marketType, query = self.handle_market_type_and_params('fetchClosedOrders', market, params)
|
3733
3830
|
if standard:
|
3734
|
-
response = self.contractV1PrivateGetAllOrders(self.extend(request,
|
3735
|
-
elif
|
3736
|
-
response = self.spotV1PrivateGetTradeHistoryOrders(self.extend(request,
|
3831
|
+
response = self.contractV1PrivateGetAllOrders(self.extend(request, params))
|
3832
|
+
elif type == 'spot':
|
3833
|
+
response = self.spotV1PrivateGetTradeHistoryOrders(self.extend(request, params))
|
3834
|
+
#
|
3835
|
+
# {
|
3836
|
+
# "code": 0,
|
3837
|
+
# "msg": "",
|
3838
|
+
# "data": {
|
3839
|
+
# "orders": [
|
3840
|
+
# {
|
3841
|
+
# "symbol": "XRP-USDT",
|
3842
|
+
# "orderId": 1514073325788200960,
|
3843
|
+
# "price": "0.5",
|
3844
|
+
# "origQty": "20",
|
3845
|
+
# "executedQty": "0",
|
3846
|
+
# "cummulativeQuoteQty": "0",
|
3847
|
+
# "status": "PENDING",
|
3848
|
+
# "type": "LIMIT",
|
3849
|
+
# "side": "BUY",
|
3850
|
+
# "time": 1649818185647,
|
3851
|
+
# "updateTime": 1649818185647,
|
3852
|
+
# "origQuoteOrderQty": "0"
|
3853
|
+
# }
|
3854
|
+
# ]
|
3855
|
+
# }
|
3856
|
+
# }
|
3857
|
+
#
|
3737
3858
|
else:
|
3738
|
-
|
3739
|
-
|
3740
|
-
|
3741
|
-
|
3742
|
-
|
3743
|
-
|
3744
|
-
|
3745
|
-
|
3746
|
-
|
3747
|
-
|
3748
|
-
|
3749
|
-
|
3750
|
-
|
3751
|
-
|
3752
|
-
|
3753
|
-
|
3754
|
-
|
3755
|
-
|
3756
|
-
|
3757
|
-
|
3758
|
-
|
3759
|
-
|
3760
|
-
|
3761
|
-
|
3762
|
-
|
3763
|
-
|
3764
|
-
|
3765
|
-
|
3766
|
-
|
3767
|
-
|
3768
|
-
|
3769
|
-
|
3770
|
-
|
3771
|
-
|
3772
|
-
|
3773
|
-
|
3774
|
-
|
3775
|
-
|
3776
|
-
|
3777
|
-
|
3778
|
-
|
3779
|
-
|
3780
|
-
|
3781
|
-
|
3782
|
-
|
3783
|
-
|
3784
|
-
|
3785
|
-
|
3786
|
-
|
3787
|
-
|
3788
|
-
|
3789
|
-
|
3790
|
-
|
3791
|
-
|
3792
|
-
|
3793
|
-
|
3794
|
-
|
3859
|
+
if subType == 'inverse':
|
3860
|
+
response = self.cswapV1PrivateGetTradeOrderHistory(self.extend(request, params))
|
3861
|
+
#
|
3862
|
+
# {
|
3863
|
+
# "code": 0,
|
3864
|
+
# "msg": "",
|
3865
|
+
# "data": {
|
3866
|
+
# "orders": [
|
3867
|
+
# {
|
3868
|
+
# "symbol": "SOL-USD",
|
3869
|
+
# "orderId": "1816002957423951872",
|
3870
|
+
# "side": "BUY",
|
3871
|
+
# "positionSide": "LONG",
|
3872
|
+
# "type": "LIMIT",
|
3873
|
+
# "quantity": 1,
|
3874
|
+
# "origQty": "10.00000000",
|
3875
|
+
# "price": "150.000",
|
3876
|
+
# "executedQty": "0.00000000",
|
3877
|
+
# "avgPrice": "0.000",
|
3878
|
+
# "cumQuote": "",
|
3879
|
+
# "stopPrice": "0.000",
|
3880
|
+
# "profit": "0.0000",
|
3881
|
+
# "commission": "0.000000",
|
3882
|
+
# "status": "Filled",
|
3883
|
+
# "time": 1721803819000,
|
3884
|
+
# "updateTime": 1721803856000,
|
3885
|
+
# "clientOrderId": "",
|
3886
|
+
# "leverage": "",
|
3887
|
+
# "takeProfit": {
|
3888
|
+
# "type": "",
|
3889
|
+
# "quantity": 0,
|
3890
|
+
# "stopPrice": 0,
|
3891
|
+
# "price": 0,
|
3892
|
+
# "workingType": "",
|
3893
|
+
# "stopGuaranteed": ""
|
3894
|
+
# },
|
3895
|
+
# "stopLoss": {
|
3896
|
+
# "type": "",
|
3897
|
+
# "quantity": 0,
|
3898
|
+
# "stopPrice": 0,
|
3899
|
+
# "price": 0,
|
3900
|
+
# "workingType": "",
|
3901
|
+
# "stopGuaranteed": ""
|
3902
|
+
# },
|
3903
|
+
# "advanceAttr": 0,
|
3904
|
+
# "positionID": 0,
|
3905
|
+
# "takeProfitEntrustPrice": 0,
|
3906
|
+
# "stopLossEntrustPrice": 0,
|
3907
|
+
# "orderType": "",
|
3908
|
+
# "workingType": "MARK_PRICE"
|
3909
|
+
# },
|
3910
|
+
# ]
|
3911
|
+
# }
|
3912
|
+
# }
|
3913
|
+
#
|
3914
|
+
else:
|
3915
|
+
response = self.swapV2PrivateGetTradeAllOrders(self.extend(request, params))
|
3916
|
+
#
|
3917
|
+
# {
|
3918
|
+
# "code": 0,
|
3919
|
+
# "msg": "",
|
3920
|
+
# "data": {
|
3921
|
+
# "orders": [
|
3922
|
+
# {
|
3923
|
+
# "symbol": "LINK-USDT",
|
3924
|
+
# "orderId": 1585839271162413056,
|
3925
|
+
# "side": "BUY",
|
3926
|
+
# "positionSide": "LONG",
|
3927
|
+
# "type": "TRIGGER_MARKET",
|
3928
|
+
# "origQty": "5.0",
|
3929
|
+
# "price": "9",
|
3930
|
+
# "executedQty": "0.0",
|
3931
|
+
# "avgPrice": "0",
|
3932
|
+
# "cumQuote": "0",
|
3933
|
+
# "stopPrice": "5",
|
3934
|
+
# "profit": "0.0000",
|
3935
|
+
# "commission": "0.000000",
|
3936
|
+
# "status": "CANCELLED",
|
3937
|
+
# "time": 1667631605000,
|
3938
|
+
# "updateTime": 1667631605000
|
3939
|
+
# },
|
3940
|
+
# ]
|
3941
|
+
# }
|
3942
|
+
# }
|
3943
|
+
#
|
3944
|
+
data = self.safe_dict(response, 'data', {})
|
3795
3945
|
orders = self.safe_list(data, 'orders', [])
|
3796
3946
|
return self.parse_orders(orders, market, since, limit)
|
3797
3947
|
|
@@ -4194,7 +4344,8 @@ class bingx(Exchange, ImplicitAPI):
|
|
4194
4344
|
def set_margin_mode(self, marginMode: str, symbol: Str = None, params={}):
|
4195
4345
|
"""
|
4196
4346
|
set margin mode to 'cross' or 'isolated'
|
4197
|
-
:see: https://bingx-api.github.io/docs/#/swapV2/trade-api.html#
|
4347
|
+
:see: https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Change%20Margin%20Type
|
4348
|
+
:see: https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Set%20Margin%20Type
|
4198
4349
|
:param str marginMode: 'cross' or 'isolated'
|
4199
4350
|
:param str symbol: unified market symbol
|
4200
4351
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -4215,7 +4366,12 @@ class bingx(Exchange, ImplicitAPI):
|
|
4215
4366
|
'symbol': market['id'],
|
4216
4367
|
'marginType': marginMode,
|
4217
4368
|
}
|
4218
|
-
|
4369
|
+
subType = None
|
4370
|
+
subType, params = self.handle_sub_type_and_params('setMarginMode', market, params)
|
4371
|
+
if subType == 'inverse':
|
4372
|
+
return self.cswapV1PrivatePostTradeMarginType(self.extend(request, params))
|
4373
|
+
else:
|
4374
|
+
return self.swapV2PrivatePostTradeMarginType(self.extend(request, params))
|
4219
4375
|
|
4220
4376
|
def add_margin(self, symbol: str, amount: float, params={}) -> MarginModification:
|
4221
4377
|
request: dict = {
|
@@ -5107,7 +5263,8 @@ class bingx(Exchange, ImplicitAPI):
|
|
5107
5263
|
def fetch_margin_mode(self, symbol: str, params={}) -> MarginMode:
|
5108
5264
|
"""
|
5109
5265
|
fetches the margin mode of the trading pair
|
5110
|
-
:see: https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20Margin%
|
5266
|
+
:see: https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20Margin%20Type
|
5267
|
+
:see: https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Query%20Margin%20Type
|
5111
5268
|
:param str symbol: unified symbol of the market to fetch the margin mode for
|
5112
5269
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
5113
5270
|
:returns dict: a `margin mode structure <https://docs.ccxt.com/#/?id=margin-mode-structure>`
|
@@ -5117,25 +5274,43 @@ class bingx(Exchange, ImplicitAPI):
|
|
5117
5274
|
request: dict = {
|
5118
5275
|
'symbol': market['id'],
|
5119
5276
|
}
|
5120
|
-
|
5121
|
-
|
5122
|
-
|
5123
|
-
|
5124
|
-
|
5125
|
-
|
5126
|
-
|
5127
|
-
|
5128
|
-
|
5129
|
-
|
5277
|
+
subType = None
|
5278
|
+
response = None
|
5279
|
+
subType, params = self.handle_sub_type_and_params('fetchMarginMode', market, params)
|
5280
|
+
if subType == 'inverse':
|
5281
|
+
response = self.cswapV1PrivateGetTradeMarginType(self.extend(request, params))
|
5282
|
+
#
|
5283
|
+
# {
|
5284
|
+
# "code": 0,
|
5285
|
+
# "msg": "",
|
5286
|
+
# "timestamp": 1721966069132,
|
5287
|
+
# "data": {
|
5288
|
+
# "symbol": "SOL-USD",
|
5289
|
+
# "marginType": "CROSSED"
|
5290
|
+
# }
|
5291
|
+
# }
|
5292
|
+
#
|
5293
|
+
else:
|
5294
|
+
response = self.swapV2PrivateGetTradeMarginType(self.extend(request, params))
|
5295
|
+
#
|
5296
|
+
# {
|
5297
|
+
# "code": 0,
|
5298
|
+
# "msg": "",
|
5299
|
+
# "data": {
|
5300
|
+
# "marginType": "CROSSED"
|
5301
|
+
# }
|
5302
|
+
# }
|
5303
|
+
#
|
5130
5304
|
data = self.safe_dict(response, 'data', {})
|
5131
5305
|
return self.parse_margin_mode(data, market)
|
5132
5306
|
|
5133
5307
|
def parse_margin_mode(self, marginMode: dict, market=None) -> MarginMode:
|
5308
|
+
marketId = self.safe_string(marginMode, 'symbol')
|
5134
5309
|
marginType = self.safe_string_lower(marginMode, 'marginType')
|
5135
5310
|
marginType = 'cross' if (marginType == 'crossed') else marginType
|
5136
5311
|
return {
|
5137
5312
|
'info': marginMode,
|
5138
|
-
'symbol': market
|
5313
|
+
'symbol': self.safe_symbol(marketId, market, '-', 'swap'),
|
5139
5314
|
'marginMode': marginType,
|
5140
5315
|
}
|
5141
5316
|
|
ccxt/bitget.py
CHANGED
@@ -4867,8 +4867,9 @@ class bitget(Exchange, ImplicitAPI):
|
|
4867
4867
|
if isinstance(response, str):
|
4868
4868
|
response = json.loads(response)
|
4869
4869
|
data = self.safe_dict(response, 'data')
|
4870
|
-
if (data is not None)
|
4871
|
-
|
4870
|
+
if (data is not None):
|
4871
|
+
if not isinstance(data, list):
|
4872
|
+
return self.parse_order(data, market)
|
4872
4873
|
dataList = self.safe_list(response, 'data', [])
|
4873
4874
|
first = self.safe_dict(dataList, 0, {})
|
4874
4875
|
return self.parse_order(first, market)
|
ccxt/pro/__init__.py
CHANGED
ccxt/pro/krakenfutures.py
CHANGED
@@ -82,16 +82,16 @@ class krakenfutures(ccxt.async_support.krakenfutures):
|
|
82
82
|
url = self.urls['api']['ws']
|
83
83
|
messageHash = 'challenge'
|
84
84
|
client = self.client(url)
|
85
|
-
future =
|
86
|
-
|
85
|
+
future = client.future(messageHash)
|
86
|
+
authenticated = self.safe_value(client.subscriptions, messageHash)
|
87
|
+
if authenticated is None:
|
87
88
|
request: dict = {
|
88
89
|
'event': 'challenge',
|
89
90
|
'api_key': self.apiKey,
|
90
91
|
}
|
91
92
|
message = self.extend(request, params)
|
92
|
-
|
93
|
-
|
94
|
-
return future
|
93
|
+
self.watch(url, messageHash, message, messageHash)
|
94
|
+
return await future
|
95
95
|
|
96
96
|
async def watch_order_book_for_symbols(self, symbols: List[str], limit: Int = None, params={}) -> OrderBook:
|
97
97
|
"""
|
@@ -1483,7 +1483,8 @@ class krakenfutures(ccxt.async_support.krakenfutures):
|
|
1483
1483
|
signature = self.hmac(hashedChallenge, base64Secret, hashlib.sha512, 'base64')
|
1484
1484
|
self.options['challenge'] = challenge
|
1485
1485
|
self.options['signedChallenge'] = signature
|
1486
|
-
client.
|
1486
|
+
future = self.safe_value(client.futures, messageHash)
|
1487
|
+
future.resolve(True)
|
1487
1488
|
else:
|
1488
1489
|
error = AuthenticationError(self.id + ' ' + self.json(message))
|
1489
1490
|
client.reject(error, messageHash)
|