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