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/__init__.py
CHANGED
ccxt/async_support/__init__.py
CHANGED
ccxt/async_support/bingx.py
CHANGED
@@ -63,6 +63,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
63
63
|
'createTrailingPercentOrder': True,
|
64
64
|
'createTriggerOrder': True,
|
65
65
|
'fetchBalance': True,
|
66
|
+
'fetchCanceledOrders': True,
|
66
67
|
'fetchClosedOrders': True,
|
67
68
|
'fetchCurrencies': True,
|
68
69
|
'fetchDepositAddress': True,
|
@@ -2842,8 +2843,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
2842
2843
|
# "clientOrderID": ""
|
2843
2844
|
# }
|
2844
2845
|
#
|
2845
|
-
# inverse swap cancelAllOrders, cancelOrder
|
2846
|
-
# inverse swap cancelAllOrders, cancelOrder, fetchOpenOrders
|
2846
|
+
# inverse swap cancelAllOrders, cancelOrder, fetchOrder, fetchOpenOrders, fetchClosedOrders, fetchCanceledOrders
|
2847
2847
|
#
|
2848
2848
|
# {
|
2849
2849
|
# "symbol": "SOL-USD",
|
@@ -2901,7 +2901,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
2901
2901
|
side = self.safe_string_lower_2(order, 'side', 'S')
|
2902
2902
|
timestamp = self.safe_integer_n(order, ['time', 'transactTime', 'E'])
|
2903
2903
|
lastTradeTimestamp = self.safe_integer_2(order, 'updateTime', 'T')
|
2904
|
-
statusId = self.
|
2904
|
+
statusId = self.safe_string_upper_2(order, 'status', 'X')
|
2905
2905
|
feeCurrencyCode = self.safe_string_2(order, 'feeAsset', 'N')
|
2906
2906
|
feeCost = self.safe_string_n(order, ['fee', 'commission', 'n'])
|
2907
2907
|
if (feeCurrencyCode is None):
|
@@ -3400,11 +3400,12 @@ class bingx(Exchange, ImplicitAPI):
|
|
3400
3400
|
async def fetch_order(self, id: str, symbol: Str = None, params={}):
|
3401
3401
|
"""
|
3402
3402
|
fetches information on an order made by the user
|
3403
|
-
:see: https://bingx-api.github.io/docs/#/spot/trade-api.html#Query%
|
3404
|
-
:see: https://bingx-api.github.io/docs/#/swapV2/trade-api.html#Query%20Order
|
3403
|
+
:see: https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Query%20Order%20details
|
3404
|
+
:see: https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20Order%20details
|
3405
|
+
:see: https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Query%20Order
|
3405
3406
|
:param str symbol: unified symbol of the market the order was made in
|
3406
3407
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
3407
|
-
:returns dict:
|
3408
|
+
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
3408
3409
|
"""
|
3409
3410
|
if symbol is None:
|
3410
3411
|
raise ArgumentsRequired(self.id + ' fetchOrder() requires a symbol argument')
|
@@ -3414,66 +3415,120 @@ class bingx(Exchange, ImplicitAPI):
|
|
3414
3415
|
'symbol': market['id'],
|
3415
3416
|
'orderId': id,
|
3416
3417
|
}
|
3418
|
+
type = None
|
3419
|
+
subType = None
|
3417
3420
|
response = None
|
3418
|
-
|
3419
|
-
|
3420
|
-
|
3421
|
+
type, params = self.handle_market_type_and_params('fetchOrder', market, params)
|
3422
|
+
subType, params = self.handle_sub_type_and_params('fetchOrder', market, params)
|
3423
|
+
if type == 'spot':
|
3424
|
+
response = await self.spotV1PrivateGetTradeQuery(self.extend(request, params))
|
3425
|
+
#
|
3426
|
+
# {
|
3427
|
+
# "code": 0,
|
3428
|
+
# "msg": "",
|
3429
|
+
# "data": {
|
3430
|
+
# "symbol": "XRP-USDT",
|
3431
|
+
# "orderId": 1514087361158316032,
|
3432
|
+
# "price": "0.5",
|
3433
|
+
# "origQty": "10",
|
3434
|
+
# "executedQty": "0",
|
3435
|
+
# "cummulativeQuoteQty": "0",
|
3436
|
+
# "status": "CANCELED",
|
3437
|
+
# "type": "LIMIT",
|
3438
|
+
# "side": "BUY",
|
3439
|
+
# "time": 1649821532000,
|
3440
|
+
# "updateTime": 1649821543000,
|
3441
|
+
# "origQuoteOrderQty": "0",
|
3442
|
+
# "fee": "0",
|
3443
|
+
# "feeAsset": "XRP"
|
3444
|
+
# }
|
3445
|
+
# }
|
3446
|
+
#
|
3421
3447
|
else:
|
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
|
-
|
3476
|
-
|
3448
|
+
if subType == 'inverse':
|
3449
|
+
response = await self.cswapV1PrivateGetTradeOrderDetail(self.extend(request, params))
|
3450
|
+
#
|
3451
|
+
# {
|
3452
|
+
# "code": 0,
|
3453
|
+
# "msg": "",
|
3454
|
+
# "data": {
|
3455
|
+
# "order": {
|
3456
|
+
# "symbol": "SOL-USD",
|
3457
|
+
# "orderId": "1816342420721254400",
|
3458
|
+
# "side": "BUY",
|
3459
|
+
# "positionSide": "Long",
|
3460
|
+
# "type": "LIMIT",
|
3461
|
+
# "quantity": 1,
|
3462
|
+
# "origQty": "",
|
3463
|
+
# "price": "150",
|
3464
|
+
# "executedQty": "0",
|
3465
|
+
# "avgPrice": "0.000",
|
3466
|
+
# "cumQuote": "",
|
3467
|
+
# "stopPrice": "",
|
3468
|
+
# "profit": "0.0000",
|
3469
|
+
# "commission": "0.0000",
|
3470
|
+
# "status": "Pending",
|
3471
|
+
# "time": 1721884753767,
|
3472
|
+
# "updateTime": 1721884753786,
|
3473
|
+
# "clientOrderId": "",
|
3474
|
+
# "leverage": "",
|
3475
|
+
# "takeProfit": {
|
3476
|
+
# "type": "TAKE_PROFIT",
|
3477
|
+
# "quantity": 0,
|
3478
|
+
# "stopPrice": 0,
|
3479
|
+
# "price": 0,
|
3480
|
+
# "workingType": "MARK_PRICE",
|
3481
|
+
# "stopGuaranteed": ""
|
3482
|
+
# },
|
3483
|
+
# "stopLoss": {
|
3484
|
+
# "type": "STOP",
|
3485
|
+
# "quantity": 0,
|
3486
|
+
# "stopPrice": 0,
|
3487
|
+
# "price": 0,
|
3488
|
+
# "workingType": "MARK_PRICE",
|
3489
|
+
# "stopGuaranteed": ""
|
3490
|
+
# },
|
3491
|
+
# "advanceAttr": 0,
|
3492
|
+
# "positionID": 0,
|
3493
|
+
# "takeProfitEntrustPrice": 0,
|
3494
|
+
# "stopLossEntrustPrice": 0,
|
3495
|
+
# "orderType": "",
|
3496
|
+
# "workingType": "MARK_PRICE"
|
3497
|
+
# }
|
3498
|
+
# }
|
3499
|
+
# }
|
3500
|
+
#
|
3501
|
+
else:
|
3502
|
+
response = await self.swapV2PrivateGetTradeOrder(self.extend(request, params))
|
3503
|
+
#
|
3504
|
+
# {
|
3505
|
+
# "code": 0,
|
3506
|
+
# "msg": "",
|
3507
|
+
# "data": {
|
3508
|
+
# "order": {
|
3509
|
+
# "symbol": "BTC-USDT",
|
3510
|
+
# "orderId": 1597597642269917184,
|
3511
|
+
# "side": "SELL",
|
3512
|
+
# "positionSide": "LONG",
|
3513
|
+
# "type": "TAKE_PROFIT_MARKET",
|
3514
|
+
# "origQty": "1.0000",
|
3515
|
+
# "price": "0.0",
|
3516
|
+
# "executedQty": "0.0000",
|
3517
|
+
# "avgPrice": "0.0",
|
3518
|
+
# "cumQuote": "",
|
3519
|
+
# "stopPrice": "16494.0",
|
3520
|
+
# "profit": "",
|
3521
|
+
# "commission": "",
|
3522
|
+
# "status": "FILLED",
|
3523
|
+
# "time": 1669731935000,
|
3524
|
+
# "updateTime": 1669752524000
|
3525
|
+
# }
|
3526
|
+
# }
|
3527
|
+
# }
|
3528
|
+
#
|
3529
|
+
data = self.safe_dict(response, 'data', {})
|
3530
|
+
order = self.safe_dict(data, 'order', data)
|
3531
|
+
return self.parse_order(order, market)
|
3477
3532
|
|
3478
3533
|
async def fetch_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
3479
3534
|
"""
|
@@ -3709,8 +3764,47 @@ class bingx(Exchange, ImplicitAPI):
|
|
3709
3764
|
async def fetch_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
3710
3765
|
"""
|
3711
3766
|
fetches information on multiple closed orders made by the user
|
3712
|
-
:see: https://bingx-api.github.io/docs/#/spot/trade-api.html#Query%20Order%
|
3713
|
-
:see: https://bingx-api.github.io/docs/#/swapV2/trade-api.html#
|
3767
|
+
:see: https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Query%20Order%20history
|
3768
|
+
:see: https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20Order%20history
|
3769
|
+
:see: https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#User's%20History%20Orders
|
3770
|
+
:see: https://bingx-api.github.io/docs/#/standard/contract-interface.html#Historical%20order
|
3771
|
+
:param str symbol: unified market symbol of the closed orders
|
3772
|
+
:param int [since]: timestamp in ms of the earliest order
|
3773
|
+
:param int [limit]: the max number of closed orders to return
|
3774
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
3775
|
+
:param int [params.until]: the latest time in ms to fetch orders for
|
3776
|
+
:param boolean [params.standard]: whether to fetch standard contract orders
|
3777
|
+
:returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
3778
|
+
"""
|
3779
|
+
await self.load_markets()
|
3780
|
+
orders = await self.fetch_canceled_and_closed_orders(symbol, since, limit, params)
|
3781
|
+
return self.filter_by(orders, 'status', 'closed')
|
3782
|
+
|
3783
|
+
async def fetch_canceled_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
3784
|
+
"""
|
3785
|
+
fetches information on multiple canceled orders made by the user
|
3786
|
+
:see: https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Query%20Order%20history
|
3787
|
+
:see: https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20Order%20history
|
3788
|
+
:see: https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#User's%20History%20Orders
|
3789
|
+
:see: https://bingx-api.github.io/docs/#/standard/contract-interface.html#Historical%20order
|
3790
|
+
:param str symbol: unified market symbol of the canceled orders
|
3791
|
+
:param int [since]: timestamp in ms of the earliest order
|
3792
|
+
:param int [limit]: the max number of canceled orders to return
|
3793
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
3794
|
+
:param int [params.until]: the latest time in ms to fetch orders for
|
3795
|
+
:param boolean [params.standard]: whether to fetch standard contract orders
|
3796
|
+
:returns dict: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
3797
|
+
"""
|
3798
|
+
await self.load_markets()
|
3799
|
+
orders = await self.fetch_canceled_and_closed_orders(symbol, since, limit, params)
|
3800
|
+
return self.filter_by(orders, 'status', 'canceled')
|
3801
|
+
|
3802
|
+
async def fetch_canceled_and_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
3803
|
+
"""
|
3804
|
+
fetches information on multiple closed orders made by the user
|
3805
|
+
:see: https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Query%20Order%20history
|
3806
|
+
:see: https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20Order%20history
|
3807
|
+
:see: https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#User's%20History%20Orders
|
3714
3808
|
:see: https://bingx-api.github.io/docs/#/standard/contract-interface.html#Historical%20order
|
3715
3809
|
:param str [symbol]: unified market symbol of the market orders were made in
|
3716
3810
|
:param int [since]: the earliest time in ms to fetch orders for
|
@@ -3727,72 +3821,128 @@ class bingx(Exchange, ImplicitAPI):
|
|
3727
3821
|
request: dict = {
|
3728
3822
|
'symbol': market['id'],
|
3729
3823
|
}
|
3730
|
-
|
3824
|
+
type = None
|
3825
|
+
subType = None
|
3731
3826
|
standard = None
|
3827
|
+
response = None
|
3828
|
+
type, params = self.handle_market_type_and_params('fetchClosedOrders', market, params)
|
3829
|
+
subType, params = self.handle_sub_type_and_params('fetchClosedOrders', market, params)
|
3732
3830
|
standard, params = self.handle_option_and_params(params, 'fetchClosedOrders', 'standard', False)
|
3733
|
-
marketType, query = self.handle_market_type_and_params('fetchClosedOrders', market, params)
|
3734
3831
|
if standard:
|
3735
|
-
response = await self.contractV1PrivateGetAllOrders(self.extend(request,
|
3736
|
-
elif
|
3737
|
-
response = await self.spotV1PrivateGetTradeHistoryOrders(self.extend(request,
|
3832
|
+
response = await self.contractV1PrivateGetAllOrders(self.extend(request, params))
|
3833
|
+
elif type == 'spot':
|
3834
|
+
response = await self.spotV1PrivateGetTradeHistoryOrders(self.extend(request, params))
|
3835
|
+
#
|
3836
|
+
# {
|
3837
|
+
# "code": 0,
|
3838
|
+
# "msg": "",
|
3839
|
+
# "data": {
|
3840
|
+
# "orders": [
|
3841
|
+
# {
|
3842
|
+
# "symbol": "XRP-USDT",
|
3843
|
+
# "orderId": 1514073325788200960,
|
3844
|
+
# "price": "0.5",
|
3845
|
+
# "origQty": "20",
|
3846
|
+
# "executedQty": "0",
|
3847
|
+
# "cummulativeQuoteQty": "0",
|
3848
|
+
# "status": "PENDING",
|
3849
|
+
# "type": "LIMIT",
|
3850
|
+
# "side": "BUY",
|
3851
|
+
# "time": 1649818185647,
|
3852
|
+
# "updateTime": 1649818185647,
|
3853
|
+
# "origQuoteOrderQty": "0"
|
3854
|
+
# }
|
3855
|
+
# ]
|
3856
|
+
# }
|
3857
|
+
# }
|
3858
|
+
#
|
3738
3859
|
else:
|
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
|
-
|
3795
|
-
|
3860
|
+
if subType == 'inverse':
|
3861
|
+
response = await self.cswapV1PrivateGetTradeOrderHistory(self.extend(request, params))
|
3862
|
+
#
|
3863
|
+
# {
|
3864
|
+
# "code": 0,
|
3865
|
+
# "msg": "",
|
3866
|
+
# "data": {
|
3867
|
+
# "orders": [
|
3868
|
+
# {
|
3869
|
+
# "symbol": "SOL-USD",
|
3870
|
+
# "orderId": "1816002957423951872",
|
3871
|
+
# "side": "BUY",
|
3872
|
+
# "positionSide": "LONG",
|
3873
|
+
# "type": "LIMIT",
|
3874
|
+
# "quantity": 1,
|
3875
|
+
# "origQty": "10.00000000",
|
3876
|
+
# "price": "150.000",
|
3877
|
+
# "executedQty": "0.00000000",
|
3878
|
+
# "avgPrice": "0.000",
|
3879
|
+
# "cumQuote": "",
|
3880
|
+
# "stopPrice": "0.000",
|
3881
|
+
# "profit": "0.0000",
|
3882
|
+
# "commission": "0.000000",
|
3883
|
+
# "status": "Filled",
|
3884
|
+
# "time": 1721803819000,
|
3885
|
+
# "updateTime": 1721803856000,
|
3886
|
+
# "clientOrderId": "",
|
3887
|
+
# "leverage": "",
|
3888
|
+
# "takeProfit": {
|
3889
|
+
# "type": "",
|
3890
|
+
# "quantity": 0,
|
3891
|
+
# "stopPrice": 0,
|
3892
|
+
# "price": 0,
|
3893
|
+
# "workingType": "",
|
3894
|
+
# "stopGuaranteed": ""
|
3895
|
+
# },
|
3896
|
+
# "stopLoss": {
|
3897
|
+
# "type": "",
|
3898
|
+
# "quantity": 0,
|
3899
|
+
# "stopPrice": 0,
|
3900
|
+
# "price": 0,
|
3901
|
+
# "workingType": "",
|
3902
|
+
# "stopGuaranteed": ""
|
3903
|
+
# },
|
3904
|
+
# "advanceAttr": 0,
|
3905
|
+
# "positionID": 0,
|
3906
|
+
# "takeProfitEntrustPrice": 0,
|
3907
|
+
# "stopLossEntrustPrice": 0,
|
3908
|
+
# "orderType": "",
|
3909
|
+
# "workingType": "MARK_PRICE"
|
3910
|
+
# },
|
3911
|
+
# ]
|
3912
|
+
# }
|
3913
|
+
# }
|
3914
|
+
#
|
3915
|
+
else:
|
3916
|
+
response = await self.swapV2PrivateGetTradeAllOrders(self.extend(request, params))
|
3917
|
+
#
|
3918
|
+
# {
|
3919
|
+
# "code": 0,
|
3920
|
+
# "msg": "",
|
3921
|
+
# "data": {
|
3922
|
+
# "orders": [
|
3923
|
+
# {
|
3924
|
+
# "symbol": "LINK-USDT",
|
3925
|
+
# "orderId": 1585839271162413056,
|
3926
|
+
# "side": "BUY",
|
3927
|
+
# "positionSide": "LONG",
|
3928
|
+
# "type": "TRIGGER_MARKET",
|
3929
|
+
# "origQty": "5.0",
|
3930
|
+
# "price": "9",
|
3931
|
+
# "executedQty": "0.0",
|
3932
|
+
# "avgPrice": "0",
|
3933
|
+
# "cumQuote": "0",
|
3934
|
+
# "stopPrice": "5",
|
3935
|
+
# "profit": "0.0000",
|
3936
|
+
# "commission": "0.000000",
|
3937
|
+
# "status": "CANCELLED",
|
3938
|
+
# "time": 1667631605000,
|
3939
|
+
# "updateTime": 1667631605000
|
3940
|
+
# },
|
3941
|
+
# ]
|
3942
|
+
# }
|
3943
|
+
# }
|
3944
|
+
#
|
3945
|
+
data = self.safe_dict(response, 'data', {})
|
3796
3946
|
orders = self.safe_list(data, 'orders', [])
|
3797
3947
|
return self.parse_orders(orders, market, since, limit)
|
3798
3948
|
|
@@ -4195,7 +4345,8 @@ class bingx(Exchange, ImplicitAPI):
|
|
4195
4345
|
async def set_margin_mode(self, marginMode: str, symbol: Str = None, params={}):
|
4196
4346
|
"""
|
4197
4347
|
set margin mode to 'cross' or 'isolated'
|
4198
|
-
:see: https://bingx-api.github.io/docs/#/swapV2/trade-api.html#
|
4348
|
+
:see: https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Change%20Margin%20Type
|
4349
|
+
:see: https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Set%20Margin%20Type
|
4199
4350
|
:param str marginMode: 'cross' or 'isolated'
|
4200
4351
|
:param str symbol: unified market symbol
|
4201
4352
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -4216,7 +4367,12 @@ class bingx(Exchange, ImplicitAPI):
|
|
4216
4367
|
'symbol': market['id'],
|
4217
4368
|
'marginType': marginMode,
|
4218
4369
|
}
|
4219
|
-
|
4370
|
+
subType = None
|
4371
|
+
subType, params = self.handle_sub_type_and_params('setMarginMode', market, params)
|
4372
|
+
if subType == 'inverse':
|
4373
|
+
return await self.cswapV1PrivatePostTradeMarginType(self.extend(request, params))
|
4374
|
+
else:
|
4375
|
+
return await self.swapV2PrivatePostTradeMarginType(self.extend(request, params))
|
4220
4376
|
|
4221
4377
|
async def add_margin(self, symbol: str, amount: float, params={}) -> MarginModification:
|
4222
4378
|
request: dict = {
|
@@ -5108,7 +5264,8 @@ class bingx(Exchange, ImplicitAPI):
|
|
5108
5264
|
async def fetch_margin_mode(self, symbol: str, params={}) -> MarginMode:
|
5109
5265
|
"""
|
5110
5266
|
fetches the margin mode of the trading pair
|
5111
|
-
:see: https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20Margin%
|
5267
|
+
:see: https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20Margin%20Type
|
5268
|
+
:see: https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Query%20Margin%20Type
|
5112
5269
|
:param str symbol: unified symbol of the market to fetch the margin mode for
|
5113
5270
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
5114
5271
|
:returns dict: a `margin mode structure <https://docs.ccxt.com/#/?id=margin-mode-structure>`
|
@@ -5118,25 +5275,43 @@ class bingx(Exchange, ImplicitAPI):
|
|
5118
5275
|
request: dict = {
|
5119
5276
|
'symbol': market['id'],
|
5120
5277
|
}
|
5121
|
-
|
5122
|
-
|
5123
|
-
|
5124
|
-
|
5125
|
-
|
5126
|
-
|
5127
|
-
|
5128
|
-
|
5129
|
-
|
5130
|
-
|
5278
|
+
subType = None
|
5279
|
+
response = None
|
5280
|
+
subType, params = self.handle_sub_type_and_params('fetchMarginMode', market, params)
|
5281
|
+
if subType == 'inverse':
|
5282
|
+
response = await self.cswapV1PrivateGetTradeMarginType(self.extend(request, params))
|
5283
|
+
#
|
5284
|
+
# {
|
5285
|
+
# "code": 0,
|
5286
|
+
# "msg": "",
|
5287
|
+
# "timestamp": 1721966069132,
|
5288
|
+
# "data": {
|
5289
|
+
# "symbol": "SOL-USD",
|
5290
|
+
# "marginType": "CROSSED"
|
5291
|
+
# }
|
5292
|
+
# }
|
5293
|
+
#
|
5294
|
+
else:
|
5295
|
+
response = await self.swapV2PrivateGetTradeMarginType(self.extend(request, params))
|
5296
|
+
#
|
5297
|
+
# {
|
5298
|
+
# "code": 0,
|
5299
|
+
# "msg": "",
|
5300
|
+
# "data": {
|
5301
|
+
# "marginType": "CROSSED"
|
5302
|
+
# }
|
5303
|
+
# }
|
5304
|
+
#
|
5131
5305
|
data = self.safe_dict(response, 'data', {})
|
5132
5306
|
return self.parse_margin_mode(data, market)
|
5133
5307
|
|
5134
5308
|
def parse_margin_mode(self, marginMode: dict, market=None) -> MarginMode:
|
5309
|
+
marketId = self.safe_string(marginMode, 'symbol')
|
5135
5310
|
marginType = self.safe_string_lower(marginMode, 'marginType')
|
5136
5311
|
marginType = 'cross' if (marginType == 'crossed') else marginType
|
5137
5312
|
return {
|
5138
5313
|
'info': marginMode,
|
5139
|
-
'symbol': market
|
5314
|
+
'symbol': self.safe_symbol(marketId, market, '-', 'swap'),
|
5140
5315
|
'marginMode': marginType,
|
5141
5316
|
}
|
5142
5317
|
|
ccxt/async_support/bitget.py
CHANGED
@@ -4868,8 +4868,9 @@ class bitget(Exchange, ImplicitAPI):
|
|
4868
4868
|
if isinstance(response, str):
|
4869
4869
|
response = json.loads(response)
|
4870
4870
|
data = self.safe_dict(response, 'data')
|
4871
|
-
if (data is not None)
|
4872
|
-
|
4871
|
+
if (data is not None):
|
4872
|
+
if not isinstance(data, list):
|
4873
|
+
return self.parse_order(data, market)
|
4873
4874
|
dataList = self.safe_list(response, 'data', [])
|
4874
4875
|
first = self.safe_dict(dataList, 0, {})
|
4875
4876
|
return self.parse_order(first, market)
|
ccxt/base/exchange.py
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
# -----------------------------------------------------------------------------
|
6
6
|
|
7
|
-
__version__ = '4.3.
|
7
|
+
__version__ = '4.3.68'
|
8
8
|
|
9
9
|
# -----------------------------------------------------------------------------
|
10
10
|
|
@@ -1848,8 +1848,9 @@ class Exchange(object):
|
|
1848
1848
|
value = self.safe_value_n(dictionaryOrList, keys, defaultValue)
|
1849
1849
|
if value is None:
|
1850
1850
|
return defaultValue
|
1851
|
-
if isinstance(value, dict):
|
1852
|
-
|
1851
|
+
if (isinstance(value, dict)):
|
1852
|
+
if not isinstance(value, list):
|
1853
|
+
return value
|
1853
1854
|
return defaultValue
|
1854
1855
|
|
1855
1856
|
def safe_dict(self, dictionary, key: IndexType, defaultValue: dict = None):
|
@@ -3455,7 +3456,7 @@ class Exchange(object):
|
|
3455
3456
|
defaultNetworkCode = defaultNetworks[currencyCode]
|
3456
3457
|
else:
|
3457
3458
|
# otherwise, try to use the global-scope 'defaultNetwork' value(even if that network is not supported by currency, it doesn't make any problem, self will be just used "at first" if currency supports self network at all)
|
3458
|
-
defaultNetwork = self.
|
3459
|
+
defaultNetwork = self.safe_string(self.options, 'defaultNetwork')
|
3459
3460
|
if defaultNetwork is not None:
|
3460
3461
|
defaultNetworkCode = defaultNetwork
|
3461
3462
|
return defaultNetworkCode
|