ccxt 4.2.29__py2.py3-none-any.whl → 4.2.31__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.
Files changed (133) hide show
  1. ccxt/__init__.py +3 -3
  2. ccxt/abstract/bybit.py +2 -2
  3. ccxt/abstract/coinbase.py +10 -0
  4. ccxt/abstract/okx.py +12 -1
  5. ccxt/ascendex.py +5 -5
  6. ccxt/async_support/__init__.py +3 -3
  7. ccxt/async_support/ascendex.py +5 -5
  8. ccxt/async_support/base/exchange.py +3 -3
  9. ccxt/async_support/bigone.py +2 -2
  10. ccxt/async_support/binance.py +892 -218
  11. ccxt/async_support/bingx.py +1 -1
  12. ccxt/async_support/bitfinex.py +1 -1
  13. ccxt/async_support/bitfinex2.py +421 -86
  14. ccxt/async_support/bitforex.py +3 -0
  15. ccxt/async_support/bitget.py +8 -4
  16. ccxt/async_support/bitmart.py +3 -3
  17. ccxt/async_support/bitmex.py +4 -4
  18. ccxt/async_support/bitrue.py +1 -1
  19. ccxt/async_support/bitso.py +1 -1
  20. ccxt/async_support/bitteam.py +2 -2
  21. ccxt/async_support/btcalpha.py +1 -1
  22. ccxt/async_support/bybit.py +3 -3
  23. ccxt/async_support/coinbase.py +20 -5
  24. ccxt/async_support/coincheck.py +1 -1
  25. ccxt/async_support/coinex.py +2 -2
  26. ccxt/async_support/coinlist.py +1 -1
  27. ccxt/async_support/coinmate.py +1 -1
  28. ccxt/async_support/coinmetro.py +2 -2
  29. ccxt/async_support/coinsph.py +1 -1
  30. ccxt/async_support/cryptocom.py +3 -3
  31. ccxt/async_support/deribit.py +1 -0
  32. ccxt/async_support/digifinex.py +6 -4
  33. ccxt/async_support/exmo.py +2 -2
  34. ccxt/async_support/gate.py +5 -5
  35. ccxt/async_support/gemini.py +3 -3
  36. ccxt/async_support/hitbtc.py +13 -17
  37. ccxt/async_support/hollaex.py +2 -2
  38. ccxt/async_support/htx.py +6 -6
  39. ccxt/async_support/huobijp.py +1 -1
  40. ccxt/async_support/kraken.py +3 -1
  41. ccxt/async_support/krakenfutures.py +4 -1
  42. ccxt/async_support/kucoin.py +17 -17
  43. ccxt/async_support/kucoinfutures.py +3 -3
  44. ccxt/async_support/lbank.py +4 -3
  45. ccxt/async_support/mexc.py +7 -7
  46. ccxt/async_support/novadax.py +1 -1
  47. ccxt/async_support/okcoin.py +2 -2
  48. ccxt/async_support/okx.py +22 -8
  49. ccxt/async_support/p2b.py +1 -0
  50. ccxt/async_support/phemex.py +3 -3
  51. ccxt/async_support/poloniexfutures.py +6 -3
  52. ccxt/async_support/probit.py +1 -1
  53. ccxt/async_support/timex.py +2 -2
  54. ccxt/async_support/tokocrypto.py +3 -3
  55. ccxt/async_support/wavesexchange.py +2 -2
  56. ccxt/async_support/whitebit.py +3 -3
  57. ccxt/async_support/woo.py +3 -3
  58. ccxt/async_support/yobit.py +1 -1
  59. ccxt/async_support/zaif.py +1 -1
  60. ccxt/async_support/zonda.py +3 -3
  61. ccxt/base/errors.py +13 -12
  62. ccxt/base/exchange.py +36 -26
  63. ccxt/bigone.py +2 -2
  64. ccxt/binance.py +892 -218
  65. ccxt/bingx.py +1 -1
  66. ccxt/bitfinex.py +1 -1
  67. ccxt/bitfinex2.py +421 -86
  68. ccxt/bitforex.py +3 -0
  69. ccxt/bitget.py +8 -4
  70. ccxt/bitmart.py +3 -3
  71. ccxt/bitmex.py +4 -4
  72. ccxt/bitrue.py +1 -1
  73. ccxt/bitso.py +1 -1
  74. ccxt/bitteam.py +2 -2
  75. ccxt/btcalpha.py +1 -1
  76. ccxt/bybit.py +3 -3
  77. ccxt/coinbase.py +20 -5
  78. ccxt/coincheck.py +1 -1
  79. ccxt/coinex.py +2 -2
  80. ccxt/coinlist.py +1 -1
  81. ccxt/coinmate.py +1 -1
  82. ccxt/coinmetro.py +2 -2
  83. ccxt/coinsph.py +1 -1
  84. ccxt/cryptocom.py +3 -3
  85. ccxt/deribit.py +1 -0
  86. ccxt/digifinex.py +6 -4
  87. ccxt/exmo.py +2 -2
  88. ccxt/gate.py +5 -5
  89. ccxt/gemini.py +3 -3
  90. ccxt/hitbtc.py +13 -17
  91. ccxt/hollaex.py +2 -2
  92. ccxt/htx.py +6 -6
  93. ccxt/huobijp.py +1 -1
  94. ccxt/kraken.py +3 -1
  95. ccxt/krakenfutures.py +4 -1
  96. ccxt/kucoin.py +17 -17
  97. ccxt/kucoinfutures.py +3 -3
  98. ccxt/lbank.py +4 -3
  99. ccxt/mexc.py +7 -7
  100. ccxt/novadax.py +1 -1
  101. ccxt/okcoin.py +2 -2
  102. ccxt/okx.py +22 -8
  103. ccxt/p2b.py +1 -0
  104. ccxt/phemex.py +3 -3
  105. ccxt/poloniexfutures.py +6 -3
  106. ccxt/pro/__init__.py +3 -1
  107. ccxt/pro/alpaca.py +1 -1
  108. ccxt/pro/binance.py +4 -4
  109. ccxt/pro/bitget.py +1 -1
  110. ccxt/pro/bitmart.py +1 -1
  111. ccxt/pro/bitmex.py +43 -7
  112. ccxt/pro/bitvavo.py +1 -1
  113. ccxt/pro/bybit.py +2 -2
  114. ccxt/pro/cex.py +2 -2
  115. ccxt/pro/independentreserve.py +1 -1
  116. ccxt/pro/okx.py +1 -1
  117. ccxt/pro/onetrading.py +2 -2
  118. ccxt/pro/p2b.py +407 -0
  119. ccxt/pro/probit.py +5 -5
  120. ccxt/pro/whitebit.py +1 -1
  121. ccxt/probit.py +1 -1
  122. ccxt/timex.py +2 -2
  123. ccxt/tokocrypto.py +3 -3
  124. ccxt/wavesexchange.py +2 -2
  125. ccxt/whitebit.py +3 -3
  126. ccxt/woo.py +3 -3
  127. ccxt/yobit.py +1 -1
  128. ccxt/zaif.py +1 -1
  129. ccxt/zonda.py +3 -3
  130. {ccxt-4.2.29.dist-info → ccxt-4.2.31.dist-info}/METADATA +6 -7
  131. {ccxt-4.2.29.dist-info → ccxt-4.2.31.dist-info}/RECORD +133 -132
  132. {ccxt-4.2.29.dist-info → ccxt-4.2.31.dist-info}/WHEEL +0 -0
  133. {ccxt-4.2.29.dist-info → ccxt-4.2.31.dist-info}/top_level.txt +0 -0
@@ -26,11 +26,12 @@ from ccxt.base.errors import OrderNotFillable
26
26
  from ccxt.base.errors import NotSupported
27
27
  from ccxt.base.errors import DDoSProtection
28
28
  from ccxt.base.errors import RateLimitExceeded
29
- from ccxt.base.errors import ExchangeNotAvailable
30
29
  from ccxt.base.errors import OnMaintenance
31
30
  from ccxt.base.errors import InvalidNonce
32
31
  from ccxt.base.errors import RequestTimeout
33
32
  from ccxt.base.errors import AuthenticationError
33
+ from ccxt.base.errors import OperationRejected
34
+ from ccxt.base.errors import OperationFailed
34
35
  from ccxt.base.decimal_to_precision import TRUNCATE
35
36
  from ccxt.base.decimal_to_precision import DECIMAL_PLACES
36
37
  from ccxt.base.precise import Precise
@@ -1454,234 +1455,885 @@ class binance(Exchange, ImplicitAPI):
1454
1455
  'BUSD': 'USD',
1455
1456
  },
1456
1457
  },
