ccxt 4.4.43__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/binance.py +1 -0
- ccxt/abstract/binancecoinm.py +1 -0
- ccxt/abstract/binanceus.py +1 -0
- ccxt/abstract/binanceusdm.py +1 -0
- 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 +235 -107
- ccxt/async_support/bingx.py +20 -9
- ccxt/async_support/bitfinex.py +7 -3
- ccxt/async_support/bitget.py +6 -4
- ccxt/async_support/bitmart.py +7 -10
- ccxt/async_support/bitmex.py +4 -6
- ccxt/async_support/bitstamp.py +5 -0
- ccxt/async_support/blofin.py +22 -0
- ccxt/async_support/bybit.py +12 -27
- ccxt/async_support/coinbase.py +14 -10
- ccxt/async_support/coinbaseinternational.py +13 -9
- ccxt/async_support/coincatch.py +2 -2
- ccxt/async_support/coinex.py +6 -6
- ccxt/async_support/cryptocom.py +5 -3
- ccxt/async_support/defx.py +2 -2
- ccxt/async_support/delta.py +1 -1
- ccxt/async_support/exmo.py +16 -8
- ccxt/async_support/gate.py +10 -5
- ccxt/async_support/gemini.py +5 -0
- ccxt/async_support/hashkey.py +15 -10
- ccxt/async_support/htx.py +103 -5
- ccxt/async_support/hyperliquid.py +6 -1
- ccxt/async_support/kraken.py +10 -3
- ccxt/async_support/krakenfutures.py +6 -1
- ccxt/async_support/kucoin.py +10 -8
- ccxt/async_support/kucoinfutures.py +7 -8
- ccxt/async_support/lykke.py +1 -1
- ccxt/async_support/mexc.py +20 -14
- ccxt/async_support/myokx.py +8 -0
- ccxt/async_support/ndax.py +1 -1
- ccxt/async_support/oceanex.py +1 -1
- ccxt/async_support/okx.py +9 -10
- ccxt/async_support/onetrading.py +2 -1
- ccxt/async_support/whitebit.py +35 -10
- ccxt/async_support/woo.py +6 -4
- ccxt/async_support/woofipro.py +7 -4
- ccxt/base/exchange.py +1 -1
- ccxt/binance.py +235 -107
- ccxt/bingx.py +20 -9
- ccxt/bitfinex.py +7 -3
- ccxt/bitget.py +6 -4
- ccxt/bitmart.py +7 -10
- ccxt/bitmex.py +4 -6
- ccxt/bitstamp.py +5 -0
- ccxt/blofin.py +22 -0
- ccxt/bybit.py +12 -27
- ccxt/coinbase.py +14 -10
- ccxt/coinbaseinternational.py +13 -9
- ccxt/coincatch.py +2 -2
- ccxt/coinex.py +6 -6
- ccxt/cryptocom.py +5 -3
- ccxt/defx.py +2 -2
- ccxt/delta.py +1 -1
- ccxt/exmo.py +16 -8
- ccxt/gate.py +10 -5
- ccxt/gemini.py +5 -0
- ccxt/hashkey.py +15 -10
- ccxt/htx.py +103 -5
- ccxt/hyperliquid.py +6 -1
- ccxt/kraken.py +10 -3
- ccxt/krakenfutures.py +6 -1
- ccxt/kucoin.py +10 -8
- ccxt/kucoinfutures.py +7 -8
- ccxt/lykke.py +1 -1
- ccxt/mexc.py +20 -14
- ccxt/myokx.py +8 -0
- ccxt/ndax.py +1 -1
- ccxt/oceanex.py +1 -1
- ccxt/okx.py +9 -10
- ccxt/onetrading.py +2 -1
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/binance.py +2 -1
- ccxt/pro/bitcoincom.py +4 -1
- ccxt/pro/bitopro.py +1 -1
- ccxt/pro/myokx.py +5 -0
- ccxt/whitebit.py +35 -10
- ccxt/woo.py +6 -4
- ccxt/woofipro.py +7 -4
- {ccxt-4.4.43.dist-info → ccxt-4.4.45.dist-info}/METADATA +4 -4
- {ccxt-4.4.43.dist-info → ccxt-4.4.45.dist-info}/RECORD +91 -91
- {ccxt-4.4.43.dist-info → ccxt-4.4.45.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.4.43.dist-info → ccxt-4.4.45.dist-info}/WHEEL +0 -0
- {ccxt-4.4.43.dist-info → ccxt-4.4.45.dist-info}/top_level.txt +0 -0
ccxt/binance.py
CHANGED
@@ -248,6 +248,7 @@ class binance(Exchange, ImplicitAPI):
|
|
248
248
|
'private': 'https://api.binance.com/api/v3',
|
249
249
|
'v1': 'https://api.binance.com/api/v1',
|
250
250
|
'papi': 'https://papi.binance.com/papi/v1',
|
251
|
+
'papiV2': 'https://papi.binance.com/papi/v2',
|
251
252
|
},
|
252
253
|
'www': 'https://www.binance.com',
|
253
254
|
'referral': {
|
@@ -1190,6 +1191,11 @@ class binance(Exchange, ImplicitAPI):
|
|
1190
1191
|
'listenKey': 0.2,
|
1191
1192
|
},
|
1192
1193
|
},
|
1194
|
+
'papiV2': {
|
1195
|
+
'get': {
|
1196
|
+
'um/account': 1,
|
1197
|
+
},
|
1198
|
+
},
|
1193
1199
|
},
|
1194
1200
|
'fees': {
|
1195
1201
|
'trading': {
|
@@ -1582,7 +1588,6 @@ class binance(Exchange, ImplicitAPI):
|
|
1582
1588
|
},
|
1583
1589
|
},
|
1584
1590
|
'features': {
|
1585
|
-
# https://developers.binance.com/docs/binance-spot-api-docs/rest-api#:~:text=quoteOrderQty
|
1586
1591
|
'spot': {
|
1587
1592
|
'sandbox': True,
|
1588
1593
|
'createOrder': {
|
@@ -1600,12 +1605,13 @@ class binance(Exchange, ImplicitAPI):
|
|
1600
1605
|
'GTD': False,
|
1601
1606
|
},
|
1602
1607
|
'hedged': True,
|
1608
|
+
'leverage': False,
|
1609
|
+
'marketBuyRequiresPrice': False,
|
1610
|
+
'marketBuyByCost': True,
|
1603
1611
|
# exchange-supported features
|
1604
|
-
'selfTradePrevention': True,
|
1612
|
+
'selfTradePrevention': True, # todo
|
1605
1613
|
'trailing': True,
|
1606
|
-
'
|
1607
|
-
'iceberg': True,
|
1608
|
-
'oco': False,
|
1614
|
+
'iceberg': True, # todo implementation
|
1609
1615
|
},
|
1610
1616
|
'createOrders': None,
|
1611
1617
|
'fetchMyTrades': {
|
@@ -1636,7 +1642,7 @@ class binance(Exchange, ImplicitAPI):
|
|
1636
1642
|
'fetchClosedOrders': {
|
1637
1643
|
'marginMode': True,
|
1638
1644
|
'limit': 1000,
|
1639
|
-
'
|
1645
|
+
'daysBack': None,
|
1640
1646
|
'daysBackCanceled': None,
|
1641
1647
|
'untilDays': 10000,
|
1642
1648
|
'trigger': False,
|
@@ -1668,11 +1674,12 @@ class binance(Exchange, ImplicitAPI):
|
|
1668
1674
|
},
|
1669
1675
|
'hedged': True,
|
1670
1676
|
# exchange-supported features
|
1671
|
-
'selfTradePrevention': True,
|
1677
|
+
'selfTradePrevention': True, # todo
|
1672
1678
|
'trailing': True,
|
1673
|
-
'twap': False,
|
1674
1679
|
'iceberg': False,
|
1675
|
-
'
|
1680
|
+
'leverage': False,
|
1681
|
+
'marketBuyRequiresPrice': False,
|
1682
|
+
'marketBuyByCost': True,
|
1676
1683
|
},
|
1677
1684
|
'createOrders': {
|
1678
1685
|
'max': 5,
|
@@ -1705,7 +1712,7 @@ class binance(Exchange, ImplicitAPI):
|
|
1705
1712
|
'fetchClosedOrders': {
|
1706
1713
|
'marginMode': True,
|
1707
1714
|
'limit': 1000,
|
1708
|
-
'
|
1715
|
+
'daysBack': 90,
|
1709
1716
|
'daysBackCanceled': 3,
|
1710
1717
|
'untilDays': 7,
|
1711
1718
|
'trigger': False,
|
@@ -2428,92 +2435,189 @@ class binance(Exchange, ImplicitAPI):
|
|
2428
2435
|
'portfolioMargin': {
|
2429
2436
|
'exact': {
|
2430
2437
|
#
|
2431
|
-
#
|
2438
|
+
# 10xx General Server or Network Issues
|
2432
2439
|
#
|
2433
|
-
'-
|
2434
|
-
'-
|
2435
|
-
'-
|
2436
|
-
'-
|
2437
|
-
'-
|
2438
|
-
'-
|
2439
|
-
'-
|
2440
|
-
'-
|
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
|
2441
2460
|
#
|
2442
|
-
#
|
2461
|
+
# 11xx Request Issues
|
2443
2462
|
#
|
2444
|
-
'-
|
2445
|
-
'-
|
2446
|
-
'-
|
2447
|
-
'-
|
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.
|
2448
2505
|
'-2021': OrderImmediatelyFillable, # Order would immediately trigger.
|
2449
|
-
'-2022': InvalidOrder, # ReduceOnly Order is rejected
|
2450
|
-
'-2023': OperationFailed, # User in liquidation mode now
|
2451
|
-
'-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.
|
2452
2509
|
'-2025': OperationRejected, # Reach max open order limit.
|
2453
2510
|
'-2026': InvalidOrder, # This OrderType is not supported when reduceOnly.
|
2454
2511
|
'-2027': OperationRejected, # Exceeded the maximum allowable position at current leverage.
|
2455
2512
|
'-2028': OperationRejected, # Leverage is smaller than permitted: insufficient margin balance.
|
2456
2513
|
#
|
2457
|
-
# 4xxx
|
2514
|
+
# 4xxx Filters and other issues
|
2458
2515
|
#
|
2459
|
-
'-
|
2460
|
-
'-
|
2461
|
-
'-
|
2462
|
-
'-
|
2463
|
-
'-
|
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
|
2464
2576
|
'-4070': BadRequest, # Client options id is not valid.
|
2465
2577
|
'-4071': BadRequest, # Invalid options direction
|
2466
2578
|
'-4072': OperationRejected, # premium fee is not updated, reject order
|
2467
|
-
'-4073': BadRequest, #
|
2579
|
+
'-4073': BadRequest, # input premium fee is less than 0, reject order
|
2468
2580
|
'-4074': BadRequest, # Order amount is bigger than upper boundary or less than 0, reject order
|
2469
2581
|
'-4075': BadRequest, # output premium fee is less than 0, reject order
|
2470
2582
|
'-4076': OperationRejected, # original fee is too much higher than last fee
|
2471
2583
|
'-4077': OperationRejected, # place order amount has reached to limit, reject order
|
2472
2584
|
'-4078': OperationFailed, # options internal error
|
2473
2585
|
'-4079': BadRequest, # invalid options id
|
2474
|
-
'-4080': PermissionDenied, # user not found
|
2475
|
-
'-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.
|
2476
2591
|
'-4085': BadRequest, # Invalid notional limit coefficient
|
2477
2592
|
'-4086': BadRequest, # Invalid price spread threshold
|
2478
2593
|
'-4087': PermissionDenied, # User can only place reduce only order
|
2479
2594
|
'-4088': PermissionDenied, # User can not place order currently
|
2480
|
-
'-
|
2481
|
-
'-
|
2482
|
-
'-
|
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
|
2483
2599
|
'-4131': OperationRejected, # The counterparty's best price does not meet the PERCENT_PRICE filter limit
|
2484
|
-
'-
|
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
|
2485
2605
|
'-4141': BadRequest, # Symbol is closed
|
2606
|
+
'-4142': OrderImmediatelyFillable, # REJECT: take profit or stop order will be triggered immediately
|
2486
2607
|
'-4144': BadSymbol, # Invalid pair
|
2487
2608
|
'-4161': OperationRejected, # Leverage reduction is not supported in Isolated Margin Mode with open positions
|
2488
|
-
'-4164':
|
2609
|
+
'-4164': InvalidOrder, # Order's notional must be no smaller than 5.0(unless you choose reduce only)
|
2489
2610
|
'-4165': BadRequest, # Invalid time interval
|
2490
|
-
'-4183':
|
2491
|
-
'-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.
|
2492
2614
|
#
|
2493
|
-
# 5xxx
|
2615
|
+
# 5xxx Order Execution Issues
|
2494
2616
|
#
|
2495
2617
|
'-5021': OrderNotFillable, # Due to the order could not be filled immediately, the FOK order has been rejected.
|
2496
2618
|
'-5022': OrderNotFillable, # Due to the order could not be executed, the Post Only order will be rejected.
|
2497
|
-
#
|
2498
|
-
#
|
2499
|
-
#
|
2500
|
-
'-20121': ExchangeError, # override commons
|
2501
|
-
'-20124': ExchangeError, # override commons
|
2502
|
-
'-20130': ExchangeError, # override commons
|
2503
|
-
'-20132': ExchangeError, # override commons
|
2504
|
-
'-20194': ExchangeError, # override commons
|
2505
|
-
'-20195': ExchangeError, # override commons
|
2506
|
-
'-20196': ExchangeError, # override commons
|
2507
|
-
'-20198': ExchangeError, # override commons
|
2508
|
-
'-20204': ExchangeError, # override commons
|
2509
|
-
# 21xxx - PORTFOLIO MARGIN(documented in spot docs)
|
2510
|
-
'-21001': BadRequest, # Request ID is not a Portfolio Margin Account.
|
2511
|
-
'-21002': BadRequest, # Portfolio Margin Account doesn't support transfer from margin to futures.
|
2512
|
-
'-21003': BadResponse, # Fail to retrieve margin assets.
|
2513
|
-
'-21004': OperationRejected, # User doesn’t have portfolio margin bankruptcy loan
|
2514
|
-
'-21005': InsufficientFunds, # User’s spot wallet doesn’t have enough BUSD to repay portfolio margin bankruptcy loan
|
2515
|
-
'-21006': OperationFailed, # User had portfolio margin bankruptcy loan repayment in process
|
2516
|
-
'-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.
|
2517
2621
|
},
|
2518
2622
|
},
|
2519
2623
|
'exact': {
|
@@ -2825,7 +2929,7 @@ class binance(Exchange, ImplicitAPI):
|
|
2825
2929
|
"""
|
2826
2930
|
fetches the current integer timestamp in milliseconds from the exchange server
|
2827
2931
|
|
2828
|
-
https://developers.binance.com/docs/binance-spot-api-docs/rest-api#check-server-time # spot
|
2932
|
+
https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#check-server-time # spot
|
2829
2933
|
https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Check-Server-Time # swap
|
2830
2934
|
https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/Check-Server-time # future
|
2831
2935
|
|
@@ -3061,7 +3165,7 @@ class binance(Exchange, ImplicitAPI):
|
|
3061
3165
|
"""
|
3062
3166
|
retrieves data on all markets for binance
|
3063
3167
|
|
3064
|
-
https://developers.binance.com/docs/binance-spot-api-docs/rest-api#exchange-information # spot
|
3168
|
+
https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#exchange-information # spot
|
3065
3169
|
https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Exchange-Information # swap
|
3066
3170
|
https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/Exchange-Information # future
|
3067
3171
|
https://developers.binance.com/docs/derivatives/option/market-data/Exchange-Information # option
|
@@ -3541,7 +3645,11 @@ class binance(Exchange, ImplicitAPI):
|
|
3541
3645
|
account['used'] = self.safe_string(entry, 'crossMarginLocked')
|
3542
3646
|
account['total'] = self.safe_string(entry, 'crossMarginAsset')
|
3543
3647
|
else:
|
3544
|
-
|
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)
|
3545
3653
|
result[code] = account
|
3546
3654
|
elif not isolated and ((type == 'spot') or cross):
|
3547
3655
|
timestamp = self.safe_integer(response, 'updateTime')
|
@@ -3616,7 +3724,7 @@ class binance(Exchange, ImplicitAPI):
|
|
3616
3724
|
"""
|
3617
3725
|
query for balance and get the amount of funds available for trading or funds locked in orders
|
3618
3726
|
|
3619
|
-
https://developers.binance.com/docs/binance-spot-api-docs/rest-api#account-information-user_data # spot
|
3727
|
+
https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#account-information-user_data # spot
|
3620
3728
|
https://developers.binance.com/docs/margin_trading/account/Query-Cross-Margin-Account-Details # cross margin
|
3621
3729
|
https://developers.binance.com/docs/margin_trading/account/Query-Isolated-Margin-Account-Info # isolated margin
|
3622
3730
|
https://developers.binance.com/docs/wallet/asset/funding-wallet # funding
|
@@ -3874,7 +3982,7 @@ class binance(Exchange, ImplicitAPI):
|
|
3874
3982
|
"""
|
3875
3983
|
fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
|
3876
3984
|
|
3877
|
-
https://developers.binance.com/docs/binance-spot-api-docs/rest-api#order-book # spot
|
3985
|
+
https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#order-book # spot
|
3878
3986
|
https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Order-Book # swap
|
3879
3987
|
https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/Order-Book # future
|
3880
3988
|
https://developers.binance.com/docs/derivatives/option/market-data/Order-Book # option
|
@@ -4131,8 +4239,8 @@ class binance(Exchange, ImplicitAPI):
|
|
4131
4239
|
"""
|
4132
4240
|
fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
4133
4241
|
|
4134
|
-
https://developers.binance.com/docs/binance-spot-api-docs/rest-api#24hr-ticker-price-change-statistics # spot
|
4135
|
-
https://developers.binance.com/docs/binance-spot-api-docs/rest-api#rolling-window-price-change-statistics # spot
|
4242
|
+
https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#24hr-ticker-price-change-statistics # spot
|
4243
|
+
https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#rolling-window-price-change-statistics # spot
|
4136
4244
|
https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/24hr-Ticker-Price-Change-Statistics # swap
|
4137
4245
|
https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/24hr-Ticker-Price-Change-Statistics # future
|
4138
4246
|
https://developers.binance.com/docs/derivatives/option/market-data/24hr-Ticker-Price-Change-Statistics # option
|
@@ -4170,7 +4278,7 @@ class binance(Exchange, ImplicitAPI):
|
|
4170
4278
|
"""
|
4171
4279
|
fetches the bid and ask price and volume for multiple markets
|
4172
4280
|
|
4173
|
-
https://developers.binance.com/docs/binance-spot-api-docs/rest-api#symbol-order-book-ticker # spot
|
4281
|
+
https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#symbol-order-book-ticker # spot
|
4174
4282
|
https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Symbol-Order-Book-Ticker # swap
|
4175
4283
|
https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/Symbol-Order-Book-Ticker # future
|
4176
4284
|
|
@@ -4204,7 +4312,7 @@ class binance(Exchange, ImplicitAPI):
|
|
4204
4312
|
"""
|
4205
4313
|
fetches the last price for multiple markets
|
4206
4314
|
|
4207
|
-
https://developers.binance.com/docs/binance-spot-api-docs/rest-api#symbol-price-ticker # spot
|
4315
|
+
https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#symbol-price-ticker # spot
|
4208
4316
|
https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Symbol-Price-Ticker # swap
|
4209
4317
|
https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/Symbol-Price-Ticker # future
|
4210
4318
|
|
@@ -4305,7 +4413,7 @@ class binance(Exchange, ImplicitAPI):
|
|
4305
4413
|
"""
|
4306
4414
|
fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
4307
4415
|
|
4308
|
-
https://developers.binance.com/docs/binance-spot-api-docs/rest-api#24hr-ticker-price-change-statistics # spot
|
4416
|
+
https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#24hr-ticker-price-change-statistics # spot
|
4309
4417
|
https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/24hr-Ticker-Price-Change-Statistics # swap
|
4310
4418
|
https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/24hr-Ticker-Price-Change-Statistics # future
|
4311
4419
|
https://developers.binance.com/docs/derivatives/option/market-data/24hr-Ticker-Price-Change-Statistics # option
|
@@ -4466,7 +4574,7 @@ class binance(Exchange, ImplicitAPI):
|
|
4466
4574
|
"""
|
4467
4575
|
fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
4468
4576
|
|
4469
|
-
https://developers.binance.com/docs/binance-spot-api-docs/rest-api#klinecandlestick-data
|
4577
|
+
https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#klinecandlestick-data
|
4470
4578
|
https://developers.binance.com/docs/derivatives/option/market-data/Kline-Candlestick-Data
|
4471
4579
|
https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Kline-Candlestick-Data
|
4472
4580
|
https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Index-Price-Kline-Candlestick-Data
|
@@ -4842,17 +4950,17 @@ class binance(Exchange, ImplicitAPI):
|
|
4842
4950
|
get the list of most recent trades for a particular symbol
|
4843
4951
|
Default fetchTradesMethod
|
4844
4952
|
|
4845
|
-
https://developers.binance.com/docs/binance-spot-api-docs/rest-api#compressedaggregate-trades-list # publicGetAggTrades(spot)
|
4953
|
+
https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#compressedaggregate-trades-list # publicGetAggTrades(spot)
|
4846
4954
|
https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Compressed-Aggregate-Trades-List # fapiPublicGetAggTrades(swap)
|
4847
4955
|
https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/Compressed-Aggregate-Trades-List # dapiPublicGetAggTrades(future)
|
4848
4956
|
https://developers.binance.com/docs/derivatives/option/market-data/Recent-Trades-List # eapiPublicGetTrades(option)
|
4849
4957
|
|
4850
4958
|
Other fetchTradesMethod
|
4851
4959
|
|
4852
|
-
https://developers.binance.com/docs/binance-spot-api-docs/rest-api#recent-trades-list # publicGetTrades(spot)
|
4960
|
+
https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#recent-trades-list # publicGetTrades(spot)
|
4853
4961
|
https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Recent-Trades-List # fapiPublicGetTrades(swap)
|
4854
4962
|
https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/Recent-Trades-List # dapiPublicGetTrades(future)
|
4855
|
-
https://developers.binance.com/docs/binance-spot-api-docs/rest-api#old-trade-lookup # publicGetHistoricalTrades(spot)
|
4963
|
+
https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#old-trade-lookup # publicGetHistoricalTrades(spot)
|
4856
4964
|
https://developers.binance.com/docs/derivatives/usds-margined-futures/market-data/rest-api/Old-Trades-Lookup # fapiPublicGetHistoricalTrades(swap)
|
4857
4965
|
https://developers.binance.com/docs/derivatives/coin-margined-futures/market-data/Old-Trades-Lookup # dapiPublicGetHistoricalTrades(future)
|
4858
4966
|
https://developers.binance.com/docs/derivatives/option/market-data/Old-Trades-Lookup # eapiPublicGetHistoricalTrades(option)
|
@@ -4979,7 +5087,7 @@ class binance(Exchange, ImplicitAPI):
|
|
4979
5087
|
@ignore
|
4980
5088
|
edit a trade order
|
4981
5089
|
|
4982
|
-
https://developers.binance.com/docs/binance-spot-api-docs/rest-api#cancel-an-existing-order-and-send-a-new-order-trade
|
5090
|
+
https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#cancel-an-existing-order-and-send-a-new-order-trade
|
4983
5091
|
|
4984
5092
|
:param str id: cancel order id
|
4985
5093
|
:param str symbol: unified symbol of the market to create an order in
|
@@ -5151,10 +5259,10 @@ class binance(Exchange, ImplicitAPI):
|
|
5151
5259
|
request: dict = {
|
5152
5260
|
'symbol': market['id'],
|
5153
5261
|
'side': side.upper(),
|
5262
|
+
'orderId': id,
|
5263
|
+
'quantity': self.amount_to_precision(symbol, amount),
|
5154
5264
|
}
|
5155
5265
|
clientOrderId = self.safe_string_n(params, ['newClientOrderId', 'clientOrderId', 'origClientOrderId'])
|
5156
|
-
request['orderId'] = id
|
5157
|
-
request['quantity'] = self.amount_to_precision(symbol, amount)
|
5158
5266
|
if price is not None:
|
5159
5267
|
request['price'] = self.price_to_precision(symbol, price)
|
5160
5268
|
if clientOrderId is not None:
|
@@ -5168,6 +5276,8 @@ class binance(Exchange, ImplicitAPI):
|
|
5168
5276
|
|
5169
5277
|
https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Modify-Order
|
5170
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
|
5171
5281
|
|
5172
5282
|
:param str id: cancel order id
|
5173
5283
|
:param str symbol: unified symbol of the market to create an order in
|
@@ -5176,16 +5286,28 @@ class binance(Exchange, ImplicitAPI):
|
|
5176
5286
|
:param float amount: how much of currency you want to trade in units of base currency
|
5177
5287
|
:param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
5178
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
|
5179
5290
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
5180
5291
|
"""
|
5181
5292
|
self.load_markets()
|
5182
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')
|
5183
5299
|
request = self.edit_contract_order_request(id, symbol, type, side, amount, price, params)
|
5184
5300
|
response = None
|
5185
5301
|
if market['linear']:
|
5186
|
-
|
5302
|
+
if isPortfolioMargin:
|
5303
|
+
response = self.papiPutUmOrder(self.extend(request, params))
|
5304
|
+
else:
|
5305
|
+
response = self.fapiPrivatePutOrder(self.extend(request, params))
|
5187
5306
|
elif market['inverse']:
|
5188
|
-
|
5307
|
+
if isPortfolioMargin:
|
5308
|
+
response = self.papiPutCmOrder(self.extend(request, params))
|
5309
|
+
else:
|
5310
|
+
response = self.dapiPrivatePutOrder(self.extend(request, params))
|
5189
5311
|
#
|
5190
5312
|
# swap and future
|
5191
5313
|
#
|
@@ -5219,7 +5341,7 @@ class binance(Exchange, ImplicitAPI):
|
|
5219
5341
|
"""
|
5220
5342
|
edit a trade order
|
5221
5343
|
|
5222
|
-
https://developers.binance.com/docs/binance-spot-api-docs/rest-api#cancel-an-existing-order-and-send-a-new-order-trade
|
5344
|
+
https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#cancel-an-existing-order-and-send-a-new-order-trade
|
5223
5345
|
https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Modify-Order
|
5224
5346
|
https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/Modify-Order
|
5225
5347
|
|
@@ -5230,6 +5352,7 @@ class binance(Exchange, ImplicitAPI):
|
|
5230
5352
|
:param float amount: how much of currency you want to trade in units of base currency
|
5231
5353
|
:param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
5232
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
|
5233
5356
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
5234
5357
|
"""
|
5235
5358
|
self.load_markets()
|
@@ -5894,13 +6017,13 @@ class binance(Exchange, ImplicitAPI):
|
|
5894
6017
|
"""
|
5895
6018
|
create a trade order
|
5896
6019
|
|
5897
|
-
https://developers.binance.com/docs/binance-spot-api-docs/rest-api#new-order-trade
|
5898
|
-
https://developers.binance.com/docs/binance-spot-api-docs/rest-api#test-new-order-trade
|
6020
|
+
https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#new-order-trade
|
6021
|
+
https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#test-new-order-trade
|
5899
6022
|
https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/New-Order
|
5900
6023
|
https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/New-Order
|
5901
6024
|
https://developers.binance.com/docs/derivatives/option/trade/New-Order
|
5902
|
-
https://developers.binance.com/docs/binance-spot-api-docs/rest-api#sor
|
5903
|
-
https://developers.binance.com/docs/binance-spot-api-docs/rest-api#test-new-order-using-sor-trade
|
6025
|
+
https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#sor
|
6026
|
+
https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#test-new-order-using-sor-trade
|
5904
6027
|
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/New-UM-Order
|
5905
6028
|
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/New-CM-Order
|
5906
6029
|
https://developers.binance.com/docs/derivatives/portfolio-margin/trade/New-Margin-Order
|
@@ -5926,6 +6049,7 @@ class binance(Exchange, ImplicitAPI):
|
|
5926
6049
|
:param str [params.stopLossOrTakeProfit]: 'stopLoss' or 'takeProfit', required for spot trailing orders
|
5927
6050
|
:param str [params.positionSide]: *swap and portfolio margin only* "BOTH" for one-way mode, "LONG" for buy side of hedged mode, "SHORT" for sell side of hedged mode
|
5928
6051
|
:param bool [params.hedged]: *swap and portfolio margin only* True for hedged mode, False for one way mode, default is False
|
6052
|
+
:param float [params.cost]: *spot market buy only* the quote quantity that can be used alternative for the amount
|
5929
6053
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
5930
6054
|
"""
|
5931
6055
|
self.load_markets()
|
@@ -6234,7 +6358,7 @@ class binance(Exchange, ImplicitAPI):
|
|
6234
6358
|
"""
|
6235
6359
|
create a market order by providing the symbol, side and cost
|
6236
6360
|
|
6237
|
-
https://developers.binance.com/docs/binance-spot-api-docs/rest-api#new-order-trade
|
6361
|
+
https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#new-order-trade
|
6238
6362
|
|
6239
6363
|
:param str symbol: unified symbol of the market to create an order in
|
6240
6364
|
:param str side: 'buy' or 'sell'
|
@@ -6246,14 +6370,16 @@ class binance(Exchange, ImplicitAPI):
|
|
6246
6370
|
market = self.market(symbol)
|
6247
6371
|
if not market['spot']:
|
6248
6372
|
raise NotSupported(self.id + ' createMarketOrderWithCost() supports spot orders only')
|
6249
|
-
|
6250
|
-
|
6373
|
+
req = {
|
6374
|
+
'cost': cost,
|
6375
|
+
}
|
6376
|
+
return self.create_order(symbol, 'market', side, 0, None, self.extend(req, params))
|
6251
6377
|
|
6252
6378
|
def create_market_buy_order_with_cost(self, symbol: str, cost: float, params={}):
|
6253
6379
|
"""
|
6254
6380
|
create a market buy order by providing the symbol and cost
|
6255
6381
|
|
6256
|
-
https://developers.binance.com/docs/binance-spot-api-docs/rest-api#new-order-trade
|
6382
|
+
https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#new-order-trade
|
6257
6383
|
|
6258
6384
|
:param str symbol: unified symbol of the market to create an order in
|
6259
6385
|
:param float cost: how much you want to trade in units of the quote currency
|
@@ -6264,14 +6390,16 @@ class binance(Exchange, ImplicitAPI):
|
|
6264
6390
|
market = self.market(symbol)
|
6265
6391
|
if not market['spot']:
|
6266
6392
|
raise NotSupported(self.id + ' createMarketBuyOrderWithCost() supports spot orders only')
|
6267
|
-
|
6268
|
-
|
6393
|
+
req = {
|
6394
|
+
'cost': cost,
|
6395
|
+
}
|
6396
|
+
return self.create_order(symbol, 'market', 'buy', 0, None, self.extend(req, params))
|
6269
6397
|
|
6270
6398
|
def create_market_sell_order_with_cost(self, symbol: str, cost: float, params={}):
|
6271
6399
|
"""
|
6272
6400
|
create a market sell order by providing the symbol and cost
|
6273
6401
|
|
6274
|
-
https://developers.binance.com/docs/binance-spot-api-docs/rest-api#new-order-trade
|
6402
|
+
https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#new-order-trade
|
6275
6403
|
|
6276
6404
|
:param str symbol: unified symbol of the market to create an order in
|
6277
6405
|
:param float cost: how much you want to trade in units of the quote currency
|
@@ -6289,7 +6417,7 @@ class binance(Exchange, ImplicitAPI):
|
|
6289
6417
|
"""
|
6290
6418
|
fetches information on an order made by the user
|
6291
6419
|
|
6292
|
-
https://developers.binance.com/docs/binance-spot-api-docs/rest-api#query-order-user_data
|
6420
|
+
https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#query-order-user_data
|
6293
6421
|
https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Query-Order
|
6294
6422
|
https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/Query-Order
|
6295
6423
|
https://developers.binance.com/docs/derivatives/option/trade/Query-Single-Order
|
@@ -6354,7 +6482,7 @@ class binance(Exchange, ImplicitAPI):
|
|
6354
6482
|
"""
|
6355
6483
|
fetches information on multiple orders made by the user
|
6356
6484
|
|
6357
|
-
https://developers.binance.com/docs/binance-spot-api-docs/rest-api#all-orders-user_data
|
6485
|
+
https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#all-orders-user_data
|
6358
6486
|
https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/All-Orders
|
6359
6487
|
https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/All-Orders
|
6360
6488
|
https://developers.binance.com/docs/derivatives/option/trade/Query-Option-Order-History
|
@@ -6613,7 +6741,7 @@ class binance(Exchange, ImplicitAPI):
|
|
6613
6741
|
"""
|
6614
6742
|
fetch all unfilled currently open orders
|
6615
6743
|
|
6616
|
-
https://developers.binance.com/docs/binance-spot-api-docs/rest-api#current-open-orders-user_data
|
6744
|
+
https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#current-open-orders-user_data
|
6617
6745
|
https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Current-All-Open-Orders
|
6618
6746
|
https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/Current-All-Open-Orders
|
6619
6747
|
https://developers.binance.com/docs/derivatives/option/trade/Query-Current-Open-Option-Orders
|
@@ -6899,7 +7027,7 @@ class binance(Exchange, ImplicitAPI):
|
|
6899
7027
|
"""
|
6900
7028
|
fetches information on multiple closed orders made by the user
|
6901
7029
|
|
6902
|
-
https://developers.binance.com/docs/binance-spot-api-docs/rest-api#all-orders-user_data
|
7030
|
+
https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#all-orders-user_data
|
6903
7031
|
https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/All-Orders
|
6904
7032
|
https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/All-Orders
|
6905
7033
|
https://developers.binance.com/docs/derivatives/option/trade/Query-Option-Order-History
|
@@ -6928,7 +7056,7 @@ class binance(Exchange, ImplicitAPI):
|
|
6928
7056
|
"""
|
6929
7057
|
fetches information on multiple canceled orders made by the user
|
6930
7058
|
|
6931
|
-
https://developers.binance.com/docs/binance-spot-api-docs/rest-api#all-orders-user_data
|
7059
|
+
https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#all-orders-user_data
|
6932
7060
|
https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/All-Orders
|
6933
7061
|
https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/All-Orders
|
6934
7062
|
https://developers.binance.com/docs/derivatives/option/trade/Query-Option-Order-History
|
@@ -6957,7 +7085,7 @@ class binance(Exchange, ImplicitAPI):
|
|
6957
7085
|
"""
|
6958
7086
|
fetches information on multiple canceled orders made by the user
|
6959
7087
|
|
6960
|
-
https://developers.binance.com/docs/binance-spot-api-docs/rest-api#all-orders-user_data
|
7088
|
+
https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#all-orders-user_data
|
6961
7089
|
https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/All-Orders
|
6962
7090
|
https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/All-Orders
|
6963
7091
|
https://developers.binance.com/docs/derivatives/option/trade/Query-Option-Order-History
|
@@ -6989,7 +7117,7 @@ class binance(Exchange, ImplicitAPI):
|
|
6989
7117
|
"""
|
6990
7118
|
cancels an open order
|
6991
7119
|
|
6992
|
-
https://developers.binance.com/docs/binance-spot-api-docs/rest-api#cancel-order-trade
|
7120
|
+
https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#cancel-order-trade
|
6993
7121
|
https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Cancel-Order
|
6994
7122
|
https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/Cancel-Order
|
6995
7123
|
https://developers.binance.com/docs/derivatives/option/trade/Cancel-Option-Order
|
@@ -7070,7 +7198,7 @@ class binance(Exchange, ImplicitAPI):
|
|
7070
7198
|
"""
|
7071
7199
|
cancel all open orders in a market
|
7072
7200
|
|
7073
|
-
https://developers.binance.com/docs/binance-spot-api-docs/rest-api#cancel-all-open-orders-on-a-symbol-trade
|
7201
|
+
https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#cancel-all-open-orders-on-a-symbol-trade
|
7074
7202
|
https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Cancel-All-Open-Orders
|
7075
7203
|
https://developers.binance.com/docs/derivatives/option/trade/Cancel-all-Option-orders-on-specific-symbol
|
7076
7204
|
https://developers.binance.com/docs/margin_trading/trade/Margin-Account-Cancel-All-Open-Orders
|
@@ -7295,7 +7423,7 @@ class binance(Exchange, ImplicitAPI):
|
|
7295
7423
|
"""
|
7296
7424
|
fetch all the trades made from a single order
|
7297
7425
|
|
7298
|
-
https://developers.binance.com/docs/binance-spot-api-docs/rest-api#account-trade-list-user_data
|
7426
|
+
https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#account-trade-list-user_data
|
7299
7427
|
https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Account-Trade-List
|
7300
7428
|
https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/Account-Trade-List
|
7301
7429
|
https://developers.binance.com/docs/margin_trading/trade/Query-Margin-Account-Trade-List
|
@@ -7324,7 +7452,7 @@ class binance(Exchange, ImplicitAPI):
|
|
7324
7452
|
"""
|
7325
7453
|
fetch all trades made by the user
|
7326
7454
|
|
7327
|
-
https://developers.binance.com/docs/binance-spot-api-docs/rest-api#account-trade-list-user_data
|
7455
|
+
https://developers.binance.com/docs/binance-spot-api-docs/rest-api/public-api-endpoints#account-trade-list-user_data
|
7328
7456
|
https://developers.binance.com/docs/derivatives/usds-margined-futures/trade/rest-api/Account-Trade-List
|
7329
7457
|
https://developers.binance.com/docs/derivatives/coin-margined-futures/trade/Account-Trade-List
|
7330
7458
|
https://developers.binance.com/docs/margin_trading/trade/Query-Margin-Account-Trade-List
|
@@ -11060,7 +11188,7 @@ class binance(Exchange, ImplicitAPI):
|
|
11060
11188
|
body = self.urlencode(params)
|
11061
11189
|
else:
|
11062
11190
|
raise AuthenticationError(self.id + ' userDataStream endpoint requires `apiKey` credential')
|
11063
|
-
elif (api == 'private') or (api == 'eapiPrivate') or (api == 'sapi' and path != 'system/status') or (api == 'sapiV2') or (api == 'sapiV3') or (api == 'sapiV4') or (api == 'dapiPrivate') or (api == 'dapiPrivateV2') or (api == 'fapiPrivate') or (api == 'fapiPrivateV2') or (api == 'fapiPrivateV3') or (api == 'papi' and path != 'ping'):
|
11191
|
+
elif (api == 'private') or (api == 'eapiPrivate') or (api == 'sapi' and path != 'system/status') or (api == 'sapiV2') or (api == 'sapiV3') or (api == 'sapiV4') or (api == 'dapiPrivate') or (api == 'dapiPrivateV2') or (api == 'fapiPrivate') or (api == 'fapiPrivateV2') or (api == 'fapiPrivateV3') or (api == 'papi' and path != 'ping') or (api == 'papiV2'):
|
11064
11192
|
self.check_required_credentials()
|
11065
11193
|
if method == 'POST' and ((path == 'order') or (path == 'sor/order')):
|
11066
11194
|
# inject in implicit API calls
|
@@ -11139,7 +11267,7 @@ class binance(Exchange, ImplicitAPI):
|
|
11139
11267
|
elif url.startswith('https://eapi.' + hostname + '/'):
|
11140
11268
|
marketType = 'option'
|
11141
11269
|
elif url.startswith('https://papi.' + hostname + '/'):
|
11142
|
-
marketType = '
|
11270
|
+
marketType = 'portfolioMargin'
|
11143
11271
|
if marketType is not None:
|
11144
11272
|
exceptionsForMarketType = self.safe_dict(self.exceptions, marketType, {})
|
11145
11273
|
return self.safe_dict(exceptionsForMarketType, exactOrBroad, {})
|