/python/ccxt/bitget.py

https://github.com/kroitor/ccxt · Python · 2702 lines · 1687 code · 46 blank · 969 comment · 177 complexity · fa97a956558a94f3ed1ea9e57ea1d7af MD5 · raw file

Large files are truncated click here to view the full file

  1. # -*- coding: utf-8 -*-
  2. # PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
  3. # https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
  4. from ccxt.base.exchange import Exchange
  5. import hashlib
  6. from ccxt.base.errors import ExchangeError
  7. from ccxt.base.errors import AuthenticationError
  8. from ccxt.base.errors import PermissionDenied
  9. from ccxt.base.errors import AccountSuspended
  10. from ccxt.base.errors import ArgumentsRequired
  11. from ccxt.base.errors import BadRequest
  12. from ccxt.base.errors import BadSymbol
  13. from ccxt.base.errors import InsufficientFunds
  14. from ccxt.base.errors import InvalidAddress
  15. from ccxt.base.errors import InvalidOrder
  16. from ccxt.base.errors import OrderNotFound
  17. from ccxt.base.errors import CancelPending
  18. from ccxt.base.errors import NotSupported
  19. from ccxt.base.errors import DDoSProtection
  20. from ccxt.base.errors import RateLimitExceeded
  21. from ccxt.base.errors import ExchangeNotAvailable
  22. from ccxt.base.errors import OnMaintenance
  23. from ccxt.base.errors import InvalidNonce
  24. from ccxt.base.errors import RequestTimeout
  25. from ccxt.base.decimal_to_precision import TRUNCATE
  26. from ccxt.base.decimal_to_precision import DECIMAL_PLACES
  27. from ccxt.base.decimal_to_precision import TICK_SIZE
  28. class bitget(Exchange):
  29. def describe(self):
  30. return self.deep_extend(super(bitget, self).describe(), {
  31. 'id': 'bitget',
  32. 'name': 'Bitget',
  33. 'countries': ['SG'],
  34. 'version': 'v3',
  35. 'rateLimit': 1000, # up to 3000 requests per 5 minutes 600 requests per minute 10 requests per second 100 ms
  36. 'has': {
  37. 'cancelOrder': True,
  38. 'cancelOrders': True,
  39. 'CORS': False,
  40. 'createOrder': True,
  41. 'fetchAccounts': True,
  42. 'fetchBalance': True,
  43. 'fetchCurrencies': True,
  44. 'fetchDeposits': True,
  45. 'fetchMarkets': True,
  46. 'fetchMyTrades': True,
  47. 'fetchOHLCV': True,
  48. 'fetchOrder': True,
  49. 'fetchOrderBook': True,
  50. 'fetchOpenOrders': True,
  51. 'fetchClosedOrders': True,
  52. 'fetchOrderTrades': True,
  53. 'fetchTicker': True,
  54. 'fetchTickers': True,
  55. 'fetchTime': True,
  56. 'fetchTrades': True,
  57. 'fetchWithdrawals': True,
  58. },
  59. 'timeframes': {
  60. '1m': '1m',
  61. '5m': '5m',
  62. '15m': '15m',
  63. '30m': '30m',
  64. '1h': '1h',
  65. '2h': '2h',
  66. '4h': '4h',
  67. '6h': '6h',
  68. '12h': '12h',
  69. '1d': '1d',
  70. '1w': '1w',
  71. },
  72. 'hostname': 'bitget.com',
  73. 'urls': {
  74. 'logo': 'https://user-images.githubusercontent.com/51840849/88317935-a8a21c80-cd22-11ea-8e2b-4b9fac5975eb.jpg',
  75. 'api': {
  76. 'data': 'https://api.{hostname}',
  77. 'api': 'https://api.{hostname}',
  78. 'capi': 'https://capi.{hostname}',
  79. 'swap': 'https://capi.{hostname}',
  80. },
  81. 'www': 'https://www.bitget.com',
  82. 'doc': [
  83. 'https://bitgetlimited.github.io/apidoc/en/swap',
  84. 'https://bitgetlimited.github.io/apidoc/en/spot',
  85. ],
  86. 'fees': 'https://www.bitget.cc/zh-CN/rate?tab=1',
  87. 'test': {
  88. 'rest': 'https://testnet.bitget.com',
  89. },
  90. 'referral': 'https://www.bitget.com/expressly?languageType=0&channelCode=ccxt&vipCode=tg9j',
  91. },
  92. 'api': {
  93. 'data': {
  94. 'get': [
  95. 'market/history/kline', # Kline data
  96. 'market/detail/merged', # Get aggregated ticker
  97. 'market/tickers', # Get all trading tickers
  98. 'market/allticker', # Get all trading market method 2
  99. 'market/depth', # Get Market Depth Data
  100. 'market/trade', # Get Trade Detail Data
  101. 'market/history/trade', # Get record of trading
  102. 'market/detail', # Get Market Detail 24h Volume
  103. 'common/symbols', # Query all trading pairs and accuracy supported in the station
  104. 'common/currencys', # Query all currencies supported in the station
  105. 'common/timestamp', # Query system current time
  106. ],
  107. },
  108. 'api': {
  109. 'get': [
  110. 'account/accounts', # Get all accounts of current user(即account_id)
  111. 'accounts/{account_id}/balance', # Get the balance of the specified account
  112. 'order/orders', # Query order, deprecated
  113. 'order/orders/openOrders',
  114. 'order/orders/history',
  115. 'order/deposit_withdraw', # Query assets history
  116. ],
  117. 'post': [
  118. 'order/orders/place', # Place order
  119. 'order/orders/{order_id}/submitcancel', # Request to cancel an order request
  120. 'order/orders/batchcancel', # Bulk order cancellation
  121. 'order/orders/{order_id}', # Query an order details
  122. 'order/orders/{order_id}/matchresults', # Query the transaction details of an order
  123. 'order/matchresults', # Query current order, order history
  124. ],
  125. },
  126. 'capi': {
  127. 'get': [
  128. 'market/time',
  129. 'market/contracts',
  130. 'market/depth',
  131. 'market/tickers',
  132. 'market/ticker',
  133. 'market/trades',
  134. 'market/candles',
  135. 'market/index',
  136. 'market/open_interest',
  137. 'market/price_limit',
  138. 'market/funding_time',
  139. 'market/historical_funding_rate',
  140. 'market/mark_price',
  141. 'market/open_count',
  142. ],
  143. },
  144. 'swap': {
  145. 'get': [
  146. 'account/accounts',
  147. 'account/account',
  148. 'account/settings',
  149. 'position/allPosition',
  150. 'position/singlePosition',
  151. 'position/holds',
  152. 'order/detail',
  153. 'order/orders',
  154. 'order/fills',
  155. 'order/currentPlan',
  156. 'order/historyPlan',
  157. ],
  158. 'post': [
  159. 'account/leverage',
  160. 'account/adjustMargin',
  161. 'account/modifyAutoAppendMargin',
  162. 'order/placeOrder',
  163. 'order/batchOrders',
  164. 'order/cancel_order',
  165. 'order/cancel_batch_orders',
  166. 'order/plan_order',
  167. 'order/cancel_plan',
  168. ],
  169. },
  170. },
  171. 'fees': {
  172. 'spot': {
  173. 'taker': 0.002,
  174. 'maker': 0.002,
  175. },
  176. 'swap': {
  177. 'taker': 0.0006,
  178. 'maker': 0.0004,
  179. },
  180. },
  181. 'requiredCredentials': {
  182. 'apiKey': True,
  183. 'secret': True,
  184. 'password': True,
  185. },
  186. 'exceptions': {
  187. # http error codes
  188. # 400 Bad Request Invalid request format
  189. # 401 Unauthorized Invalid API Key
  190. # 403 Forbidden You do not have access to the requested resource
  191. # 404 Not Found
  192. # 500 Internal Server Error We had a problem with our server
  193. 'exact': {
  194. '1': ExchangeError, # {"code": 1, "message": "System error"}
  195. # undocumented
  196. 'failure to get a peer from the ring-balancer': ExchangeNotAvailable, # {"message": "failure to get a peer from the ring-balancer"}
  197. '4010': PermissionDenied, # {"code": 4010, "message": "For the security of your funds, withdrawals are not permitted within 24 hours after changing fund password / mobile number / Google Authenticator settings "}
  198. # common
  199. # '0': ExchangeError, # 200 successful,when the order placement / cancellation / operation is successful
  200. '4001': ExchangeError, # no data received in 30s
  201. '4002': ExchangeError, # Buffer full. cannot write data
  202. # --------------------------------------------------------
  203. '30001': AuthenticationError, # {"code": 30001, "message": 'request header "OK_ACCESS_KEY" cannot be blank'}
  204. '30002': AuthenticationError, # {"code": 30002, "message": 'request header "OK_ACCESS_SIGN" cannot be blank'}
  205. '30003': AuthenticationError, # {"code": 30003, "message": 'request header "OK_ACCESS_TIMESTAMP" cannot be blank'}
  206. '30004': AuthenticationError, # {"code": 30004, "message": 'request header "OK_ACCESS_PASSPHRASE" cannot be blank'}
  207. '30005': InvalidNonce, # {"code": 30005, "message": "invalid OK_ACCESS_TIMESTAMP"}
  208. '30006': AuthenticationError, # {"code": 30006, "message": "invalid OK_ACCESS_KEY"}
  209. '30007': BadRequest, # {"code": 30007, "message": 'invalid Content_Type, please use "application/json" format'}
  210. '30008': RequestTimeout, # {"code": 30008, "message": "timestamp request expired"}
  211. '30009': ExchangeError, # {"code": 30009, "message": "system error"}
  212. '30010': AuthenticationError, # {"code": 30010, "message": "API validation failed"}
  213. '30011': PermissionDenied, # {"code": 30011, "message": "invalid IP"}
  214. '30012': AuthenticationError, # {"code": 30012, "message": "invalid authorization"}
  215. '30013': AuthenticationError, # {"code": 30013, "message": "invalid sign"}
  216. '30014': DDoSProtection, # {"code": 30014, "message": "request too frequent"}
  217. '30015': AuthenticationError, # {"code": 30015, "message": 'request header "OK_ACCESS_PASSPHRASE" incorrect'}
  218. '30016': ExchangeError, # {"code": 30015, "message": "you are using v1 apiKey, please use v1 endpoint. If you would like to use v3 endpoint, please subscribe to v3 apiKey"}
  219. '30017': ExchangeError, # {"code": 30017, "message": "apikey's broker id does not match"}
  220. '30018': ExchangeError, # {"code": 30018, "message": "apikey's domain does not match"}
  221. '30019': ExchangeNotAvailable, # {"code": 30019, "message": "Api is offline or unavailable"}
  222. '30020': BadRequest, # {"code": 30020, "message": "body cannot be blank"}
  223. '30021': BadRequest, # {"code": 30021, "message": "Json data format error"}, {"code": 30021, "message": "json data format error"}
  224. '30022': PermissionDenied, # {"code": 30022, "message": "Api has been frozen"}
  225. '30023': BadRequest, # {"code": 30023, "message": "{0} parameter cannot be blank"}
  226. '30024': BadSymbol, # {"code":30024,"message":"\"instrument_id\" is an invalid parameter"}
  227. '30025': BadRequest, # {"code": 30025, "message": "{0} parameter category error"}
  228. '30026': DDoSProtection, # {"code": 30026, "message": "requested too frequent"}
  229. '30027': AuthenticationError, # {"code": 30027, "message": "login failure"}
  230. '30028': PermissionDenied, # {"code": 30028, "message": "unauthorized execution"}
  231. '30029': AccountSuspended, # {"code": 30029, "message": "account suspended"}
  232. '30030': ExchangeError, # {"code": 30030, "message": "endpoint request failed. Please try again"}
  233. '30031': BadRequest, # {"code": 30031, "message": "token does not exist"}
  234. '30032': BadSymbol, # {"code": 30032, "message": "pair does not exist"}
  235. '30033': BadRequest, # {"code": 30033, "message": "exchange domain does not exist"}
  236. '30034': ExchangeError, # {"code": 30034, "message": "exchange ID does not exist"}
  237. '30035': ExchangeError, # {"code": 30035, "message": "trading is not supported in self website"}
  238. '30036': ExchangeError, # {"code": 30036, "message": "no relevant data"}
  239. '30037': ExchangeNotAvailable, # {"code": 30037, "message": "endpoint is offline or unavailable"}
  240. # '30038': AuthenticationError, # {"code": 30038, "message": "user does not exist"}
  241. '30038': OnMaintenance, # {"client_oid":"","code":"30038","error_code":"30038","error_message":"Matching engine is being upgraded. Please try in about 1 minute.","message":"Matching engine is being upgraded. Please try in about 1 minute.","order_id":"-1","result":false}
  242. # futures
  243. '32001': AccountSuspended, # {"code": 32001, "message": "futures account suspended"}
  244. '32002': PermissionDenied, # {"code": 32002, "message": "futures account does not exist"}
  245. '32003': CancelPending, # {"code": 32003, "message": "canceling, please wait"}
  246. '32004': ExchangeError, # {"code": 32004, "message": "you have no unfilled orders"}
  247. '32005': InvalidOrder, # {"code": 32005, "message": "max order quantity"}
  248. '32006': InvalidOrder, # {"code": 32006, "message": "the order price or trigger price exceeds USD 1 million"}
  249. '32007': InvalidOrder, # {"code": 32007, "message": "leverage level must be the same for orders on the same side of the contract"}
  250. '32008': InvalidOrder, # {"code": 32008, "message": "Max. positions to open(cross margin)"}
  251. '32009': InvalidOrder, # {"code": 32009, "message": "Max. positions to open(fixed margin)"}
  252. '32010': ExchangeError, # {"code": 32010, "message": "leverage cannot be changed with open positions"}
  253. '32011': ExchangeError, # {"code": 32011, "message": "futures status error"}
  254. '32012': ExchangeError, # {"code": 32012, "message": "futures order update error"}
  255. '32013': ExchangeError, # {"code": 32013, "message": "token type is blank"}
  256. '32014': ExchangeError, # {"code": 32014, "message": "your number of contracts closing is larger than the number of contracts available"}
  257. '32015': ExchangeError, # {"code": 32015, "message": "margin ratio is lower than 100% before opening positions"}
  258. '32016': ExchangeError, # {"code": 32016, "message": "margin ratio is lower than 100% after opening position"}
  259. '32017': ExchangeError, # {"code": 32017, "message": "no BBO"}
  260. '32018': ExchangeError, # {"code": 32018, "message": "the order quantity is less than 1, please try again"}
  261. '32019': ExchangeError, # {"code": 32019, "message": "the order price deviates from the price of the previous minute by more than 3%"}
  262. '32020': ExchangeError, # {"code": 32020, "message": "the price is not in the range of the price limit"}
  263. '32021': ExchangeError, # {"code": 32021, "message": "leverage error"}
  264. '32022': ExchangeError, # {"code": 32022, "message": "self function is not supported in your country or region according to the regulations"}
  265. '32023': ExchangeError, # {"code": 32023, "message": "self account has outstanding loan"}
  266. '32024': ExchangeError, # {"code": 32024, "message": "order cannot be placed during delivery"}
  267. '32025': ExchangeError, # {"code": 32025, "message": "order cannot be placed during settlement"}
  268. '32026': ExchangeError, # {"code": 32026, "message": "your account is restricted from opening positions"}
  269. '32027': ExchangeError, # {"code": 32027, "message": "cancelled over 20 orders"}
  270. '32028': AccountSuspended, # {"code": 32028, "message": "account is suspended and liquidated"}
  271. '32029': ExchangeError, # {"code": 32029, "message": "order info does not exist"}
  272. '32030': InvalidOrder, # The order cannot be cancelled
  273. '32031': ArgumentsRequired, # client_oid or order_id is required.
  274. '32038': AuthenticationError, # User does not exist
  275. '32040': ExchangeError, # User have open contract orders or position
  276. '32044': ExchangeError, # {"code": 32044, "message": "The margin ratio after submitting self order is lower than the minimum requirement({0}) for your tier."}
  277. '32045': ExchangeError, # String of commission over 1 million
  278. '32046': ExchangeError, # Each user can hold up to 10 trade plans at the same time
  279. '32047': ExchangeError, # system error
  280. '32048': InvalidOrder, # Order strategy track range error
  281. '32049': ExchangeError, # Each user can hold up to 10 track plans at the same time
  282. '32050': InvalidOrder, # Order strategy rang error
  283. '32051': InvalidOrder, # Order strategy ice depth error
  284. '32052': ExchangeError, # String of commission over 100 thousand
  285. '32053': ExchangeError, # Each user can hold up to 6 ice plans at the same time
  286. '32057': ExchangeError, # The order price is zero. Market-close-all function cannot be executed
  287. '32054': ExchangeError, # Trade not allow
  288. '32055': InvalidOrder, # cancel order error
  289. '32056': ExchangeError, # iceberg per order average should between {0}-{1} contracts
  290. '32058': ExchangeError, # Each user can hold up to 6 initiative plans at the same time
  291. '32059': InvalidOrder, # Total amount should exceed per order amount
  292. '32060': InvalidOrder, # Order strategy type error
  293. '32061': InvalidOrder, # Order strategy initiative limit error
  294. '32062': InvalidOrder, # Order strategy initiative range error
  295. '32063': InvalidOrder, # Order strategy initiative rate error
  296. '32064': ExchangeError, # Time Stringerval of orders should set between 5-120s
  297. '32065': ExchangeError, # Close amount exceeds the limit of Market-close-all(999 for BTC, and 9999 for the rest tokens)
  298. '32066': ExchangeError, # You have open orders. Please cancel all open orders before changing your leverage level.
  299. '32067': ExchangeError, # Account equity < required margin in self setting. Please adjust your leverage level again.
  300. '32068': ExchangeError, # The margin for self position will fall short of the required margin in self setting. Please adjust your leverage level or increase your margin to proceed.
  301. '32069': ExchangeError, # Target leverage level too low. Your account balance is insufficient to cover the margin required. Please adjust the leverage level again.
  302. '32070': ExchangeError, # Please check open position or unfilled order
  303. '32071': ExchangeError, # Your current liquidation mode does not support self action.
  304. '32072': ExchangeError, # The highest available margin for your orders tier is {0}. Please edit your margin and place a new order.
  305. '32073': ExchangeError, # The action does not apply to the token
  306. '32074': ExchangeError, # The number of contracts of your position, open orders, and the current order has exceeded the maximum order limit of self asset.
  307. '32075': ExchangeError, # Account risk rate breach
  308. '32076': ExchangeError, # Liquidation of the holding position(s) at market price will require cancellation of all pending close orders of the contracts.
  309. '32077': ExchangeError, # Your margin for self asset in futures account is insufficient and the position has been taken over for liquidation.(You will not be able to place orders, close positions, transfer funds, or add margin during self period of time. Your account will be restored after the liquidation is complete.)
  310. '32078': ExchangeError, # Please cancel all open orders before switching the liquidation mode(Please cancel all open orders before switching the liquidation mode)
  311. '32079': ExchangeError, # Your open positions are at high risk.(Please add margin or reduce positions before switching the mode)
  312. '32080': ExchangeError, # Funds cannot be transferred out within 30 minutes after futures settlement
  313. '32083': ExchangeError, # The number of contracts should be a positive multiple of %%. Please place your order again
  314. # token and margin trading
  315. '33001': PermissionDenied, # {"code": 33001, "message": "margin account for self pair is not enabled yet"}
  316. '33002': AccountSuspended, # {"code": 33002, "message": "margin account for self pair is suspended"}
  317. '33003': InsufficientFunds, # {"code": 33003, "message": "no loan balance"}
  318. '33004': ExchangeError, # {"code": 33004, "message": "loan amount cannot be smaller than the minimum limit"}
  319. '33005': ExchangeError, # {"code": 33005, "message": "repayment amount must exceed 0"}
  320. '33006': ExchangeError, # {"code": 33006, "message": "loan order not found"}
  321. '33007': ExchangeError, # {"code": 33007, "message": "status not found"}
  322. '33008': InsufficientFunds, # {"code": 33008, "message": "loan amount cannot exceed the maximum limit"}
  323. '33009': ExchangeError, # {"code": 33009, "message": "user ID is blank"}
  324. '33010': ExchangeError, # {"code": 33010, "message": "you cannot cancel an order during session 2 of call auction"}
  325. '33011': ExchangeError, # {"code": 33011, "message": "no new market data"}
  326. '33012': ExchangeError, # {"code": 33012, "message": "order cancellation failed"}
  327. '33013': InvalidOrder, # {"code": 33013, "message": "order placement failed"}
  328. '33014': OrderNotFound, # {"code": 33014, "message": "order does not exist"}
  329. '33015': InvalidOrder, # {"code": 33015, "message": "exceeded maximum limit"}
  330. '33016': ExchangeError, # {"code": 33016, "message": "margin trading is not open for self token"}
  331. '33017': InsufficientFunds, # {"code": 33017, "message": "insufficient balance"}
  332. '33018': ExchangeError, # {"code": 33018, "message": "self parameter must be smaller than 1"}
  333. '33020': ExchangeError, # {"code": 33020, "message": "request not supported"}
  334. '33021': BadRequest, # {"code": 33021, "message": "token and the pair do not match"}
  335. '33022': InvalidOrder, # {"code": 33022, "message": "pair and the order do not match"}
  336. '33023': ExchangeError, # {"code": 33023, "message": "you can only place market orders during call auction"}
  337. '33024': InvalidOrder, # {"code": 33024, "message": "trading amount too small"}
  338. '33025': InvalidOrder, # {"code": 33025, "message": "base token amount is blank"}
  339. '33026': ExchangeError, # {"code": 33026, "message": "transaction completed"}
  340. '33027': InvalidOrder, # {"code": 33027, "message": "cancelled order or order cancelling"}
  341. '33028': InvalidOrder, # {"code": 33028, "message": "the decimal places of the trading price exceeded the limit"}
  342. '33029': InvalidOrder, # {"code": 33029, "message": "the decimal places of the trading size exceeded the limit"}
  343. '33034': ExchangeError, # {"code": 33034, "message": "You can only place limit order after Call Auction has started"}
  344. '33035': ExchangeError, # This type of order cannot be canceled(This type of order cannot be canceled)
  345. '33036': ExchangeError, # Exceeding the limit of entrust order
  346. '33037': ExchangeError, # The buy order price should be lower than 130% of the trigger price
  347. '33038': ExchangeError, # The sell order price should be higher than 70% of the trigger price
  348. '33039': ExchangeError, # The limit of callback rate is 0 < x <= 5%
  349. '33040': ExchangeError, # The trigger price of a buy order should be lower than the latest transaction price
  350. '33041': ExchangeError, # The trigger price of a sell order should be higher than the latest transaction price
  351. '33042': ExchangeError, # The limit of price variance is 0 < x <= 1%
  352. '33043': ExchangeError, # The total amount must be larger than 0
  353. '33044': ExchangeError, # The average amount should be 1/1000 * total amount <= x <= total amount
  354. '33045': ExchangeError, # The price should not be 0, including trigger price, order price, and price limit
  355. '33046': ExchangeError, # Price variance should be 0 < x <= 1%
  356. '33047': ExchangeError, # Sweep ratio should be 0 < x <= 100%
  357. '33048': ExchangeError, # Per order limit: Total amount/1000 < x <= Total amount
  358. '33049': ExchangeError, # Total amount should be X > 0
  359. '33050': ExchangeError, # Time interval should be 5 <= x <= 120s
  360. '33051': ExchangeError, # cancel order number not higher limit: plan and track entrust no more than 10, ice and time entrust no more than 6
  361. '33059': BadRequest, # {"code": 33059, "message": "client_oid or order_id is required"}
  362. '33060': BadRequest, # {"code": 33060, "message": "Only fill in either parameter client_oid or order_id"}
  363. '33061': ExchangeError, # Value of a single market price order cannot exceed 100,000 USD
  364. '33062': ExchangeError, # The leverage ratio is too high. The borrowed position has exceeded the maximum position of self leverage ratio. Please readjust the leverage ratio
  365. '33063': ExchangeError, # Leverage multiple is too low, there is insufficient margin in the account, please readjust the leverage ratio
  366. '33064': ExchangeError, # The setting of the leverage ratio cannot be less than 2, please readjust the leverage ratio
  367. '33065': ExchangeError, # Leverage ratio exceeds maximum leverage ratio, please readjust leverage ratio
  368. # account
  369. '21009': ExchangeError, # Funds cannot be transferred out within 30 minutes after swap settlement(Funds cannot be transferred out within 30 minutes after swap settlement)
  370. '34001': PermissionDenied, # {"code": 34001, "message": "withdrawal suspended"}
  371. '34002': InvalidAddress, # {"code": 34002, "message": "please add a withdrawal address"}
  372. '34003': ExchangeError, # {"code": 34003, "message": "sorry, self token cannot be withdrawn to xx at the moment"}
  373. '34004': ExchangeError, # {"code": 34004, "message": "withdrawal fee is smaller than minimum limit"}
  374. '34005': ExchangeError, # {"code": 34005, "message": "withdrawal fee exceeds the maximum limit"}
  375. '34006': ExchangeError, # {"code": 34006, "message": "withdrawal amount is lower than the minimum limit"}
  376. '34007': ExchangeError, # {"code": 34007, "message": "withdrawal amount exceeds the maximum limit"}
  377. '34008': InsufficientFunds, # {"code": 34008, "message": "insufficient balance"}
  378. '34009': ExchangeError, # {"code": 34009, "message": "your withdrawal amount exceeds the daily limit"}
  379. '34010': ExchangeError, # {"code": 34010, "message": "transfer amount must be larger than 0"}
  380. '34011': ExchangeError, # {"code": 34011, "message": "conditions not met"}
  381. '34012': ExchangeError, # {"code": 34012, "message": "the minimum withdrawal amount for NEO is 1, and the amount must be an integer"}
  382. '34013': ExchangeError, # {"code": 34013, "message": "please transfer"}
  383. '34014': ExchangeError, # {"code": 34014, "message": "transfer limited"}
  384. '34015': ExchangeError, # {"code": 34015, "message": "subaccount does not exist"}
  385. '34016': PermissionDenied, # {"code": 34016, "message": "transfer suspended"}
  386. '34017': AccountSuspended, # {"code": 34017, "message": "account suspended"}
  387. '34018': AuthenticationError, # {"code": 34018, "message": "incorrect trades password"}
  388. '34019': PermissionDenied, # {"code": 34019, "message": "please bind your email before withdrawal"}
  389. '34020': PermissionDenied, # {"code": 34020, "message": "please bind your funds password before withdrawal"}
  390. '34021': InvalidAddress, # {"code": 34021, "message": "Not verified address"}
  391. '34022': ExchangeError, # {"code": 34022, "message": "Withdrawals are not available for sub accounts"}
  392. '34023': PermissionDenied, # {"code": 34023, "message": "Please enable futures trading before transferring your funds"}
  393. '34026': ExchangeError, # transfer too frequently(transfer too frequently)
  394. '34036': ExchangeError, # Parameter is incorrect, please refer to API documentation
  395. '34037': ExchangeError, # Get the sub-account balance interface, account type is not supported
  396. '34038': ExchangeError, # Since your C2C transaction is unusual, you are restricted from fund transfer. Please contact our customer support to cancel the restriction
  397. '34039': ExchangeError, # You are now restricted from transferring out your funds due to abnormal trades on C2C Market. Please transfer your fund on our website or app instead to verify your identity
  398. # swap
  399. '35001': ExchangeError, # {"code": 35001, "message": "Contract does not exist"}
  400. '35002': ExchangeError, # {"code": 35002, "message": "Contract settling"}
  401. '35003': ExchangeError, # {"code": 35003, "message": "Contract paused"}
  402. '35004': ExchangeError, # {"code": 35004, "message": "Contract pending settlement"}
  403. '35005': AuthenticationError, # {"code": 35005, "message": "User does not exist"}
  404. '35008': InvalidOrder, # {"code": 35008, "message": "Risk ratio too high"}
  405. '35010': InvalidOrder, # {"code": 35010, "message": "Position closing too large"}
  406. '35012': InvalidOrder, # {"code": 35012, "message": "Incorrect order size"}
  407. '35014': InvalidOrder, # {"code": 35014, "message": "Order price is not within limit"}
  408. '35015': InvalidOrder, # {"code": 35015, "message": "Invalid leverage level"}
  409. '35017': ExchangeError, # {"code": 35017, "message": "Open orders exist"}
  410. '35019': InvalidOrder, # {"code": 35019, "message": "Order size too large"}
  411. '35020': InvalidOrder, # {"code": 35020, "message": "Order price too high"}
  412. '35021': InvalidOrder, # {"code": 35021, "message": "Order size exceeded current tier limit"}
  413. '35022': ExchangeError, # {"code": 35022, "message": "Contract status error"}
  414. '35024': ExchangeError, # {"code": 35024, "message": "Contract not initialized"}
  415. '35025': InsufficientFunds, # {"code": 35025, "message": "No account balance"}
  416. '35026': ExchangeError, # {"code": 35026, "message": "Contract settings not initialized"}
  417. '35029': OrderNotFound, # {"code": 35029, "message": "Order does not exist"}
  418. '35030': InvalidOrder, # {"code": 35030, "message": "Order size too large"}
  419. '35031': InvalidOrder, # {"code": 35031, "message": "Cancel order size too large"}
  420. '35032': ExchangeError, # {"code": 35032, "message": "Invalid user status"}
  421. '35037': ExchangeError, # No last traded price in cache
  422. '35039': ExchangeError, # {"code": 35039, "message": "Open order quantity exceeds limit"}
  423. '35040': InvalidOrder, # {"error_message":"Invalid order type","result":"true","error_code":"35040","order_id":"-1"}
  424. '35044': ExchangeError, # {"code": 35044, "message": "Invalid order status"}
  425. '35046': InsufficientFunds, # {"code": 35046, "message": "Negative account balance"}
  426. '35047': InsufficientFunds, # {"code": 35047, "message": "Insufficient account balance"}
  427. '35048': ExchangeError, # {"code": 35048, "message": "User contract is frozen and liquidating"}
  428. '35049': InvalidOrder, # {"code": 35049, "message": "Invalid order type"}
  429. '35050': InvalidOrder, # {"code": 35050, "message": "Position settings are blank"}
  430. '35052': InsufficientFunds, # {"code": 35052, "message": "Insufficient cross margin"}
  431. '35053': ExchangeError, # {"code": 35053, "message": "Account risk too high"}
  432. '35055': InsufficientFunds, # {"code": 35055, "message": "Insufficient account balance"}
  433. '35057': ExchangeError, # {"code": 35057, "message": "No last traded price"}
  434. '35058': ExchangeError, # {"code": 35058, "message": "No limit"}
  435. '35059': BadRequest, # {"code": 35059, "message": "client_oid or order_id is required"}
  436. '35060': BadRequest, # {"code": 35060, "message": "Only fill in either parameter client_oid or order_id"}
  437. '35061': BadRequest, # {"code": 35061, "message": "Invalid instrument_id"}
  438. '35062': InvalidOrder, # {"code": 35062, "message": "Invalid match_price"}
  439. '35063': InvalidOrder, # {"code": 35063, "message": "Invalid order_size"}
  440. '35064': InvalidOrder, # {"code": 35064, "message": "Invalid client_oid"}
  441. '35066': InvalidOrder, # Order interval error
  442. '35067': InvalidOrder, # Time-weighted order ratio error
  443. '35068': InvalidOrder, # Time-weighted order range error
  444. '35069': InvalidOrder, # Time-weighted single transaction limit error
  445. '35070': InvalidOrder, # Algo order type error
  446. '35071': InvalidOrder, # Order total must be larger than single order limit
  447. '35072': InvalidOrder, # Maximum 6 unfulfilled time-weighted orders can be held at the same time
  448. '35073': InvalidOrder, # Order price is 0. Market-close-all not available
  449. '35074': InvalidOrder, # Iceberg order single transaction average error
  450. '35075': InvalidOrder, # Failed to cancel order
  451. '35076': InvalidOrder, # LTC 20x leverage. Not allowed to open position
  452. '35077': InvalidOrder, # Maximum 6 unfulfilled iceberg orders can be held at the same time
  453. '35078': InvalidOrder, # Order amount exceeded 100,000
  454. '35079': InvalidOrder, # Iceberg order price variance error
  455. '35080': InvalidOrder, # Callback rate error
  456. '35081': InvalidOrder, # Maximum 10 unfulfilled trail orders can be held at the same time
  457. '35082': InvalidOrder, # Trail order callback rate error
  458. '35083': InvalidOrder, # Each user can only hold a maximum of 10 unfulfilled stop-limit orders at the same time
  459. '35084': InvalidOrder, # Order amount exceeded 1 million
  460. '35085': InvalidOrder, # Order amount is not in the correct range
  461. '35086': InvalidOrder, # Price exceeds 100 thousand
  462. '35087': InvalidOrder, # Price exceeds 100 thousand
  463. '35088': InvalidOrder, # Average amount error
  464. '35089': InvalidOrder, # Price exceeds 100 thousand
  465. '35090': ExchangeError, # No stop-limit orders available for cancelation
  466. '35091': ExchangeError, # No trail orders available for cancellation
  467. '35092': ExchangeError, # No iceberg orders available for cancellation
  468. '35093': ExchangeError, # No trail orders available for cancellation
  469. '35094': ExchangeError, # Stop-limit order last traded price error
  470. '35095': BadRequest, # Instrument_id error
  471. '35096': ExchangeError, # Algo order status error
  472. '35097': ExchangeError, # Order status and order ID cannot exist at the same time
  473. '35098': ExchangeError, # An order status or order ID must exist
  474. '35099': ExchangeError, # Algo order ID error
  475. # option
  476. '36001': BadRequest, # Invalid underlying index.
  477. '36002': BadRequest, # Instrument does not exist.
  478. '36005': ExchangeError, # Instrument status is invalid.
  479. '36101': AuthenticationError, # Account does not exist.
  480. '36102': PermissionDenied, # Account status is invalid.
  481. '36103': AccountSuspended, # Account is suspended due to ongoing liquidation.
  482. '36104': PermissionDenied, # Account is not enabled for options trading.
  483. '36105': PermissionDenied, # Please enable the account for option contract.
  484. '36106': AccountSuspended, # Funds cannot be transferred in or out, as account is suspended.
  485. '36107': PermissionDenied, # Funds cannot be transferred out within 30 minutes after option exercising or settlement.
  486. '36108': InsufficientFunds, # Funds cannot be transferred in or out, as equity of the account is less than zero.
  487. '36109': PermissionDenied, # Funds cannot be transferred in or out during option exercising or settlement.
  488. '36201': PermissionDenied, # New order function is blocked.
  489. '36202': PermissionDenied, # Account does not have permission to short option.
  490. '36203': InvalidOrder, # Invalid format for client_oid.
  491. '36204': ExchangeError, # Invalid format for request_id.
  492. '36205': BadRequest, # Instrument id does not match underlying index.
  493. '36206': BadRequest, # Order_id and client_oid can not be used at the same time.
  494. '36207': InvalidOrder, # Either order price or fartouch price must be present.
  495. '36208': InvalidOrder, # Either order price or size must be present.
  496. '36209': InvalidOrder, # Either order_id or client_oid must be present.
  497. '36210': InvalidOrder, # Either order_ids or client_oids must be present.
  498. '36211': InvalidOrder, # Exceeding max batch size for order submission.
  499. '36212': InvalidOrder, # Exceeding max batch size for oder cancellation.
  500. '36213': InvalidOrder, # Exceeding max batch size for order amendment.
  501. '36214': ExchangeError, # Instrument does not have valid bid/ask quote.
  502. '36216': OrderNotFound, # Order does not exist.
  503. '36217': InvalidOrder, # Order submission failed.
  504. '36218': InvalidOrder, # Order cancellation failed.
  505. '36219': InvalidOrder, # Order amendment failed.
  506. '36220': InvalidOrder, # Order is pending cancel.
  507. '36221': InvalidOrder, # Order qty is not valid multiple of lot size.
  508. '36222': InvalidOrder, # Order price is breaching highest buy limit.
  509. '36223': InvalidOrder, # Order price is breaching lowest sell limit.
  510. '36224': InvalidOrder, # Exceeding max order size.
  511. '36225': InvalidOrder, # Exceeding max open order count for instrument.
  512. '36226': InvalidOrder, # Exceeding max open order count for underlying.
  513. '36227': InvalidOrder, # Exceeding max open size across all orders for underlying
  514. '36228': InvalidOrder, # Exceeding max available qty for instrument.
  515. '36229': InvalidOrder, # Exceeding max available qty for underlying.
  516. '36230': InvalidOrder, # Exceeding max position limit for underlying.
  517. # --------------------------------------------------------
  518. # swap
  519. '400': BadRequest, # Bad Request
  520. '401': AuthenticationError, # Unauthorized access
  521. '403': PermissionDenied, # Access prohibited
  522. '404': BadRequest, # Request address does not exist
  523. '405': BadRequest, # The HTTP Method is not supported
  524. '415': BadRequest, # The current media type is not supported
  525. '429': DDoSProtection, # Too many requests
  526. '500': ExchangeNotAvailable, # System busy
  527. '1001': RateLimitExceeded, # The request is too frequent and has been throttled
  528. '1002': ExchangeError, # {0} verifications within 24 hours
  529. '1003': ExchangeError, # You failed more than {0} times today, the current operation is locked, please try again in 24 hours
  530. # '00000': ExchangeError, # success
  531. '40001': AuthenticationError, # ACCESS_KEY cannot be empty
  532. '40002': AuthenticationError, # SECRET_KEY cannot be empty
  533. '40003': AuthenticationError, # Signature cannot be empty
  534. '40004': InvalidNonce, # Request timestamp expired
  535. '40005': InvalidNonce, # Invalid ACCESS_TIMESTAMP
  536. '40006': AuthenticationError, # Invalid ACCESS_KEY
  537. '40007': BadRequest, # Invalid Content_Type
  538. '40008': InvalidNonce, # Request timestamp expired
  539. '40009': AuthenticationError, # sign signature error
  540. '40010': AuthenticationError, # sign signature error
  541. '40011': AuthenticationError, # ACCESS_PASSPHRASE cannot be empty
  542. '40012': AuthenticationError, # apikey/password is incorrect
  543. '40013': ExchangeError, # User status is abnormal
  544. '40014': PermissionDenied, # Incorrect permissions
  545. '40015': ExchangeError, # System is abnormal, please try again later
  546. '40016': PermissionDenied, # The user must bind the phone or Google
  547. '40017': ExchangeError, # Parameter verification failed
  548. '40018': PermissionDenied, # Invalid IP
  549. '40102': BadRequest, # Contract configuration does not exist, please check the parameters
  550. '40103': BadRequest, # Request method cannot be empty
  551. '40104': ExchangeError, # Lever adjustment failure
  552. '40105': ExchangeError, # Abnormal access to current price limit data
  553. '40106': ExchangeError, # Abnormal get next settlement time
  554. '40107': ExchangeError, # Abnormal access to index price data
  555. '40108': InvalidOrder, # Wrong order quantity
  556. '40109': OrderNotFound, # The data of the order cannot be found, please confirm the order number
  557. '40200': OnMaintenance, # Server upgrade, please try again later
  558. '40201': InvalidOrder, # Order number cannot be empty
  559. '40202': ExchangeError, # User information cannot be empty
  560. '40203': BadRequest, # The amount of adjustment margin cannot be empty or negative
  561. '40204': BadRequest, # Adjustment margin type cannot be empty
  562. '40205': BadRequest, # Adjusted margin type data is wrong
  563. '40206': BadRequest, # The direction of the adjustment margin cannot be empty
  564. '40207': BadRequest, # The adjustment margin data is wrong
  565. '40208': BadRequest, # The accuracy of the adjustment margin amount is incorrect
  566. '40209': BadRequest, # The current page number is wrong, please confirm
  567. '40300': ExchangeError, # User does not exist
  568. '40301': PermissionDenied, # Permission has not been obtained yet. If you need to use it, please contact customer service
  569. '40302': BadRequest, # Parameter abnormality
  570. '40303': BadRequest, # Can only query up to 20,000 data
  571. '40304': BadRequest, # Parameter type is abnormal
  572. '40305': BadRequest, # Client_oid length is not greater than 50, and cannot be Martian characters
  573. '40306': ExchangeError, # Batch processing orders can only process up to 20
  574. '40308': OnMaintenance, # The contract is being temporarily maintained
  575. '40309': BadSymbol, # The contract has been removed
  576. '40400': ExchangeError, # Status check abnormal
  577. '40401': ExchangeError, # The operation cannot be performed
  578. '40402': BadRequest, # The opening direction cannot be empty
  579. '40403': BadRequest, # Wrong opening direction format
  580. '40404': BadRequest, # Whether to enable automatic margin call parameters cannot be empty
  581. '40405': BadRequest, # Whether to enable the automatic margin call parameter type is wrong
  582. '40406': BadRequest, # Whether to enable automatic margin call parameters is of unknown type
  583. '40407': ExchangeError, # The query direction is not the direction entrusted by the plan
  584. '40408': ExchangeError, # Wrong time range
  585. '40409': ExchangeError, # Time format error
  586. '40500': InvalidOrder, # Client_oid check error
  587. '40501': ExchangeError, # Channel name error
  588. '40502': ExchangeError, # If it is a copy user, you must pass the copy to whom
  589. '40503': ExchangeError, # With the single type
  590. '40504': ExchangeError, # Platform code must pass
  591. '40505': ExchangeError, # Not the same as single type
  592. '40506': AuthenticationError, # Platform signature error
  593. '40507': AuthenticationError, # Api signature error
  594. '40508': ExchangeError, # KOL is not authorized
  595. '40509': ExchangeError, # Abnormal copy end
  596. '40600': ExchangeError, # Copy function suspended
  597. '40601': ExchangeError, # Followers cannot be KOL
  598. '40602': ExchangeError, # The number of copies has reached the limit and cannot process the request
  599. '40603': ExchangeError, # Abnormal copy end
  600. '40604': ExchangeNotAvailable, # Server is busy, please try again later
  601. '40605': ExchangeError, # Copy type, the copy number must be passed
  602. '40606': ExchangeError, # The type of document number is wrong
  603. '40607': ExchangeError, # Document number must be passed
  604. '40608': ExchangeError, # No documented products currently supported
  605. '40609': ExchangeError, # The contract product does not support copying