1457
- # https://binance-docs.github.io/apidocs/spot/en/#error-codes-2
1458
1458
  'exceptions': {
1459
+ 'spot': {
1460
+ # https://binance-docs.github.io/apidocs/spot/en/#error-codes
1461
+ 'exact': {
1462
+ '-1000': OperationFailed, # {"code":-1000,"msg":"An unknown error occured while processing the request."}
1463
+ '-1001': OperationFailed, # {"code":-1001,"msg":"'Internal error; unable to process your request. Please try again.'"}
1464
+ '-1002': AuthenticationError, # {"code":-1002,"msg":"'You are not authorized to execute self request.'"}
1465
+ '-1003': RateLimitExceeded, # {"code":-1003,"msg":"Too much request weight used, current limit is 1200 request weight per 1 MINUTE. Please use the websocket for live updates to avoid polling the API."}
1466
+ '-1004': OperationFailed, # {"code":-1004,"msg":"Server is busy, please wait and try again"}
1467
+ '-1006': OperationFailed, # {"code":-1006,"msg":"An unexpected response was received from the message bus. Execution status unknown."}
1468
+ '-1007': RequestTimeout, # {"code":-1007,"msg":"Timeout waiting for response from backend server. Send status unknown; execution status unknown."}
1469
+ '-1008': OperationFailed, # undocumented, but mentioned: This is sent whenever the servers are overloaded with requests.
1470
+ '-1010': OperationFailed, # undocumented, but mentioned ERROR_MSG_RECEIVED
1471
+ '-1013': OperationFailed, # undocumented, but mentioned
1472
+ '-1014': InvalidOrder, # {"code":-1014,"msg":"Unsupported order combination."}
1473
+ '-1015': RateLimitExceeded, # {"code":-1015,"msg":"'Too many new orders; current limit is %s orders per %s.'"}
1474
+ '-1016': BadRequest, # {"code":-1016,"msg":"'This service is no longer available.',"}
1475
+ '-1020': BadRequest, # {"code":-1020,"msg":"'This operation is not supported.'"}
1476
+ '-1021': InvalidNonce, # {"code":-1021,"msg":"'your time is ahead of server'"}
1477
+ '-1022': AuthenticationError, # {"code":-1022,"msg":"Signature for self request is not valid."}
1478
+ '-1099': AuthenticationError, # {"code":-1099,"msg":"Not found, authenticated, or authorized"}
1479
+ '-1100': BadRequest, # {"code":-1100,"msg":"createOrder(symbol, 1, asdf) -> 'Illegal characters found in parameter 'price'"}
1480
+ '-1101': BadRequest, # {"code":-1101,"msg":"Too many parameters; expected %s and received %s."}
1481
+ '-1102': BadRequest, # {"code":-1102,"msg":"Param %s or %s must be sent, but both were empty"}
1482
+ '-1103': BadRequest, # {"code":-1103,"msg":"An unknown parameter was sent."}
1483
+ '-1104': BadRequest, # {"code":-1104,"msg":"Not all sent parameters were read, read 8 parameters but was sent 9"}
1484
+ '-1105': BadRequest, # {"code":-1105,"msg":"Parameter %s was empty."}
1485
+ '-1106': BadRequest, # {"code":-1106,"msg":"Parameter %s sent when not required."}
1486
+ '-1108': BadRequest, # undocumented, but mentioned: This error will occur if a value to a parameter being sent was too large, potentially causing overflow
1487
+ '-1111': BadRequest, # {"code":-1111,"msg":"Precision is over the maximum defined for self asset."}
1488
+ '-1112': OperationFailed, # {"code":-1112,"msg":"No orders on book for symbol."}
1489
+ '-1114': BadRequest, # {"code":-1114,"msg":"TimeInForce parameter sent when not required."}
1490
+ '-1115': BadRequest, # {"code":-1115,"msg":"Invalid timeInForce."}
1491
+ '-1116': BadRequest, # {"code":-1116,"msg":"Invalid orderType."}
1492
+ '-1117': BadRequest, # {"code":-1117,"msg":"Invalid side."}
1493
+ '-1118': BadRequest, # {"code":-1118,"msg":"New client order ID was empty."}
1494
+ '-1119': BadRequest, # {"code":-1119,"msg":"Original client order ID was empty."}
1495
+ '-1120': BadRequest, # {"code":-1120,"msg":"Invalid interval."}
1496
+ '-1121': BadSymbol, # {"code":-1121,"msg":"Invalid symbol."}
1497
+ '-1125': AuthenticationError, # {"code":-1125,"msg":"This listenKey does not exist."}
1498
+ '-1127': BadRequest, # {"code":-1127,"msg":"More than %s hours between startTime and endTime."}
1499
+ '-1128': BadRequest, # {"code":-1128,"msg":"Combination of optional parameters invalid."}
1500
+ '-1130': BadRequest, # {"code":-1130,"msg":"Data sent for paramter %s is not valid."}
1501
+ '-1131': BadRequest, # {"code":-1131,"msg":"recvWindow must be less than 60000"}
1502
+ '-1134': BadRequest, # strategyType was less than 1000000.
1503
+ '-1135': BadRequest, # undocumented, but mentioned: This error code will occur if a parameter requiring a JSON object is invalid.
1504
+ '-1145': BadRequest, # cancelRestrictions has to be either ONLY_NEW or ONLY_PARTIALLY_FILLED.
1505
+ '-1151': BadSymbol, # Symbol is present multiple times in the list.
1506
+ '-2008': AuthenticationError, # undocumented, Invalid Api-Key ID
1507
+ '-2010': InvalidOrder, # NEW_ORDER_REJECTED
1508
+ '-2011': OrderNotFound, # {"code":-2011,"msg":"cancelOrder(1, 'BTC/USDT') -> 'UNKNOWN_ORDER'"}
1509
+ '-2013': OrderNotFound, # {"code":-2013,"msg":"fetchOrder(1, 'BTC/USDT') -> 'Order does not exist'"}
1510
+ '-2014': AuthenticationError, # {"code":-2014,"msg":"API-key format invalid."}
1511
+ '-2015': AuthenticationError, # {"code":-2015,"msg":"Invalid API-key, IP, or permissions for action."}
1512
+ '-2016': OperationRejected, # {"code":-2016,"msg":"No trading window could be found for the symbol. Try ticker/24hrs instead."}
1513
+ '-2021': BadResponse, # This code is sent when either the cancellation of the order failed or the new order placement failed but not both.
1514
+ '-2022': BadResponse, # This code is sent when both the cancellation of the order failed and the new order placement failed.
1515
+ '-2026': InvalidOrder, # Order was canceled or expired with no executed qty over 90 days ago and has been archived.
1516
+ # 3xxx errors are available only for spot
1517
+ '-3000': OperationFailed, # {"code":-3000,"msg":"Internal server error."}
1518
+ '-3001': AuthenticationError, # {"code":-3001,"msg":"Please enable 2FA first."}
1519
+ '-3002': BadSymbol, # {"code":-3002,"msg":"We don't have self asset."}
1520
+ '-3003': BadRequest, # {"code":-3003,"msg":"Margin account does not exist."}
1521
+ '-3004': OperationRejected, # {"code":-3004,"msg":"Trade not allowed."}
1522
+ '-3005': BadRequest, # {"code":-3005,"msg":"Transferring out not allowed. Transfer out amount exceeds max amount."}
1523
+ '-3006': BadRequest, # {"code":-3006,"msg":"Your borrow amount has exceed maximum borrow amount."}
1524
+ '-3007': OperationFailed, # {"code":-3007,"msg":"You have pending transaction, please try again later.."}
1525
+ '-3008': BadRequest, # {"code":-3008,"msg":"Borrow not allowed. Your borrow amount has exceed maximum borrow amount."}
1526
+ '-3009': OperationRejected, # {"code":-3009,"msg":"This asset are not allowed to transfer into margin account currently."}
1527
+ '-3010': BadRequest, # {"code":-3010,"msg":"Repay not allowed. Repay amount exceeds borrow amount."}
1528
+ '-3011': BadRequest, # {"code":-3011,"msg":"Your input date is invalid."}
1529
+ '-3012': OperationRejected, # {"code":-3012,"msg":"Borrow is banned for self asset."}
1530
+ '-3013': BadRequest, # {"code":-3013,"msg":"Borrow amount less than minimum borrow amount."}
1531
+ '-3014': AccountSuspended, # {"code":-3014,"msg":"Borrow is banned for self account."}
1532
+ '-3015': BadRequest, # {"code":-3015,"msg":"Repay amount exceeds borrow amount."}
1533
+ '-3016': BadRequest, # {"code":-3016,"msg":"Repay amount less than minimum repay amount."}
1534
+ '-3017': OperationRejected, # {"code":-3017,"msg":"This asset are not allowed to transfer into margin account currently."}
1535
+ '-3018': AccountSuspended, # {"code":-3018,"msg":"Transferring in has been banned for self account."}
1536
+ '-3019': AccountSuspended, # {"code":-3019,"msg":"Transferring out has been banned for self account."}
1537
+ '-3020': BadRequest, # {"code":-3020,"msg":"Transfer out amount exceeds max amount."}
1538
+ '-3021': BadRequest, # {"code":-3021,"msg":"Margin account are not allowed to trade self trading pair."}
1539
+ '-3022': AccountSuspended, # {"code":-3022,"msg":"You account's trading is banned."}
1540
+ '-3023': OperationRejected, # {"code":-3023,"msg":"You can't transfer out/place order under current margin level."}
1541
+ '-3024': OperationRejected, # {"code":-3024,"msg":"The unpaid debt is too small after self repayment."}
1542
+ '-3025': BadRequest, # {"code":-3025,"msg":"Your input date is invalid."}
1543
+ '-3026': BadRequest, # {"code":-3026,"msg":"Your input param is invalid."}
1544
+ '-3027': BadSymbol, # {"code":-3027,"msg":"Not a valid margin asset."}
1545
+ '-3028': BadSymbol, # {"code":-3028,"msg":"Not a valid margin pair."}
1546
+ '-3029': OperationFailed, # {"code":-3029,"msg":"Transfer failed."}
1547
+ '-3036': AccountSuspended, # {"code":-3036,"msg":"This account is not allowed to repay."}
1548
+ '-3037': OperationFailed, # {"code":-3037,"msg":"PNL is clearing. Wait a second."}
1549
+ '-3038': BadRequest, # {"code":-3038,"msg":"Listen key not found."}
1550
+ '-3041': InsufficientFunds, # {"code":-3041,"msg":"Balance is not enough"}
1551
+ '-3042': BadRequest, # {"code":-3042,"msg":"PriceIndex not available for self margin pair."}
1552
+ '-3043': PermissionDenied, # {"code":-3043,"msg":"Transferring in not allowed."}
1553
+ '-3044': OperationFailed, # {"code":-3044,"msg":"System busy."}
1554
+ '-3045': OperationFailed, # {"code":-3045,"msg":"The system doesn't have enough asset now."}
1555
+ '-3999': PermissionDenied, # {"code":-3999,"msg":"This function is only available for invited users."}
1556
+ '-4001': BadRequest, # {"code":-4001 ,"msg":"Invalid operation."}
1557
+ '-4002': BadRequest, # {"code":-4002 ,"msg":"Invalid get."}
1558
+ '-4003': BadRequest, # {"code":-4003 ,"msg":"Your input email is invalid."}
1559
+ '-4004': AuthenticationError, # {"code":-4004,"msg":"You don't login or auth."}
1560
+ '-4005': RateLimitExceeded, # {"code":-4005 ,"msg":"Too many new requests."}
1561
+ '-4006': BadRequest, # {"code":-4006 ,"msg":"Support main account only."}
1562
+ '-4007': PermissionDenied, # {"code":-4007 ,"msg":"Address validation is not passed."}
1563
+ '-4008': PermissionDenied, # {"code":-4008 ,"msg":"Address tag validation is not passed."}
1564
+ '-4009': ExchangeError, # undocumented
1565
+ '-4010': PermissionDenied, # {"code":-4010 ,"msg":"White list mail has been confirmed."} # [TODO] possible bug: it should probably be "has not been confirmed"
1566
+ '-4011': BadRequest, # {"code":-4011 ,"msg":"White list mail is invalid."}
1567
+ '-4012': PermissionDenied, # {"code":-4012 ,"msg":"White list is not opened."}
1568
+ '-4013': AuthenticationError, # {"code":-4013 ,"msg":"2FA is not opened."}
1569
+ '-4014': OperationFailed, # {"code":-4014 ,"msg":"Withdraw is not allowed within 2 min login."}
1570
+ '-4015': PermissionDenied, # {"code":-4015 ,"msg":"Withdraw is limited."}
1571
+ '-4016': PermissionDenied, # {"code":-4016 ,"msg":"Within 24 hours after password modification, withdrawal is prohibited."}
1572
+ '-4017': PermissionDenied, # {"code":-4017 ,"msg":"Within 24 hours after the release of 2FA, withdrawal is prohibited."}
1573
+ '-4018': BadSymbol, # {"code":-4018,"msg":"We don't have self asset."}
1574
+ '-4019': BadRequest, # {"code":-4019,"msg":"Current asset is not open for withdrawal."}
1575
+ '-4021': BadRequest, # {"code":-4021,"msg":"Asset withdrawal must be an %s multiple of %s."}
1576
+ '-4022': BadRequest, # {"code":-4022,"msg":"Not less than the minimum pick-up quantity %s."}
1577
+ '-4023': OperationFailed, # {"code":-4023,"msg":"Within 24 hours, the withdrawal exceeds the maximum amount."}
1578
+ '-4024': InsufficientFunds, # {"code":-4024,"msg":"You don't have self asset."}
1579
+ '-4025': InsufficientFunds, # {"code":-4025,"msg":"The number of hold asset is less than zero."}
1580
+ '-4026': InsufficientFunds, # {"code":-4026,"msg":"You have insufficient balance."}
1581
+ '-4027': OperationFailed, # {"code":-4027,"msg":"Failed to obtain tranId."}
1582
+ '-4028': BadRequest, # {"code":-4028,"msg":"The amount of withdrawal must be greater than the Commission."}
1583
+ '-4029': BadRequest, # {"code":-4029,"msg":"The withdrawal record does not exist."}
1584
+ '-4030': BadResponse, # {"code":-4030,"msg":"Confirmation of successful asset withdrawal. [TODO] possible bug in docs"}
1585
+ '-4031': OperationFailed, # {"code":-4031,"msg":"Cancellation failed."}
1586
+ '-4032': OperationFailed, # {"code":-4032,"msg":"Withdraw verification exception."}
1587
+ '-4033': BadRequest, # {"code":-4033,"msg":"Illegal address."}
1588
+ '-4034': OperationRejected, # {"code":-4034,"msg":"The address is suspected of fake."}
1589
+ '-4035': PermissionDenied, # {"code":-4035,"msg":"This address is not on the whitelist. Please join and try again."}
1590
+ '-4036': PermissionDenied, # {"code":-4036,"msg":"The new address needs to be withdrawn in {0} hours."}
1591
+ '-4037': OperationFailed, # {"code":-4037,"msg":"Re-sending Mail failed."}
1592
+ '-4038': OperationFailed, # {"code":-4038,"msg":"Please try again in 5 minutes."}
1593
+ '-4039': PermissionDenied, # {"code":-4039,"msg":"The user does not exist."}
1594
+ '-4040': OperationRejected, # {"code":-4040,"msg":"This address not charged."}
1595
+ '-4041': OperationFailed, # {"code":-4041,"msg":"Please try again in one minute."}
1596
+ '-4042': OperationRejected, # {"code":-4042,"msg":"This asset cannot get deposit address again."}
1597
+ '-4043': OperationRejected, # {"code":-4043,"msg":"More than 100 recharge addresses were used in 24 hours."}
1598
+ '-4044': PermissionDenied, # {"code":-4044,"msg":"This is a blacklist country."}
1599
+ '-4045': OperationFailed, # {"code":-4045,"msg":"Failure to acquire assets."}
1600
+ '-4046': AuthenticationError, # {"code":-4046,"msg":"Agreement not confirmed."}
1601
+ '-4047': BadRequest, # {"code":-4047,"msg":"Time interval must be within 0-90 days"}
1602
+ '-4060': OperationFailed, # As your deposit has not reached the required block confirmations, we have temporarily locked {0} asset
1603
+ '-5001': BadRequest, # Don't allow transfer to micro assets.
1604
+ '-5002': InsufficientFunds, # You have insufficient balance.
1605
+ '-5003': InsufficientFunds, # You don't have self asset.
1606
+ '-5004': OperationRejected, # The residual balances of %s have exceeded 0.001BTC, Please re-choose.
1607
+ '-5005': OperationRejected, # The residual balances of %s is too low, Please re-choose.
1608
+ '-5006': OperationFailed, # Only transfer once in 24 hours.
1609
+ '-5007': BadRequest, # Quantity must be greater than zero.
1610
+ '-5008': OperationRejected, # Insufficient amount of returnable assets.
1611
+ '-5009': BadSymbol, # Product does not exist.
1612
+ '-5010': OperationFailed, # Asset transfer fail.
1613
+ '-5011': BadRequest, # future account not exists.
1614
+ '-5012': OperationFailed, # Asset transfer is in pending.
1615
+ '-5013': InsufficientFunds, # {"code":-5013,"msg":"Asset transfer failed: insufficient balance""} # undocumented
1616
+ '-5021': BadRequest, # This parent sub have no relation
1617
+ '-5022': BadRequest, # future account or sub relation not exists.
1618
+ '-6001': BadSymbol, # Daily product not exists.
1619
+ '-6003': PermissionDenied, # Product not exist or you don't have permission
1620
+ '-6004': BadRequest, # Product not in purchase status
1621
+ '-6005': BadRequest, # Smaller than min purchase limit
1622
+ '-6006': BadRequest, # Redeem amount error
1623
+ '-6007': OperationFailed, # Not in redeem time
1624
+ '-6008': OperationFailed, # Product not in redeem status
1625
+ '-6009': RateLimitExceeded, # Request frequency too high
1626
+ '-6011': OperationRejected, # Exceeding the maximum num allowed to purchase per user
1627
+ '-6012': InsufficientFunds, # Balance not enough
1628
+ '-6013': BadResponse, # Purchasing failed
1629
+ '-6014': OperationRejected, # Exceed up-limit allowed to purchased
1630
+ '-6015': BadRequest, # Empty request body
1631
+ '-6016': BadRequest, # Parameter err
1632
+ '-6017': PermissionDenied, # Not in whitelist
1633
+ '-6018': InsufficientFunds, # Asset not enough
1634
+ '-6019': OperationRejected, # Need confirm
1635
+ '-6020': BadRequest, # Project not exists
1636
+ '-7001': BadRequest, # Date range is not supported.
1637
+ '-7002': BadRequest, # Data request type is not supported.
1638
+ '-10001': OperationFailed, # The system is under maintenance, please try again later.
1639
+ '-10002': BadRequest, # Invalid input parameters.
1640
+ '-10005': BadResponse, # No records found.
1641
+ '-10007': BadRequest, # This coin is not loanable
1642
+ '-10008': BadRequest, # This coin is not loanable
1643
+ '-10009': BadRequest, # This coin can not be used.
1644
+ '-10010': BadRequest, # This coin can not be used.
1645
+ '-10011': InsufficientFunds, # Insufficient spot assets.
1646
+ '-10012': BadRequest, # Invalid repayment amount.
1647
+ '-10013': InsufficientFunds, # Insufficient collateral amount.
1648
+ '-10015': OperationFailed, # Collateral deduction failed.
1649
+ '-10016': OperationFailed, # Failed to provide loan.
1650
+ '-10017': OperationRejected, # {"code":-10017,"msg":"Repay amount should not be larger than liability."}
1651
+ '-10018': BadRequest, # Invalid repayment amount.
1652
+ '-10019': BadRequest, # Configuration does not exists.
1653
+ '-10020': BadRequest, # User ID does not exist.
1654
+ '-10021': InvalidOrder, # Order does not exist.
1655
+ '-10022': BadRequest, # Invalid adjustment amount.
1656
+ '-10023': OperationFailed, # Failed to adjust LTV.
1657
+ '-10024': BadRequest, # LTV adjustment not supported.
1658
+ '-10025': OperationFailed, # Repayment failed.
1659
+ '-10026': BadRequest, # Invalid parameter.
1660
+ '-10028': BadRequest, # Invalid parameter.
1661
+ '-10029': OperationRejected, # Loan amount is too small.
1662
+ '-10030': OperationRejected, # Loan amount is too much.
1663
+ '-10031': OperationRejected, # Individual loan quota reached.
1664
+ '-10032': OperationFailed, # Repayment is temporarily unavailable.
1665
+ '-10034': OperationRejected, # Repay with collateral is not available currently, please try to repay with borrowed coin.
1666
+ '-10039': OperationRejected, # Repayment amount is too small.
1667
+ '-10040': OperationRejected, # Repayment amount is too large.
1668
+ '-10041': OperationFailed, # Due to high demand, there are currently insufficient loanable assets for {0}. Please adjust your borrow amount or try again tomorrow.
1669
+ '-10042': BadSymbol, # asset %s is not supported
1670
+ '-10043': OperationRejected, # {0} borrowing is currently not supported.
1671
+ '-10044': OperationRejected, # Collateral amount has reached the limit. Please reduce your collateral amount or try with other collaterals.
1672
+ '-10045': OperationRejected, # The loan coin does not support collateral repayment. Please try again later.
1673
+ '-10046': OperationRejected, # Collateral Adjustment exceeds the maximum limit. Please try again.
1674
+ '-10047': PermissionDenied, # This coin is currently not supported in your location due to local regulations.
1675
+ '-11008': OperationRejected, # undocumented: Exceeding the account’s maximum borrowable limit
1676
+ '-12014': RateLimitExceeded, # More than 1 request in 2 seconds
1677
+ # BLVT
1678
+ '-13000': OperationRejected, # Redeption of the token is forbiden now
1679
+ '-13001': OperationRejected, # Exceeds individual 24h redemption limit of the token
1680
+ '-13002': OperationRejected, # Exceeds total 24h redemption limit of the token
1681
+ '-13003': PermissionDenied, # Subscription of the token is forbiden now
1682
+ '-13004': OperationRejected, # Exceeds individual 24h subscription limit of the token
1683
+ '-13005': OperationRejected, # Exceeds total 24h subscription limit of the token
1684
+ '-13006': OperationRejected, # Subscription amount is too small
1685
+ '-13007': PermissionDenied, # The Agreement is not signed
1686
+ # 18xxx - BINANCE CODE
1687
+ '-18002': OperationRejected, # The total amount of codes you created has exceeded the 24-hour limit, please try again after UTC 0
1688
+ '-18003': OperationRejected, # Too many codes created in 24 hours, please try again after UTC 0
1689
+ '-18004': OperationRejected, # Too many invalid redeem attempts in 24 hours, please try again after UTC 0
1690
+ '-18005': PermissionDenied, # Too many invalid verify attempts, please try later
1691
+ '-18006': OperationRejected, # The amount is too small, please re-enter
1692
+ '-18007': OperationRejected, # This token is not currently supported, please re-enter
1693
+ # spot & futures algo(TBD for OPTIONS & PORTFOLIO MARGIN)
1694
+ '-20121': BadSymbol, # Invalid symbol.
1695
+ '-20124': BadRequest, # Invalid algo id or it has been completed.
1696
+ '-20130': BadRequest, # Invalid data sent for a parameter
1697
+ '-20132': BadRequest, # The client algo id is duplicated
1698
+ '-20194': BadRequest, # Duration is too short to execute all required quantity.
1699
+ '-20195': BadRequest, # The total size is too small.
1700
+ '-20196': BadRequest, # The total size is too large.
1701
+ '-20198': OperationRejected, # Reach the max open orders allowed.
1702
+ '-20204': BadRequest, # The notional of USD is less or more than the limit.
1703
+ # 21xxx - PORTFOLIO MARGIN
1704
+ '-21001': BadRequest, # Request ID is not a Portfolio Margin Account.
1705
+ '-21002': BadRequest, # Portfolio Margin Account doesn't support transfer from margin to futures.
1706
+ '-21003': BadResponse, # Fail to retrieve margin assets.
1707
+ '-21004': OperationRejected, # User doesn’t have portfolio margin bankruptcy loan
1708
+ '-21005': InsufficientFunds, # User’s spot wallet doesn’t have enough BUSD to repay portfolio margin bankruptcy loan
1709
+ '-21006': OperationFailed, # User had portfolio margin bankruptcy loan repayment in process
1710
+ '-21007': OperationFailed, # User failed to repay portfolio margin bankruptcy loan since liquidation was in process
1711
+ '-32603': BadRequest, # undocumented, Filter failure: LOT_SIZE & precision
1712
+ '400002': BadRequest, # undocumented, {“status”: “FAIL”, “code”: “400002”, “errorMessage”: “Signature for self request is not valid.”}
1713
+ '100001003': AuthenticationError, # undocumented, {"code":100001003,"msg":"Verification failed"}
1714
+ '200003903': AuthenticationError, # undocumented, {"code":200003903,"msg":"Your identity verification has been rejected. Please complete identity verification again."}
1715
+ },
1716
+ },
1717
+ 'linear': {
1718
+ # https://binance-docs.github.io/apidocs/futures/en/#error-codes
1719
+ 'exact': {
1720
+ '-1000': OperationFailed, # {"code":-1000,"msg":"An unknown error occured while processing the request."}
1721
+ '-1001': OperationFailed, # {"code":-1001,"msg":"'Internal error; unable to process your request. Please try again.'"}
1722
+ '-1002': AuthenticationError, # {"code":-1002,"msg":"'You are not authorized to execute self request.'"}
1723
+ '-1003': RateLimitExceeded, # {"code":-1003,"msg":"Too much request weight used, current limit is 1200 request weight per 1 MINUTE. Please use the websocket for live updates to avoid polling the API."}
1724
+ '-1004': OperationRejected, # DUPLICATE_IP : This IP is already on the white list
1725
+ '-1005': PermissionDenied, # {"code":-1005,"msg":"No such IP has been white listed"}
1726
+ '-1006': OperationFailed, # {"code":-1006,"msg":"An unexpected response was received from the message bus. Execution status unknown."}
1727
+ '-1007': RequestTimeout, # {"code":-1007,"msg":"Timeout waiting for response from backend server. Send status unknown; execution status unknown."}
1728
+ '-1008': OperationFailed, # -1008 SERVER_BUSY: Server is currently overloaded with other requests. Please try again in a few minutes.
1729
+ '-1010': OperationFailed, # {"code":-1010,"msg":"ERROR_MSG_RECEIVED."}
1730
+ '-1011': PermissionDenied, # {"code":-1011,"msg":"This IP cannot access self route."}
1731
+ '-1013': BadRequest, # {"code":-1013,"msg":"createOrder -> 'invalid quantity'/'invalid price'/MIN_NOTIONAL"} | -1013 INVALID_MESSAGE
1732
+ '-1014': InvalidOrder, # {"code":-1014,"msg":"Unsupported order combination."}
1733
+ '-1015': RateLimitExceeded, # {"code":-1015,"msg":"'Too many new orders; current limit is %s orders per %s.'"}
1734
+ '-1016': BadRequest, # {"code":-1016,"msg":"'This service is no longer available.',"}
1735
+ '-1020': BadRequest, # {"code":-1020,"msg":"'This operation is not supported.'"}
1736
+ '-1021': InvalidNonce, # {"code":-1021,"msg":"'your time is ahead of server'"}
1737
+ '-1022': AuthenticationError, # {"code":-1022,"msg":"Signature for self request is not valid."}
1738
+ '-1023': BadRequest, # {"code":-1023,"msg":"Start time is greater than end time."}
1739
+ '-1099': AuthenticationError, # {"code":-1099,"msg":"Not found, authenticated, or authorized"}
1740
+ '-1100': BadRequest, # {"code":-1100,"msg":"createOrder(symbol, 1, asdf) -> 'Illegal characters found in parameter 'price'"}
1741
+ '-1101': BadRequest, # {"code":-1101,"msg":"Too many parameters; expected %s and received %s."}
1742
+ '-1102': BadRequest, # {"code":-1102,"msg":"Param %s or %s must be sent, but both were empty"}
1743
+ '-1103': BadRequest, # {"code":-1103,"msg":"An unknown parameter was sent."}
1744
+ '-1104': BadRequest, # {"code":-1104,"msg":"Not all sent parameters were read, read 8 parameters but was sent 9"}
1745
+ '-1105': BadRequest, # {"code":-1105,"msg":"Parameter %s was empty."}
1746
+ '-1106': BadRequest, # {"code":-1106,"msg":"Parameter %s sent when not required."}
1747
+ '-1108': BadSymbol, # {"code":-1108,"msg":"Invalid asset."}
1748
+ '-1109': PermissionDenied, # {"code":-1109,"msg":"Invalid account."}
1749
+ '-1110': BadRequest, # {"code":-1110,"msg":"Invalid symbolType."}
1750
+ '-1111': BadRequest, # {"code":-1111,"msg":"Precision is over the maximum defined for self asset."}
1751
+ '-1112': OperationFailed, # {"code":-1112,"msg":"No orders on book for symbol."}
1752
+ '-1113': BadRequest, # {"code":-1113,"msg":"Withdrawal amount must be negative."}
1753
+ '-1114': BadRequest, # {"code":-1114,"msg":"TimeInForce parameter sent when not required."}
1754
+ '-1115': BadRequest, # {"code":-1115,"msg":"Invalid timeInForce."}
1755
+ '-1116': BadRequest, # {"code":-1116,"msg":"Invalid orderType."}
1756
+ '-1117': BadRequest, # {"code":-1117,"msg":"Invalid side."}
1757
+ '-1118': BadRequest, # {"code":-1118,"msg":"New client order ID was empty."}
1758
+ '-1119': BadRequest, # {"code":-1119,"msg":"Original client order ID was empty."}
1759
+ '-1120': BadRequest, # {"code":-1120,"msg":"Invalid interval."}
1760
+ '-1121': BadSymbol, # {"code":-1121,"msg":"Invalid symbol."}
1761
+ '-1122': BadRequest, # INVALID_SYMBOL_STATUS
1762
+ '-1125': AuthenticationError, # {"code":-1125,"msg":"This listenKey does not exist."}
1763
+ '-1126': BadSymbol, # ASSET_NOT_SUPPORTED
1764
+ '-1127': BadRequest, # {"code":-1127,"msg":"More than %s hours between startTime and endTime."}
1765
+ '-1128': BadRequest, # {"code":-1128,"msg":"Combination of optional parameters invalid."}
1766
+ '-1130': BadRequest, # {"code":-1130,"msg":"Data sent for paramter %s is not valid."}
1767
+ '-1136': BadRequest, # {"code":-1136,"msg":"Invalid newOrderRespType"}
1768
+ '-2010': OrderNotFound, # NEW_ORDER_REJECTED
1769
+ '-2011': OrderNotFound, # {"code":-2011,"msg":"cancelOrder(1, 'BTC/USDT') -> 'UNKNOWN_ORDER'"}
1770
+ '-2012': OperationFailed, # CANCEL_ALL_FAIL
1771
+ '-2013': OrderNotFound, # {"code":-2013,"msg":"fetchOrder(1, 'BTC/USDT') -> 'Order does not exist'"}
1772
+ '-2014': AuthenticationError, # {"code":-2014,"msg":"API-key format invalid."}
1773
+ '-2015': AuthenticationError, # {"code":-2015,"msg":"Invalid API-key, IP, or permissions for action."}
1774
+ '-2016': OperationRejected, # {"code":-2016,"msg":"No trading window could be found for the symbol. Try ticker/24hrs instead."}
1775
+ '-2017': PermissionDenied, # API Keys are locked on self account.
1776
+ '-2018': InsufficientFunds, # {"code":-2018,"msg":"Balance is insufficient"}
1777
+ '-2019': InsufficientFunds, # {"code":-2019,"msg":"Margin is insufficient."}
1778
+ '-2020': OperationFailed, # {"code":-2020,"msg":"Unable to fill."}
1779
+ '-2021': OrderImmediatelyFillable, # {"code":-2021,"msg":"Order would immediately trigger."}
1780
+ '-2022': InvalidOrder, # {"code":-2022,"msg":"ReduceOnly Order is rejected."}
1781
+ '-2023': OperationFailed, # {"code":-2023,"msg":"User in liquidation mode now."}
1782
+ '-2024': InsufficientFunds, # {"code":-2024,"msg":"Position is not sufficient."}
1783
+ '-2025': OperationRejected, # {"code":-2025,"msg":"Reach max open order limit."}
1784
+ '-2026': InvalidOrder, # {"code":-2026,"msg":"This OrderType is not supported when reduceOnly."}
1785
+ '-2027': OperationRejected, # {"code":-2027,"msg":"Exceeded the maximum allowable position at current leverage."}
1786
+ '-2028': OperationRejected, # {"code":-2028,"msg":"Leverage is smaller than permitted: insufficient margin balance"}
1787
+ '-4000': InvalidOrder, # INVALID_ORDER_STATUS
1788
+ '-4001': BadRequest, # PRICE_LESS_THAN_ZERO
1789
+ '-4002': BadRequest, # PRICE_GREATER_THAN_MAX_PRICE
1790
+ '-4003': BadRequest, # QTY_LESS_THAN_ZERO
1791
+ '-4004': BadRequest, # QTY_LESS_THAN_MIN_QTY
1792
+ '-4005': BadRequest, # QTY_GREATER_THAN_MAX_QTY
1793
+ '-4006': BadRequest, # STOP_PRICE_LESS_THAN_ZERO
1794
+ '-4007': BadRequest, # STOP_PRICE_GREATER_THAN_MAX_PRICE
1795
+ '-4008': BadRequest, # TICK SIZE LESS THAN ZERO
1796
+ '-4009': BadRequest, # MAX_PRICE_LESS_THAN_MIN_PRICE
1797
+ '-4010': BadRequest, # MAX_QTY_LESS_THAN_MIN_QTY
1798
+ '-4011': BadRequest, # STEP_SIZE_LESS_THAN_ZERO
1799
+ '-4012': BadRequest, # MAX_NUM_ORDERS_LESS_THAN_ZERO
1800
+ '-4013': BadRequest, # PRICE_LESS_THAN_MIN_PRICE
1801
+ '-4014': BadRequest, # PRICE NOT INCREASED BY TICK SIZE
1802
+ '-4015': BadRequest, # Client order id is not valid
1803
+ '-4016': OperationRejected, # Price is higher than mark price multiplier cap.
1804
+ '-4017': BadRequest, # MULTIPLIER_UP_LESS_THAN_ZERO
1805
+ '-4018': BadRequest, # MULTIPLIER_DOWN_LESS_THAN_ZERO
1806
+ '-4019': OperationRejected, # COMPOSITE_SCALE_OVERFLOW
1807
+ '-4020': BadRequest, # TARGET_STRATEGY_INVALID
1808
+ '-4021': BadRequest, # INVALID_DEPTH_LIMIT
1809
+ '-4022': BadRequest, # WRONG_MARKET_STATUS
1810
+ '-4023': BadRequest, # QTY_NOT_INCREASED_BY_STEP_SIZE
1811
+ '-4024': BadRequest, # PRICE_LOWER_THAN_MULTIPLIER_DOWN
1812
+ '-4025': BadRequest, # MULTIPLIER_DECIMAL_LESS_THAN_ZERO
1813
+ '-4026': BadRequest, # COMMISSION_INVALID
1814
+ '-4027': BadRequest, # INVALID_ACCOUNT_TYPE
1815
+ '-4028': BadRequest, # INVALID_LEVERAGE
1816
+ '-4029': BadRequest, # INVALID TICK SIZE PRECISION
1817
+ '-4030': BadRequest, # INVALID_STEP_SIZE_PRECISION
1818
+ '-4031': BadRequest, # INVALID_WORKING_TYPE
1819
+ '-4032': OperationRejected, # EXCEED_MAX_CANCEL_ORDER_SIZE
1820
+ '-4033': BadRequest, # INSURANCE_ACCOUNT_NOT_FOUND
1821
+ '-4044': BadRequest, # INVALID_BALANCE_TYPE
1822
+ '-4045': OperationRejected, # MAX_STOP_ORDER_EXCEEDED
1823
+ '-4046': OperationRejected, # NO_NEED_TO_CHANGE_MARGIN_TYPE
1824
+ '-4047': OperationRejected, # Margin type cannot be changed if there exists open orders.
1825
+ '-4048': OperationRejected, # Margin type cannot be changed if there exists position.
1826
+ '-4049': BadRequest, # Add margin only support for isolated position.
1827
+ '-4050': InsufficientFunds, # Cross balance insufficient
1828
+ '-4051': InsufficientFunds, # Isolated balance insufficient.
1829
+ '-4052': OperationRejected, # No need to change auto add margin.
1830
+ '-4053': BadRequest, # Auto add margin only support for isolated position.
1831
+ '-4054': OperationRejected, # Cannot add position margin: position is 0.
1832
+ '-4055': BadRequest, # Amount must be positive.
1833
+ '-4056': AuthenticationError, # Invalid api key type.
1834
+ '-4057': AuthenticationError, # Invalid api public key
1835
+ '-4058': BadRequest, # MAX_PRICE_TOO_LARGE
1836
+ '-4059': OperationRejected, # NO_NEED_TO_CHANGE_POSITION_SIDE
1837
+ '-4060': BadRequest, # INVALID_POSITION_SIDE
1838
+ '-4061': BadRequest, # POSITION_SIDE_NOT_MATCH
1839
+ '-4062': BadRequest, # REDUCE_ONLY_CONFLICT
1840
+ '-4063': BadRequest, # INVALID_OPTIONS_REQUEST_TYPE
1841
+ '-4064': BadRequest, # INVALID_OPTIONS_TIME_FRAME
1842
+ '-4065': BadRequest, # INVALID_OPTIONS_AMOUNT
1843
+ '-4066': BadRequest, # INVALID_OPTIONS_EVENT_TYPE
1844
+ '-4067': OperationRejected, # Position side cannot be changed if there exists open orders.
1845
+ '-4068': OperationRejected, # Position side cannot be changed if there exists position.
1846
+ '-4069': BadRequest, # Position INVALID_OPTIONS_PREMIUM_FEE
1847
+ '-4070': BadRequest, # Client options id is not valid.
1848
+ '-4071': BadRequest, # Invalid options direction
1849
+ '-4072': OperationRejected, # premium fee is not updated, reject order
1850
+ '-4073': BadRequest, # OPTIONS_PREMIUM_INPUT_LESS_THAN_ZERO
1851
+ '-4074': OperationRejected, # Order amount is bigger than upper boundary or less than 0, reject order
1852
+ '-4075': BadRequest, # output premium fee is less than 0, reject order
1853
+ '-4076': OperationRejected, # original fee is too much higher than last fee
1854
+ '-4077': OperationRejected, # place order amount has reached to limit, reject order
1855
+ '-4078': OperationFailed, # options internal error
1856
+ '-4079': BadRequest, # invalid options id
1857
+ '-4080': PermissionDenied, # user not found with id: %s
1858
+ '-4081': BadRequest, # OPTIONS_NOT_FOUND
1859
+ '-4082': OperationRejected, # Invalid number of batch place orders
1860
+ '-4083': OperationFailed, # Fail to place batch orders.
1861
+ '-4084': BadRequest, # UPCOMING_METHOD
1862
+ '-4085': BadRequest, # Invalid notional limit coefficient
1863
+ '-4086': BadRequest, # Invalid price spread threshold
1864
+ '-4087': PermissionDenied, # User can only place reduce only order
1865
+ '-4088': PermissionDenied, # User can not place order currently
1866
+ '-4104': BadRequest, # INVALID_CONTRACT_TYPE
1867
+ '-4114': BadRequest, # INVALID_CLIENT_TRAN_ID_LEN
1868
+ '-4115': BadRequest, # DUPLICATED_CLIENT_TRAN_ID
1869
+ '-4118': OperationRejected, # REDUCE_ONLY_MARGIN_CHECK_FAILED
1870
+ '-4131': OperationRejected, # The counterparty's best price does not meet the PERCENT_PRICE filter limit
1871
+ '-4135': BadRequest, # Invalid activation price
1872
+ '-4137': BadRequest, # Quantity must be zero with closePosition equals True
1873
+ '-4138': BadRequest, # Reduce only must be True with closePosition equals True
1874
+ '-4139': BadRequest, # Order type can not be market if it's unable to cancel
1875
+ '-4140': BadRequest, # Invalid symbol status for opening position
1876
+ '-4141': OperationRejected, # Symbol is closed
1877
+ '-4142': OrderImmediatelyFillable, # REJECT: take profit or stop order will be triggered immediately
1878
+ '-4144': BadSymbol, # Invalid pair
1879
+ '-4164': OperationRejected, # Leverage reduction is not supported in Isolated Margin Mode with open positions
1880
+ '-4165': BadRequest, # Invalid time interval
1881
+ '-4167': BadRequest, # Unable to adjust to Multi-Assets mode with symbols of USDⓈ-M Futures under isolated-margin mode.
1882
+ '-4168': BadRequest, # Unable to adjust to isolated-margin mode under the Multi-Assets mode.
1883
+ '-4169': OperationRejected, # Unable to adjust Multi-Assets Mode with insufficient margin balance in USDⓈ-M Futures
1884
+ '-4170': OperationRejected, # Unable to adjust Multi-Assets Mode with open orders in USDⓈ-M Futures
1885
+ '-4171': OperationRejected, # Adjusted asset mode is currently set and does not need to be adjusted repeatedly
1886
+ '-4172 ': OperationRejected, # Unable to adjust Multi-Assets Mode with a negative wallet balance of margin available asset in USDⓈ-M Futures account.
1887
+ '-4183': BadRequest, # Price is higher than stop price multiplier cap.
1888
+ '-4184': BadRequest, # Price is lower than stop price multiplier floor.
1889
+ '-4192': PermissionDenied, # Trade forbidden due to Cooling-off Period.
1890
+ '-4202': PermissionDenied, # Intermediate Personal Verification is required for adjusting leverage over 20x
1891
+ '-4203': PermissionDenied, # More than 20x leverage is available one month after account registration.
1892
+ '-4205': PermissionDenied, # More than 20x leverage is available %s days after Futures account registration.
1893
+ '-4206': PermissionDenied, # hasattr(self, Users) country has limited adjust leverage.
1894
+ '-4208': OperationRejected, # Current symbol leverage cannot exceed 20 when using position limit adjustment service.
1895
+ '-4209': OperationRejected, # Leverage adjustment failed. Current symbol max leverage limit is %sx
1896
+ '-4210': BadRequest, # Stop price is higher than price multiplier cap
1897
+ '-4211': BadRequest, # Stop price is lower than price multiplier floor
1898
+ '-4400': PermissionDenied, # Futures Trading Quantitative Rules violated, only reduceOnly order is allowed, please try again later.
1899
+ '-4401': PermissionDenied, # Compliance restricted account permission: can only place reduceOnly order.
1900
+ '-4402': PermissionDenied, # Dear user, our Terms of Use and compliance with local regulations, self feature is currently not available in your region.
1901
+ '-4403': PermissionDenied, # Dear user, our Terms of Use and compliance with local regulations, the leverage can only up to %sx in your region
1902
+ '-5021': OrderNotFillable, # Due to the order could not be filled immediately, the FOK order has been rejected.
1903
+ '-5022': OrderNotFillable, # Due to the order could not be executed, the Post Only order will be rejected.
1904
+ '-5024': OperationRejected, # Symbol is not in trading status. Order amendment is not permitted.
1905
+ '-5025': OperationRejected, # Only limit order is supported.
1906
+ '-5026': OperationRejected, # Exceed maximum modify order limit.
1907
+ '-5027': OperationRejected, # No need to modify the order.
1908
+ '-5028': BadRequest, # Timestamp for self request is outside of the ME recvWindow.
1909
+ '-5037': BadRequest, # Invalid price match
1910
+ '-5038': BadRequest, # Price match only supports order type: LIMIT, STOP AND TAKE_PROFIT
1911
+ '-5039': BadRequest, # Invalid self trade prevention mode
1912
+ '-5040': BadRequest, # The goodTillDate timestamp must be greater than the current time plus 600 seconds and smaller than 253402300799000
1913
+ '-5041': OperationFailed, # No depth matches self BBO order
1914
+ #
1915
+ # spot & futures algo(TBD for OPTIONS & PORTFOLIO MARGIN)
1916
+ #
1917
+ '-20121': BadSymbol, # Invalid symbol.
1918
+ '-20124': BadRequest, # Invalid algo id or it has been completed.
1919
+ '-20130': BadRequest, # Invalid data sent for a parameter
1920
+ '-20132': BadRequest, # The client algo id is duplicated
1921
+ '-20194': BadRequest, # Duration is too short to execute all required quantity.
1922
+ '-20195': BadRequest, # The total size is too small.
1923
+ '-20196': BadRequest, # The total size is too large.
1924
+ '-20198': OperationRejected, # Reach the max open orders allowed.
1925
+ '-20204': BadRequest, # The notional of USD is less or more than the limit.
1926
+ },
1927
+ },
1928
+ 'inverse': {
1929
+ # https://binance-docs.github.io/apidocs/delivery/en/#error-codes
1930
+ 'exact': {
1931
+ '-1000': OperationFailed, # {"code":-1000,"msg":"An unknown error occured while processing the request."}
1932
+ '-1001': OperationFailed, # {"code":-1001,"msg":"'Internal error; unable to process your request. Please try again.'"}
1933
+ '-1002': AuthenticationError, # {"code":-1002,"msg":"'You are not authorized to execute self request.'"}
1934
+ '-1003': RateLimitExceeded, # {"code":-1003,"msg":"Too much request weight used, current limit is 1200 request weight per 1 MINUTE. Please use the websocket for live updates to avoid polling the API."}
1935
+ '-1004': OperationRejected, # DUPLICATE_IP : This IP is already on the white list
1936
+ '-1005': PermissionDenied, # {"code":-1005,"msg":"No such IP has been white listed"}
1937
+ '-1006': OperationFailed, # {"code":-1006,"msg":"An unexpected response was received from the message bus. Execution status unknown."}
1938
+ '-1007': RequestTimeout, # {"code":-1007,"msg":"Timeout waiting for response from backend server. Send status unknown; execution status unknown."}
1939
+ '-1010': OperationFailed, # {"code":-1010,"msg":"ERROR_MSG_RECEIVED."}
1940
+ '-1011': PermissionDenied, # {"code":-1011,"msg":"This IP cannot access self route."}
1941
+ '-1013': BadRequest, # {"code":-1013,"msg":"createOrder -> 'invalid quantity'/'invalid price'/MIN_NOTIONAL"} | -1013 INVALID_MESSAGE
1942
+ '-1014': InvalidOrder, # {"code":-1014,"msg":"Unsupported order combination."}
1943
+ '-1015': RateLimitExceeded, # {"code":-1015,"msg":"'Too many new orders; current limit is %s orders per %s.'"}
1944
+ '-1016': BadRequest, # {"code":-1016,"msg":"'This service is no longer available.',"}
1945
+ '-1020': BadRequest, # {"code":-1020,"msg":"'This operation is not supported.'"}
1946
+ '-1021': InvalidNonce, # {"code":-1021,"msg":"'your time is ahead of server'"}
1947
+ '-1022': AuthenticationError, # {"code":-1022,"msg":"Signature for self request is not valid."}
1948
+ '-1023': BadRequest, # {"code":-1023,"msg":"Start time is greater than end time."}
1949
+ '-1100': BadRequest, # {"code":-1100,"msg":"createOrder(symbol, 1, asdf) -> 'Illegal characters found in parameter 'price'"}
1950
+ '-1101': BadRequest, # {"code":-1101,"msg":"Too many parameters; expected %s and received %s."}
1951
+ '-1102': BadRequest, # {"code":-1102,"msg":"Param %s or %s must be sent, but both were empty"}
1952
+ '-1103': BadRequest, # {"code":-1103,"msg":"An unknown parameter was sent."}
1953
+ '-1104': BadRequest, # {"code":-1104,"msg":"Not all sent parameters were read, read 8 parameters but was sent 9"}
1954
+ '-1105': BadRequest, # {"code":-1105,"msg":"Parameter %s was empty."}
1955
+ '-1106': BadRequest, # {"code":-1106,"msg":"Parameter %s sent when not required."}
1956
+ '-1108': BadSymbol, # {"code":-1108,"msg":"Invalid asset."}
1957
+ '-1109': AuthenticationError, # {"code":-1109,"msg":"Invalid account."}
1958
+ '-1110': BadSymbol, # {"code":-1110,"msg":"Invalid symbolType."}
1959
+ '-1111': BadRequest, # {"code":-1111,"msg":"Precision is over the maximum defined for self asset."}
1960
+ '-1112': OperationFailed, # {"code":-1112,"msg":"No orders on book for symbol."}
1961
+ '-1113': BadRequest, # {"code":-1113,"msg":"Withdrawal amount must be negative."}
1962
+ '-1114': BadRequest, # {"code":-1114,"msg":"TimeInForce parameter sent when not required."}
1963
+ '-1115': BadRequest, # {"code":-1115,"msg":"Invalid timeInForce."}
1964
+ '-1116': BadRequest, # {"code":-1116,"msg":"Invalid orderType."}
1965
+ '-1117': BadRequest, # {"code":-1117,"msg":"Invalid side."}
1966
+ '-1118': BadRequest, # {"code":-1118,"msg":"New client order ID was empty."}
1967
+ '-1119': BadRequest, # {"code":-1119,"msg":"Original client order ID was empty."}
1968
+ '-1120': BadRequest, # {"code":-1120,"msg":"Invalid interval."}
1969
+ '-1121': BadSymbol, # {"code":-1121,"msg":"Invalid symbol."}
1970
+ '-1125': AuthenticationError, # {"code":-1125,"msg":"This listenKey does not exist."}
1971
+ '-1127': BadRequest, # {"code":-1127,"msg":"More than %s hours between startTime and endTime."}
1972
+ '-1128': BadRequest, # {"code":-1128,"msg":"Combination of optional parameters invalid."}
1973
+ '-1130': BadRequest, # {"code":-1130,"msg":"Data sent for paramter %s is not valid."}
1974
+ '-1136': BadRequest, # {"code":-1136,"msg":"Invalid newOrderRespType"}
1975
+ '-2010': InvalidOrder, # NEW_ORDER_REJECTED
1976
+ '-2011': OrderNotFound, # {"code":-2011,"msg":"cancelOrder(1, 'BTC/USDT') -> 'UNKNOWN_ORDER'"}
1977
+ '-2013': OrderNotFound, # {"code":-2013,"msg":"fetchOrder(1, 'BTC/USDT') -> 'Order does not exist'"}
1978
+ '-2014': AuthenticationError, # {"code":-2014,"msg":"API-key format invalid."}
1979
+ '-2015': AuthenticationError, # {"code":-2015,"msg":"Invalid API-key, IP, or permissions for action."}
1980
+ '-2016': OperationRejected, # {"code":-2016,"msg":"No trading window could be found for the symbol. Try ticker/24hrs instead."}
1981
+ '-2018': InsufficientFunds, # {"code":-2018,"msg":"Balance is insufficient"}
1982
+ '-2019': InsufficientFunds, # {"code":-2019,"msg":"Margin is insufficient."}
1983
+ '-2020': OperationFailed, # {"code":-2020,"msg":"Unable to fill."}
1984
+ '-2021': OrderImmediatelyFillable, # {"code":-2021,"msg":"Order would immediately trigger."}
1985
+ '-2022': InvalidOrder, # {"code":-2022,"msg":"ReduceOnly Order is rejected."}
1986
+ '-2023': OperationFailed, # {"code":-2023,"msg":"User in liquidation mode now."}
1987
+ '-2024': BadRequest, # {"code":-2024,"msg":"Position is not sufficient."}
1988
+ '-2025': OperationRejected, # {"code":-2025,"msg":"Reach max open order limit."}
1989
+ '-2026': InvalidOrder, # {"code":-2026,"msg":"This OrderType is not supported when reduceOnly."}
1990
+ '-2027': OperationRejected, # {"code":-2027,"msg":"Exceeded the maximum allowable position at current leverage."}
1991
+ '-2028': OperationRejected, # {"code":-2028,"msg":"Leverage is smaller than permitted: insufficient margin balance"}
1992
+ '-4000': InvalidOrder, # INVALID_ORDER_STATUS
1993
+ '-4001': BadRequest, # PRICE_LESS_THAN_ZERO
1994
+ '-4002': BadRequest, # PRICE_GREATER_THAN_MAX_PRICE
1995
+ '-4003': BadRequest, # QTY_LESS_THAN_ZERO
1996
+ '-4004': BadRequest, # QTY_LESS_THAN_MIN_QTY
1997
+ '-4005': BadRequest, # QTY_GREATER_THAN_MAX_QTY
1998
+ '-4006': BadRequest, # STOP_PRICE_LESS_THAN_ZERO
1999
+ '-4007': BadRequest, # STOP_PRICE_GREATER_THAN_MAX_PRICE
2000
+ '-4008': BadRequest, # TICK SIZE LESS THAN ZERO
2001
+ '-4009': BadRequest, # MAX_PRICE_LESS_THAN_MIN_PRICE
2002
+ '-4010': BadRequest, # MAX_QTY_LESS_THAN_MIN_QTY
2003
+ '-4011': BadRequest, # STEP_SIZE_LESS_THAN_ZERO
2004
+ '-4012': BadRequest, # MAX_NUM_ORDERS_LESS_THAN_ZERO
2005
+ '-4013': BadRequest, # PRICE_LESS_THAN_MIN_PRICE
2006
+ '-4014': BadRequest, # PRICE NOT INCREASED BY TICK SIZE
2007
+ '-4015': BadRequest, # Client order id is not valid
2008
+ '-4016': BadRequest, # Price is higher than mark price multiplier cap.
2009
+ '-4017': BadRequest, # MULTIPLIER_UP_LESS_THAN_ZERO
2010
+ '-4018': BadRequest, # MULTIPLIER_DOWN_LESS_THAN_ZERO
2011
+ '-4019': OperationRejected, # COMPOSITE_SCALE_OVERFLOW
2012
+ '-4020': BadRequest, # TARGET_STRATEGY_INVALID
2013
+ '-4021': BadRequest, # INVALID_DEPTH_LIMIT
2014
+ '-4022': BadRequest, # WRONG_MARKET_STATUS
2015
+ '-4023': BadRequest, # QTY_NOT_INCREASED_BY_STEP_SIZE
2016
+ '-4024': BadRequest, # PRICE_LOWER_THAN_MULTIPLIER_DOWN
2017
+ '-4025': BadRequest, # MULTIPLIER_DECIMAL_LESS_THAN_ZERO
2018
+ '-4026': BadRequest, # COMMISSION_INVALID
2019
+ '-4027': BadRequest, # INVALID_ACCOUNT_TYPE
2020
+ '-4028': BadRequest, # INVALID_LEVERAGE
2021
+ '-4029': BadRequest, # INVALID TICK SIZE PRECISION
2022
+ '-4030': BadRequest, # INVALID_STEP_SIZE_PRECISION
2023
+ '-4031': BadRequest, # INVALID_WORKING_TYPE
2024
+ '-4032': OperationRejected, # Exceed maximum cancel order size. | Invalid parameter working type: %s
2025
+ '-4033': BadRequest, # INSURANCE_ACCOUNT_NOT_FOUND
2026
+ '-4044': BadRequest, # INVALID_BALANCE_TYPE
2027
+ '-4045': OperationRejected, # Reach max stop order limit.
2028
+ '-4046': BadRequest, # NO_NEED_TO_CHANGE_MARGIN_TYPE
2029
+ '-4047': OperationRejected, # Margin type cannot be changed if there exists open orders.
2030
+ '-4048': OperationRejected, # Margin type cannot be changed if there exists position.
2031
+ '-4049': OperationRejected, # ADD_ISOLATED_MARGIN_REJECT
2032
+ '-4050': InsufficientFunds, # CROSS_BALANCE_INSUFFICIENT
2033
+ '-4051': InsufficientFunds, # ISOLATED_BALANCE_INSUFFICIENT
2034
+ '-4052': OperationRejected, # NO_NEED_TO_CHANGE_AUTO_ADD_MARGIN
2035
+ '-4053': OperationRejected, # AUTO_ADD_CROSSED_MARGIN_REJECT
2036
+ '-4054': OperationRejected, # Cannot add position margin: position is 0.
2037
+ '-4055': BadRequest, # AMOUNT_MUST_BE_POSITIVE
2038
+ '-4056': AuthenticationError, # INVALID_API_KEY_TYPE
2039
+ '-4057': AuthenticationError, # INVALID_RSA_PUBLIC_KEY
2040
+ '-4058': BadRequest, # MAX_PRICE_TOO_LARGE
2041
+ '-4059': OperationRejected, # NO_NEED_TO_CHANGE_POSITION_SIDE
2042
+ '-4060': BadRequest, # INVALID_POSITION_SIDE
2043
+ '-4061': OperationRejected, # Order's position side does not match user's setting.
2044
+ '-4062': BadRequest, # Invalid or improper reduceOnly value.
2045
+ #
2046
+ '-4067': OperationRejected, # Position side cannot be changed if there exists open orders.
2047
+ '-4068': OperationRejected, # Position side cannot be changed if there exists position.
2048
+ '-4082': OperationRejected, # Invalid number of batch place orders.
2049
+ '-4083': OperationRejected, # PLACE_BATCH_ORDERS_FAIL
2050
+ '-4084': BadRequest, # Method is not allowed currently. Upcoming soon.
2051
+ '-4086': BadRequest, # Invalid price spread threshold.
2052
+ '-4087': BadSymbol, # Invalid pair
2053
+ '-4088': BadRequest, # Invalid time interval
2054
+ '-4089': PermissionDenied, # User can only place reduce only order.
2055
+ '-4090': PermissionDenied, # User can not place order currently.
2056
+ '-4104': BadRequest, # Invalid contract type
2057
+ '-4110': BadRequest, # clientTranId is not valid
2058
+ '-4111': BadRequest, # clientTranId is duplicated.
2059
+ '-4112': OperationRejected, # ReduceOnly Order Failed. Please check your existing position and open orders.
2060
+ '-4113': OperationRejected, # The counterparty's best price does not meet the PERCENT_PRICE filter limit.
2061
+ '-4135': BadRequest, # Invalid activation price.
2062
+ '-4137': BadRequest, # Quantity must be zero with closePosition equals True.
2063
+ '-4138': BadRequest, # Reduce only must be True with closePosition equals True.
2064
+ '-4139': BadRequest, # Order type can not be market if it's unable to cancel.
2065
+ '-4142': OrderImmediatelyFillable, # REJECT: take profit or stop order will be triggered immediately.
2066
+ '-4150': OperationRejected, # Leverage reduction is not supported in Isolated Margin Mode with open positions.
2067
+ '-4151': BadRequest, # Price is higher than stop price multiplier cap.
2068
+ '-4152': BadRequest, # Price is lower than stop price multiplier floor.
2069
+ '-4154': BadRequest, # Stop price is higher than price multiplier cap.
2070
+ '-4155': BadRequest, # Stop price is lower than price multiplier floor
2071
+ '-4178': BadRequest, # Order's notional must be no smaller than one(unless you choose reduce only)
2072
+ '-4192': PermissionDenied, # Trade forbidden due to Cooling-off Period.
2073
+ '-4194': PermissionDenied, # Intermediate Personal Verification is required for adjusting leverage over 20x.
2074
+ '-4195': PermissionDenied, # More than 20x leverage is available one month after account registration.
2075
+ '-4196': BadRequest, # Only limit order is supported.
2076
+ '-4197': OperationRejected, # No need to modify the order.
2077
+ '-4198': OperationRejected, # Exceed maximum modify order limit.
2078
+ '-4199': BadRequest, # Symbol is not in trading status. Order amendment is not permitted.
2079
+ '-4200': PermissionDenied, # More than 20x leverage is available %s days after Futures account registration.
2080
+ '-4201': PermissionDenied, # Users in your location/country can only access a maximum leverage of %s
2081
+ '-4202': OperationRejected, # Current symbol leverage cannot exceed 20 when using position limit adjustment service.
2082
+ '-4188': BadRequest, # Timestamp for self request is outside of the ME recvWindow.
2083
+ #
2084
+ # spot & futures algo
2085
+ #
2086
+ '-20121': BadSymbol, # Invalid symbol.
2087
+ '-20124': BadRequest, # Invalid algo id or it has been completed.
2088
+ '-20130': BadRequest, # Invalid data sent for a parameter
2089
+ '-20132': BadRequest, # The client algo id is duplicated
2090
+ '-20194': BadRequest, # Duration is too short to execute all required quantity.
2091
+ '-20195': BadRequest, # The total size is too small.
2092
+ '-20196': BadRequest, # The total size is too large.
2093
+ '-20198': OperationRejected, # Reach the max open orders allowed.
2094
+ '-20204': BadRequest, # The notional of USD is less or more than the limit.
2095
+ },
2096
+ },
2097
+ 'option': {
2098
+ # https://binance-docs.github.io/apidocs/voptions/en/#error-codes
2099
+ 'exact': {
2100
+ '-1000': OperationFailed, # {"code":-1000,"msg":"An unknown error occured while processing the request."}
2101
+ '-1001': OperationFailed, # {"code":-1001,"msg":"'Internal error; unable to process your request. Please try again.'"}
2102
+ '-1002': AuthenticationError, # {"code":-1002,"msg":"'You are not authorized to execute self request.'"}
2103
+ '-1008': RateLimitExceeded, # TOO_MANY_REQUESTS
2104
+ '-1014': InvalidOrder, # {"code":-1014,"msg":"Unsupported order combination."}
2105
+ '-1015': RateLimitExceeded, # {"code":-1015,"msg":"'Too many new orders; current limit is %s orders per %s.'"}
2106
+ '-1016': BadRequest, # {"code":-1016,"msg":"'This service is no longer available.',"}
2107
+ '-1020': BadRequest, # {"code":-1020,"msg":"'This operation is not supported.'"}
2108
+ '-1021': InvalidNonce, # {"code":-1021,"msg":"'your time is ahead of server'"}
2109
+ '-1022': AuthenticationError, # {"code":-1022,"msg":"Signature for self request is not valid."}
2110
+ '-1100': BadRequest, # {"code":-1100,"msg":"createOrder(symbol, 1, asdf) -> 'Illegal characters found in parameter 'price'"}
2111
+ '-1101': BadRequest, # {"code":-1101,"msg":"Too many parameters; expected %s and received %s."}
2112
+ '-1102': BadRequest, # {"code":-1102,"msg":"Param %s or %s must be sent, but both were empty"}
2113
+ '-1103': BadRequest, # {"code":-1103,"msg":"An unknown parameter was sent."}
2114
+ '-1104': BadRequest, # {"code":-1104,"msg":"Not all sent parameters were read, read 8 parameters but was sent 9"}
2115
+ '-1105': BadRequest, # {"code":-1105,"msg":"Parameter %s was empty."}
2116
+ '-1106': BadRequest, # {"code":-1106,"msg":"Parameter %s sent when not required."}
2117
+ '-1111': BadRequest, # {"code":-1111,"msg":"Precision is over the maximum defined for self asset."}
2118
+ '-1115': BadRequest, # {"code":-1115,"msg":"Invalid timeInForce."}
2119
+ '-1116': BadRequest, # {"code":-1116,"msg":"Invalid orderType."}
2120
+ '-1117': BadRequest, # {"code":-1117,"msg":"Invalid side."}
2121
+ '-1118': BadRequest, # {"code":-1118,"msg":"New client order ID was empty."}
2122
+ '-1119': BadRequest, # {"code":-1119,"msg":"Original client order ID was empty."}
2123
+ '-1120': BadRequest, # {"code":-1120,"msg":"Invalid interval."}
2124
+ '-1121': BadSymbol, # {"code":-1121,"msg":"Invalid symbol."}
2125
+ '-1125': AuthenticationError, # {"code":-1125,"msg":"This listenKey does not exist."}
2126
+ '-1127': BadRequest, # {"code":-1127,"msg":"More than %s hours between startTime and endTime."}
2127
+ '-1128': BadSymbol, # BAD_CONTRACT
2128
+ '-1129': BadSymbol, # BAD_CURRENCY
2129
+ '-1130': BadRequest, # {"code":-1130,"msg":"Data sent for paramter %s is not valid."}
2130
+ '-1131': BadRequest, # {"code":-1131,"msg":"recvWindow must be less than 60000"}
2131
+ '-2010': InvalidOrder, # NEW_ORDER_REJECTED
2132
+ '-2013': OrderNotFound, # {"code":-2013,"msg":"fetchOrder(1, 'BTC/USDT') -> 'Order does not exist'"}
2133
+ '-2014': AuthenticationError, # {"code":-2014,"msg":"API-key format invalid."}
2134
+ '-2015': AuthenticationError, # {"code":-2015,"msg":"Invalid API-key, IP, or permissions for action."}
2135
+ '-2018': InsufficientFunds, # BALANCE_NOT_SUFFICIENT
2136
+ '-2027': InsufficientFunds, # OPTION_MARGIN_NOT_SUFFICIENT
2137
+ '-3029': OperationFailed, # {"code":-3029,"msg":"Transfer failed."}
2138
+ '-4001': BadRequest, # PRICE_LESS_THAN_ZERO
2139
+ '-4002': BadRequest, # PRICE_GREATER_THAN_MAX_PRICE
2140
+ '-4003': BadRequest, # QTY_LESS_THAN_ZERO
2141
+ '-4004': BadRequest, # QTY_LESS_THAN_MIN_QTY
2142
+ '-4005': BadRequest, # QTY_GREATER_THAN_MAX_QTY
2143
+ '-4013': BadRequest, # PRICE_LESS_THAN_MIN_PRICE
2144
+ '-4029': BadRequest, # INVALID TICK SIZE PRECISION
2145
+ '-4030': BadRequest, # INVALID_QTY_PRECISION
2146
+ '-4055': BadRequest, # AMOUNT_MUST_BE_POSITIVE
2147
+ },
2148
+ },
2149
+ 'portfolioMargin': {
2150
+ 'exact': {
2151
+ '-1000': OperationFailed, # {"code":-1000,"msg":"An unknown error occured while processing the request."}
2152
+ '-1001': OperationFailed, # {"code":-1001,"msg":"'Internal error; unable to process your request. Please try again.'"}
2153
+ '-1002': AuthenticationError, # {"code":-1002,"msg":"'You are not authorized to execute self request.'"}
2154
+ '-1003': RateLimitExceeded, # {"code":-1003,"msg":"Too much request weight used, current limit is 1200 request weight per 1 MINUTE. Please use the websocket for live updates to avoid polling the API."}
2155
+ '-1004': OperationRejected, # DUPLICATE_IP : This IP is already on the white list
2156
+ '-1005': PermissionDenied, # {"code":-1005,"msg":"No such IP has been white listed"}
2157
+ '-1006': OperationFailed, # {"code":-1006,"msg":"An unexpected response was received from the message bus. Execution status unknown."}
2158
+ '-1007': RequestTimeout, # {"code":-1007,"msg":"Timeout waiting for response from backend server. Send status unknown; execution status unknown."}
2159
+ '-1010': OperationFailed, # {"code":-1010,"msg":"ERROR_MSG_RECEIVED."}
2160
+ '-1011': PermissionDenied, # {"code":-1011,"msg":"This IP cannot access self route."}
2161
+ '-1013': OperationFailed, #
2162
+ '-1014': InvalidOrder, # {"code":-1014,"msg":"Unsupported order combination."}
2163
+ '-1015': RateLimitExceeded, # {"code":-1015,"msg":"'Too many new orders; current limit is %s orders per %s.'"}
2164
+ '-1016': BadRequest, # {"code":-1016,"msg":"'This service is no longer available.',"}
2165
+ '-1020': BadRequest, # {"code":-1020,"msg":"'This operation is not supported.'"}
2166
+ '-1021': InvalidNonce, # {"code":-1021,"msg":"'your time is ahead of server'"}
2167
+ '-1022': AuthenticationError, # {"code":-1022,"msg":"Signature for self request is not valid."}
2168
+ '-1023': BadRequest, # START_TIME_GREATER_THAN_END_TIME
2169
+ '-1100': BadRequest, # {"code":-1100,"msg":"createOrder(symbol, 1, asdf) -> 'Illegal characters found in parameter 'price'"}
2170
+ '-1101': BadRequest, # {"code":-1101,"msg":"Too many parameters; expected %s and received %s."}
2171
+ '-1102': BadRequest, # {"code":-1102,"msg":"Param %s or %s must be sent, but both were empty"}
2172
+ '-1103': BadRequest, # {"code":-1103,"msg":"An unknown parameter was sent."}
2173
+ '-1104': BadRequest, # {"code":-1104,"msg":"Not all sent parameters were read, read 8 parameters but was sent 9"}
2174
+ '-1105': BadRequest, # {"code":-1105,"msg":"Parameter %s was empty."}
2175
+ '-1106': BadRequest, # {"code":-1106,"msg":"Parameter %s sent when not required."}
2176
+ '-1108': BadSymbol, # BAD_ASSET
2177
+ '-1109': BadRequest, # BAD_ACCOUNT
2178
+ '-1110': BadSymbol, # BAD_INSTRUMENT_TYPE
2179
+ '-1111': BadRequest, # {"code":-1111,"msg":"Precision is over the maximum defined for self asset."}
2180
+ '-1112': OperationFailed, # {"code":-1112,"msg":"No orders on book for symbol."}
2181
+ '-1113': BadRequest, # {"code":-1113,"msg":"Withdrawal amount must be negative."}
2182
+ '-1114': BadRequest, # {"code":-1114,"msg":"TimeInForce parameter sent when not required."}
2183
+ '-1115': BadRequest, # {"code":-1115,"msg":"Invalid timeInForce."}
2184
+ '-1116': BadRequest, # {"code":-1116,"msg":"Invalid orderType."}
2185
+ '-1117': BadRequest, # {"code":-1117,"msg":"Invalid side."}
2186
+ '-1118': BadRequest, # {"code":-1118,"msg":"New client order ID was empty."}
2187
+ '-1119': BadRequest, # {"code":-1119,"msg":"Original client order ID was empty."}
2188
+ '-1120': BadRequest, # {"code":-1120,"msg":"Invalid interval."}
2189
+ '-1121': BadSymbol, # {"code":-1121,"msg":"Invalid symbol."}
2190
+ '-1125': AuthenticationError, # {"code":-1125,"msg":"This listenKey does not exist."}
2191
+ '-1127': BadRequest, # {"code":-1127,"msg":"More than %s hours between startTime and endTime."}
2192
+ '-1128': BadRequest, # {"code":-1128,"msg":"Combination of optional parameters invalid."}
2193
+ '-1130': BadRequest, # {"code":-1130,"msg":"Data sent for paramter %s is not valid."}
2194
+ '-1136': BadRequest, # INVALID_NEW_ORDER_RESP_TYPE
2195
+ '-2010': InvalidOrder, # NEW_ORDER_REJECTED
2196
+ '-2011': OrderNotFound, # {"code":-2011,"msg":"cancelOrder(1, 'BTC/USDT') -> 'UNKNOWN_ORDER'"}
2197
+ '-2013': OrderNotFound, # {"code":-2013,"msg":"fetchOrder(1, 'BTC/USDT') -> 'Order does not exist'"}
2198
+ '-2014': AuthenticationError, # {"code":-2014,"msg":"API-key format invalid."}
2199
+ '-2015': AuthenticationError, # {"code":-2015,"msg":"Invalid API-key, IP, or permissions for action."}
2200
+ '-2016': OperationRejected, # {"code":-2016,"msg":"No trading window could be found for the symbol. Try ticker/24hrs instead."}
2201
+ '-2018': InsufficientFunds, # {"code":-2018,"msg":"Balance is insufficient"}
2202
+ '-2019': InsufficientFunds, # Margin is insufficient
2203
+ '-2020': OrderNotFillable, # UNABLE_TO_FILL
2204
+ '-2021': OrderImmediatelyFillable, # Order would immediately trigger.
2205
+ '-2022': InvalidOrder, # ReduceOnly Order is rejected
2206
+ '-2023': OperationFailed, # User in liquidation mode now
2207
+ '-2024': OperationRejected, # Position is not sufficient
2208
+ '-2025': OperationRejected, # Reach max open order limit.
2209
+ '-2026': InvalidOrder, # This OrderType is not supported when reduceOnly.
2210
+ '-2027': OperationRejected, # Exceeded the maximum allowable position at current leverage.
2211
+ '-2028': OperationRejected, # Leverage is smaller than permitted: insufficient margin balance.
2212
+ '-4000': InvalidOrder, # INVALID_ORDER_STATUS
2213
+ '-4001': BadRequest, # PRICE_LESS_THAN_ZERO
2214
+ '-4002': BadRequest, # PRICE_GREATER_THAN_MAX_PRICE
2215
+ '-4003': BadRequest, # QTY_LESS_THAN_ZERO
2216
+ '-4004': BadRequest, # QTY_LESS_THAN_MIN_QTY
2217
+ '-4005': BadRequest, # QTY_GREATER_THAN_MAX_QTY
2218
+ '-4006': BadRequest, # STOP_PRICE_LESS_THAN_ZERO
2219
+ '-4007': BadRequest, # STOP_PRICE_GREATER_THAN_MAX_PRICE
2220
+ '-4008': BadRequest, # TICK SIZE LESS THAN ZERO
2221
+ '-4009': BadRequest, # MAX_PRICE_LESS_THAN_MIN_PRICE
2222
+ '-4010': BadRequest, # MAX_QTY_LESS_THAN_MIN_QTY
2223
+ '-4011': BadRequest, # STEP_SIZE_LESS_THAN_ZERO
2224
+ '-4012': BadRequest, # MAX_NUM_ORDERS_LESS_THAN_ZERO
2225
+ '-4013': BadRequest, # PRICE_LESS_THAN_MIN_PRICE
2226
+ '-4014': BadRequest, # PRICE NOT INCREASED BY TICK SIZE
2227
+ '-4015': BadRequest, # Client order id is not valid
2228
+ '-4016': BadRequest, # Price is higher than mark price multiplier cap.
2229
+ '-4017': BadRequest, # MULTIPLIER_UP_LESS_THAN_ZERO
2230
+ '-4018': BadRequest, # MULTIPLIER_DOWN_LESS_THAN_ZERO
2231
+ '-4019': OperationRejected, # COMPOSITE_SCALE_OVERFLOW
2232
+ '-4020': BadRequest, # TARGET_STRATEGY_INVALID
2233
+ '-4021': BadRequest, # INVALID_DEPTH_LIMIT
2234
+ '-4022': BadRequest, # WRONG_MARKET_STATUS
2235
+ '-4023': BadRequest, # QTY_NOT_INCREASED_BY_STEP_SIZE
2236
+ '-4024': BadRequest, # PRICE_LOWER_THAN_MULTIPLIER_DOWN
2237
+ '-4025': BadRequest, # MULTIPLIER_DECIMAL_LESS_THAN_ZERO
2238
+ '-4026': BadRequest, # COMMISSION_INVALID
2239
+ '-4027': BadRequest, # INVALID_ACCOUNT_TYPE
2240
+ '-4028': BadRequest, # INVALID_LEVERAGE
2241
+ '-4029': BadRequest, # INVALID TICK SIZE PRECISION
2242
+ '-4030': BadRequest, # INVALID_STEP_SIZE_PRECISION
2243
+ '-4031': BadRequest, # INVALID_WORKING_TYPE
2244
+ '-4032': OperationRejected, # EXCEED_MAX_CANCEL_ORDER_SIZE
2245
+ '-4033': BadRequest, # INSURANCE_ACCOUNT_NOT_FOUND
2246
+ '-4044': BadRequest, # INVALID_BALANCE_TYPE
2247
+ '-4045': OperationRejected, # MAX_STOP_ORDER_EXCEEDED
2248
+ '-4046': OperationRejected, # NO_NEED_TO_CHANGE_MARGIN_TYPE
2249
+ '-4047': OperationRejected, # Margin type cannot be changed if there exists open orders.
2250
+ '-4048': OperationRejected, # Margin type cannot be changed if there exists position.
2251
+ '-4049': BadRequest, # Add margin only support for isolated position.
2252
+ '-4050': InsufficientFunds, # Cross balance insufficient
2253
+ '-4051': InsufficientFunds, # Isolated balance insufficient.
2254
+ '-4052': OperationRejected, # No need to change auto add margin.
2255
+ '-4053': BadRequest, # Auto add margin only support for isolated position.
2256
+ '-4054': OperationRejected, # Cannot add position margin: position is 0.
2257
+ '-4055': BadRequest, # Amount must be positive.
2258
+ '-4056': AuthenticationError, # Invalid api key type.
2259
+ '-4057': AuthenticationError, # Invalid api public key
2260
+ '-4058': BadRequest, # MAX_PRICE_TOO_LARGE
2261
+ '-4059': OperationRejected, # NO_NEED_TO_CHANGE_POSITION_SIDE
2262
+ '-4060': BadRequest, # INVALID_POSITION_SIDE
2263
+ '-4061': BadRequest, # POSITION_SIDE_NOT_MATCH
2264
+ '-4062': BadRequest, # REDUCE_ONLY_CONFLICT
2265
+ '-4063': BadRequest, # INVALID_OPTIONS_REQUEST_TYPE
2266
+ '-4064': BadRequest, # INVALID_OPTIONS_TIME_FRAME
2267
+ '-4065': BadRequest, # INVALID_OPTIONS_AMOUNT
2268
+ '-4066': BadRequest, # INVALID_OPTIONS_EVENT_TYPE
2269
+ '-4067': OperationRejected, # Position side cannot be changed if there exists open orders.
2270
+ '-4068': OperationRejected, # Position side cannot be changed if there exists position.
2271
+ '-4069': BadRequest, # Position INVALID_OPTIONS_PREMIUM_FEE
2272
+ '-4070': BadRequest, # Client options id is not valid.
2273
+ '-4071': BadRequest, # Invalid options direction
2274
+ '-4072': OperationRejected, # premium fee is not updated, reject order
2275
+ '-4073': BadRequest, # OPTIONS_PREMIUM_INPUT_LESS_THAN_ZERO
2276
+ '-4074': BadRequest, # Order amount is bigger than upper boundary or less than 0, reject order
2277
+ '-4075': BadRequest, # output premium fee is less than 0, reject order
2278
+ '-4076': OperationRejected, # original fee is too much higher than last fee
2279
+ '-4077': OperationRejected, # place order amount has reached to limit, reject order
2280
+ '-4078': OperationFailed, # options internal error
2281
+ '-4079': BadRequest, # invalid options id
2282
+ '-4080': PermissionDenied, # user not found with id: %s
2283
+ '-4081': BadRequest, # OPTIONS_NOT_FOUND
2284
+ '-4082': BadRequest, # Invalid number of batch place orders
2285
+ '-4083': OperationFailed, # Fail to place batch orders.
2286
+ '-4084': BadRequest, # UPCOMING_METHOD
2287
+ '-4085': BadRequest, # Invalid notional limit coefficient
2288
+ '-4086': BadRequest, # Invalid price spread threshold
2289
+ '-4087': PermissionDenied, # User can only place reduce only order
2290
+ '-4088': PermissionDenied, # User can not place order currently
2291
+ '-4104': BadRequest, # INVALID_CONTRACT_TYPE
2292
+ '-4114': BadRequest, # INVALID_CLIENT_TRAN_ID_LEN
2293
+ '-4115': BadRequest, # DUPLICATED_CLIENT_TRAN_ID
2294
+ '-4118': OperationRejected, # REDUCE_ONLY_MARGIN_CHECK_FAILED
2295
+ '-4131': OperationRejected, # The counterparty's best price does not meet the PERCENT_PRICE filter limit
2296
+ '-4135': BadRequest, # Invalid activation price
2297
+ '-4137': BadRequest, # Quantity must be zero with closePosition equals True
2298
+ '-4138': BadRequest, # Reduce only must be True with closePosition equals True
2299
+ '-4139': BadRequest, # Order type can not be market if it's unable to cancel
2300
+ '-4140': BadRequest, # Invalid symbol status for opening position
2301
+ '-4141': BadRequest, # Symbol is closed
2302
+ '-4142': OrderImmediatelyFillable, # REJECT: take profit or stop order will be triggered immediately
2303
+ '-4144': BadSymbol, # Invalid pair
2304
+ '-4161': OperationRejected, # Leverage reduction is not supported in Isolated Margin Mode with open positions
2305
+ '-4164': OperationRejected, # Leverage reduction is not supported in Isolated Margin Mode with open positions
2306
+ '-4165': BadRequest, # Invalid time interval
2307
+ '-4183': BadRequest, # Price is higher than stop price multiplier cap.
2308
+ '-4184': BadRequest, # Price is lower than stop price multiplier floor.
2309
+ '-5021': OrderNotFillable, # Due to the order could not be filled immediately, the FOK order has been rejected.
2310
+ '-5022': OrderNotFillable, # Due to the order could not be executed, the Post Only order will be rejected.
2311
+ },
2312
+ },
1459
2313
  'exact': {
1460
2314
  'System is under maintenance.': OnMaintenance, # {"code":1,"msg":"System is under maintenance."}
1461
- 'System abnormality': ExchangeError, # {"code":-1000,"msg":"System abnormality"}
2315
+ 'System abnormality': OperationFailed, # {"code":-1000,"msg":"System abnormality"}
1462
2316
  'You are not authorized to execute self request.': PermissionDenied, # {"msg":"You are not authorized to execute self request."}
1463
2317
  'API key does not exist': AuthenticationError,
1464
2318
  'Order would trigger immediately.': OrderImmediatelyFillable,
1465
2319
  'Stop price would trigger immediately.': OrderImmediatelyFillable, # {"code":-2010,"msg":"Stop price would trigger immediately."}
1466
2320
  'Order would immediately match and take.': OrderImmediatelyFillable, # {"code":-2010,"msg":"Order would immediately match and take."}
1467
2321
  'Account has insufficient balance for requested action.': InsufficientFunds,
1468
- 'Rest API trading is not enabled.': ExchangeNotAvailable,
1469
- 'This account may not place or cancel orders.': ExchangeNotAvailable,
2322
+ 'Rest API trading is not enabled.': PermissionDenied,
2323
+ 'This account may not place or cancel orders.': PermissionDenied,
1470
2324
  "You don't have permission.": PermissionDenied, # {"msg":"You don't have permission.","success":false}
1471
- 'Market is closed.': ExchangeNotAvailable, # {"code":-1013,"msg":"Market is closed."}
1472
- 'Too many requests. Please try again later.': DDoSProtection, # {"msg":"Too many requests. Please try again later.","success":false}
2325
+ 'Market is closed.': OperationRejected, # {"code":-1013,"msg":"Market is closed."}
2326
+ 'Too many requests. Please try again later.': RateLimitExceeded, # {"msg":"Too many requests. Please try again later.","success":false}
1473
2327
  'This action is disabled on self account.': AccountSuspended, # {"code":-2011,"msg":"This action is disabled on self account."}
1474
2328
  'Limit orders require GTC for self phase.': BadRequest,
1475
2329
  'This order type is not hasattr(self, possible) trading phase.': BadRequest,
1476
- 'This type of sub-account exceeds the maximum number limit': BadRequest, # {"code":-9000,"msg":"This type of sub-account exceeds the maximum number limit"}
2330
+ 'This type of sub-account exceeds the maximum number limit': OperationRejected, # {"code":-9000,"msg":"This type of sub-account exceeds the maximum number limit"}
1477
2331
  'This symbol is restricted for self account.': PermissionDenied,
1478
2332
  'This symbol is not permitted for self account.': PermissionDenied, # {"code":-2010,"msg":"This symbol is not permitted for self account."}
1479
- '-1000': ExchangeNotAvailable, # {"code":-1000,"msg":"An unknown error occured while processing the request."}
1480
- '-1001': ExchangeNotAvailable, # {"code":-1001,"msg":"'Internal error; unable to process your request. Please try again.'"}
1481
- '-1002': AuthenticationError, # {"code":-1002,"msg":"'You are not authorized to execute self request.'"}
1482
- '-1003': RateLimitExceeded, # {"code":-1003,"msg":"Too much request weight used, current limit is 1200 request weight per 1 MINUTE. Please use the websocket for live updates to avoid polling the API."}
1483
- '-1004': DDoSProtection, # {"code":-1004,"msg":"Server is busy, please wait and try again"}
1484
- '-1005': PermissionDenied, # {"code":-1005,"msg":"No such IP has been white listed"}
1485
- '-1006': BadResponse, # {"code":-1006,"msg":"An unexpected response was received from the message bus. Execution status unknown."}
1486
- '-1007': RequestTimeout, # {"code":-1007,"msg":"Timeout waiting for response from backend server. Send status unknown; execution status unknown."}
1487
- '-1010': BadResponse, # {"code":-1010,"msg":"ERROR_MSG_RECEIVED."}
1488
- '-1011': PermissionDenied, # {"code":-1011,"msg":"This IP cannot access self route."}
1489
- '-1013': InvalidOrder, # {"code":-1013,"msg":"createOrder -> 'invalid quantity'/'invalid price'/MIN_NOTIONAL"}
1490
- '-1014': InvalidOrder, # {"code":-1014,"msg":"Unsupported order combination."}
1491
- '-1015': RateLimitExceeded, # {"code":-1015,"msg":"'Too many new orders; current limit is %s orders per %s.'"}
1492
- '-1016': ExchangeNotAvailable, # {"code":-1016,"msg":"'This service is no longer available.',"}
1493
- '-1020': BadRequest, # {"code":-1020,"msg":"'This operation is not supported.'"}
1494
- '-1021': InvalidNonce, # {"code":-1021,"msg":"'your time is ahead of server'"}
1495
- '-1022': AuthenticationError, # {"code":-1022,"msg":"Signature for self request is not valid."}
1496
- '-1023': BadRequest, # {"code":-1023,"msg":"Start time is greater than end time."}
1497
- '-1099': AuthenticationError, # {"code":-1099,"msg":"Not found, authenticated, or authorized"}
1498
- '-1100': BadRequest, # {"code":-1100,"msg":"createOrder(symbol, 1, asdf) -> 'Illegal characters found in parameter 'price'"}
1499
- '-1101': BadRequest, # {"code":-1101,"msg":"Too many parameters; expected %s and received %s."}
1500
- '-1102': BadRequest, # {"code":-1102,"msg":"Param %s or %s must be sent, but both were empty"}
1501
- '-1103': BadRequest, # {"code":-1103,"msg":"An unknown parameter was sent."}
1502
- '-1104': BadRequest, # {"code":-1104,"msg":"Not all sent parameters were read, read 8 parameters but was sent 9"}
1503
- '-1105': BadRequest, # {"code":-1105,"msg":"Parameter %s was empty."}
1504
- '-1106': BadRequest, # {"code":-1106,"msg":"Parameter %s sent when not required."}
1505
- '-1108': BadRequest, # {"code":-1108,"msg":"Invalid asset."}
1506
- '-1109': AuthenticationError, # {"code":-1109,"msg":"Invalid account."}
1507
- '-1110': BadRequest, # {"code":-1110,"msg":"Invalid symbolType."}
1508
- '-1111': BadRequest, # {"code":-1111,"msg":"Precision is over the maximum defined for self asset."}
1509
- '-1112': InvalidOrder, # {"code":-1112,"msg":"No orders on book for symbol."}
1510
- '-1113': BadRequest, # {"code":-1113,"msg":"Withdrawal amount must be negative."}
1511
- '-1114': BadRequest, # {"code":-1114,"msg":"TimeInForce parameter sent when not required."}
1512
- '-1115': BadRequest, # {"code":-1115,"msg":"Invalid timeInForce."}
1513
- '-1116': BadRequest, # {"code":-1116,"msg":"Invalid orderType."}
1514
- '-1117': BadRequest, # {"code":-1117,"msg":"Invalid side."}
1515
- '-1118': BadRequest, # {"code":-1118,"msg":"New client order ID was empty."}
1516
- '-1119': BadRequest, # {"code":-1119,"msg":"Original client order ID was empty."}
1517
- '-1120': BadRequest, # {"code":-1120,"msg":"Invalid interval."}
1518
- '-1121': BadSymbol, # {"code":-1121,"msg":"Invalid symbol."}
1519
- '-1125': AuthenticationError, # {"code":-1125,"msg":"This listenKey does not exist."}
1520
- '-1127': BadRequest, # {"code":-1127,"msg":"More than %s hours between startTime and endTime."}
1521
- '-1128': BadRequest, # {"code":-1128,"msg":"{"code":-1128,"msg":"Combination of optional parameters invalid."}"}
1522
- '-1130': BadRequest, # {"code":-1130,"msg":"Data sent for paramter %s is not valid."}
1523
- '-1131': BadRequest, # {"code":-1131,"msg":"recvWindow must be less than 60000"}
1524
- '-1135': BadRequest, # This error code will occur if a parameter requiring a JSON object is invalid.
1525
- '-1136': BadRequest, # {"code":-1136,"msg":"Invalid newOrderRespType"}
1526
- '-2008': AuthenticationError, # {"code":-2008,"msg":"Invalid Api-Key ID."}
1527
- '-2010': ExchangeError, # {"code":-2010,"msg":"generic error code for createOrder -> 'Account has insufficient balance for requested action.', {"code":-2010,"msg":"Rest API trading is not enabled."}, etc..."}
1528
- '-2011': OrderNotFound, # {"code":-2011,"msg":"cancelOrder(1, 'BTC/USDT') -> 'UNKNOWN_ORDER'"}
1529
- '-2013': OrderNotFound, # {"code":-2013,"msg":"fetchOrder(1, 'BTC/USDT') -> 'Order does not exist'"}
1530
- '-2014': AuthenticationError, # {"code":-2014,"msg":"API-key format invalid."}
1531
- '-2015': AuthenticationError, # {"code":-2015,"msg":"Invalid API-key, IP, or permissions for action."}
1532
- '-2016': BadRequest, # {"code":-2016,"msg":"No trading window could be found for the symbol. Try ticker/24hrs instead."}
1533
- '-2018': InsufficientFunds, # {"code":-2018,"msg":"Balance is insufficient"}
1534
- '-2019': InsufficientFunds, # {"code":-2019,"msg":"Margin is insufficient."}
1535
- '-2020': OrderNotFillable, # {"code":-2020,"msg":"Unable to fill."}
1536
- '-2021': OrderImmediatelyFillable, # {"code":-2021,"msg":"Order would immediately trigger."}
1537
- '-2022': InvalidOrder, # {"code":-2022,"msg":"ReduceOnly Order is rejected."}
1538
- '-2023': InsufficientFunds, # {"code":-2023,"msg":"User in liquidation mode now."}
1539
- '-2024': InsufficientFunds, # {"code":-2024,"msg":"Position is not sufficient."}
1540
- '-2025': InvalidOrder, # {"code":-2025,"msg":"Reach max open order limit."}
1541
- '-2026': InvalidOrder, # {"code":-2026,"msg":"This OrderType is not supported when reduceOnly."}
1542
- '-2027': InvalidOrder, # {"code":-2027,"msg":"Exceeded the maximum allowable position at current leverage."}
1543
- '-2028': InsufficientFunds, # {"code":-2028,"msg":"Leverage is smaller than permitted: insufficient margin balance"}
1544
- '-3000': ExchangeError, # {"code":-3000,"msg":"Internal server error."}
1545
- '-3001': AuthenticationError, # {"code":-3001,"msg":"Please enable 2FA first."}
1546
- '-3002': BadSymbol, # {"code":-3002,"msg":"We don't have self asset."}
1547
- '-3003': BadRequest, # {"code":-3003,"msg":"Margin account does not exist."}
1548
- '-3004': ExchangeError, # {"code":-3004,"msg":"Trade not allowed."}
1549
- '-3005': InsufficientFunds, # {"code":-3005,"msg":"Transferring out not allowed. Transfer out amount exceeds max amount."}
1550
- '-3006': InsufficientFunds, # {"code":-3006,"msg":"Your borrow amount has exceed maximum borrow amount."}
1551
- '-3007': ExchangeError, # {"code":-3007,"msg":"You have pending transaction, please try again later.."}
1552
- '-3008': InsufficientFunds, # {"code":-3008,"msg":"Borrow not allowed. Your borrow amount has exceed maximum borrow amount."}
1553
- '-3009': BadRequest, # {"code":-3009,"msg":"This asset are not allowed to transfer into margin account currently."}
1554
- '-3010': BadRequest, # {"code":-3010,"msg":"Repay not allowed. Repay amount exceeds borrow amount."}
1555
- '-3011': BadRequest, # {"code":-3011,"msg":"Your input date is invalid."}
1556
- '-3012': InsufficientFunds, # {"code":-3012,"msg":"Borrow is banned for self asset."}
1557
- '-3013': BadRequest, # {"code":-3013,"msg":"Borrow amount less than minimum borrow amount."}
1558
- '-3014': AccountSuspended, # {"code":-3014,"msg":"Borrow is banned for self account."}
1559
- '-3015': BadRequest, # {"code":-3015,"msg":"Repay amount exceeds borrow amount."}
1560
- '-3016': BadRequest, # {"code":-3016,"msg":"Repay amount less than minimum repay amount."}
1561
- '-3017': ExchangeError, # {"code":-3017,"msg":"This asset are not allowed to transfer into margin account currently."}
1562
- '-3018': AccountSuspended, # {"code":-3018,"msg":"Transferring in has been banned for self account."}
1563
- '-3019': AccountSuspended, # {"code":-3019,"msg":"Transferring out has been banned for self account."}
1564
- '-3020': InsufficientFunds, # {"code":-3020,"msg":"Transfer out amount exceeds max amount."}
1565
- '-3021': BadRequest, # {"code":-3021,"msg":"Margin account are not allowed to trade self trading pair."}
1566
- '-3022': AccountSuspended, # {"code":-3022,"msg":"You account's trading is banned."}
1567
- '-3023': BadRequest, # {"code":-3023,"msg":"You can't transfer out/place order under current margin level."}
1568
- '-3024': ExchangeError, # {"code":-3024,"msg":"The unpaid debt is too small after self repayment."}
1569
- '-3025': BadRequest, # {"code":-3025,"msg":"Your input date is invalid."}
1570
- '-3026': BadRequest, # {"code":-3026,"msg":"Your input param is invalid."}
1571
- '-3027': BadSymbol, # {"code":-3027,"msg":"Not a valid margin asset."}
1572
- '-3028': BadSymbol, # {"code":-3028,"msg":"Not a valid margin pair."}
1573
- '-3029': ExchangeError, # {"code":-3029,"msg":"Transfer failed."}
1574
- '-3036': AccountSuspended, # {"code":-3036,"msg":"This account is not allowed to repay."}
1575
- '-3037': ExchangeError, # {"code":-3037,"msg":"PNL is clearing. Wait a second."}
1576
- '-3038': BadRequest, # {"code":-3038,"msg":"Listen key not found."}
1577
- '-3041': InsufficientFunds, # {"code":-3041,"msg":"Balance is not enough"}
1578
- '-3042': BadRequest, # {"code":-3042,"msg":"PriceIndex not available for self margin pair."}
1579
- '-3043': BadRequest, # {"code":-3043,"msg":"Transferring in not allowed."}
1580
- '-3044': DDoSProtection, # {"code":-3044,"msg":"System busy."}
1581
- '-3045': ExchangeError, # {"code":-3045,"msg":"The system doesn't have enough asset now."}
1582
- '-3999': ExchangeError, # {"code":-3999,"msg":"This function is only available for invited users."}
1583
- '-4001': BadRequest, # {"code":-4001 ,"msg":"Invalid operation."}
1584
- '-4002': BadRequest, # {"code":-4002 ,"msg":"Invalid get."}
1585
- '-4003': BadRequest, # {"code":-4003 ,"msg":"Your input email is invalid."}
1586
- '-4004': AuthenticationError, # {"code":-4004,"msg":"You don't login or auth."}
1587
- '-4005': RateLimitExceeded, # {"code":-4005 ,"msg":"Too many new requests."}
1588
- '-4006': BadRequest, # {"code":-4006 ,"msg":"Support main account only."}
1589
- '-4007': BadRequest, # {"code":-4007 ,"msg":"Address validation is not passed."}
1590
- '-4008': BadRequest, # {"code":-4008 ,"msg":"Address tag validation is not passed."}
1591
- '-4010': BadRequest, # {"code":-4010 ,"msg":"White list mail has been confirmed."} # [TODO] possible bug: it should probably be "has not been confirmed"
1592
- '-4011': BadRequest, # {"code":-4011 ,"msg":"White list mail is invalid."}
1593
- '-4012': BadRequest, # {"code":-4012 ,"msg":"White list is not opened."}
1594
- '-4013': AuthenticationError, # {"code":-4013 ,"msg":"2FA is not opened."}
1595
- '-4014': PermissionDenied, # {"code":-4014 ,"msg":"Withdraw is not allowed within 2 min login."}
1596
- '-4015': ExchangeError, # {"code":-4015 ,"msg":"Withdraw is limited."}
1597
- '-4016': PermissionDenied, # {"code":-4016 ,"msg":"Within 24 hours after password modification, withdrawal is prohibited."} | on swap: {"code":-4016,"msg":"Limit price can't be higher than 27330.52."}
1598
- '-4017': PermissionDenied, # {"code":-4017 ,"msg":"Within 24 hours after the release of 2FA, withdrawal is prohibited."}
1599
- '-4018': BadSymbol, # {"code":-4018,"msg":"We don't have self asset."}
1600
- '-4019': BadSymbol, # {"code":-4019,"msg":"Current asset is not open for withdrawal."}
1601
- '-4021': BadRequest, # {"code":-4021,"msg":"Asset withdrawal must be an %s multiple of %s."}
1602
- '-4022': BadRequest, # {"code":-4022,"msg":"Not less than the minimum pick-up quantity %s."}
1603
- '-4023': ExchangeError, # {"code":-4023,"msg":"Within 24 hours, the withdrawal exceeds the maximum amount."}
1604
- '-4024': InsufficientFunds, # {"code":-4024,"msg":"You don't have self asset."}
1605
- '-4025': InsufficientFunds, # {"code":-4025,"msg":"The number of hold asset is less than zero."}
1606
- '-4026': InsufficientFunds, # {"code":-4026,"msg":"You have insufficient balance."}
1607
- '-4027': ExchangeError, # {"code":-4027,"msg":"Failed to obtain tranId."}
1608
- '-4028': BadRequest, # {"code":-4028,"msg":"The amount of withdrawal must be greater than the Commission."}
1609
- '-4029': BadRequest, # {"code":-4029,"msg":"The withdrawal record does not exist."}
1610
- '-4030': ExchangeError, # {"code":-4030,"msg":"Confirmation of successful asset withdrawal. [TODO] possible bug in docs"}
1611
- '-4031': ExchangeError, # {"code":-4031,"msg":"Cancellation failed."}
1612
- '-4032': ExchangeError, # {"code":-4032,"msg":"Withdraw verification exception."}
1613
- '-4033': BadRequest, # {"code":-4033,"msg":"Illegal address."}
1614
- '-4034': ExchangeError, # {"code":-4034,"msg":"The address is suspected of fake."}
1615
- '-4035': PermissionDenied, # {"code":-4035,"msg":"This address is not on the whitelist. Please join and try again."}
1616
- '-4036': BadRequest, # {"code":-4036,"msg":"The new address needs to be withdrawn in {0} hours."}
1617
- '-4037': ExchangeError, # {"code":-4037,"msg":"Re-sending Mail failed."}
1618
- '-4038': ExchangeError, # {"code":-4038,"msg":"Please try again in 5 minutes."}
1619
- '-4039': BadRequest, # {"code":-4039,"msg":"The user does not exist."}
1620
- '-4040': BadRequest, # {"code":-4040,"msg":"This address not charged."}
1621
- '-4041': ExchangeError, # {"code":-4041,"msg":"Please try again in one minute."}
1622
- '-4042': ExchangeError, # {"code":-4042,"msg":"This asset cannot get deposit address again."}
1623
- '-4043': BadRequest, # {"code":-4043,"msg":"More than 100 recharge addresses were used in 24 hours."}
1624
- '-4044': BadRequest, # {"code":-4044,"msg":"This is a blacklist country."}
1625
- '-4045': ExchangeError, # {"code":-4045,"msg":"Failure to acquire assets."}
1626
- '-4046': AuthenticationError, # {"code":-4046,"msg":"Agreement not confirmed."}
1627
- '-4047': BadRequest, # {"code":-4047,"msg":"Time interval must be within 0-90 days"}
1628
- '-4054': BadRequest, # {"code":-4054,"msg":"Cannot add position margin: position is 0."}
1629
- '-4164': InvalidOrder, # {"code":-4164,"msg":"Order's notional must be no smaller than 5(unless you choose reduce only)."}
1630
- '-5001': BadRequest, # {"code":-5001,"msg":"Don't allow transfer to micro assets."}
1631
- '-5002': InsufficientFunds, # {"code":-5002,"msg":"You have insufficient balance."}
1632
- '-5003': InsufficientFunds, # {"code":-5003,"msg":"You don't have self asset."}
1633
- '-5004': BadRequest, # {"code":-5004,"msg":"The residual balances of %s have exceeded 0.001BTC, Please re-choose."}
1634
- '-5005': InsufficientFunds, # {"code":-5005,"msg":"The residual balances of %s is too low, Please re-choose."}
1635
- '-5006': BadRequest, # {"code":-5006,"msg":"Only transfer once in 24 hours."}
1636
- '-5007': BadRequest, # {"code":-5007,"msg":"Quantity must be greater than zero."}
1637
- '-5008': InsufficientFunds, # {"code":-5008,"msg":"Insufficient amount of returnable assets."}
1638
- '-5009': BadRequest, # {"code":-5009,"msg":"Product does not exist."}
1639
- '-5010': ExchangeError, # {"code":-5010,"msg":"Asset transfer fail."}
1640
- '-5011': BadRequest, # {"code":-5011,"msg":"future account not exists."}
1641
- '-5012': ExchangeError, # {"code":-5012,"msg":"Asset transfer is in pending."}
1642
- '-5013': InsufficientFunds, # {"code":-5013,"msg":"Asset transfer failed: insufficient balance""} # undocumented
1643
- '-5021': BadRequest, # {"code":-5021,"msg":"This parent sub have no relation"}
1644
- '-6001': BadRequest, # {"code":-6001,"msg":"Daily product not exists."}
1645
- '-6003': BadRequest, # {"code":-6003,"msg":"Product not exist or you don't have permission"}
1646
- '-6004': ExchangeError, # {"code":-6004,"msg":"Product not in purchase status"}
1647
- '-6005': InvalidOrder, # {"code":-6005,"msg":"Smaller than min purchase limit"}
1648
- '-6006': BadRequest, # {"code":-6006,"msg":"Redeem amount error"}
1649
- '-6007': BadRequest, # {"code":-6007,"msg":"Not in redeem time"}
1650
- '-6008': BadRequest, # {"code":-6008,"msg":"Product not in redeem status"}
1651
- '-6009': RateLimitExceeded, # {"code":-6009,"msg":"Request frequency too high"}
1652
- '-6011': BadRequest, # {"code":-6011,"msg":"Exceeding the maximum num allowed to purchase per user"}
1653
- '-6012': InsufficientFunds, # {"code":-6012,"msg":"Balance not enough"}
1654
- '-6013': ExchangeError, # {"code":-6013,"msg":"Purchasing failed"}
1655
- '-6014': BadRequest, # {"code":-6014,"msg":"Exceed up-limit allowed to purchased"}
1656
- '-6015': BadRequest, # {"code":-6015,"msg":"Empty request body"}
1657
- '-6016': BadRequest, # {"code":-6016,"msg":"Parameter err"}
1658
- '-6017': BadRequest, # {"code":-6017,"msg":"Not in whitelist"}
1659
- '-6018': BadRequest, # {"code":-6018,"msg":"Asset not enough"}
1660
- '-6019': AuthenticationError, # {"code":-6019,"msg":"Need confirm"}
1661
- '-6020': BadRequest, # {"code":-6020,"msg":"Project not exists"}
1662
- '-7001': BadRequest, # {"code":-7001,"msg":"Date range is not supported."}
1663
- '-7002': BadRequest, # {"code":-7002,"msg":"Data request type is not supported."}
1664
- '-9000': InsufficientFunds, # {"code":-9000,"msg":"user have no avaliable amount"}"
1665
- '-10017': BadRequest, # {"code":-10017,"msg":"Repay amount should not be larger than liability."}
1666
- '-11008': InsufficientFunds, # {"code":-11008,"msg":"Exceeding the account's maximum borrowable limit."} # undocumented
1667
- '-12014': RateLimitExceeded, # {"code":-12014,"msg":"More than 1 request in 3 seconds"}
1668
- '-13000': BadRequest, # {"code":-13000,"msg":"Redeption of the token is forbiden now"}
1669
- '-13001': BadRequest, # {"code":-13001,"msg":"Exceeds individual 24h redemption limit of the token"}
1670
- '-13002': BadRequest, # {"code":-13002,"msg":"Exceeds total 24h redemption limit of the token"}
1671
- '-13003': BadRequest, # {"code":-13003,"msg":"Subscription of the token is forbiden now"}
1672
- '-13004': BadRequest, # {"code":-13004,"msg":"Exceeds individual 24h subscription limit of the token"}
1673
- '-13005': BadRequest, # {"code":-13005,"msg":"Exceeds total 24h subscription limit of the token"}
1674
- '-13006': InvalidOrder, # {"code":-13006,"msg":"Subscription amount is too small"}
1675
- '-13007': AuthenticationError, # {"code":-13007,"msg":"The Agreement is not signed"}
1676
- '-21001': BadRequest, # {"code":-21001,"msg":"USER_IS_NOT_UNIACCOUNT"}
1677
- '-21002': BadRequest, # {"code":-21002,"msg":"UNI_ACCOUNT_CANT_TRANSFER_FUTURE"}
1678
- '-21003': BadRequest, # {"code":-21003,"msg":"NET_ASSET_MUST_LTE_RATIO"}
1679
- '100001003': AuthenticationError, # {"code":100001003,"msg":"Verification failed"} # undocumented
1680
- '200003903': AuthenticationError, # {"code":200003903,"msg":"Your identity verification has been rejected. Please complete identity verification again."}
1681
2333
  },
1682
2334
  'broad': {
1683
2335
  'has no operation privilege': PermissionDenied,
1684
- 'MAX_POSITION': InvalidOrder, # {"code":-2010,"msg":"Filter failure: MAX_POSITION"}
2336
+ 'MAX_POSITION': BadRequest, # {"code":-2010,"msg":"Filter failure: MAX_POSITION"}
1685
2337
  },
1686
2338
  },
