ccxt 4.2.76__py2.py3-none-any.whl → 4.2.78__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 (57) hide show
  1. ccxt/__init__.py +1 -1
  2. ccxt/abstract/kucoin.py +1 -0
  3. ccxt/abstract/kucoinfutures.py +1 -0
  4. ccxt/async_support/__init__.py +1 -1
  5. ccxt/async_support/base/exchange.py +1 -1
  6. ccxt/async_support/binance.py +503 -444
  7. ccxt/async_support/bingx.py +1 -1
  8. ccxt/async_support/bitflyer.py +2 -2
  9. ccxt/async_support/bithumb.py +2 -2
  10. ccxt/async_support/blofin.py +11 -2
  11. ccxt/async_support/bybit.py +88 -52
  12. ccxt/async_support/coinbase.py +21 -10
  13. ccxt/async_support/delta.py +65 -51
  14. ccxt/async_support/deribit.py +2 -2
  15. ccxt/async_support/gate.py +3 -2
  16. ccxt/async_support/htx.py +34 -27
  17. ccxt/async_support/hyperliquid.py +7 -5
  18. ccxt/async_support/kraken.py +8 -8
  19. ccxt/async_support/kucoin.py +192 -5
  20. ccxt/async_support/okcoin.py +27 -1
  21. ccxt/async_support/okx.py +20 -2
  22. ccxt/async_support/woo.py +62 -3
  23. ccxt/base/exchange.py +9 -4
  24. ccxt/binance.py +503 -444
  25. ccxt/bingx.py +1 -1
  26. ccxt/bitflyer.py +2 -2
  27. ccxt/bithumb.py +2 -2
  28. ccxt/blofin.py +11 -2
  29. ccxt/bybit.py +88 -52
  30. ccxt/coinbase.py +21 -10
  31. ccxt/delta.py +65 -51
  32. ccxt/deribit.py +2 -2
  33. ccxt/gate.py +3 -2
  34. ccxt/htx.py +34 -27
  35. ccxt/hyperliquid.py +7 -5
  36. ccxt/kraken.py +8 -8
  37. ccxt/kucoin.py +192 -5
  38. ccxt/okcoin.py +27 -1
  39. ccxt/okx.py +20 -2
  40. ccxt/pro/__init__.py +1 -1
  41. ccxt/pro/ascendex.py +1 -1
  42. ccxt/pro/bitvavo.py +1 -1
  43. ccxt/pro/coinex.py +20 -14
  44. ccxt/pro/deribit.py +1 -1
  45. ccxt/pro/exmo.py +1 -1
  46. ccxt/pro/krakenfutures.py +1 -1
  47. ccxt/pro/phemex.py +1 -1
  48. ccxt/pro/poloniex.py +1 -1
  49. ccxt/pro/probit.py +1 -1
  50. ccxt/pro/woo.py +50 -6
  51. ccxt/test/test_async.py +9 -16
  52. ccxt/test/test_sync.py +9 -16
  53. ccxt/woo.py +62 -3
  54. {ccxt-4.2.76.dist-info → ccxt-4.2.78.dist-info}/METADATA +4 -4
  55. {ccxt-4.2.76.dist-info → ccxt-4.2.78.dist-info}/RECORD +57 -57
  56. {ccxt-4.2.76.dist-info → ccxt-4.2.78.dist-info}/WHEEL +0 -0
  57. {ccxt-4.2.76.dist-info → ccxt-4.2.78.dist-info}/top_level.txt +0 -0
@@ -8,7 +8,7 @@ from ccxt.abstract.binance import ImplicitAPI
8
8
  import asyncio
9
9
  import hashlib
10
10
  import json
11
- from ccxt.base.types import Balances, Currency, Greeks, Int, Leverage, Leverages, MarginMode, MarginModes, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
11
+ from ccxt.base.types import Balances, Currency, Greeks, Int, Leverage, Leverages, MarginMode, MarginModes, Market, MarketInterface, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
12
12
  from typing import List
13
13
  from ccxt.base.errors import ExchangeError
14
14
  from ccxt.base.errors import PermissionDenied
@@ -1483,63 +1483,30 @@ class binance(Exchange, ImplicitAPI):
1483
1483
  },
