ccxt 4.4.44__py2.py3-none-any.whl → 4.4.45__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/abstract/blofin.py +22 -0
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/base/exchange.py +1 -1
- ccxt/async_support/binance.py +178 -62
- ccxt/async_support/bingx.py +15 -9
- ccxt/async_support/bitfinex.py +1 -1
- ccxt/async_support/bitget.py +3 -3
- ccxt/async_support/bitmart.py +3 -3
- ccxt/async_support/bitmex.py +1 -1
- ccxt/async_support/blofin.py +22 -0
- ccxt/async_support/bybit.py +4 -4
- ccxt/async_support/coinbase.py +1 -1
- ccxt/async_support/coinex.py +1 -1
- ccxt/async_support/cryptocom.py +1 -1
- ccxt/async_support/exmo.py +16 -8
- ccxt/async_support/gate.py +1 -1
- ccxt/async_support/hashkey.py +6 -1
- ccxt/async_support/htx.py +2 -2
- ccxt/async_support/hyperliquid.py +1 -1
- ccxt/async_support/kraken.py +1 -1
- ccxt/async_support/krakenfutures.py +1 -1
- ccxt/async_support/kucoin.py +1 -1
- ccxt/async_support/kucoinfutures.py +2 -3
- ccxt/async_support/lykke.py +1 -1
- ccxt/async_support/mexc.py +2 -2
- ccxt/async_support/myokx.py +8 -0
- ccxt/async_support/okx.py +4 -4
- ccxt/async_support/onetrading.py +2 -1
- ccxt/async_support/whitebit.py +31 -8
- ccxt/async_support/woo.py +1 -1
- ccxt/async_support/woofipro.py +2 -2
- ccxt/base/exchange.py +1 -1
- ccxt/binance.py +178 -62
- ccxt/bingx.py +15 -9
- ccxt/bitfinex.py +1 -1
- ccxt/bitget.py +3 -3
- ccxt/bitmart.py +3 -3
- ccxt/bitmex.py +1 -1
- ccxt/blofin.py +22 -0
- ccxt/bybit.py +4 -4
- ccxt/coinbase.py +1 -1
- ccxt/coinex.py +1 -1
- ccxt/cryptocom.py +1 -1
- ccxt/exmo.py +16 -8
- ccxt/gate.py +1 -1
- ccxt/hashkey.py +6 -1
- ccxt/htx.py +2 -2
- ccxt/hyperliquid.py +1 -1
- ccxt/kraken.py +1 -1
- ccxt/krakenfutures.py +1 -1
- ccxt/kucoin.py +1 -1
- ccxt/kucoinfutures.py +2 -3
- ccxt/lykke.py +1 -1
- ccxt/mexc.py +2 -2
- ccxt/myokx.py +8 -0
- ccxt/okx.py +4 -4
- ccxt/onetrading.py +2 -1
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/binance.py +2 -1
- ccxt/pro/myokx.py +5 -0
- ccxt/whitebit.py +31 -8
- ccxt/woo.py +1 -1
- ccxt/woofipro.py +2 -2
- {ccxt-4.4.44.dist-info → ccxt-4.4.45.dist-info}/METADATA +4 -4
- {ccxt-4.4.44.dist-info → ccxt-4.4.45.dist-info}/RECORD +69 -69
- {ccxt-4.4.44.dist-info → ccxt-4.4.45.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.4.44.dist-info → ccxt-4.4.45.dist-info}/WHEEL +0 -0
- {ccxt-4.4.44.dist-info → ccxt-4.4.45.dist-info}/top_level.txt +0 -0
ccxt/binance.py
CHANGED
@@ -1642,7 +1642,7 @@ class binance(Exchange, ImplicitAPI):
|
|
1642
1642
|
'fetchClosedOrders': {
|
1643
1643
|
'marginMode': True,
|
1644
1644
|
'limit': 1000,
|
1645
|
-
'
|
1645
|
+
'daysBack': None,
|
1646
1646
|
'daysBackCanceled': None,
|
1647
1647
|
'untilDays': 10000,
|
1648
1648
|
'trigger': False,
|
@@ -1712,7 +1712,7 @@ class binance(Exchange, ImplicitAPI):
|
|
1712
1712
|
'fetchClosedOrders': {
|
1713
1713
|
'marginMode': True,
|
1714
1714
|
'limit': 1000,
|
1715
|
-
'
|
1715
|
+
'daysBack': 90,
|
1716
1716
|
'daysBackCanceled': 3,
|
1717
1717
|
'untilDays': 7,
|
1718
1718
|
'trigger': False,
|
@@ -2435,92 +2435,189 @@ class binance(Exchange, ImplicitAPI):
|
|
2435
2435
|
'portfolioMargin': {
|
2436
2436
|
'exact': {
|
2437
2437
|
#
|
2438
|
-
#
|
2438
|
+
# 10xx General Server or Network Issues
|
2439
2439
|
#
|
2440
|
-
'-
|
2441
|
-
'-
|
2442
|
-
'-
|
2443
|
-
'-
|
2444
|
-
'-
|
2445
|
-
'-
|
2446
|
-
'-
|
2447
|
-
'-
|
2440
|
+
'-1000': OperationFailed, # An unknown error occured while processing the request.
|
2441
|
+
'-1001': ExchangeError, # Internal error; unable to process your request. Please try again.
|
2442
|
+
'-1002': PermissionDenied, # You are not authorized to execute self request.
|
2443
|
+
'-1003': RateLimitExceeded, # Too many requests use the websocket for live updates to avoid polling the API.
|
2444
|
+
'-1004': BadRequest, # This IP is already on the white list.
|
2445
|
+
'-1005': PermissionDenied, # No such IP has been white listed.
|
2446
|
+
'-1006': BadResponse, # An unexpected response was received from the message bus. Execution status unknown.
|
2447
|
+
'-1007': BadResponse, # Timeout waiting for response from backend server. Send status unknown, execution status unknown.
|
2448
|
+
'-1008': OperationFailed, # WS Spot server is currently overloaded with other requests. Please try again in a few minutes.
|
2449
|
+
'-1010': ExchangeError, # ERROR_MSG_RECEIVED
|
2450
|
+
'-1011': PermissionDenied, # This IP cannot access self route.
|
2451
|
+
'-1013': ExchangeError, # INVALID_MESSAGE.
|
2452
|
+
'-1014': InvalidOrder, # Unsupported order combination.
|
2453
|
+
'-1015': InvalidOrder, # Too many new orders.
|
2454
|
+
'-1016': NotSupported, # This service is no longer available.
|
2455
|
+
'-1020': NotSupported, # This operation is not supported.
|
2456
|
+
'-1021': BadRequest, # Timestamp for self request is outside of the recvWindow 1000ms ahead of the servers time.
|
2457
|
+
'-1022': BadRequest, # Signature for self request is not valid.
|
2458
|
+
'-1023': BadRequest, # Start time is greater than end time
|
2459
|
+
'-1099': OperationFailed, # WS not found authenticated or authorized
|
2448
2460
|
#
|
2449
|
-
#
|
2461
|
+
# 11xx Request Issues
|
2450
2462
|
#
|
2451
|
-
'-
|
2452
|
-
'-
|
2453
|
-
'-
|
2454
|
-
'-
|
2463
|
+
'-1100': BadRequest, # Illegal characters found in a parameter.
|
2464
|
+
'-1101': BadRequest, # Too many parameters sent for self endpoint.
|
2465
|
+
'-1102': BadRequest, # A mandatory parameter was not sent, was empty/null, or malformed.
|
2466
|
+
'-1103': BadRequest, # An unknown parameter was sent.
|
2467
|
+
'-1104': BadRequest, # Not all sent parameters were read.
|
2468
|
+
'-1105': BadRequest, # A parameter was empty.
|
2469
|
+
'-1106': BadRequest, # A parameter was sent when not required.
|
2470
|
+
'-1108': BadRequest, # Invalid asset.
|
2471
|
+
'-1109': BadRequest, # Invalid account.
|
2472
|
+
'-1110': BadSymbol, # Invalid symbolType.
|
2473
|
+
'-1111': BadRequest, # Precision is over the maximum defined for self asset.
|
2474
|
+
'-1112': BadRequest, # No orders on book for symbol.
|
2475
|
+
'-1113': BadRequest, # Withdrawal amount must be negative.
|
2476
|
+
'-1114': BadRequest, # TimeInForce parameter sent when not required.
|
2477
|
+
'-1115': BadRequest, # Invalid timeInForce.
|
2478
|
+
'-1116': BadRequest, # Invalid orderType.
|
2479
|
+
'-1117': BadRequest, # Invalid side.
|
2480
|
+
'-1118': BadRequest, # New client order ID was empty.
|
2481
|
+
'-1119': BadRequest, # Original client order ID was empty.
|
2482
|
+
'-1120': BadRequest, # Invalid interval.
|
2483
|
+
'-1121': BadSymbol, # Invalid symbol.
|
2484
|
+
'-1125': BadRequest, # This listenKey does not exist.
|
2485
|
+
'-1127': BadRequest, # Lookup interval is too big.
|
2486
|
+
'-1128': BadRequest, # Combination of optional parameters invalid.
|
2487
|
+
'-1130': BadRequest, # Invalid data sent for a parameter.
|
2488
|
+
'-1131': BadRequest, # WS recvWindow must be less than 60000
|
2489
|
+
'-1134': BadRequest, # WS strategyType was less than 1000000.
|
2490
|
+
'-1136': BadRequest, # Invalid newOrderRespType.
|
2491
|
+
'-1145': BadRequest, # WS cancelRestrictions has to be either ONLY_NEW or ONLY_PARTIALLY_FILLED.
|
2492
|
+
'-1151': BadRequest, # WS Symbol is present multiple times in the list.
|
2493
|
+
#
|
2494
|
+
# 20xx Processing Issues
|
2495
|
+
#
|
2496
|
+
'-2010': InvalidOrder, # NEW_ORDER_REJECTED
|
2497
|
+
'-2011': OperationRejected, # CANCEL_REJECTED
|
2498
|
+
'-2013': BadRequest, # Order does not exist.
|
2499
|
+
'-2014': OperationRejected, # API-key format invalid.
|
2500
|
+
'-2015': OperationRejected, # Invalid API-key, IP, or permissions for action.
|
2501
|
+
'-2016': OperationFailed, # No trading window could be found for the symbol. Try ticker/24hrs instead.
|
2502
|
+
'-2018': OperationFailed, # Balance is insufficient.
|
2503
|
+
'-2019': OperationFailed, # Margin is insufficient.
|
2504
|
+
'-2020': OrderNotFillable, # Unable to fill.
|
2455
2505
|
'-2021': OrderImmediatelyFillable, # Order would immediately trigger.
|
2456
|
-
'-2022': InvalidOrder, # ReduceOnly Order is rejected
|
2457
|
-
'-2023': OperationFailed, # User in liquidation mode now
|
2458
|
-
'-2024': OperationRejected, # Position is not sufficient
|
2506
|
+
'-2022': InvalidOrder, # ReduceOnly Order is rejected.
|
2507
|
+
'-2023': OperationFailed, # User in liquidation mode now.
|
2508
|
+
'-2024': OperationRejected, # Position is not sufficient.
|
2459
2509
|
'-2025': OperationRejected, # Reach max open order limit.
|
2460
2510
|
'-2026': InvalidOrder, # This OrderType is not supported when reduceOnly.
|
2461
2511
|
'-2027': OperationRejected, # Exceeded the maximum allowable position at current leverage.
|
2462
2512
|
'-2028': OperationRejected, # Leverage is smaller than permitted: insufficient margin balance.
|
2463
2513
|
#
|
2464
|
-
# 4xxx
|
2514
|
+
# 4xxx Filters and other issues
|
2465
2515
|
#
|
2466
|
-
'-
|
2467
|
-
'-
|
2468
|
-
'-
|
2469
|
-
'-
|
2470
|
-
'-
|
2516
|
+
'-4000': BadRequest, # Invalid order status.
|
2517
|
+
'-4001': BadRequest, # Price less than 0.
|
2518
|
+
'-4002': BadRequest, # Price greater than max price.
|
2519
|
+
'-4003': BadRequest, # Quantity less than zero.
|
2520
|
+
'-4004': BadRequest, # Quantity less than min quantity.
|
2521
|
+
'-4005': BadRequest, # Quantity greater than max quantity.
|
2522
|
+
'-4006': BadRequest, # Stop price less than zero.
|
2523
|
+
'-4007': BadRequest, # Stop price greater than max price.
|
2524
|
+
'-4008': BadRequest, # Tick size less than zero.
|
2525
|
+
'-4009': BadRequest, # Max price less than min price.
|
2526
|
+
'-4010': BadRequest, # Max qty less than min qty.
|
2527
|
+
'-4011': BadRequest, # Step size less than zero.
|
2528
|
+
'-4012': BadRequest, # Max mum orders less than zero.
|
2529
|
+
'-4013': BadRequest, # Price less than min price.
|
2530
|
+
'-4014': BadRequest, # Price not increased by tick size.
|
2531
|
+
'-4015': BadRequest, # Client order id is not valid.
|
2532
|
+
'-4016': BadRequest, # Price is higher than mark price multiplier cap.
|
2533
|
+
'-4017': BadRequest, # Multiplier up less than zero.
|
2534
|
+
'-4018': BadRequest, # Multiplier down less than zero.
|
2535
|
+
'-4019': BadRequest, # Composite scale too large.
|
2536
|
+
'-4020': BadRequest, # Target strategy invalid for orderType '%s',reduceOnly '%b'.
|
2537
|
+
'-4021': BadRequest, # Invalid depth limit.
|
2538
|
+
'-4022': BadRequest, # market status sent is not valid.
|
2539
|
+
'-4023': BadRequest, # Qty not increased by step size.
|
2540
|
+
'-4024': BadRequest, # Price is lower than mark price multiplier floor.
|
2541
|
+
'-4025': BadRequest, # Multiplier decimal less than zero.
|
2542
|
+
'-4026': BadRequest, # Commission invalid.
|
2543
|
+
'-4027': BadRequest, # Invalid account type.
|
2544
|
+
'-4028': BadRequest, # Invalid leverage
|
2545
|
+
'-4029': BadRequest, # Tick size precision is invalid.
|
2546
|
+
'-4030': BadRequest, # Step size precision is invalid.
|
2547
|
+
'-4031': BadRequest, # Invalid parameter working type
|
2548
|
+
'-4032': BadRequest, # Exceed maximum cancel order size.
|
2549
|
+
'-4033': BadRequest, # Insurance account not found.
|
2550
|
+
'-4044': BadRequest, # Balance Type is invalid.
|
2551
|
+
'-4045': BadRequest, # Reach max stop order limit.
|
2552
|
+
'-4046': BadRequest, # No need to change margin type.
|
2553
|
+
'-4047': BadRequest, # Margin type cannot be changed if there exists open orders.
|
2554
|
+
'-4048': BadRequest, # Margin type cannot be changed if there exists position.
|
2555
|
+
'-4049': BadRequest, # Add margin only support for isolated position.
|
2556
|
+
'-4050': BadRequest, # Cross balance insufficient.
|
2557
|
+
'-4051': BadRequest, # Isolated balance insufficient.
|
2558
|
+
'-4052': BadRequest, # No need to change auto add margin.
|
2559
|
+
'-4053': BadRequest, # Auto add margin only support for isolated position.
|
2560
|
+
'-4054': BadRequest, # Cannot add position margin: position is 0.
|
2561
|
+
'-4055': BadRequest, # Amount must be positive.
|
2562
|
+
'-4056': PermissionDenied, # Invalid api key type.
|
2563
|
+
'-4057': PermissionDenied, # Invalid api public key
|
2564
|
+
'-4058': BadRequest, # maxPrice and priceDecimal too large,please check.
|
2565
|
+
'-4059': BadRequest, # No need to change position side.
|
2566
|
+
'-4060': BadRequest, # Invalid position side.
|
2567
|
+
'-4061': InvalidOrder, # Order's position side does not match user's setting.
|
2568
|
+
'-4062': BadRequest, # Invalid or improper reduceOnly value.
|
2569
|
+
'-4063': BadRequest, # Invalid options request type
|
2570
|
+
'-4064': BadRequest, # Invalid options time frame
|
2571
|
+
'-4065': BadRequest, # Invalid options amount
|
2572
|
+
'-4066': BadRequest, # Invalid options event type
|
2573
|
+
'-4067': BadRequest, # Position side cannot be changed if there exists open orders.
|
2574
|
+
'-4068': BadRequest, # Position side cannot be changed if there exists position.
|
2575
|
+
'-4069': BadRequest, # Invalid options premium fee
|
2471
2576
|
'-4070': BadRequest, # Client options id is not valid.
|
2472
2577
|
'-4071': BadRequest, # Invalid options direction
|
2473
2578
|
'-4072': OperationRejected, # premium fee is not updated, reject order
|
2474
|
-
'-4073': BadRequest, #
|
2579
|
+
'-4073': BadRequest, # input premium fee is less than 0, reject order
|
2475
2580
|
'-4074': BadRequest, # Order amount is bigger than upper boundary or less than 0, reject order
|
2476
2581
|
'-4075': BadRequest, # output premium fee is less than 0, reject order
|
2477
2582
|
'-4076': OperationRejected, # original fee is too much higher than last fee
|
2478
2583
|
'-4077': OperationRejected, # place order amount has reached to limit, reject order
|
2479
2584
|
'-4078': OperationFailed, # options internal error
|
2480
2585
|
'-4079': BadRequest, # invalid options id
|
2481
|
-
'-4080': PermissionDenied, # user not found
|
2482
|
-
'-4081': BadRequest, #
|
2586
|
+
'-4080': PermissionDenied, # user not found
|
2587
|
+
'-4081': BadRequest, # options not found
|
2588
|
+
'-4082': BadRequest, # Invalid number of batch place orders.
|
2589
|
+
'-4083': BadRequest, # Fail to place batch orders.
|
2590
|
+
'-4084': NotSupported, # Method is not allowed currently. Upcoming soon.
|
2483
2591
|
'-4085': BadRequest, # Invalid notional limit coefficient
|
2484
2592
|
'-4086': BadRequest, # Invalid price spread threshold
|
2485
2593
|
'-4087': PermissionDenied, # User can only place reduce only order
|
2486
2594
|
'-4088': PermissionDenied, # User can not place order currently
|
2487
|
-
'-
|
2488
|
-
'-
|
2489
|
-
'-
|
2595
|
+
'-4104': BadRequest, # Invalid contract type
|
2596
|
+
'-4114': BadRequest, # clientTranId is not valid
|
2597
|
+
'-4115': BadRequest, # clientTranId is duplicated
|
2598
|
+
'-4118': OperationRejected, # ReduceOnly Order Failed. Please check your existing position and open orders
|
2490
2599
|
'-4131': OperationRejected, # The counterparty's best price does not meet the PERCENT_PRICE filter limit
|
2491
|
-
'-
|
2600
|
+
'-4135': BadRequest, # Invalid activation price
|
2601
|
+
'-4137': BadRequest, # Quantity must be zero with closePosition equals True
|
2602
|
+
'-4138': BadRequest, # Reduce only must be True with closePosition equals True
|
2603
|
+
'-4139': BadRequest, # Order type can not be market if it's unable to cancel
|
2604
|
+
'-4140': OrderImmediatelyFillable, # Invalid symbol status for opening position
|
2492
2605
|
'-4141': BadRequest, # Symbol is closed
|
2606
|
+
'-4142': OrderImmediatelyFillable, # REJECT: take profit or stop order will be triggered immediately
|
2493
2607
|
'-4144': BadSymbol, # Invalid pair
|
2494
2608
|
'-4161': OperationRejected, # Leverage reduction is not supported in Isolated Margin Mode with open positions
|
2495
|
-
'-4164':
|
2609
|
+
'-4164': InvalidOrder, # Order's notional must be no smaller than 5.0(unless you choose reduce only)
|
2496
2610
|
'-4165': BadRequest, # Invalid time interval
|
2497
|
-
'-4183':
|
2498
|
-
'-4184':
|
2611
|
+
'-4183': InvalidOrder, # Price is higher than stop price multiplier cap.
|
2612
|
+
'-4184': InvalidOrder, # Price is lower than stop price multiplier floor.
|
2613
|
+
'-4408': InvalidOrder, # This symbol is in reduce only mode due to regulation requirements. Please upgrade to Binance Credits Trading Mode.
|
2499
2614
|
#
|
2500
|
-
# 5xxx
|
2615
|
+
# 5xxx Order Execution Issues
|
2501
2616
|
#
|
2502
2617
|
'-5021': OrderNotFillable, # Due to the order could not be filled immediately, the FOK order has been rejected.
|
2503
2618
|
'-5022': OrderNotFillable, # Due to the order could not be executed, the Post Only order will be rejected.
|
2504
|
-
#
|
2505
|
-
#
|
2506
|
-
#
|
2507
|
-
'-20121': ExchangeError, # override commons
|
2508
|
-
'-20124': ExchangeError, # override commons
|
2509
|
-
'-20130': ExchangeError, # override commons
|
2510
|
-
'-20132': ExchangeError, # override commons
|
2511
|
-
'-20194': ExchangeError, # override commons
|
2512
|
-
'-20195': ExchangeError, # override commons
|
2513
|
-
'-20196': ExchangeError, # override commons
|
2514
|
-
'-20198': ExchangeError, # override commons
|
2515
|
-
'-20204': ExchangeError, # override commons
|
2516
|
-
# 21xxx - PORTFOLIO MARGIN(documented in spot docs)
|
2517
|
-
'-21001': BadRequest, # Request ID is not a Portfolio Margin Account.
|
2518
|
-
'-21002': BadRequest, # Portfolio Margin Account doesn't support transfer from margin to futures.
|
2519
|
-
'-21003': BadResponse, # Fail to retrieve margin assets.
|
2520
|
-
'-21004': OperationRejected, # User doesn’t have portfolio margin bankruptcy loan
|
2521
|
-
'-21005': InsufficientFunds, # User’s spot wallet doesn’t have enough BUSD to repay portfolio margin bankruptcy loan
|
2522
|
-
'-21006': OperationFailed, # User had portfolio margin bankruptcy loan repayment in process
|
2523
|
-
'-21007': OperationFailed, # User failed to repay portfolio margin bankruptcy loan since liquidation was in process
|
2619
|
+
'-5028': OperationFailed, # The requested timestamp is outside the recvWindow of the matching engine
|
2620
|
+
'-5041': RateLimitExceeded, # Time out for too many requests from self account queueing at the same time.
|
2524
2621
|
},
|
2525
2622
|
},
|
2526
2623
|
'exact': {
|
@@ -3548,7 +3645,11 @@ class binance(Exchange, ImplicitAPI):
|
|
3548
3645
|
account['used'] = self.safe_string(entry, 'crossMarginLocked')
|
3549
3646
|
account['total'] = self.safe_string(entry, 'crossMarginAsset')
|
3550
3647
|
else:
|
3551
|
-
|
3648
|
+
usedLinear = self.safe_string(entry, 'umUnrealizedPNL')
|
3649
|
+
usedInverse = self.safe_string(entry, 'cmUnrealizedPNL')
|
3650
|
+
totalUsed = Precise.string_add(usedLinear, usedInverse)
|
3651
|
+
totalWalletBalance = self.safe_string(entry, 'totalWalletBalance')
|
3652
|
+
account['total'] = Precise.string_add(totalUsed, totalWalletBalance)
|
3552
3653
|
result[code] = account
|
3553
3654
|
elif not isolated and ((type == 'spot') or cross):
|
3554
3655
|
timestamp = self.safe_integer(response, 'updateTime')
|
@@ -5158,10 +5259,10 @@ class binance(Exchange, ImplicitAPI):
|
|
5158
5259
|
request: dict = {
|
5159
5260
|
'symbol': market['id'],
|
5160
5261
|
'side': side.upper(),
|
5262
|
+
'orderId': id,
|
5263
|
+
'quantity': self.amount_to_precision(symbol, amount),
|
5161
5264
|
}
|
5162
5265
|
clientOrderId = self.safe_string_n(params, ['newClientOrderId', 'clientOrderId', 'origClientOrderId'])
|
5163
|
-
request['orderId'] = id
|
5164
|
-
request['quantity'] = self.amount_to_precision(symbol, amount)
|
5165
5266
|
if price is not None:
|
5166
5267
|
request['price'] = self.price_to_precision(symbol, price)
|
5167
5268
|
if clientOrderId is not None:
|
@@ -5175,6 +5276,8 @@ class binance(Exchange, ImplicitAPI):
|
|
5175
5276
|
|
5176
5277
|
https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Modify-Order
|
5177
5278
|
https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/Modify-Order
|
5279
|
+
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Modify-UM-Order
|
5280
|
+
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/Modify-CM-Order
|
5178
5281
|
|
5179
5282
|
:param str id: cancel order id
|
5180
5283
|
:param str symbol: unified symbol of the market to create an order in
|
@@ -5183,16 +5286,28 @@ class binance(Exchange, ImplicitAPI):
|
|
5183
5286
|
:param float amount: how much of currency you want to trade in units of base currency
|
5184
5287
|
:param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
5185
5288
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
5289
|
+
:param boolean [params.portfolioMargin]: set to True if you would like to edit an order in a portfolio margin account
|
5186
5290
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
5187
5291
|
"""
|
5188
5292
|
self.load_markets()
|
5189
5293
|
market = self.market(symbol)
|
5294
|
+
isPortfolioMargin = None
|
5295
|
+
isPortfolioMargin, params = self.handle_option_and_params_2(params, 'editContractOrder', 'papi', 'portfolioMargin', False)
|
5296
|
+
if market['linear'] or isPortfolioMargin:
|
5297
|
+
if price is None:
|
5298
|
+
raise ArgumentsRequired(self.id + ' editOrder() requires a price argument for portfolio margin and linear orders')
|
5190
5299
|
request = self.edit_contract_order_request(id, symbol, type, side, amount, price, params)
|
5191
5300
|
response = None
|
5192
5301
|
if market['linear']:
|
5193
|
-
|
5302
|
+
if isPortfolioMargin:
|
5303
|
+
response = self.papiPutUmOrder(self.extend(request, params))
|
5304
|
+
else:
|
5305
|
+
response = self.fapiPrivatePutOrder(self.extend(request, params))
|
5194
5306
|
elif market['inverse']:
|
5195
|
-
|
5307
|
+
if isPortfolioMargin:
|
5308
|
+
response = self.papiPutCmOrder(self.extend(request, params))
|
5309
|
+
else:
|
5310
|
+
response = self.dapiPrivatePutOrder(self.extend(request, params))
|
5196
5311
|
#
|
5197
5312
|
# swap and future
|
5198
5313
|
#
|
@@ -5237,6 +5352,7 @@ class binance(Exchange, ImplicitAPI):
|
|
5237
5352
|
:param float amount: how much of currency you want to trade in units of base currency
|
5238
5353
|
:param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
5239
5354
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
5355
|
+
:param boolean [params.portfolioMargin]: set to True if you would like to edit an order in a portfolio margin account
|
5240
5356
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
5241
5357
|
"""
|
5242
5358
|
self.load_markets()
|
@@ -11151,7 +11267,7 @@ class binance(Exchange, ImplicitAPI):
|
|
11151
11267
|
elif url.startswith('https://eapi.' + hostname + '/'):
|
11152
11268
|
marketType = 'option'
|
11153
11269
|
elif url.startswith('https://papi.' + hostname + '/'):
|
11154
|
-
marketType = '
|
11270
|
+
marketType = 'portfolioMargin'
|
11155
11271
|
if marketType is not None:
|
11156
11272
|
exceptionsForMarketType = self.safe_dict(self.exceptions, marketType, {})
|
11157
11273
|
return self.safe_dict(exceptionsForMarketType, exactOrBroad, {})
|
ccxt/bingx.py
CHANGED
@@ -565,7 +565,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
565
565
|
'mark': True,
|
566
566
|
'index': True,
|
567
567
|
},
|
568
|
-
'
|
568
|
+
'price': True,
|
569
569
|
},
|
570
570
|
'timeInForce': {
|
571
571
|
'IOC': True,
|
@@ -612,7 +612,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
612
612
|
'fetchClosedOrders': {
|
613
613
|
'marginMode': False,
|
614
614
|
'limit': 1000,
|
615
|
-
'
|
615
|
+
'daysBack': None,
|
616
616
|
'daysBackCanceled': None,
|
617
617
|
'untilDays': 7,
|
618
618
|
'trigger': False,
|
@@ -636,7 +636,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
636
636
|
'fetchClosedOrders': {
|
637
637
|
'marginMode': False,
|
638
638
|
'limit': 1000,
|
639
|
-
'
|
639
|
+
'daysBack': None,
|
640
640
|
'daysBackCanceled': None,
|
641
641
|
'untilDays': 7,
|
642
642
|
'trigger': False,
|
@@ -2651,8 +2651,10 @@ class bingx(Exchange, ImplicitAPI):
|
|
2651
2651
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2652
2652
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
2653
2653
|
"""
|
2654
|
-
|
2655
|
-
|
2654
|
+
req = {
|
2655
|
+
'quoteOrderQty': cost,
|
2656
|
+
}
|
2657
|
+
return self.create_order(symbol, 'market', side, cost, None, self.extend(req, params))
|
2656
2658
|
|
2657
2659
|
def create_market_buy_order_with_cost(self, symbol: str, cost: float, params={}):
|
2658
2660
|
"""
|
@@ -2662,8 +2664,10 @@ class bingx(Exchange, ImplicitAPI):
|
|
2662
2664
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2663
2665
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
2664
2666
|
"""
|
2665
|
-
|
2666
|
-
|
2667
|
+
req = {
|
2668
|
+
'quoteOrderQty': cost,
|
2669
|
+
}
|
2670
|
+
return self.create_order(symbol, 'market', 'buy', cost, None, self.extend(req, params))
|
2667
2671
|
|
2668
2672
|
def create_market_sell_order_with_cost(self, symbol: str, cost: float, params={}):
|
2669
2673
|
"""
|
@@ -2673,8 +2677,10 @@ class bingx(Exchange, ImplicitAPI):
|
|
2673
2677
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2674
2678
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
2675
2679
|
"""
|
2676
|
-
|
2677
|
-
|
2680
|
+
req = {
|
2681
|
+
'quoteOrderQty': cost,
|
2682
|
+
}
|
2683
|
+
return self.create_order(symbol, 'market', 'sell', cost, None, self.extend(req, params))
|
2678
2684
|
|
2679
2685
|
def create_order_request(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
|
2680
2686
|
"""
|
ccxt/bitfinex.py
CHANGED
ccxt/bitget.py
CHANGED
@@ -1482,7 +1482,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
1482
1482
|
'mark': False,
|
1483
1483
|
'index': False,
|
1484
1484
|
},
|
1485
|
-
'
|
1485
|
+
'price': True,
|
1486
1486
|
},
|
1487
1487
|
'timeInForce': {
|
1488
1488
|
'IOC': True,
|
@@ -1524,7 +1524,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
1524
1524
|
'fetchClosedOrders': {
|
1525
1525
|
'marginMode': True,
|
1526
1526
|
'limit': 100,
|
1527
|
-
'
|
1527
|
+
'daysBack': None,
|
1528
1528
|
'daysBackCanceled': None,
|
1529
1529
|
'untilDays': 90,
|
1530
1530
|
'trigger': True,
|
@@ -1552,7 +1552,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
1552
1552
|
'mark': True,
|
1553
1553
|
'index': True,
|
1554
1554
|
},
|
1555
|
-
'
|
1555
|
+
'price': False,
|
1556
1556
|
},
|
1557
1557
|
'timeInForce': {
|
1558
1558
|
'IOC': True,
|
ccxt/bitmart.py
CHANGED
@@ -756,7 +756,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
756
756
|
'fetchClosedOrders': {
|
757
757
|
'marginMode': True,
|
758
758
|
'limit': 200,
|
759
|
-
'
|
759
|
+
'daysBack': None,
|
760
760
|
'daysBackCanceled': None,
|
761
761
|
'untilDays': None,
|
762
762
|
'trigger': False,
|
@@ -785,7 +785,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
785
785
|
'mark': True,
|
786
786
|
'index': False,
|
787
787
|
},
|
788
|
-
'
|
788
|
+
'price': False,
|
789
789
|
},
|
790
790
|
'timeInForce': {
|
791
791
|
'IOC': True,
|
@@ -823,7 +823,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
823
823
|
'fetchClosedOrders': {
|
824
824
|
'marginMode': True,
|
825
825
|
'limit': 200,
|
826
|
-
'
|
826
|
+
'daysBack': None,
|
827
827
|
'daysBackCanceled': None,
|
828
828
|
'untilDays': None,
|
829
829
|
'trigger': False,
|
ccxt/bitmex.py
CHANGED
ccxt/blofin.py
CHANGED
@@ -204,6 +204,18 @@ class blofin(Exchange, ImplicitAPI):
|
|
204
204
|
'trade/orders-tpsl-history': 1,
|
205
205
|
'user/query-apikey': 1,
|
206
206
|
'affiliate/basic': 1,
|
207
|
+
'copytrading/instruments': 1,
|
208
|
+
'copytrading/account/balance': 1,
|
209
|
+
'copytrading/account/positions-by-order': 1,
|
210
|
+
'copytrading/account/positions-details-by-order': 1,
|
211
|
+
'copytrading/account/positions-by-contract': 1,
|
212
|
+
'copytrading/account/position-mode': 1,
|
213
|
+
'copytrading/account/leverage-info': 1,
|
214
|
+
'copytrading/trade/orders-pending': 1,
|
215
|
+
'copytrading/trade/pending-tpsl-by-contract': 1,
|
216
|
+
'copytrading/trade/position-history-by-order': 1,
|
217
|
+
'copytrading/trade/orders-history': 1,
|
218
|
+
'copytrading/trade/pending-tpsl-by-order': 1,
|
207
219
|
},
|
208
220
|
'post': {
|
209
221
|
'trade/order': 1,
|
@@ -215,6 +227,16 @@ class blofin(Exchange, ImplicitAPI):
|
|
215
227
|
'trade/cancel-tpsl': 1,
|
216
228
|
'trade/close-position': 1,
|
217
229
|
'asset/transfer': 1,
|
230
|
+
'copytrading/account/set-position-mode': 1,
|
231
|
+
'copytrading/account/set-leverage': 1,
|
232
|
+
'copytrading/trade/place-order': 1,
|
233
|
+
'copytrading/trade/cancel-order': 1,
|
234
|
+
'copytrading/trade/place-tpsl-by-contract': 1,
|
235
|
+
'copytrading/trade/cancel-tpsl-by-contract': 1,
|
236
|
+
'copytrading/trade/place-tpsl-by-order': 1,
|
237
|
+
'copytrading/trade/cancel-tpsl-by-order': 1,
|
238
|
+
'copytrading/trade/close-position-by-order': 1,
|
239
|
+
'copytrading/trade/close-position-by-contract': 1,
|
218
240
|
},
|
219
241
|
},
|
220
242
|
},
|
ccxt/bybit.py
CHANGED
@@ -1115,7 +1115,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
1115
1115
|
'mark': True,
|
1116
1116
|
'index': True,
|
1117
1117
|
},
|
1118
|
-
'
|
1118
|
+
'price': True,
|
1119
1119
|
},
|
1120
1120
|
'timeInForce': {
|
1121
1121
|
'IOC': True,
|
@@ -1155,7 +1155,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
1155
1155
|
'fetchClosedOrders': {
|
1156
1156
|
'marginMode': False,
|
1157
1157
|
'limit': 50,
|
1158
|
-
'
|
1158
|
+
'daysBack': 365 * 2, # 2 years
|
1159
1159
|
'daysBackCanceled': 1,
|
1160
1160
|
'untilDays': 7,
|
1161
1161
|
'trigger': True,
|
@@ -1172,7 +1172,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
1172
1172
|
'triggerDirection': False,
|
1173
1173
|
'attachedStopLossTakeProfit': {
|
1174
1174
|
'triggerPriceType': None,
|
1175
|
-
'
|
1175
|
+
'price': True,
|
1176
1176
|
},
|
1177
1177
|
'marketBuyRequiresPrice': True,
|
1178
1178
|
},
|
@@ -1253,7 +1253,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
1253
1253
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1254
1254
|
:returns any: [enableUnifiedMargin, enableUnifiedAccount]
|
1255
1255
|
"""
|
1256
|
-
# The API key of user id must own one of permissions will be allowed to call following API endpoints
|
1256
|
+
# The API key of user id must own one of permissions will be allowed to call following API endpoints:
|
1257
1257
|
# SUB UID: "Account Transfer"
|
1258
1258
|
# MASTER UID: "Account Transfer", "Subaccount Transfer", "Withdrawal"
|
1259
1259
|
enableUnifiedMargin = self.safe_bool(self.options, 'enableUnifiedMargin')
|
ccxt/coinbase.py
CHANGED
ccxt/coinex.py
CHANGED
ccxt/cryptocom.py
CHANGED