1687
2339
  })
@@ -2333,7 +2985,7 @@ class binance(Exchange, ImplicitAPI):
2333
2985
  if permissions[j] == 'TRD_GRP_003':
2334
2986
  active = False
2335
2987
  break
2336
- isMarginTradingAllowed = self.safe_value(market, 'isMarginTradingAllowed', False)
2988
+ isMarginTradingAllowed = self.safe_bool(market, 'isMarginTradingAllowed', False)
2337
2989
  unifiedType = None
2338
2990
  if spot:
2339
2991
  unifiedType = 'spot'
@@ -3021,7 +3673,7 @@ class binance(Exchange, ImplicitAPI):
3021
3673
  elif market['inverse']:
3022
3674
  response = await self.dapiPublicGetTicker24hr(self.extend(request, params))
3023
3675
  else:
3024
- rolling = self.safe_value(params, 'rolling', False)
3676
+ rolling = self.safe_bool(params, 'rolling', False)
3025
3677
  params = self.omit(params, 'rolling')
3026
3678
  if rolling:
3027
3679
  response = await self.publicGetTicker(self.extend(request, params))
@@ -4337,7 +4989,7 @@ class binance(Exchange, ImplicitAPI):
4337
4989
  method = 'eapiPrivatePostOrder'
4338
4990
  # support for testing orders