1484
1484
  'exceptions': {
1485
1485
  'spot': {
1486
- # https://binance-docs.github.io/apidocs/spot/en/#error-codes
1487
1486
  'exact': {
1488
- '-1000': OperationFailed, # {"code":-1000,"msg":"An unknown error occured while processing the request."}
1489
- '-1001': OperationFailed, # {"code":-1001,"msg":"'Internal error; unable to process your request. Please try again.'"}
1490
- '-1002': AuthenticationError, # {"code":-1002,"msg":"'You are not authorized to execute self request.'"}
1491
- '-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."}
1487
+ #
1488
+ # 1xxx
1489
+ #
1492
1490
  '-1004': OperationFailed, # {"code":-1004,"msg":"Server is busy, please wait and try again"}
1493
- '-1006': OperationFailed, # {"code":-1006,"msg":"An unexpected response was received from the message bus. Execution status unknown."}
1494
- '-1007': RequestTimeout, # {"code":-1007,"msg":"Timeout waiting for response from backend server. Send status unknown; execution status unknown."}
1495
1491
  '-1008': OperationFailed, # undocumented, but mentioned: This is sent whenever the servers are overloaded with requests.
1496
- '-1010': OperationFailed, # undocumented, but mentioned ERROR_MSG_RECEIVED
1497
- '-1013': OperationFailed, # undocumented, but mentioned
1498
- '-1014': InvalidOrder, # {"code":-1014,"msg":"Unsupported order combination."}
1499
- '-1015': RateLimitExceeded, # {"code":-1015,"msg":"'Too many new orders; current limit is %s orders per %s.'"}
1500
- '-1016': BadRequest, # {"code":-1016,"msg":"'This service is no longer available.',"}
1501
- '-1020': BadRequest, # {"code":-1020,"msg":"'This operation is not supported.'"}
1502
- '-1021': InvalidNonce, # {"code":-1021,"msg":"'your time is ahead of server'"}
1503
- '-1022': AuthenticationError, # {"code":-1022,"msg":"Signature for self request is not valid."}
1504
1492
  '-1099': AuthenticationError, # {"code":-1099,"msg":"Not found, authenticated, or authorized"}
1505
- '-1100': BadRequest, # {"code":-1100,"msg":"createOrder(symbol, 1, asdf) -> 'Illegal characters found in parameter 'price'"}
1506
- '-1101': BadRequest, # {"code":-1101,"msg":"Too many parameters; expected %s and received %s."}
1507
- '-1102': BadRequest, # {"code":-1102,"msg":"Param %s or %s must be sent, but both were empty"}
1508
- '-1103': BadRequest, # {"code":-1103,"msg":"An unknown parameter was sent."}
1509
- '-1104': BadRequest, # {"code":-1104,"msg":"Not all sent parameters were read, read 8 parameters but was sent 9"}
1510
- '-1105': BadRequest, # {"code":-1105,"msg":"Parameter %s was empty."}
1511
- '-1106': BadRequest, # {"code":-1106,"msg":"Parameter %s sent when not required."}
1512
1493
  '-1108': BadRequest, # undocumented, but mentioned: This error will occur if a value to a parameter being sent was too large, potentially causing overflow
1513
- '-1111': BadRequest, # {"code":-1111,"msg":"Precision is over the maximum defined for self asset."}
1514
- '-1112': OperationFailed, # {"code":-1112,"msg":"No orders on book for symbol."}
1515
- '-1114': BadRequest, # {"code":-1114,"msg":"TimeInForce parameter sent when not required."}
1516
- '-1115': BadRequest, # {"code":-1115,"msg":"Invalid timeInForce."}
1517
- '-1116': BadRequest, # {"code":-1116,"msg":"Invalid orderType."}
1518
- '-1117': BadRequest, # {"code":-1117,"msg":"Invalid side."}
1519
- '-1118': BadRequest, # {"code":-1118,"msg":"New client order ID was empty."}
1520
- '-1119': BadRequest, # {"code":-1119,"msg":"Original client order ID was empty."}
1521
- '-1120': BadRequest, # {"code":-1120,"msg":"Invalid interval."}
1522
- '-1121': BadSymbol, # {"code":-1121,"msg":"Invalid symbol."}
1523
- '-1125': AuthenticationError, # {"code":-1125,"msg":"This listenKey does not exist."}
1524
- '-1127': BadRequest, # {"code":-1127,"msg":"More than %s hours between startTime and endTime."}
1525
- '-1128': BadRequest, # {"code":-1128,"msg":"Combination of optional parameters invalid."}
1526
- '-1130': BadRequest, # {"code":-1130,"msg":"Data sent for paramter %s is not valid."}
1527
1494
  '-1131': BadRequest, # {"code":-1131,"msg":"recvWindow must be less than 60000"}
1528
1495
  '-1134': BadRequest, # strategyType was less than 1000000.
1529
1496
  '-1135': BadRequest, # undocumented, but mentioned: This error code will occur if a parameter requiring a JSON object is invalid.
1530
1497
  '-1145': BadRequest, # cancelRestrictions has to be either ONLY_NEW or ONLY_PARTIALLY_FILLED.
1531
1498
  '-1151': BadSymbol, # Symbol is present multiple times in the list.
1499
+ #
1500
+ # 2xxx
1501
+ #
1532
1502
  '-2008': AuthenticationError, # undocumented, Invalid Api-Key ID
1533
- '-2010': InvalidOrder, # NEW_ORDER_REJECTED
1534
- '-2011': OrderNotFound, # {"code":-2011,"msg":"cancelOrder(1, 'BTC/USDT') -> 'UNKNOWN_ORDER'"}
1535
- '-2013': OrderNotFound, # {"code":-2013,"msg":"fetchOrder(1, 'BTC/USDT') -> 'Order does not exist'"}
1536
- '-2014': AuthenticationError, # {"code":-2014,"msg":"API-key format invalid."}
1537
- '-2015': AuthenticationError, # {"code":-2015,"msg":"Invalid API-key, IP, or permissions for action."}
1538
1503
  '-2016': OperationRejected, # {"code":-2016,"msg":"No trading window could be found for the symbol. Try ticker/24hrs instead."}
1539
1504
  '-2021': BadResponse, # This code is sent when either the cancellation of the order failed or the new order placement failed but not both.
1540
1505
  '-2022': BadResponse, # This code is sent when both the cancellation of the order failed and the new order placement failed.
1541
1506
  '-2026': InvalidOrder, # Order was canceled or expired with no executed qty over 90 days ago and has been archived.
1542
- # 3xxx errors are available only for spot
1507
+ #
1508
+ # 3xxx(these errors are available only for spot atm)
1509
+ #
1543
1510
  '-3000': OperationFailed, # {"code":-3000,"msg":"Internal server error."}
1544
1511
  '-3001': AuthenticationError, # {"code":-3001,"msg":"Please enable 2FA first."}
1545
1512
  '-3002': BadSymbol, # {"code":-3002,"msg":"We don't have self asset."}
@@ -1579,6 +1546,10 @@ class binance(Exchange, ImplicitAPI):
1579
1546
  '-3044': OperationFailed, # {"code":-3044,"msg":"System busy."}
1580
1547
  '-3045': OperationFailed, # {"code":-3045,"msg":"The system doesn't have enough asset now."}
1581
1548
  '-3999': PermissionDenied, # {"code":-3999,"msg":"This function is only available for invited users."}
1549
+ #
1550
+ # 4xxx(different from contract markets)
1551
+ #
1552
+ '-4000': ExchangeError, # override commons
1582
1553
  '-4001': BadRequest, # {"code":-4001 ,"msg":"Invalid operation."}
1583
1554
  '-4002': BadRequest, # {"code":-4002 ,"msg":"Invalid get."}
1584
1555
  '-4003': BadRequest, # {"code":-4003 ,"msg":"Your input email is invalid."}
@@ -1598,6 +1569,7 @@ class binance(Exchange, ImplicitAPI):
1598
1569
  '-4017': PermissionDenied, # {"code":-4017 ,"msg":"Within 24 hours after the release of 2FA, withdrawal is prohibited."}
1599
1570
  '-4018': BadSymbol, # {"code":-4018,"msg":"We don't have self asset."}
1600
1571
  '-4019': BadRequest, # {"code":-4019,"msg":"Current asset is not open for withdrawal."}
1572
+ '-4020': ExchangeError, # override commons
1601
1573
  '-4021': BadRequest, # {"code":-4021,"msg":"Asset withdrawal must be an %s multiple of %s."}
1602
1574
  '-4022': BadRequest, # {"code":-4022,"msg":"Not less than the minimum pick-up quantity %s."}
1603
1575
  '-4023': OperationFailed, # {"code":-4023,"msg":"Within 24 hours, the withdrawal exceeds the maximum amount."}
@@ -1625,7 +1597,108 @@ class binance(Exchange, ImplicitAPI):
1625
1597
  '-4045': OperationFailed, # {"code":-4045,"msg":"Failure to acquire assets."}
1626
1598
  '-4046': AuthenticationError, # {"code":-4046,"msg":"Agreement not confirmed."}
1627
1599
  '-4047': BadRequest, # {"code":-4047,"msg":"Time interval must be within 0-90 days"}
1600
+ '-4048': ExchangeError, # override commons
1601
+ '-4049': ExchangeError, # override commons
1602
+ '-4050': ExchangeError, # override commons
1603
+ '-4051': ExchangeError, # override commons
1604
+ '-4052': ExchangeError, # override commons
1605
+ '-4053': ExchangeError, # override commons
1606
+ '-4054': ExchangeError, # override commons
1607
+ '-4055': ExchangeError, # override commons
1608
+ '-4056': ExchangeError, # override commons
1609
+ '-4057': ExchangeError, # override commons
1610
+ '-4058': ExchangeError, # override commons
1611
+ '-4059': ExchangeError, # override commons
1628
1612
  '-4060': OperationFailed, # As your deposit has not reached the required block confirmations, we have temporarily locked {0} asset
1613
+ '-4061': ExchangeError, # override commons
1614
+ '-4062': ExchangeError, # override commons
1615
+ '-4063': ExchangeError, # override commons
1616
+ '-4064': ExchangeError, # override commons
1617
+ '-4065': ExchangeError, # override commons
1618
+ '-4066': ExchangeError, # override commons
1619
+ '-4067': ExchangeError, # override commons
1620
+ '-4068': ExchangeError, # override commons
1621
+ '-4069': ExchangeError, # override commons
1622
+ '-4070': ExchangeError, # override commons
1623
+ '-4071': ExchangeError, # override commons
1624
+ '-4072': ExchangeError, # override commons
1625
+ '-4073': ExchangeError, # override commons
1626
+ '-4074': ExchangeError, # override commons
1627
+ '-4075': ExchangeError, # override commons
1628
+ '-4076': ExchangeError, # override commons
1629
+ '-4077': ExchangeError, # override commons
1630
+ '-4078': ExchangeError, # override commons
1631
+ '-4079': ExchangeError, # override commons
1632
+ '-4080': ExchangeError, # override commons
1633
+ '-4081': ExchangeError, # override commons
1634
+ '-4082': ExchangeError, # override commons
1635
+ '-4083': ExchangeError, # override commons
1636
+ '-4084': ExchangeError, # override commons
1637
+ '-4085': ExchangeError, # override commons
1638
+ '-4086': ExchangeError, # override commons
1639
+ '-4087': ExchangeError, # override commons
1640
+ '-4088': ExchangeError, # override commons
1641
+ '-4089': ExchangeError, # override commons
1642
+ '-4091': ExchangeError, # override commons
1643
+ '-4092': ExchangeError, # override commons
1644
+ '-4093': ExchangeError, # override commons
1645
+ '-4094': ExchangeError, # override commons
1646
+ '-4095': ExchangeError, # override commons
1647
+ '-4096': ExchangeError, # override commons
1648
+ '-4097': ExchangeError, # override commons
1649
+ '-4098': ExchangeError, # override commons
1650
+ '-4099': ExchangeError, # override commons
1651
+ '-4101': ExchangeError, # override commons
1652
+ '-4102': ExchangeError, # override commons
1653
+ '-4103': ExchangeError, # override commons
1654
+ '-4104': ExchangeError, # override commons
1655
+ '-4105': ExchangeError, # override commons
1656
+ '-4106': ExchangeError, # override commons
1657
+ '-4107': ExchangeError, # override commons
1658
+ '-4108': ExchangeError, # override commons
1659
+ '-4109': ExchangeError, # override commons
1660
+ '-4110': ExchangeError, # override commons
1661
+ '-4112': ExchangeError, # override commons
1662
+ '-4113': ExchangeError, # override commons
1663
+ '-4114': ExchangeError, # override commons
1664
+ '-4115': ExchangeError, # override commons
1665
+ '-4116': ExchangeError, # override commons
1666
+ '-4117': ExchangeError, # override commons
1667
+ '-4118': ExchangeError, # override commons
1668
+ '-4119': ExchangeError, # override commons
1669
+ '-4120': ExchangeError, # override commons
1670
+ '-4121': ExchangeError, # override commons
1671
+ '-4122': ExchangeError, # override commons
1672
+ '-4123': ExchangeError, # override commons
1673
+ '-4124': ExchangeError, # override commons
1674
+ '-4125': ExchangeError, # override commons
1675
+ '-4126': ExchangeError, # override commons
1676
+ '-4127': ExchangeError, # override commons
1677
+ '-4128': ExchangeError, # override commons
1678
+ '-4129': ExchangeError, # override commons
1679
+ '-4130': ExchangeError, # override commons
1680
+ '-4131': ExchangeError, # override commons
1681
+ '-4132': ExchangeError, # override commons
1682
+ '-4133': ExchangeError, # override commons
1683
+ '-4134': ExchangeError, # override commons
1684
+ '-4135': ExchangeError, # override commons
1685
+ '-4136': ExchangeError, # override commons
1686
+ '-4137': ExchangeError, # override commons
1687
+ '-4138': ExchangeError, # override commons
1688
+ '-4139': ExchangeError, # override commons
1689
+ '-4141': ExchangeError, # override commons
1690
+ '-4142': ExchangeError, # override commons
1691
+ '-4143': ExchangeError, # override commons
1692
+ '-4144': ExchangeError, # override commons
1693
+ '-4145': ExchangeError, # override commons
1694
+ '-4146': ExchangeError, # override commons
1695
+ '-4147': ExchangeError, # override commons
1696
+ '-4148': ExchangeError, # override commons
1697
+ '-4149': ExchangeError, # override commons
1698
+ '-4150': ExchangeError, # override commons
1699
+ #
1700
+ # 5xxx
1701
+ #
1629
1702
  '-5001': BadRequest, # Don't allow transfer to micro assets.
1630
1703
  '-5002': InsufficientFunds, # You have insufficient balance.
1631
1704
  '-5003': InsufficientFunds, # You don't have self asset.
@@ -1641,6 +1714,9 @@ class binance(Exchange, ImplicitAPI):
1641
1714
  '-5013': InsufficientFunds, # {"code":-5013,"msg":"Asset transfer failed: insufficient balance""} # undocumented
1642
1715
  '-5021': BadRequest, # This parent sub have no relation
1643
1716
  '-5022': BadRequest, # future account or sub relation not exists.
1717
+ #
1718
+ # 6xxx
1719
+ #
1644
1720
  '-6001': BadSymbol, # Daily product not exists.
1645
1721
  '-6003': PermissionDenied, # Product not exist or you don't have permission
1646
1722
  '-6004': BadRequest, # Product not in purchase status
@@ -1659,8 +1735,14 @@ class binance(Exchange, ImplicitAPI):
1659
1735
  '-6018': InsufficientFunds, # Asset not enough
1660
1736
  '-6019': OperationRejected, # Need confirm
1661
1737
  '-6020': BadRequest, # Project not exists
1738
+ #
1739
+ # 7xxx
1740
+ #
1662
1741
  '-7001': BadRequest, # Date range is not supported.
1663
1742
  '-7002': BadRequest, # Data request type is not supported.
1743
+ #
1744
+ # 1xxxx
1745
+ #
1664
1746
  '-10001': OperationFailed, # The system is under maintenance, please try again later.
1665
1747
  '-10002': BadRequest, # Invalid input parameters.
1666
1748
  '-10005': BadResponse, # No records found.
@@ -1716,17 +1798,10 @@ class binance(Exchange, ImplicitAPI):
1716
1798
  '-18005': PermissionDenied, # Too many invalid verify attempts, please try later
1717
1799
  '-18006': OperationRejected, # The amount is too small, please re-enter
1718
1800
  '-18007': OperationRejected, # This token is not currently supported, please re-enter
1719
- # spot & futures algo(TBD for OPTIONS & PORTFOLIO MARGIN)
1720
- '-20121': BadSymbol, # Invalid symbol.
1721
- '-20124': BadRequest, # Invalid algo id or it has been completed.
1722
- '-20130': BadRequest, # Invalid data sent for a parameter
1723
- '-20132': BadRequest, # The client algo id is duplicated
1724
- '-20194': BadRequest, # Duration is too short to execute all required quantity.
1725
- '-20195': BadRequest, # The total size is too small.
1726
- '-20196': BadRequest, # The total size is too large.
1727
- '-20198': OperationRejected, # Reach the max open orders allowed.
1728
- '-20204': BadRequest, # The notional of USD is less or more than the limit.
1729
- # 21xxx - PORTFOLIO MARGIN
1801
+ #
1802
+ # 2xxxx
1803
+ #
1804
+ # 21xxx - PORTFOLIO MARGIN(documented in spot docs)
1730
1805
  '-21001': BadRequest, # Request ID is not a Portfolio Margin Account.
1731
1806
  '-21002': BadRequest, # Portfolio Margin Account doesn't support transfer from margin to futures.
1732
1807
  '-21003': BadResponse, # Fail to retrieve margin assets.
@@ -1734,6 +1809,9 @@ class binance(Exchange, ImplicitAPI):
1734
1809
  '-21005': InsufficientFunds, # User’s spot wallet doesn’t have enough BUSD to repay portfolio margin bankruptcy loan
1735
1810
  '-21006': OperationFailed, # User had portfolio margin bankruptcy loan repayment in process
1736
1811
  '-21007': OperationFailed, # User failed to repay portfolio margin bankruptcy loan since liquidation was in process
1812
+ #
1813
+ # misc
1814
+ #
1737
1815
  '-32603': BadRequest, # undocumented, Filter failure: LOT_SIZE & precision
1738
1816
  '400002': BadRequest, # undocumented, {“status”: “FAIL”, “code”: “400002”, “errorMessage”: “Signature for self request is not valid.”}
1739
1817
  '100001003': AuthenticationError, # undocumented, {"code":100001003,"msg":"Verification failed"}
@@ -1741,62 +1819,25 @@ class binance(Exchange, ImplicitAPI):
1741
1819
  },
1742
1820
  },
1743
1821
  'linear': {
1744
- # https://binance-docs.github.io/apidocs/futures/en/#error-codes
1745
1822
  'exact': {
1746
- '-1000': OperationFailed, # {"code":-1000,"msg":"An unknown error occured while processing the request."}
1747
- '-1001': OperationFailed, # {"code":-1001,"msg":"'Internal error; unable to process your request. Please try again.'"}
1748
- '-1002': AuthenticationError, # {"code":-1002,"msg":"'You are not authorized to execute self request.'"}
1749
- '-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."}
1750
- '-1004': OperationRejected, # DUPLICATE_IP : This IP is already on the white list
1823
+ #
1824
+ # 1xxx
1825
+ #
1751
1826
  '-1005': PermissionDenied, # {"code":-1005,"msg":"No such IP has been white listed"}
1752
- '-1006': OperationFailed, # {"code":-1006,"msg":"An unexpected response was received from the message bus. Execution status unknown."}
1753
- '-1007': RequestTimeout, # {"code":-1007,"msg":"Timeout waiting for response from backend server. Send status unknown; execution status unknown."}
1754
1827
  '-1008': OperationFailed, # -1008 SERVER_BUSY: Server is currently overloaded with other requests. Please try again in a few minutes.
1755
- '-1010': OperationFailed, # {"code":-1010,"msg":"ERROR_MSG_RECEIVED."}
1756
1828
  '-1011': PermissionDenied, # {"code":-1011,"msg":"This IP cannot access self route."}
1757
- '-1013': BadRequest, # {"code":-1013,"msg":"createOrder -> 'invalid quantity'/'invalid price'/MIN_NOTIONAL"} | -1013 INVALID_MESSAGE
1758
- '-1014': InvalidOrder, # {"code":-1014,"msg":"Unsupported order combination."}
1759
- '-1015': RateLimitExceeded, # {"code":-1015,"msg":"'Too many new orders; current limit is %s orders per %s.'"}
1760
- '-1016': BadRequest, # {"code":-1016,"msg":"'This service is no longer available.',"}
1761
- '-1020': BadRequest, # {"code":-1020,"msg":"'This operation is not supported.'"}
1762
- '-1021': InvalidNonce, # {"code":-1021,"msg":"'your time is ahead of server'"}
1763
- '-1022': AuthenticationError, # {"code":-1022,"msg":"Signature for self request is not valid."}
1764
1829
  '-1023': BadRequest, # {"code":-1023,"msg":"Start time is greater than end time."}
1765
1830
  '-1099': AuthenticationError, # {"code":-1099,"msg":"Not found, authenticated, or authorized"}
1766
- '-1100': BadRequest, # {"code":-1100,"msg":"createOrder(symbol, 1, asdf) -> 'Illegal characters found in parameter 'price'"}
1767
- '-1101': BadRequest, # {"code":-1101,"msg":"Too many parameters; expected %s and received %s."}
1768
- '-1102': BadRequest, # {"code":-1102,"msg":"Param %s or %s must be sent, but both were empty"}
1769
- '-1103': BadRequest, # {"code":-1103,"msg":"An unknown parameter was sent."}
1770
- '-1104': BadRequest, # {"code":-1104,"msg":"Not all sent parameters were read, read 8 parameters but was sent 9"}
1771
- '-1105': BadRequest, # {"code":-1105,"msg":"Parameter %s was empty."}
1772
- '-1106': BadRequest, # {"code":-1106,"msg":"Parameter %s sent when not required."}
1773
- '-1108': BadSymbol, # {"code":-1108,"msg":"Invalid asset."}
1774
1831
  '-1109': PermissionDenied, # {"code":-1109,"msg":"Invalid account."}
1775
1832
  '-1110': BadRequest, # {"code":-1110,"msg":"Invalid symbolType."}
1776
- '-1111': BadRequest, # {"code":-1111,"msg":"Precision is over the maximum defined for self asset."}
1777
- '-1112': OperationFailed, # {"code":-1112,"msg":"No orders on book for symbol."}
1778
1833
  '-1113': BadRequest, # {"code":-1113,"msg":"Withdrawal amount must be negative."}
1779
- '-1114': BadRequest, # {"code":-1114,"msg":"TimeInForce parameter sent when not required."}
1780
- '-1115': BadRequest, # {"code":-1115,"msg":"Invalid timeInForce."}
1781
- '-1116': BadRequest, # {"code":-1116,"msg":"Invalid orderType."}
1782
- '-1117': BadRequest, # {"code":-1117,"msg":"Invalid side."}
1783
- '-1118': BadRequest, # {"code":-1118,"msg":"New client order ID was empty."}
1784
- '-1119': BadRequest, # {"code":-1119,"msg":"Original client order ID was empty."}
1785
- '-1120': BadRequest, # {"code":-1120,"msg":"Invalid interval."}
1786
- '-1121': BadSymbol, # {"code":-1121,"msg":"Invalid symbol."}
1787
1834
  '-1122': BadRequest, # INVALID_SYMBOL_STATUS
1788
- '-1125': AuthenticationError, # {"code":-1125,"msg":"This listenKey does not exist."}
1789
1835
  '-1126': BadSymbol, # ASSET_NOT_SUPPORTED
1790
- '-1127': BadRequest, # {"code":-1127,"msg":"More than %s hours between startTime and endTime."}
1791
- '-1128': BadRequest, # {"code":-1128,"msg":"Combination of optional parameters invalid."}
1792
- '-1130': BadRequest, # {"code":-1130,"msg":"Data sent for paramter %s is not valid."}
1793
1836
  '-1136': BadRequest, # {"code":-1136,"msg":"Invalid newOrderRespType"}
1794
- '-2010': OrderNotFound, # NEW_ORDER_REJECTED
1795
- '-2011': OrderNotFound, # {"code":-2011,"msg":"cancelOrder(1, 'BTC/USDT') -> 'UNKNOWN_ORDER'"}
1837
+ #
1838
+ # 2xxx
1839
+ #
1796
1840
  '-2012': OperationFailed, # CANCEL_ALL_FAIL
1797
- '-2013': OrderNotFound, # {"code":-2013,"msg":"fetchOrder(1, 'BTC/USDT') -> 'Order does not exist'"}
1798
- '-2014': AuthenticationError, # {"code":-2014,"msg":"API-key format invalid."}
1799
- '-2015': AuthenticationError, # {"code":-2015,"msg":"Invalid API-key, IP, or permissions for action."}
1800
1841
  '-2016': OperationRejected, # {"code":-2016,"msg":"No trading window could be found for the symbol. Try ticker/24hrs instead."}
1801
1842
  '-2017': PermissionDenied, # API Keys are locked on self account.
1802
1843
  '-2018': InsufficientFunds, # {"code":-2018,"msg":"Balance is insufficient"}
@@ -1810,65 +1851,13 @@ class binance(Exchange, ImplicitAPI):
1810
1851
  '-2026': InvalidOrder, # {"code":-2026,"msg":"This OrderType is not supported when reduceOnly."}
1811
1852
  '-2027': OperationRejected, # {"code":-2027,"msg":"Exceeded the maximum allowable position at current leverage."}
1812
1853
  '-2028': OperationRejected, # {"code":-2028,"msg":"Leverage is smaller than permitted: insufficient margin balance"}
1813
- '-4000': InvalidOrder, # INVALID_ORDER_STATUS
1814
- '-4001': BadRequest, # PRICE_LESS_THAN_ZERO
1815
- '-4002': BadRequest, # PRICE_GREATER_THAN_MAX_PRICE
1816
- '-4003': BadRequest, # QTY_LESS_THAN_ZERO
1817
- '-4004': BadRequest, # QTY_LESS_THAN_MIN_QTY
1818
- '-4005': BadRequest, # QTY_GREATER_THAN_MAX_QTY
1819
- '-4006': BadRequest, # STOP_PRICE_LESS_THAN_ZERO
1820
- '-4007': BadRequest, # STOP_PRICE_GREATER_THAN_MAX_PRICE
1821
- '-4008': BadRequest, # TICK SIZE LESS THAN ZERO
1822
- '-4009': BadRequest, # MAX_PRICE_LESS_THAN_MIN_PRICE
1823
- '-4010': BadRequest, # MAX_QTY_LESS_THAN_MIN_QTY
1824
- '-4011': BadRequest, # STEP_SIZE_LESS_THAN_ZERO
1825
- '-4012': BadRequest, # MAX_NUM_ORDERS_LESS_THAN_ZERO
1826
- '-4013': BadRequest, # PRICE_LESS_THAN_MIN_PRICE
1827
- '-4014': BadRequest, # PRICE NOT INCREASED BY TICK SIZE
1828
- '-4015': BadRequest, # Client order id is not valid
1829
- '-4016': OperationRejected, # Price is higher than mark price multiplier cap.
1830
- '-4017': BadRequest, # MULTIPLIER_UP_LESS_THAN_ZERO
1831
- '-4018': BadRequest, # MULTIPLIER_DOWN_LESS_THAN_ZERO
1832
- '-4019': OperationRejected, # COMPOSITE_SCALE_OVERFLOW
1833
- '-4020': BadRequest, # TARGET_STRATEGY_INVALID
1834
- '-4021': BadRequest, # INVALID_DEPTH_LIMIT
1835
- '-4022': BadRequest, # WRONG_MARKET_STATUS
1836
- '-4023': BadRequest, # QTY_NOT_INCREASED_BY_STEP_SIZE
1837
- '-4024': BadRequest, # PRICE_LOWER_THAN_MULTIPLIER_DOWN
1838
- '-4025': BadRequest, # MULTIPLIER_DECIMAL_LESS_THAN_ZERO
1839
- '-4026': BadRequest, # COMMISSION_INVALID
1840
- '-4027': BadRequest, # INVALID_ACCOUNT_TYPE
1841
- '-4028': BadRequest, # INVALID_LEVERAGE
1842
- '-4029': BadRequest, # INVALID TICK SIZE PRECISION
1843
- '-4030': BadRequest, # INVALID_STEP_SIZE_PRECISION
1844
- '-4031': BadRequest, # INVALID_WORKING_TYPE
1845
- '-4032': OperationRejected, # EXCEED_MAX_CANCEL_ORDER_SIZE
1846
- '-4033': BadRequest, # INSURANCE_ACCOUNT_NOT_FOUND
1847
- '-4044': BadRequest, # INVALID_BALANCE_TYPE
1848
- '-4045': OperationRejected, # MAX_STOP_ORDER_EXCEEDED
1849
- '-4046': OperationRejected, # NO_NEED_TO_CHANGE_MARGIN_TYPE
1850
- '-4047': OperationRejected, # Margin type cannot be changed if there exists open orders.
1851
- '-4048': OperationRejected, # Margin type cannot be changed if there exists position.
1852
- '-4049': BadRequest, # Add margin only support for isolated position.
1853
- '-4050': InsufficientFunds, # Cross balance insufficient
1854
- '-4051': InsufficientFunds, # Isolated balance insufficient.
1855
- '-4052': OperationRejected, # No need to change auto add margin.
1856
- '-4053': BadRequest, # Auto add margin only support for isolated position.
1857
- '-4054': OperationRejected, # Cannot add position margin: position is 0.
1858
- '-4055': BadRequest, # Amount must be positive.
1859
- '-4056': AuthenticationError, # Invalid api key type.
1860
- '-4057': AuthenticationError, # Invalid api public key
1861
- '-4058': BadRequest, # MAX_PRICE_TOO_LARGE
1862
- '-4059': OperationRejected, # NO_NEED_TO_CHANGE_POSITION_SIDE
1863
- '-4060': BadRequest, # INVALID_POSITION_SIDE
1864
- '-4061': BadRequest, # POSITION_SIDE_NOT_MATCH
1865
- '-4062': BadRequest, # REDUCE_ONLY_CONFLICT
1854
+ #
1855
+ # 4xxx
1856
+ #
1866
1857
  '-4063': BadRequest, # INVALID_OPTIONS_REQUEST_TYPE
1867
1858
  '-4064': BadRequest, # INVALID_OPTIONS_TIME_FRAME
1868
1859
  '-4065': BadRequest, # INVALID_OPTIONS_AMOUNT
1869
1860
  '-4066': BadRequest, # INVALID_OPTIONS_EVENT_TYPE
1870
- '-4067': OperationRejected, # Position side cannot be changed if there exists open orders.
1871
- '-4068': OperationRejected, # Position side cannot be changed if there exists position.
1872
1861
  '-4069': BadRequest, # Position INVALID_OPTIONS_PREMIUM_FEE
1873
1862
  '-4070': BadRequest, # Client options id is not valid.
1874
1863
  '-4071': BadRequest, # Invalid options direction
@@ -1882,25 +1871,15 @@ class binance(Exchange, ImplicitAPI):
1882
1871
  '-4079': BadRequest, # invalid options id
1883
1872
  '-4080': PermissionDenied, # user not found with id: %s
1884
1873
  '-4081': BadRequest, # OPTIONS_NOT_FOUND
1885
- '-4082': OperationRejected, # Invalid number of batch place orders
1886
- '-4083': OperationFailed, # Fail to place batch orders.
1887
- '-4084': BadRequest, # UPCOMING_METHOD
1888
1874
  '-4085': BadRequest, # Invalid notional limit coefficient
1889
- '-4086': BadRequest, # Invalid price spread threshold
1890
1875
  '-4087': PermissionDenied, # User can only place reduce only order
1891
1876
  '-4088': PermissionDenied, # User can not place order currently
1892
- '-4104': BadRequest, # INVALID_CONTRACT_TYPE
1893
1877
  '-4114': BadRequest, # INVALID_CLIENT_TRAN_ID_LEN
1894
1878
  '-4115': BadRequest, # DUPLICATED_CLIENT_TRAN_ID
1895
1879
  '-4118': OperationRejected, # REDUCE_ONLY_MARGIN_CHECK_FAILED
1896
1880
  '-4131': OperationRejected, # The counterparty's best price does not meet the PERCENT_PRICE filter limit
1897
- '-4135': BadRequest, # Invalid activation price
1898
- '-4137': BadRequest, # Quantity must be zero with closePosition equals True
1899
- '-4138': BadRequest, # Reduce only must be True with closePosition equals True
1900
- '-4139': BadRequest, # Order type can not be market if it's unable to cancel
1901
1881
  '-4140': BadRequest, # Invalid symbol status for opening position
1902
1882
  '-4141': OperationRejected, # Symbol is closed
1903
- '-4142': OrderImmediatelyFillable, # REJECT: take profit or stop order will be triggered immediately
1904
1883
  '-4144': BadSymbol, # Invalid pair
1905
1884
  '-4164': OperationRejected, # Leverage reduction is not supported in Isolated Margin Mode with open positions
1906
1885
  '-4165': BadRequest, # Invalid time interval
@@ -1909,7 +1888,7 @@ class binance(Exchange, ImplicitAPI):
1909
1888
  '-4169': OperationRejected, # Unable to adjust Multi-Assets Mode with insufficient margin balance in USDⓈ-M Futures
1910
1889
  '-4170': OperationRejected, # Unable to adjust Multi-Assets Mode with open orders in USDⓈ-M Futures
1911
1890
  '-4171': OperationRejected, # Adjusted asset mode is currently set and does not need to be adjusted repeatedly
1912
- '-4172 ': OperationRejected, # Unable to adjust Multi-Assets Mode with a negative wallet balance of margin available asset in USDⓈ-M Futures account.
1891
+ '-4172': OperationRejected, # Unable to adjust Multi-Assets Mode with a negative wallet balance of margin available asset in USDⓈ-M Futures account.
1913
1892
  '-4183': BadRequest, # Price is higher than stop price multiplier cap.
1914
1893
  '-4184': BadRequest, # Price is lower than stop price multiplier floor.
1915
1894
  '-4192': PermissionDenied, # Trade forbidden due to Cooling-off Period.
@@ -1925,6 +1904,9 @@ class binance(Exchange, ImplicitAPI):
1925
1904
  '-4401': PermissionDenied, # Compliance restricted account permission: can only place reduceOnly order.
1926
1905
  '-4402': PermissionDenied, # Dear user, our Terms of Use and compliance with local regulations, self feature is currently not available in your region.
1927
1906
  '-4403': PermissionDenied, # Dear user, our Terms of Use and compliance with local regulations, the leverage can only up to %sx in your region
1907
+ #
1908
+ # 5xxx
1909
+ #
1928
1910
  '-5021': OrderNotFillable, # Due to the order could not be filled immediately, the FOK order has been rejected.
1929
1911
  '-5022': OrderNotFillable, # Due to the order could not be executed, the Post Only order will be rejected.
1930
1912
  '-5024': OperationRejected, # Symbol is not in trading status. Order amendment is not permitted.
@@ -1937,72 +1919,24 @@ class binance(Exchange, ImplicitAPI):
1937
1919
  '-5039': BadRequest, # Invalid self trade prevention mode
1938
1920
  '-5040': BadRequest, # The goodTillDate timestamp must be greater than the current time plus 600 seconds and smaller than 253402300799000
1939
1921
  '-5041': OperationFailed, # No depth matches self BBO order
1940
- #
1941
- # spot & futures algo(TBD for OPTIONS & PORTFOLIO MARGIN)
1942
- #
1943
- '-20121': BadSymbol, # Invalid symbol.
1944
- '-20124': BadRequest, # Invalid algo id or it has been completed.
1945
- '-20130': BadRequest, # Invalid data sent for a parameter
1946
- '-20132': BadRequest, # The client algo id is duplicated
1947
- '-20194': BadRequest, # Duration is too short to execute all required quantity.
1948
- '-20195': BadRequest, # The total size is too small.
1949
- '-20196': BadRequest, # The total size is too large.
1950
- '-20198': OperationRejected, # Reach the max open orders allowed.
1951
- '-20204': BadRequest, # The notional of USD is less or more than the limit.
1952
1922
  },
1953
1923
  },
1954
1924
  'inverse': {
1955
- # https://binance-docs.github.io/apidocs/delivery/en/#error-codes
1956
1925
  'exact': {
1957
- '-1000': OperationFailed, # {"code":-1000,"msg":"An unknown error occured while processing the request."}
1958
- '-1001': OperationFailed, # {"code":-1001,"msg":"'Internal error; unable to process your request. Please try again.'"}
1959
- '-1002': AuthenticationError, # {"code":-1002,"msg":"'You are not authorized to execute self request.'"}
1960
- '-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."}
1961
- '-1004': OperationRejected, # DUPLICATE_IP : This IP is already on the white list
1926
+ #
1927
+ # 1xxx
1928
+ #
1962
1929
  '-1005': PermissionDenied, # {"code":-1005,"msg":"No such IP has been white listed"}
1963
- '-1006': OperationFailed, # {"code":-1006,"msg":"An unexpected response was received from the message bus. Execution status unknown."}
1964
- '-1007': RequestTimeout, # {"code":-1007,"msg":"Timeout waiting for response from backend server. Send status unknown; execution status unknown."}
1965
- '-1010': OperationFailed, # {"code":-1010,"msg":"ERROR_MSG_RECEIVED."}
1966
1930
  '-1011': PermissionDenied, # {"code":-1011,"msg":"This IP cannot access self route."}
1967
- '-1013': BadRequest, # {"code":-1013,"msg":"createOrder -> 'invalid quantity'/'invalid price'/MIN_NOTIONAL"} | -1013 INVALID_MESSAGE
1968
- '-1014': InvalidOrder, # {"code":-1014,"msg":"Unsupported order combination."}
1969
- '-1015': RateLimitExceeded, # {"code":-1015,"msg":"'Too many new orders; current limit is %s orders per %s.'"}
1970
- '-1016': BadRequest, # {"code":-1016,"msg":"'This service is no longer available.',"}
1971
- '-1020': BadRequest, # {"code":-1020,"msg":"'This operation is not supported.'"}
1972
- '-1021': InvalidNonce, # {"code":-1021,"msg":"'your time is ahead of server'"}
1973
- '-1022': AuthenticationError, # {"code":-1022,"msg":"Signature for self request is not valid."}
1974
1931
  '-1023': BadRequest, # {"code":-1023,"msg":"Start time is greater than end time."}
1975
- '-1100': BadRequest, # {"code":-1100,"msg":"createOrder(symbol, 1, asdf) -> 'Illegal characters found in parameter 'price'"}
1976
- '-1101': BadRequest, # {"code":-1101,"msg":"Too many parameters; expected %s and received %s."}
1977
- '-1102': BadRequest, # {"code":-1102,"msg":"Param %s or %s must be sent, but both were empty"}
1978
- '-1103': BadRequest, # {"code":-1103,"msg":"An unknown parameter was sent."}
1979
- '-1104': BadRequest, # {"code":-1104,"msg":"Not all sent parameters were read, read 8 parameters but was sent 9"}
1980
- '-1105': BadRequest, # {"code":-1105,"msg":"Parameter %s was empty."}
1981
- '-1106': BadRequest, # {"code":-1106,"msg":"Parameter %s sent when not required."}
1982
- '-1108': BadSymbol, # {"code":-1108,"msg":"Invalid asset."}
1983
1932
  '-1109': AuthenticationError, # {"code":-1109,"msg":"Invalid account."}
1984
1933
  '-1110': BadSymbol, # {"code":-1110,"msg":"Invalid symbolType."}
1985
- '-1111': BadRequest, # {"code":-1111,"msg":"Precision is over the maximum defined for self asset."}
1986
- '-1112': OperationFailed, # {"code":-1112,"msg":"No orders on book for symbol."}
1987
1934
  '-1113': BadRequest, # {"code":-1113,"msg":"Withdrawal amount must be negative."}
1988
- '-1114': BadRequest, # {"code":-1114,"msg":"TimeInForce parameter sent when not required."}
1989
- '-1115': BadRequest, # {"code":-1115,"msg":"Invalid timeInForce."}
1990
- '-1116': BadRequest, # {"code":-1116,"msg":"Invalid orderType."}
1991
- '-1117': BadRequest, # {"code":-1117,"msg":"Invalid side."}
1992
- '-1118': BadRequest, # {"code":-1118,"msg":"New client order ID was empty."}
1993
- '-1119': BadRequest, # {"code":-1119,"msg":"Original client order ID was empty."}
1994
- '-1120': BadRequest, # {"code":-1120,"msg":"Invalid interval."}
1995
- '-1121': BadSymbol, # {"code":-1121,"msg":"Invalid symbol."}
1996
- '-1125': AuthenticationError, # {"code":-1125,"msg":"This listenKey does not exist."}
1997
- '-1127': BadRequest, # {"code":-1127,"msg":"More than %s hours between startTime and endTime."}
1998
1935
  '-1128': BadRequest, # {"code":-1128,"msg":"Combination of optional parameters invalid."}
1999
- '-1130': BadRequest, # {"code":-1130,"msg":"Data sent for paramter %s is not valid."}
2000
1936
  '-1136': BadRequest, # {"code":-1136,"msg":"Invalid newOrderRespType"}
2001
- '-2010': InvalidOrder, # NEW_ORDER_REJECTED
2002
- '-2011': OrderNotFound, # {"code":-2011,"msg":"cancelOrder(1, 'BTC/USDT') -> 'UNKNOWN_ORDER'"}
2003
- '-2013': OrderNotFound, # {"code":-2013,"msg":"fetchOrder(1, 'BTC/USDT') -> 'Order does not exist'"}
2004
- '-2014': AuthenticationError, # {"code":-2014,"msg":"API-key format invalid."}
2005
- '-2015': AuthenticationError, # {"code":-2015,"msg":"Invalid API-key, IP, or permissions for action."}
1937
+ #
1938
+ # 2xxx
1939
+ #
2006
1940
  '-2016': OperationRejected, # {"code":-2016,"msg":"No trading window could be found for the symbol. Try ticker/24hrs instead."}
2007
1941
  '-2018': InsufficientFunds, # {"code":-2018,"msg":"Balance is insufficient"}
2008
1942
  '-2019': InsufficientFunds, # {"code":-2019,"msg":"Margin is insufficient."}
@@ -2015,86 +1949,25 @@ class binance(Exchange, ImplicitAPI):
2015
1949
  '-2026': InvalidOrder, # {"code":-2026,"msg":"This OrderType is not supported when reduceOnly."}
2016
1950
  '-2027': OperationRejected, # {"code":-2027,"msg":"Exceeded the maximum allowable position at current leverage."}
2017
1951
  '-2028': OperationRejected, # {"code":-2028,"msg":"Leverage is smaller than permitted: insufficient margin balance"}
2018
- '-4000': InvalidOrder, # INVALID_ORDER_STATUS
2019
- '-4001': BadRequest, # PRICE_LESS_THAN_ZERO
2020
- '-4002': BadRequest, # PRICE_GREATER_THAN_MAX_PRICE
2021
- '-4003': BadRequest, # QTY_LESS_THAN_ZERO
2022
- '-4004': BadRequest, # QTY_LESS_THAN_MIN_QTY
2023
- '-4005': BadRequest, # QTY_GREATER_THAN_MAX_QTY
2024
- '-4006': BadRequest, # STOP_PRICE_LESS_THAN_ZERO
2025
- '-4007': BadRequest, # STOP_PRICE_GREATER_THAN_MAX_PRICE
2026
- '-4008': BadRequest, # TICK SIZE LESS THAN ZERO
2027
- '-4009': BadRequest, # MAX_PRICE_LESS_THAN_MIN_PRICE
2028
- '-4010': BadRequest, # MAX_QTY_LESS_THAN_MIN_QTY
2029
- '-4011': BadRequest, # STEP_SIZE_LESS_THAN_ZERO
2030
- '-4012': BadRequest, # MAX_NUM_ORDERS_LESS_THAN_ZERO
2031
- '-4013': BadRequest, # PRICE_LESS_THAN_MIN_PRICE
2032
- '-4014': BadRequest, # PRICE NOT INCREASED BY TICK SIZE
2033
- '-4015': BadRequest, # Client order id is not valid
2034
- '-4016': BadRequest, # Price is higher than mark price multiplier cap.
2035
- '-4017': BadRequest, # MULTIPLIER_UP_LESS_THAN_ZERO
2036
- '-4018': BadRequest, # MULTIPLIER_DOWN_LESS_THAN_ZERO
2037
- '-4019': OperationRejected, # COMPOSITE_SCALE_OVERFLOW
2038
- '-4020': BadRequest, # TARGET_STRATEGY_INVALID
2039
- '-4021': BadRequest, # INVALID_DEPTH_LIMIT
2040
- '-4022': BadRequest, # WRONG_MARKET_STATUS
2041
- '-4023': BadRequest, # QTY_NOT_INCREASED_BY_STEP_SIZE
2042
- '-4024': BadRequest, # PRICE_LOWER_THAN_MULTIPLIER_DOWN
2043
- '-4025': BadRequest, # MULTIPLIER_DECIMAL_LESS_THAN_ZERO
2044
- '-4026': BadRequest, # COMMISSION_INVALID
2045
- '-4027': BadRequest, # INVALID_ACCOUNT_TYPE
2046
- '-4028': BadRequest, # INVALID_LEVERAGE
2047
- '-4029': BadRequest, # INVALID TICK SIZE PRECISION
2048
- '-4030': BadRequest, # INVALID_STEP_SIZE_PRECISION
2049
- '-4031': BadRequest, # INVALID_WORKING_TYPE
2050
- '-4032': OperationRejected, # Exceed maximum cancel order size. | Invalid parameter working type: %s
2051
- '-4033': BadRequest, # INSURANCE_ACCOUNT_NOT_FOUND
2052
- '-4044': BadRequest, # INVALID_BALANCE_TYPE
2053
- '-4045': OperationRejected, # Reach max stop order limit.
2054
- '-4046': BadRequest, # NO_NEED_TO_CHANGE_MARGIN_TYPE
2055
- '-4047': OperationRejected, # Margin type cannot be changed if there exists open orders.
2056
- '-4048': OperationRejected, # Margin type cannot be changed if there exists position.
2057
- '-4049': OperationRejected, # ADD_ISOLATED_MARGIN_REJECT
2058
- '-4050': InsufficientFunds, # CROSS_BALANCE_INSUFFICIENT
2059
- '-4051': InsufficientFunds, # ISOLATED_BALANCE_INSUFFICIENT
2060
- '-4052': OperationRejected, # NO_NEED_TO_CHANGE_AUTO_ADD_MARGIN
2061
- '-4053': OperationRejected, # AUTO_ADD_CROSSED_MARGIN_REJECT
2062
- '-4054': OperationRejected, # Cannot add position margin: position is 0.
2063
- '-4055': BadRequest, # AMOUNT_MUST_BE_POSITIVE
2064
- '-4056': AuthenticationError, # INVALID_API_KEY_TYPE
2065
- '-4057': AuthenticationError, # INVALID_RSA_PUBLIC_KEY
2066
- '-4058': BadRequest, # MAX_PRICE_TOO_LARGE
2067
- '-4059': OperationRejected, # NO_NEED_TO_CHANGE_POSITION_SIDE
2068
- '-4060': BadRequest, # INVALID_POSITION_SIDE
2069
- '-4061': OperationRejected, # Order's position side does not match user's setting.
2070
- '-4062': BadRequest, # Invalid or improper reduceOnly value.
2071
1952
  #
2072
- '-4067': OperationRejected, # Position side cannot be changed if there exists open orders.
2073
- '-4068': OperationRejected, # Position side cannot be changed if there exists position.
2074
- '-4082': OperationRejected, # Invalid number of batch place orders.
2075
- '-4083': OperationRejected, # PLACE_BATCH_ORDERS_FAIL
2076
- '-4084': BadRequest, # Method is not allowed currently. Upcoming soon.
1953
+ # 4xxx
1954
+ #
2077
1955
  '-4086': BadRequest, # Invalid price spread threshold.
2078
1956
  '-4087': BadSymbol, # Invalid pair
2079
1957
  '-4088': BadRequest, # Invalid time interval
2080
1958
  '-4089': PermissionDenied, # User can only place reduce only order.
2081
1959
  '-4090': PermissionDenied, # User can not place order currently.
2082
- '-4104': BadRequest, # Invalid contract type
2083
1960
  '-4110': BadRequest, # clientTranId is not valid
2084
1961
  '-4111': BadRequest, # clientTranId is duplicated.
2085
1962
  '-4112': OperationRejected, # ReduceOnly Order Failed. Please check your existing position and open orders.
2086
1963
  '-4113': OperationRejected, # The counterparty's best price does not meet the PERCENT_PRICE filter limit.
2087
- '-4135': BadRequest, # Invalid activation price.
2088
- '-4137': BadRequest, # Quantity must be zero with closePosition equals True.
2089
- '-4138': BadRequest, # Reduce only must be True with closePosition equals True.
2090
- '-4139': BadRequest, # Order type can not be market if it's unable to cancel.
2091
- '-4142': OrderImmediatelyFillable, # REJECT: take profit or stop order will be triggered immediately.
2092
1964
  '-4150': OperationRejected, # Leverage reduction is not supported in Isolated Margin Mode with open positions.
2093
1965
  '-4151': BadRequest, # Price is higher than stop price multiplier cap.
2094
1966
  '-4152': BadRequest, # Price is lower than stop price multiplier floor.
2095
1967
  '-4154': BadRequest, # Stop price is higher than price multiplier cap.
2096
1968
  '-4155': BadRequest, # Stop price is lower than price multiplier floor
2097
1969
  '-4178': BadRequest, # Order's notional must be no smaller than one(unless you choose reduce only)
1970
+ '-4188': BadRequest, # Timestamp for self request is outside of the ME recvWindow.
2098
1971
  '-4192': PermissionDenied, # Trade forbidden due to Cooling-off Period.
2099
1972
  '-4194': PermissionDenied, # Intermediate Personal Verification is required for adjusting leverage over 20x.
2100
1973
  '-4195': PermissionDenied, # More than 20x leverage is available one month after account registration.
@@ -2105,124 +1978,215 @@ class binance(Exchange, ImplicitAPI):
2105
1978
  '-4200': PermissionDenied, # More than 20x leverage is available %s days after Futures account registration.
2106
1979
  '-4201': PermissionDenied, # Users in your location/country can only access a maximum leverage of %s
2107
1980
  '-4202': OperationRejected, # Current symbol leverage cannot exceed 20 when using position limit adjustment service.
2108
- '-4188': BadRequest, # Timestamp for self request is outside of the ME recvWindow.
2109
- #
2110
- # spot & futures algo
2111
- #
2112
- '-20121': BadSymbol, # Invalid symbol.
2113
- '-20124': BadRequest, # Invalid algo id or it has been completed.
2114
- '-20130': BadRequest, # Invalid data sent for a parameter
2115
- '-20132': BadRequest, # The client algo id is duplicated
2116
- '-20194': BadRequest, # Duration is too short to execute all required quantity.
2117
- '-20195': BadRequest, # The total size is too small.
2118
- '-20196': BadRequest, # The total size is too large.
2119
- '-20198': OperationRejected, # Reach the max open orders allowed.
2120
- '-20204': BadRequest, # The notional of USD is less or more than the limit.
2121
1981
  },
2122
1982
  },
2123
1983
  'option': {
2124
- # https://binance-docs.github.io/apidocs/voptions/en/#error-codes
2125
1984
  'exact': {
2126
- '-1000': OperationFailed, # {"code":-1000,"msg":"An unknown error occured while processing the request."}
2127
- '-1001': OperationFailed, # {"code":-1001,"msg":"'Internal error; unable to process your request. Please try again.'"}
2128
- '-1002': AuthenticationError, # {"code":-1002,"msg":"'You are not authorized to execute self request.'"}
2129
- '-1008': RateLimitExceeded, # TOO_MANY_REQUESTS
2130
- '-1014': InvalidOrder, # {"code":-1014,"msg":"Unsupported order combination."}
2131
- '-1015': RateLimitExceeded, # {"code":-1015,"msg":"'Too many new orders; current limit is %s orders per %s.'"}
2132
- '-1016': BadRequest, # {"code":-1016,"msg":"'This service is no longer available.',"}
2133
- '-1020': BadRequest, # {"code":-1020,"msg":"'This operation is not supported.'"}
2134
- '-1021': InvalidNonce, # {"code":-1021,"msg":"'your time is ahead of server'"}
2135
- '-1022': AuthenticationError, # {"code":-1022,"msg":"Signature for self request is not valid."}
2136
- '-1100': BadRequest, # {"code":-1100,"msg":"createOrder(symbol, 1, asdf) -> 'Illegal characters found in parameter 'price'"}
2137
- '-1101': BadRequest, # {"code":-1101,"msg":"Too many parameters; expected %s and received %s."}
2138
- '-1102': BadRequest, # {"code":-1102,"msg":"Param %s or %s must be sent, but both were empty"}
2139
- '-1103': BadRequest, # {"code":-1103,"msg":"An unknown parameter was sent."}
2140
- '-1104': BadRequest, # {"code":-1104,"msg":"Not all sent parameters were read, read 8 parameters but was sent 9"}
2141
- '-1105': BadRequest, # {"code":-1105,"msg":"Parameter %s was empty."}
2142
- '-1106': BadRequest, # {"code":-1106,"msg":"Parameter %s sent when not required."}
2143
- '-1111': BadRequest, # {"code":-1111,"msg":"Precision is over the maximum defined for self asset."}
2144
- '-1115': BadRequest, # {"code":-1115,"msg":"Invalid timeInForce."}
2145
- '-1116': BadRequest, # {"code":-1116,"msg":"Invalid orderType."}
2146
- '-1117': BadRequest, # {"code":-1117,"msg":"Invalid side."}
2147
- '-1118': BadRequest, # {"code":-1118,"msg":"New client order ID was empty."}
2148
- '-1119': BadRequest, # {"code":-1119,"msg":"Original client order ID was empty."}
2149
- '-1120': BadRequest, # {"code":-1120,"msg":"Invalid interval."}
2150
- '-1121': BadSymbol, # {"code":-1121,"msg":"Invalid symbol."}
2151
- '-1125': AuthenticationError, # {"code":-1125,"msg":"This listenKey does not exist."}
2152
- '-1127': BadRequest, # {"code":-1127,"msg":"More than %s hours between startTime and endTime."}
1985
+ #
1986
+ # 1xxx
1987
+ #
1988
+ '-1003': ExchangeError, # override common
1989
+ '-1004': ExchangeError, # override common
1990
+ '-1006': ExchangeError, # override common
1991
+ '-1007': ExchangeError, # override common
1992
+ '-1008': RateLimitExceeded, # TOO_MANY_REQUEST
1993
+ '-1010': ExchangeError, # override common
1994
+ '-1013': ExchangeError, # override common
1995
+ '-1108': ExchangeError, # override common
1996
+ '-1112': ExchangeError, # override common
1997
+ '-1114': ExchangeError, # override common
2153
1998
  '-1128': BadSymbol, # BAD_CONTRACT
2154
1999
  '-1129': BadSymbol, # BAD_CURRENCY
2155
- '-1130': BadRequest, # {"code":-1130,"msg":"Data sent for paramter %s is not valid."}
2156
2000
  '-1131': BadRequest, # {"code":-1131,"msg":"recvWindow must be less than 60000"}
2157
- '-2010': InvalidOrder, # NEW_ORDER_REJECTED
2158
- '-2013': OrderNotFound, # {"code":-2013,"msg":"fetchOrder(1, 'BTC/USDT') -> 'Order does not exist'"}
2159
- '-2014': AuthenticationError, # {"code":-2014,"msg":"API-key format invalid."}
2160
- '-2015': AuthenticationError, # {"code":-2015,"msg":"Invalid API-key, IP, or permissions for action."}
2001
+ #
2002
+ # 2xxx
2003
+ #
2004
+ '-2011': ExchangeError, # override common
2161
2005
  '-2018': InsufficientFunds, # BALANCE_NOT_SUFFICIENT
2162
2006
  '-2027': InsufficientFunds, # OPTION_MARGIN_NOT_SUFFICIENT
2007
+ #
2008
+ # 3xxx
2009
+ #
2163
2010
  '-3029': OperationFailed, # {"code":-3029,"msg":"Transfer failed."}
2164
- '-4001': BadRequest, # PRICE_LESS_THAN_ZERO
2165
- '-4002': BadRequest, # PRICE_GREATER_THAN_MAX_PRICE
2166
- '-4003': BadRequest, # QTY_LESS_THAN_ZERO
2167
- '-4004': BadRequest, # QTY_LESS_THAN_MIN_QTY
2168
- '-4005': BadRequest, # QTY_GREATER_THAN_MAX_QTY
2169
- '-4013': BadRequest, # PRICE_LESS_THAN_MIN_PRICE
2170
- '-4029': BadRequest, # INVALID TICK SIZE PRECISION
2171
- '-4030': BadRequest, # INVALID_QTY_PRECISION
2172
- '-4055': BadRequest, # AMOUNT_MUST_BE_POSITIVE
2011
+ #
2012
+ # 4xxx
2013
+ #
2014
+ # -4001 inherited
2015
+ # -4002 inherited
2016
+ # -4003 inherited
2017
+ # -4004 inherited
2018
+ # -4005 inherited
2019
+ '-4006': ExchangeError, # override commons
2020
+ '-4007': ExchangeError, # override commons
2021
+ '-4008': ExchangeError, # override commons
2022
+ '-4009': ExchangeError, # override commons
2023
+ '-4010': ExchangeError, # override commons
2024
+ '-4011': ExchangeError, # override commons
2025
+ '-4012': ExchangeError, # override commons
2026
+ # -4013 inherited
2027
+ '-4014': ExchangeError, # override commons
2028
+ '-4015': ExchangeError, # override commons
2029
+ '-4016': ExchangeError, # override commons
2030
+ '-4017': ExchangeError, # override commons
2031
+ '-4018': ExchangeError, # override commons
2032
+ '-4019': ExchangeError, # override commons
2033
+ '-4020': ExchangeError, # override commons
2034
+ '-4021': ExchangeError, # override commons
2035
+ '-4022': ExchangeError, # override commons
2036
+ '-4023': ExchangeError, # override commons
2037
+ '-4024': ExchangeError, # override commons
2038
+ '-4025': ExchangeError, # override commons
2039
+ '-4026': ExchangeError, # override commons
2040
+ '-4027': ExchangeError, # override commons
2041
+ '-4028': ExchangeError, # override commons
2042
+ # -4029 inherited
2043
+ # -4030 inherited
2044
+ '-4031': ExchangeError, # override commons
2045
+ '-4032': ExchangeError, # override commons
2046
+ '-4033': ExchangeError, # override commons
2047
+ '-4034': ExchangeError, # override commons
2048
+ '-4035': ExchangeError, # override commons
2049
+ '-4036': ExchangeError, # override commons
2050
+ '-4037': ExchangeError, # override commons
2051
+ '-4038': ExchangeError, # override commons
2052
+ '-4039': ExchangeError, # override commons
2053
+ '-4040': ExchangeError, # override commons
2054
+ '-4041': ExchangeError, # override commons
2055
+ '-4042': ExchangeError, # override commons
2056
+ '-4043': ExchangeError, # override commons
2057
+ '-4044': ExchangeError, # override commons
2058
+ '-4045': ExchangeError, # override commons
2059
+ '-4046': ExchangeError, # override commons
2060
+ '-4047': ExchangeError, # override commons
2061
+ '-4048': ExchangeError, # override commons
2062
+ '-4049': ExchangeError, # override commons
2063
+ '-4050': ExchangeError, # override commons
2064
+ '-4051': ExchangeError, # override commons
2065
+ '-4052': ExchangeError, # override commons
2066
+ '-4053': ExchangeError, # override commons
2067
+ '-4054': ExchangeError, # override commons
2068
+ # -4055 inherited
2069
+ '-4056': ExchangeError, # override commons
2070
+ '-4057': ExchangeError, # override commons
2071
+ '-4058': ExchangeError, # override commons
2072
+ '-4059': ExchangeError, # override commons
2073
+ '-4060': ExchangeError, # override commons
2074
+ '-4061': ExchangeError, # override commons
2075
+ '-4062': ExchangeError, # override commons
2076
+ '-4063': ExchangeError, # override commons
2077
+ '-4064': ExchangeError, # override commons
2078
+ '-4065': ExchangeError, # override commons
2079
+ '-4066': ExchangeError, # override commons
2080
+ '-4067': ExchangeError, # override commons
2081
+ '-4068': ExchangeError, # override commons
2082
+ '-4069': ExchangeError, # override commons
2083
+ '-4070': ExchangeError, # override commons
2084
+ '-4071': ExchangeError, # override commons
2085
+ '-4072': ExchangeError, # override commons
2086
+ '-4073': ExchangeError, # override commons
2087
+ '-4074': ExchangeError, # override commons
2088
+ '-4075': ExchangeError, # override commons
2089
+ '-4076': ExchangeError, # override commons
2090
+ '-4077': ExchangeError, # override commons
2091
+ '-4078': ExchangeError, # override commons
2092
+ '-4079': ExchangeError, # override commons
2093
+ '-4080': ExchangeError, # override commons
2094
+ '-4081': ExchangeError, # override commons
2095
+ '-4082': ExchangeError, # override commons
2096
+ '-4083': ExchangeError, # override commons
2097
+ '-4084': ExchangeError, # override commons
2098
+ '-4085': ExchangeError, # override commons
2099
+ '-4086': ExchangeError, # override commons
2100
+ '-4087': ExchangeError, # override commons
2101
+ '-4088': ExchangeError, # override commons
2102
+ '-4089': ExchangeError, # override commons
2103
+ '-4091': ExchangeError, # override commons
2104
+ '-4092': ExchangeError, # override commons
2105
+ '-4093': ExchangeError, # override commons
2106
+ '-4094': ExchangeError, # override commons
2107
+ '-4095': ExchangeError, # override commons
2108
+ '-4096': ExchangeError, # override commons
2109
+ '-4097': ExchangeError, # override commons
2110
+ '-4098': ExchangeError, # override commons
2111
+ '-4099': ExchangeError, # override commons
2112
+ '-4101': ExchangeError, # override commons
2113
+ '-4102': ExchangeError, # override commons
2114
+ '-4103': ExchangeError, # override commons
2115
+ '-4104': ExchangeError, # override commons
2116
+ '-4105': ExchangeError, # override commons
2117
+ '-4106': ExchangeError, # override commons
2118
+ '-4107': ExchangeError, # override commons
2119
+ '-4108': ExchangeError, # override commons
2120
+ '-4109': ExchangeError, # override commons
2121
+ '-4110': ExchangeError, # override commons
2122
+ '-4112': ExchangeError, # override commons
2123
+ '-4113': ExchangeError, # override commons
2124
+ '-4114': ExchangeError, # override commons
2125
+ '-4115': ExchangeError, # override commons
2126
+ '-4116': ExchangeError, # override commons
2127
+ '-4117': ExchangeError, # override commons
2128
+ '-4118': ExchangeError, # override commons
2129
+ '-4119': ExchangeError, # override commons
2130
+ '-4120': ExchangeError, # override commons
2131
+ '-4121': ExchangeError, # override commons
2132
+ '-4122': ExchangeError, # override commons
2133
+ '-4123': ExchangeError, # override commons
2134
+ '-4124': ExchangeError, # override commons
2135
+ '-4125': ExchangeError, # override commons
2136
+ '-4126': ExchangeError, # override commons
2137
+ '-4127': ExchangeError, # override commons
2138
+ '-4128': ExchangeError, # override commons
2139
+ '-4129': ExchangeError, # override commons
2140
+ '-4130': ExchangeError, # override commons
2141
+ '-4131': ExchangeError, # override commons
2142
+ '-4132': ExchangeError, # override commons
2143
+ '-4133': ExchangeError, # override commons
2144
+ '-4134': ExchangeError, # override commons
2145
+ '-4135': ExchangeError, # override commons
2146
+ '-4136': ExchangeError, # override commons
2147
+ '-4137': ExchangeError, # override commons
2148
+ '-4138': ExchangeError, # override commons
2149
+ '-4139': ExchangeError, # override commons
2150
+ '-4141': ExchangeError, # override commons
2151
+ '-4142': ExchangeError, # override commons
2152
+ '-4143': ExchangeError, # override commons
2153
+ '-4144': ExchangeError, # override commons
2154
+ '-4145': ExchangeError, # override commons
2155
+ '-4146': ExchangeError, # override commons
2156
+ '-4147': ExchangeError, # override commons
2157
+ '-4148': ExchangeError, # override commons
2158
+ '-4149': ExchangeError, # override commons
2159
+ '-4150': ExchangeError, # override commons
2160
+ #
2161
+ # 2xxxx
2162
+ #
2163
+ '-20121': ExchangeError, # override commons
2164
+ '-20124': ExchangeError, # override commons
2165
+ '-20130': ExchangeError, # override commons
2166
+ '-20132': ExchangeError, # override commons
2167
+ '-20194': ExchangeError, # override commons
2168
+ '-20195': ExchangeError, # override commons
2169
+ '-20196': ExchangeError, # override commons
2170
+ '-20198': ExchangeError, # override commons
2171
+ '-20204': ExchangeError, # override commons
2173
2172
  },
2174
2173
  },
2175
2174
  'portfolioMargin': {
2176
2175
  'exact': {
2177
- '-1000': OperationFailed, # {"code":-1000,"msg":"An unknown error occured while processing the request."}
2178
- '-1001': OperationFailed, # {"code":-1001,"msg":"'Internal error; unable to process your request. Please try again.'"}
2179
- '-1002': AuthenticationError, # {"code":-1002,"msg":"'You are not authorized to execute self request.'"}
2180
- '-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."}
2181
- '-1004': OperationRejected, # DUPLICATE_IP : This IP is already on the white list
2176
+ #
2177
+ # 1xxx
2178
+ #
2182
2179
  '-1005': PermissionDenied, # {"code":-1005,"msg":"No such IP has been white listed"}
2183
- '-1006': OperationFailed, # {"code":-1006,"msg":"An unexpected response was received from the message bus. Execution status unknown."}
2184
- '-1007': RequestTimeout, # {"code":-1007,"msg":"Timeout waiting for response from backend server. Send status unknown; execution status unknown."}
2185
- '-1010': OperationFailed, # {"code":-1010,"msg":"ERROR_MSG_RECEIVED."}
2186
2180
  '-1011': PermissionDenied, # {"code":-1011,"msg":"This IP cannot access self route."}
2187
- '-1013': OperationFailed, #
2188
- '-1014': InvalidOrder, # {"code":-1014,"msg":"Unsupported order combination."}
2189
- '-1015': RateLimitExceeded, # {"code":-1015,"msg":"'Too many new orders; current limit is %s orders per %s.'"}
2190
- '-1016': BadRequest, # {"code":-1016,"msg":"'This service is no longer available.',"}
2191
- '-1020': BadRequest, # {"code":-1020,"msg":"'This operation is not supported.'"}
2192
- '-1021': InvalidNonce, # {"code":-1021,"msg":"'your time is ahead of server'"}
2193
- '-1022': AuthenticationError, # {"code":-1022,"msg":"Signature for self request is not valid."}
2194
2181
  '-1023': BadRequest, # START_TIME_GREATER_THAN_END_TIME
2195
- '-1100': BadRequest, # {"code":-1100,"msg":"createOrder(symbol, 1, asdf) -> 'Illegal characters found in parameter 'price'"}
2196
- '-1101': BadRequest, # {"code":-1101,"msg":"Too many parameters; expected %s and received %s."}
2197
- '-1102': BadRequest, # {"code":-1102,"msg":"Param %s or %s must be sent, but both were empty"}
2198
- '-1103': BadRequest, # {"code":-1103,"msg":"An unknown parameter was sent."}
2199
- '-1104': BadRequest, # {"code":-1104,"msg":"Not all sent parameters were read, read 8 parameters but was sent 9"}
2200
- '-1105': BadRequest, # {"code":-1105,"msg":"Parameter %s was empty."}
2201
- '-1106': BadRequest, # {"code":-1106,"msg":"Parameter %s sent when not required."}
2202
- '-1108': BadSymbol, # BAD_ASSET
2203
2182
  '-1109': BadRequest, # BAD_ACCOUNT
2204
2183
  '-1110': BadSymbol, # BAD_INSTRUMENT_TYPE
2205
- '-1111': BadRequest, # {"code":-1111,"msg":"Precision is over the maximum defined for self asset."}
2206
- '-1112': OperationFailed, # {"code":-1112,"msg":"No orders on book for symbol."}
2207
2184
  '-1113': BadRequest, # {"code":-1113,"msg":"Withdrawal amount must be negative."}
2208
- '-1114': BadRequest, # {"code":-1114,"msg":"TimeInForce parameter sent when not required."}
2209
- '-1115': BadRequest, # {"code":-1115,"msg":"Invalid timeInForce."}
2210
- '-1116': BadRequest, # {"code":-1116,"msg":"Invalid orderType."}
2211
- '-1117': BadRequest, # {"code":-1117,"msg":"Invalid side."}
2212
- '-1118': BadRequest, # {"code":-1118,"msg":"New client order ID was empty."}
2213
- '-1119': BadRequest, # {"code":-1119,"msg":"Original client order ID was empty."}
2214
- '-1120': BadRequest, # {"code":-1120,"msg":"Invalid interval."}
2215
- '-1121': BadSymbol, # {"code":-1121,"msg":"Invalid symbol."}
2216
- '-1125': AuthenticationError, # {"code":-1125,"msg":"This listenKey does not exist."}
2217
- '-1127': BadRequest, # {"code":-1127,"msg":"More than %s hours between startTime and endTime."}
2218
2185
  '-1128': BadRequest, # {"code":-1128,"msg":"Combination of optional parameters invalid."}
2219
- '-1130': BadRequest, # {"code":-1130,"msg":"Data sent for paramter %s is not valid."}
2220
2186
  '-1136': BadRequest, # INVALID_NEW_ORDER_RESP_TYPE
2221
- '-2010': InvalidOrder, # NEW_ORDER_REJECTED
2222
- '-2011': OrderNotFound, # {"code":-2011,"msg":"cancelOrder(1, 'BTC/USDT') -> 'UNKNOWN_ORDER'"}
2223
- '-2013': OrderNotFound, # {"code":-2013,"msg":"fetchOrder(1, 'BTC/USDT') -> 'Order does not exist'"}
2224
- '-2014': AuthenticationError, # {"code":-2014,"msg":"API-key format invalid."}
2225
- '-2015': AuthenticationError, # {"code":-2015,"msg":"Invalid API-key, IP, or permissions for action."}
2187
+ #
2188
+ # 2xxx
2189
+ #
2226
2190
  '-2016': OperationRejected, # {"code":-2016,"msg":"No trading window could be found for the symbol. Try ticker/24hrs instead."}
2227
2191
  '-2018': InsufficientFunds, # {"code":-2018,"msg":"Balance is insufficient"}
2228
2192
  '-2019': InsufficientFunds, # Margin is insufficient
@@ -2235,65 +2199,13 @@ class binance(Exchange, ImplicitAPI):
2235
2199
  '-2026': InvalidOrder, # This OrderType is not supported when reduceOnly.
2236
2200
  '-2027': OperationRejected, # Exceeded the maximum allowable position at current leverage.
2237
2201
  '-2028': OperationRejected, # Leverage is smaller than permitted: insufficient margin balance.
2238
- '-4000': InvalidOrder, # INVALID_ORDER_STATUS
2239
- '-4001': BadRequest, # PRICE_LESS_THAN_ZERO
2240
- '-4002': BadRequest, # PRICE_GREATER_THAN_MAX_PRICE
2241
- '-4003': BadRequest, # QTY_LESS_THAN_ZERO
2242
- '-4004': BadRequest, # QTY_LESS_THAN_MIN_QTY
2243
- '-4005': BadRequest, # QTY_GREATER_THAN_MAX_QTY
2244
- '-4006': BadRequest, # STOP_PRICE_LESS_THAN_ZERO
2245
- '-4007': BadRequest, # STOP_PRICE_GREATER_THAN_MAX_PRICE
2246
- '-4008': BadRequest, # TICK SIZE LESS THAN ZERO
2247
- '-4009': BadRequest, # MAX_PRICE_LESS_THAN_MIN_PRICE
2248
- '-4010': BadRequest, # MAX_QTY_LESS_THAN_MIN_QTY
2249
- '-4011': BadRequest, # STEP_SIZE_LESS_THAN_ZERO
2250
- '-4012': BadRequest, # MAX_NUM_ORDERS_LESS_THAN_ZERO
2251
- '-4013': BadRequest, # PRICE_LESS_THAN_MIN_PRICE
2252
- '-4014': BadRequest, # PRICE NOT INCREASED BY TICK SIZE
2253
- '-4015': BadRequest, # Client order id is not valid
2254
- '-4016': BadRequest, # Price is higher than mark price multiplier cap.
2255
- '-4017': BadRequest, # MULTIPLIER_UP_LESS_THAN_ZERO
2256
- '-4018': BadRequest, # MULTIPLIER_DOWN_LESS_THAN_ZERO
2257
- '-4019': OperationRejected, # COMPOSITE_SCALE_OVERFLOW
2258
- '-4020': BadRequest, # TARGET_STRATEGY_INVALID
2259
- '-4021': BadRequest, # INVALID_DEPTH_LIMIT
2260
- '-4022': BadRequest, # WRONG_MARKET_STATUS
2261
- '-4023': BadRequest, # QTY_NOT_INCREASED_BY_STEP_SIZE
2262
- '-4024': BadRequest, # PRICE_LOWER_THAN_MULTIPLIER_DOWN
2263
- '-4025': BadRequest, # MULTIPLIER_DECIMAL_LESS_THAN_ZERO
2264
- '-4026': BadRequest, # COMMISSION_INVALID
2265
- '-4027': BadRequest, # INVALID_ACCOUNT_TYPE
2266
- '-4028': BadRequest, # INVALID_LEVERAGE
2267
- '-4029': BadRequest, # INVALID TICK SIZE PRECISION
2268
- '-4030': BadRequest, # INVALID_STEP_SIZE_PRECISION
2269
- '-4031': BadRequest, # INVALID_WORKING_TYPE
2270
- '-4032': OperationRejected, # EXCEED_MAX_CANCEL_ORDER_SIZE
2271
- '-4033': BadRequest, # INSURANCE_ACCOUNT_NOT_FOUND
2272
- '-4044': BadRequest, # INVALID_BALANCE_TYPE
2273
- '-4045': OperationRejected, # MAX_STOP_ORDER_EXCEEDED
2274
- '-4046': OperationRejected, # NO_NEED_TO_CHANGE_MARGIN_TYPE
2275
- '-4047': OperationRejected, # Margin type cannot be changed if there exists open orders.
2276
- '-4048': OperationRejected, # Margin type cannot be changed if there exists position.
2277
- '-4049': BadRequest, # Add margin only support for isolated position.
2278
- '-4050': InsufficientFunds, # Cross balance insufficient
2279
- '-4051': InsufficientFunds, # Isolated balance insufficient.
2280
- '-4052': OperationRejected, # No need to change auto add margin.
2281
- '-4053': BadRequest, # Auto add margin only support for isolated position.
2282
- '-4054': OperationRejected, # Cannot add position margin: position is 0.
2283
- '-4055': BadRequest, # Amount must be positive.
2284
- '-4056': AuthenticationError, # Invalid api key type.
2285
- '-4057': AuthenticationError, # Invalid api public key
2286
- '-4058': BadRequest, # MAX_PRICE_TOO_LARGE
2287
- '-4059': OperationRejected, # NO_NEED_TO_CHANGE_POSITION_SIDE
2288
- '-4060': BadRequest, # INVALID_POSITION_SIDE
2289
- '-4061': BadRequest, # POSITION_SIDE_NOT_MATCH
2290
- '-4062': BadRequest, # REDUCE_ONLY_CONFLICT
2202
+ #
2203
+ # 4xxx
2204
+ #
2291
2205
  '-4063': BadRequest, # INVALID_OPTIONS_REQUEST_TYPE
2292
2206
  '-4064': BadRequest, # INVALID_OPTIONS_TIME_FRAME
2293
2207
  '-4065': BadRequest, # INVALID_OPTIONS_AMOUNT
2294
2208
  '-4066': BadRequest, # INVALID_OPTIONS_EVENT_TYPE
2295
- '-4067': OperationRejected, # Position side cannot be changed if there exists open orders.
2296
- '-4068': OperationRejected, # Position side cannot be changed if there exists position.
2297
2209
  '-4069': BadRequest, # Position INVALID_OPTIONS_PREMIUM_FEE
2298
2210
  '-4070': BadRequest, # Client options id is not valid.
2299
2211
  '-4071': BadRequest, # Invalid options direction
@@ -2307,36 +2219,183 @@ class binance(Exchange, ImplicitAPI):
2307
2219
  '-4079': BadRequest, # invalid options id
2308
2220
  '-4080': PermissionDenied, # user not found with id: %s
2309
2221
  '-4081': BadRequest, # OPTIONS_NOT_FOUND
2310
- '-4082': BadRequest, # Invalid number of batch place orders
2311
- '-4083': OperationFailed, # Fail to place batch orders.
2312
- '-4084': BadRequest, # UPCOMING_METHOD
2313
2222
  '-4085': BadRequest, # Invalid notional limit coefficient
2314
2223
  '-4086': BadRequest, # Invalid price spread threshold
2315
2224
  '-4087': PermissionDenied, # User can only place reduce only order
2316
2225
  '-4088': PermissionDenied, # User can not place order currently
2317
- '-4104': BadRequest, # INVALID_CONTRACT_TYPE
2318
2226
  '-4114': BadRequest, # INVALID_CLIENT_TRAN_ID_LEN
2319
2227
  '-4115': BadRequest, # DUPLICATED_CLIENT_TRAN_ID
2320
2228
  '-4118': OperationRejected, # REDUCE_ONLY_MARGIN_CHECK_FAILED
2321
2229
  '-4131': OperationRejected, # The counterparty's best price does not meet the PERCENT_PRICE filter limit
2322
- '-4135': BadRequest, # Invalid activation price
2323
- '-4137': BadRequest, # Quantity must be zero with closePosition equals True
2324
- '-4138': BadRequest, # Reduce only must be True with closePosition equals True
2325
- '-4139': BadRequest, # Order type can not be market if it's unable to cancel
2326
2230
  '-4140': BadRequest, # Invalid symbol status for opening position
2327
2231
  '-4141': BadRequest, # Symbol is closed
2328
- '-4142': OrderImmediatelyFillable, # REJECT: take profit or stop order will be triggered immediately
2329
2232
  '-4144': BadSymbol, # Invalid pair
2330
2233
  '-4161': OperationRejected, # Leverage reduction is not supported in Isolated Margin Mode with open positions
2331
2234
  '-4164': OperationRejected, # Leverage reduction is not supported in Isolated Margin Mode with open positions
2332
2235
  '-4165': BadRequest, # Invalid time interval
2333
2236
  '-4183': BadRequest, # Price is higher than stop price multiplier cap.
2334
2237
  '-4184': BadRequest, # Price is lower than stop price multiplier floor.
2238
+ #
2239
+ # 5xxx
2240
+ #
2335
2241
  '-5021': OrderNotFillable, # Due to the order could not be filled immediately, the FOK order has been rejected.
2336
2242
  '-5022': OrderNotFillable, # Due to the order could not be executed, the Post Only order will be rejected.
2243
+ #
2244
+ # 2xxxx
2245
+ #
2246
+ '-20121': ExchangeError, # override commons
2247
+ '-20124': ExchangeError, # override commons
2248
+ '-20130': ExchangeError, # override commons
2249
+ '-20132': ExchangeError, # override commons
2250
+ '-20194': ExchangeError, # override commons
2251
+ '-20195': ExchangeError, # override commons
2252
+ '-20196': ExchangeError, # override commons
2253
+ '-20198': ExchangeError, # override commons
2254
+ '-20204': ExchangeError, # override commons
2255
+ # 21xxx - PORTFOLIO MARGIN(documented in spot docs)
2256
+ '-21001': BadRequest, # Request ID is not a Portfolio Margin Account.
2257
+ '-21002': BadRequest, # Portfolio Margin Account doesn't support transfer from margin to futures.
2258
+ '-21003': BadResponse, # Fail to retrieve margin assets.
2259
+ '-21004': OperationRejected, # User doesn’t have portfolio margin bankruptcy loan
2260
+ '-21005': InsufficientFunds, # User’s spot wallet doesn’t have enough BUSD to repay portfolio margin bankruptcy loan
2261
+ '-21006': OperationFailed, # User had portfolio margin bankruptcy loan repayment in process
2262
+ '-21007': OperationFailed, # User failed to repay portfolio margin bankruptcy loan since liquidation was in process
2337
2263
  },
2338
2264
  },
2339
2265
  'exact': {
2266
+ # error codes to cover ALL market types(however, specific market type might have override)
2267
+ #
2268
+ # 1xxx
2269
+ #
2270
+ '-1000': OperationFailed, # {"code":-1000,"msg":"An unknown error occured while processing the request."}
2271
+ '-1001': OperationFailed, # {"code":-1001,"msg":"'Internal error; unable to process your request. Please try again.'"}
2272
+ '-1002': AuthenticationError, # {"code":-1002,"msg":"'You are not authorized to execute self request.'"}
2273
+ '-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."}
2274
+ '-1004': OperationRejected, # DUPLICATE_IP : This IP is already on the white list
2275
+ '-1006': OperationFailed, # {"code":-1006,"msg":"An unexpected response was received from the message bus. Execution status unknown."}
2276
+ '-1007': RequestTimeout, # {"code":-1007,"msg":"Timeout waiting for response from backend server. Send status unknown; execution status unknown."}
2277
+ '-1010': OperationFailed, # {"code":-1010,"msg":"ERROR_MSG_RECEIVED."}
2278
+ '-1013': BadRequest, # INVALID_MESSAGE
2279
+ '-1014': InvalidOrder, # {"code":-1014,"msg":"Unsupported order combination."}
2280
+ '-1015': RateLimitExceeded, # {"code":-1015,"msg":"'Too many new orders; current limit is %s orders per %s.'"}
2281
+ '-1016': BadRequest, # {"code":-1016,"msg":"'This service is no longer available.',"}
2282
+ '-1020': BadRequest, # {"code":-1020,"msg":"'This operation is not supported.'"}
2283
+ '-1021': InvalidNonce, # {"code":-1021,"msg":"'your time is ahead of server'"}
2284
+ '-1022': AuthenticationError, # {"code":-1022,"msg":"Signature for self request is not valid."}
2285
+ '-1100': BadRequest, # {"code":-1100,"msg":"createOrder(symbol, 1, asdf) -> 'Illegal characters found in parameter 'price'"}
2286
+ '-1101': BadRequest, # {"code":-1101,"msg":"Too many parameters; expected %s and received %s."}
2287
+ '-1102': BadRequest, # {"code":-1102,"msg":"Param %s or %s must be sent, but both were empty"}
2288
+ '-1103': BadRequest, # {"code":-1103,"msg":"An unknown parameter was sent."}
2289
+ '-1104': BadRequest, # {"code":-1104,"msg":"Not all sent parameters were read, read 8 parameters but was sent 9"}
2290
+ '-1105': BadRequest, # {"code":-1105,"msg":"Parameter %s was empty."}
2291
+ '-1106': BadRequest, # {"code":-1106,"msg":"Parameter %s sent when not required."}
2292
+ '-1108': BadSymbol, # {"code":-1108,"msg":"Invalid asset."}
2293
+ '-1111': BadRequest, # {"code":-1111,"msg":"Precision is over the maximum defined for self asset."}
2294
+ '-1112': OperationFailed, # {"code":-1112,"msg":"No orders on book for symbol."}
2295
+ '-1114': BadRequest, # {"code":-1114,"msg":"TimeInForce parameter sent when not required."}
2296
+ '-1115': BadRequest, # {"code":-1115,"msg":"Invalid timeInForce."}
2297
+ '-1116': BadRequest, # {"code":-1116,"msg":"Invalid orderType."}
2298
+ '-1117': BadRequest, # {"code":-1117,"msg":"Invalid side."}
2299
+ '-1118': BadRequest, # {"code":-1118,"msg":"New client order ID was empty."}
2300
+ '-1119': BadRequest, # {"code":-1119,"msg":"Original client order ID was empty."}
2301
+ '-1120': BadRequest, # {"code":-1120,"msg":"Invalid interval."}
2302
+ '-1121': BadSymbol, # {"code":-1121,"msg":"Invalid symbol."}
2303
+ '-1125': AuthenticationError, # {"code":-1125,"msg":"This listenKey does not exist."}
2304
+ '-1127': BadRequest, # {"code":-1127,"msg":"More than %s hours between startTime and endTime."}
2305
+ '-1128': BadRequest, # {"code":-1128,"msg":"Combination of optional parameters invalid."}
2306
+ '-1130': BadRequest, # {"code":-1130,"msg":"Data sent for paramter %s is not valid."}
2307
+ #
2308
+ # 2xxx
2309
+ #
2310
+ '-2010': InvalidOrder, # NEW_ORDER_REJECTED
2311
+ '-2011': OrderNotFound, # {"code":-2011,"msg":"cancelOrder(1, 'BTC/USDT') -> 'UNKNOWN_ORDER'"}
2312
+ '-2013': OrderNotFound, # {"code":-2013,"msg":"fetchOrder(1, 'BTC/USDT') -> 'Order does not exist'"}
2313
+ '-2014': AuthenticationError, # {"code":-2014,"msg":"API-key format invalid."}
2314
+ '-2015': AuthenticationError, # {"code":-2015,"msg":"Invalid API-key, IP, or permissions for action."}
2315
+ #
2316
+ # 4xxx(common for linear, inverse, pm)
2317
+ #
2318
+ '-4000': InvalidOrder, # INVALID_ORDER_STATUS
2319
+ '-4001': BadRequest, # PRICE_LESS_THAN_ZERO
2320
+ '-4002': BadRequest, # PRICE_GREATER_THAN_MAX_PRICE
2321
+ '-4003': BadRequest, # QTY_LESS_THAN_ZERO
2322
+ '-4004': BadRequest, # QTY_LESS_THAN_MIN_QTY
2323
+ '-4005': BadRequest, # QTY_GREATER_THAN_MAX_QTY
2324
+ '-4006': BadRequest, # STOP_PRICE_LESS_THAN_ZERO
2325
+ '-4007': BadRequest, # STOP_PRICE_GREATER_THAN_MAX_PRICE
2326
+ '-4008': BadRequest, # TICK SIZE LESS THAN ZERO
2327
+ '-4009': BadRequest, # MAX_PRICE_LESS_THAN_MIN_PRICE
2328
+ '-4010': BadRequest, # MAX_QTY_LESS_THAN_MIN_QTY
2329
+ '-4011': BadRequest, # STEP_SIZE_LESS_THAN_ZERO
2330
+ '-4012': BadRequest, # MAX_NUM_ORDERS_LESS_THAN_ZERO
2331
+ '-4013': BadRequest, # PRICE_LESS_THAN_MIN_PRICE
2332
+ '-4014': BadRequest, # PRICE NOT INCREASED BY TICK SIZE
2333
+ '-4015': BadRequest, # Client order id is not valid
2334
+ '-4016': BadRequest, # Price is higher than mark price multiplier cap.
2335
+ '-4017': BadRequest, # MULTIPLIER_UP_LESS_THAN_ZERO
2336
+ '-4018': BadRequest, # MULTIPLIER_DOWN_LESS_THAN_ZERO
2337
+ '-4019': OperationRejected, # COMPOSITE_SCALE_OVERFLOW
2338
+ '-4020': BadRequest, # TARGET_STRATEGY_INVALID
2339
+ '-4021': BadRequest, # INVALID_DEPTH_LIMIT
2340
+ '-4022': BadRequest, # WRONG_MARKET_STATUS
2341
+ '-4023': BadRequest, # QTY_NOT_INCREASED_BY_STEP_SIZE
2342
+ '-4024': BadRequest, # PRICE_LOWER_THAN_MULTIPLIER_DOWN
2343
+ '-4025': BadRequest, # MULTIPLIER_DECIMAL_LESS_THAN_ZERO
2344
+ '-4026': BadRequest, # COMMISSION_INVALID
2345
+ '-4027': BadRequest, # INVALID_ACCOUNT_TYPE
2346
+ '-4028': BadRequest, # INVALID_LEVERAGE
2347
+ '-4029': BadRequest, # INVALID_TICK SIZE_PRECISION
2348
+ '-4030': BadRequest, # INVALID_STEP_SIZE_PRECISION
2349
+ '-4031': BadRequest, # INVALID_WORKING_TYPE
2350
+ '-4032': OperationRejected, # EXCEED_MAX_CANCEL_ORDER_SIZE(or Invalid parameter working type: %s)
2351
+ '-4033': BadRequest, # INSURANCE_ACCOUNT_NOT_FOUND
2352
+ '-4044': BadRequest, # INVALID_BALANCE_TYPE
2353
+ '-4045': OperationRejected, # MAX_STOP_ORDER_EXCEEDED
2354
+ '-4046': OperationRejected, # NO_NEED_TO_CHANGE_MARGIN_TYPE
2355
+ '-4047': OperationRejected, # Margin type cannot be changed if there exists open orders.
2356
+ '-4048': OperationRejected, # Margin type cannot be changed if there exists position.
2357
+ '-4049': BadRequest, # Add margin only support for isolated position.
2358
+ '-4050': InsufficientFunds, # Cross balance insufficient
2359
+ '-4051': InsufficientFunds, # Isolated balance insufficient.
2360
+ '-4052': OperationRejected, # No need to change auto add margin.
2361
+ '-4053': BadRequest, # Auto add margin only support for isolated position.
2362
+ '-4054': OperationRejected, # Cannot add position margin: position is 0.
2363
+ '-4055': BadRequest, # Amount must be positive.
2364
+ '-4056': AuthenticationError, # INVALID_API_KEY_TYPE
2365
+ '-4057': AuthenticationError, # INVALID_RSA_PUBLIC_KEY: Invalid api public key
2366
+ '-4058': BadRequest, # MAX_PRICE_TOO_LARGE
2367
+ '-4059': OperationRejected, # NO_NEED_TO_CHANGE_POSITION_SIDE
2368
+ '-4060': BadRequest, # INVALID_POSITION_SIDE
2369
+ '-4061': OperationRejected, # POSITION_SIDE_NOT_MATCH: Order's position side does not match user's setting.
2370
+ '-4062': BadRequest, # REDUCE_ONLY_CONFLICT: Invalid or improper reduceOnly value.
2371
+ '-4067': OperationRejected, # Position side cannot be changed if there exists open orders.
2372
+ '-4068': OperationRejected, # Position side cannot be changed if there exists position.
2373
+ '-4082': BadRequest, # Invalid number of batch place orders.
2374
+ '-4083': OperationRejected, # PLACE_BATCH_ORDERS_FAIL : Fail to place batch orders.
2375
+ '-4084': BadRequest, # UPCOMING_METHOD : Method is not allowed currently. Upcoming soon.
2376
+ '-4086': BadRequest, # Invalid price spread threshold.
2377
+ '-4104': BadRequest, # INVALID_CONTRACT_TYPE
2378
+ '-4135': BadRequest, # Invalid activation price
2379
+ '-4137': BadRequest, # Quantity must be zero with closePosition equals True
2380
+ '-4138': BadRequest, # Reduce only must be True with closePosition equals True
2381
+ '-4139': BadRequest, # Order type can not be market if it's unable to cancel
2382
+ '-4142': OrderImmediatelyFillable, # REJECT: take profit or stop order will be triggered immediately
2383
+ #
2384
+ # 2xxxx
2385
+ #
2386
+ # 20xxx - spot & futures algo(TBD for OPTIONS & PORTFOLIO MARGIN)
2387
+ '-20121': BadSymbol, # Invalid symbol.
2388
+ '-20124': BadRequest, # Invalid algo id or it has been completed.
2389
+ '-20130': BadRequest, # Invalid data sent for a parameter
2390
+ '-20132': BadRequest, # The client algo id is duplicated
2391
+ '-20194': BadRequest, # Duration is too short to execute all required quantity.
2392
+ '-20195': BadRequest, # The total size is too small.
2393
+ '-20196': BadRequest, # The total size is too large.
2394
+ '-20198': OperationRejected, # Reach the max open orders allowed.
2395
+ '-20204': BadRequest, # The notional of USD is less or more than the limit.
2396
+ #
2397
+ # strings
2398
+ #
2340
2399
  'System is under maintenance.': OnMaintenance, # {"code":1,"msg":"System is under maintenance."}
2341
2400
  'System abnormality': OperationFailed, # {"code":-1000,"msg":"System abnormality"}
2342
2401
  'You are not authorized to execute self request.': PermissionDenied, # {"msg":"You are not authorized to execute self request."}
@@ -2449,7 +2508,7 @@ class binance(Exchange, ImplicitAPI):
2449
2508
  'info': None,
2450
2509
  }
2451
2510
 
2452
- def market(self, symbol):
2511
+ def market(self, symbol: str) -> MarketInterface:
2453
2512
  if self.markets is None:
2454
2513
  raise ExchangeError(self.id + ' markets not loaded')
2455
2514
  # defaultType has legacy support on binance
@@ -2496,7 +2555,7 @@ class binance(Exchange, ImplicitAPI):
2496
2555
  return self.create_expired_option_market(symbol)
2497
2556
  raise BadSymbol(self.id + ' does not have market symbol ' + symbol)
2498
2557
 
2499
- def safe_market(self, marketId=None, market=None, delimiter=None, marketType=None):
2558
+ def safe_market(self, marketId: Str = None, market: Market = None, delimiter: Str = None, marketType: Str = None) -> MarketInterface:
2500
2559
  isOption = (marketId is not None) and ((marketId.find('-C') > -1) or (marketId.find('-P') > -1))
2501
2560
  if isOption and not (marketId in self.markets_by_id):
2502
2561
  # handle expired option contracts
@@ -4012,7 +4071,7 @@ class binance(Exchange, ImplicitAPI):
4012
4071
  inverse = self.safe_bool(market, 'inverse')
4013
4072
  volumeIndex = 7 if inverse else 5
4014
4073
  return [
4015
- self.safe_integer_2(ohlcv, 0, 'closeTime'),
4074
+ self.safe_integer_2(ohlcv, 0, 'openTime'),
4016
4075
  self.safe_number_2(ohlcv, 1, 'open'),
4017
4076
  self.safe_number_2(ohlcv, 2, 'high'),
4018
4077
  self.safe_number_2(ohlcv, 3, 'low'),