4339
4991
  if market['spot'] or marketType == 'margin':
4340
- test = self.safe_value(query, 'test', False)
4992
+ test = self.safe_bool(query, 'test', False)
4341
4993
  if test:
4342
4994
  method += 'Test'
4343
4995
  response = await getattr(self, method)(request)
@@ -4863,7 +5515,7 @@ class binance(Exchange, ImplicitAPI):
4863
5515
  params = self.omit(params, 'type')
4864
5516
  orders = await self.fetch_orders(symbol, since, None, params)
4865
5517
  filteredOrders = self.filter_by(orders, 'status', 'canceled')
4866
- return self.filter_by_limit(filteredOrders, limit)
5518
+ return self.filter_by_since_limit(filteredOrders, since, limit)
4867
5519
 
4868
5520
  async def cancel_order(self, id: str, symbol: Str = None, params={}):
4869
5521
  """
@@ -5340,7 +5992,7 @@ class binance(Exchange, ImplicitAPI):
5340
5992
  response = None
5341
5993
  request = {}
5342
5994
  legalMoney = self.safe_value(self.options, 'legalMoney', {})
5343
- fiatOnly = self.safe_value(params, 'fiat', False)
5995
+ fiatOnly = self.safe_bool(params, 'fiat', False)
5344
5996
  params = self.omit(params, 'fiatOnly')
5345
5997
  until = self.safe_integer(params, 'until')
5346
5998
  params = self.omit(params, 'until')
@@ -5439,7 +6091,7 @@ class binance(Exchange, ImplicitAPI):
5439
6091
  if paginate:
5440
6092
  return await self.fetch_paginated_call_dynamic('fetchWithdrawals', code, since, limit, params)
5441
6093
  legalMoney = self.safe_value(self.options, 'legalMoney', {})
5442
- fiatOnly = self.safe_value(params, 'fiat', False)
6094
+ fiatOnly = self.safe_bool(params, 'fiat', False)
5443
6095
  params = self.omit(params, 'fiatOnly')
5444
6096
  request = {}
5445
6097
  until = self.safe_integer(params, 'until')
@@ -8092,6 +8744,24 @@ class binance(Exchange, ImplicitAPI):
8092
8744
  url += '?' + self.urlencode(params)
8093
8745
  return {'url': url, 'method': method, 'body': body, 'headers': headers}
8094
8746
 
8747
+ def get_exceptions_by_url(self, url, exactOrBroad):
8748
+ marketType = None
8749
+ hostname = self.hostname if (self.hostname is not None) else 'binance.com'
8750
+ if url.startswith('https://api.' + hostname + '/'):
8751
+ marketType = 'spot'
8752
+ elif url.startswith('https://dapi.' + hostname + '/'):
8753
+ marketType = 'inverse'
8754
+ elif url.startswith('https://fapi.' + hostname + '/'):
8755
+ marketType = 'linear'
8756
+ elif url.startswith('https://eapi.' + hostname + '/'):
8757
+ marketType = 'option'
8758
+ elif url.startswith('https://papi.' + hostname + '/'):
8759
+ marketType = 'portfoliomargin'
8760
+ if marketType is not None:
8761
+ exceptionsForMarketType = self.safe_value(self.exceptions, marketType, {})
8762
+ return self.safe_value(exceptionsForMarketType, exactOrBroad, {})
8763
+ return {}
8764
+
8095
8765
  def handle_errors(self, code, reason, url, method, headers, body, response, requestHeaders, requestBody):
8096
8766
  if (code == 418) or (code == 429):
8097
8767
  raise DDoSProtection(self.id + ' ' + str(code) + ' ' + reason + ' ' + body)
@@ -8108,7 +8778,7 @@ class binance(Exchange, ImplicitAPI):
8108
8778
  if response is None:
8109
8779
  return None # fallback to default error handler
8110
8780
  # response in format {'msg': 'The coin does not exist.', 'success': True/false}
8111
- success = self.safe_value(response, 'success', True)
8781
+ success = self.safe_bool(response, 'success', True)
8112
8782
  if not success:
8113
8783
  messageNew = self.safe_string(response, 'msg')
8114
8784
  parsedMessage = None
@@ -8122,7 +8792,9 @@ class binance(Exchange, ImplicitAPI):
8122
8792
  response = parsedMessage
8123
8793
  message = self.safe_string(response, 'msg')
8124
8794
  if message is not None:
8795
+ self.throw_exactly_matched_exception(self.get_exceptions_by_url(url, 'exact'), message, self.id + ' ' + message)
8125
8796
  self.throw_exactly_matched_exception(self.exceptions['exact'], message, self.id + ' ' + message)
8797
+ self.throw_broadly_matched_exception(self.get_exceptions_by_url(url, 'broad'), message, self.id + ' ' + message)
8126
8798
  self.throw_broadly_matched_exception(self.exceptions['broad'], message, self.id + ' ' + message)
8127
8799
  # checks against error codes
8128
8800
  error = self.safe_string(response, 'code')
@@ -8144,6 +8816,7 @@ class binance(Exchange, ImplicitAPI):
8144
8816
  # POST https://fapi.binance.com/fapi/v1/marginType 400 Bad Request
8145
8817
  # binanceusdm {"code":-4046,"msg":"No need to change margin type."}
8146
8818
  raise MarginModeAlreadySet(feedback)
8819
+ self.throw_exactly_matched_exception(self.get_exceptions_by_url(url, 'exact'), error, feedback)
8147
8820
  self.throw_exactly_matched_exception(self.exceptions['exact'], error, feedback)
8148
8821
  raise ExchangeError(feedback)
8149
8822
  if not success:
@@ -8155,6 +8828,7 @@ class binance(Exchange, ImplicitAPI):
8155
8828
  element = response[0]
8156
8829
  errorCode = self.safe_string(element, 'code')
8157
8830
  if errorCode is not None:
8831
+ self.throw_exactly_matched_exception(self.get_exceptions_by_url(url, 'exact'), errorCode, self.id + ' ' + body)
8158
8832
  self.throw_exactly_matched_exception(self.exceptions['exact'], errorCode, self.id + ' ' + body)
8159
8833
  return None
8160
8834