bitmart 0.0.116__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 (466) hide show
  1. bitmart/__init__.py +7 -0
  2. bitmart/ccxt/__init__.py +102 -0
  3. bitmart/ccxt/abstract/bitmart.py +117 -0
  4. bitmart/ccxt/async_support/__init__.py +81 -0
  5. bitmart/ccxt/async_support/base/__init__.py +1 -0
  6. bitmart/ccxt/async_support/base/exchange.py +2315 -0
  7. bitmart/ccxt/async_support/base/throttler.py +88 -0
  8. bitmart/ccxt/async_support/base/ws/__init__.py +38 -0
  9. bitmart/ccxt/async_support/base/ws/cache.py +219 -0
  10. bitmart/ccxt/async_support/base/ws/client.py +350 -0
  11. bitmart/ccxt/async_support/base/ws/functions.py +59 -0
  12. bitmart/ccxt/async_support/base/ws/future.py +46 -0
  13. bitmart/ccxt/async_support/base/ws/order_book.py +78 -0
  14. bitmart/ccxt/async_support/base/ws/order_book_side.py +174 -0
  15. bitmart/ccxt/async_support/bitmart.py +5361 -0
  16. bitmart/ccxt/base/__init__.py +27 -0
  17. bitmart/ccxt/base/decimal_to_precision.py +178 -0
  18. bitmart/ccxt/base/errors.py +273 -0
  19. bitmart/ccxt/base/exchange.py +7642 -0
  20. bitmart/ccxt/base/precise.py +297 -0
  21. bitmart/ccxt/base/types.py +619 -0
  22. bitmart/ccxt/bitmart.py +5361 -0
  23. bitmart/ccxt/pro/__init__.py +66 -0
  24. bitmart/ccxt/pro/bitmart.py +1917 -0
  25. bitmart/ccxt/static_dependencies/README.md +1 -0
  26. bitmart/ccxt/static_dependencies/__init__.py +1 -0
  27. bitmart/ccxt/static_dependencies/bip/__init__.py +6 -0
  28. bitmart/ccxt/static_dependencies/bip/addr/P2PKH_addr.py +205 -0
  29. bitmart/ccxt/static_dependencies/bip/addr/__init__.py +5 -0
  30. bitmart/ccxt/static_dependencies/bip/addr/addr_dec_utils.py +125 -0
  31. bitmart/ccxt/static_dependencies/bip/addr/addr_key_validator.py +162 -0
  32. bitmart/ccxt/static_dependencies/bip/addr/iaddr_decoder.py +48 -0
  33. bitmart/ccxt/static_dependencies/bip/addr/iaddr_encoder.py +50 -0
  34. bitmart/ccxt/static_dependencies/bip/base58/__init__.py +3 -0
  35. bitmart/ccxt/static_dependencies/bip/base58/base58.py +207 -0
  36. bitmart/ccxt/static_dependencies/bip/base58/base58_ex.py +25 -0
  37. bitmart/ccxt/static_dependencies/bip/base58/base58_xmr.py +155 -0
  38. bitmart/ccxt/static_dependencies/bip/bech32/__init__.py +4 -0
  39. bitmart/ccxt/static_dependencies/bip/bech32/bch_bech32.py +220 -0
  40. bitmart/ccxt/static_dependencies/bip/bech32/bech32.py +235 -0
  41. bitmart/ccxt/static_dependencies/bip/bech32/bech32_base.py +246 -0
  42. bitmart/ccxt/static_dependencies/bip/bech32/bech32_ex.py +25 -0
  43. bitmart/ccxt/static_dependencies/bip/bech32/segwit_bech32.py +173 -0
  44. bitmart/ccxt/static_dependencies/bip/bip32/__init__.py +14 -0
  45. bitmart/ccxt/static_dependencies/bip/bip32/base/__init__.py +3 -0
  46. bitmart/ccxt/static_dependencies/bip/bip32/base/bip32_base.py +581 -0
  47. bitmart/ccxt/static_dependencies/bip/bip32/base/ibip32_key_derivator.py +83 -0
  48. bitmart/ccxt/static_dependencies/bip/bip32/base/ibip32_mst_key_generator.py +47 -0
  49. bitmart/ccxt/static_dependencies/bip/bip32/bip32_const.py +35 -0
  50. bitmart/ccxt/static_dependencies/bip/bip32/bip32_ex.py +29 -0
  51. bitmart/ccxt/static_dependencies/bip/bip32/bip32_key_data.py +500 -0
  52. bitmart/ccxt/static_dependencies/bip/bip32/bip32_key_net_ver.py +83 -0
  53. bitmart/ccxt/static_dependencies/bip/bip32/bip32_key_ser.py +294 -0
  54. bitmart/ccxt/static_dependencies/bip/bip32/bip32_keys.py +457 -0
  55. bitmart/ccxt/static_dependencies/bip/bip32/bip32_path.py +247 -0
  56. bitmart/ccxt/static_dependencies/bip/bip32/bip32_utils.py +72 -0
  57. bitmart/ccxt/static_dependencies/bip/bip32/kholaw/__init__.py +4 -0
  58. bitmart/ccxt/static_dependencies/bip/bip32/kholaw/bip32_kholaw_ed25519.py +82 -0
  59. bitmart/ccxt/static_dependencies/bip/bip32/kholaw/bip32_kholaw_ed25519_key_derivator.py +118 -0
  60. bitmart/ccxt/static_dependencies/bip/bip32/kholaw/bip32_kholaw_key_derivator_base.py +204 -0
  61. bitmart/ccxt/static_dependencies/bip/bip32/kholaw/bip32_kholaw_mst_key_generator.py +119 -0
  62. bitmart/ccxt/static_dependencies/bip/bip32/slip10/__init__.py +1 -0
  63. bitmart/ccxt/static_dependencies/bip/bip32/slip10/bip32_slip10_key_derivator.py +200 -0
  64. bitmart/ccxt/static_dependencies/bip/bip32/slip10/bip32_slip10_mst_key_generator.py +168 -0
  65. bitmart/ccxt/static_dependencies/bip/bip32/slip10/bip32_slip10_secp256k1.py +82 -0
  66. bitmart/ccxt/static_dependencies/bip/bip44/__init__.py +1 -0
  67. bitmart/ccxt/static_dependencies/bip/bip44/bip44.py +265 -0
  68. bitmart/ccxt/static_dependencies/bip/bip44_base/__init__.py +3 -0
  69. bitmart/ccxt/static_dependencies/bip/bip44_base/bip44_base.py +624 -0
  70. bitmart/ccxt/static_dependencies/bip/bip44_base/bip44_base_ex.py +25 -0
  71. bitmart/ccxt/static_dependencies/bip/bip44_base/bip44_keys.py +225 -0
  72. bitmart/ccxt/static_dependencies/bip/coin_conf/__init__.py +2 -0
  73. bitmart/ccxt/static_dependencies/bip/coin_conf/coin_conf.py +68 -0
  74. bitmart/ccxt/static_dependencies/bip/coin_conf/coins_conf.py +890 -0
  75. bitmart/ccxt/static_dependencies/bip/conf/__init__.py +0 -0
  76. bitmart/ccxt/static_dependencies/bip/conf/bip44/__init__.py +3 -0
  77. bitmart/ccxt/static_dependencies/bip/conf/bip44/bip44_coins.py +126 -0
  78. bitmart/ccxt/static_dependencies/bip/conf/bip44/bip44_conf.py +1360 -0
  79. bitmart/ccxt/static_dependencies/bip/conf/bip44/bip44_conf_getter.py +153 -0
  80. bitmart/ccxt/static_dependencies/bip/conf/bip49/__init__.py +3 -0
  81. bitmart/ccxt/static_dependencies/bip/conf/bip49/bip49_coins.py +53 -0
  82. bitmart/ccxt/static_dependencies/bip/conf/bip49/bip49_conf.py +366 -0
  83. bitmart/ccxt/static_dependencies/bip/conf/bip49/bip49_conf_getter.py +80 -0
  84. bitmart/ccxt/static_dependencies/bip/conf/bip84/__init__.py +3 -0
  85. bitmart/ccxt/static_dependencies/bip/conf/bip84/bip84_coins.py +39 -0
  86. bitmart/ccxt/static_dependencies/bip/conf/bip84/bip84_conf.py +113 -0
  87. bitmart/ccxt/static_dependencies/bip/conf/bip84/bip84_conf_getter.py +66 -0
  88. bitmart/ccxt/static_dependencies/bip/conf/bip86/__init__.py +3 -0
  89. bitmart/ccxt/static_dependencies/bip/conf/bip86/bip86_coins.py +37 -0
  90. bitmart/ccxt/static_dependencies/bip/conf/bip86/bip86_conf.py +83 -0
  91. bitmart/ccxt/static_dependencies/bip/conf/bip86/bip86_conf_getter.py +64 -0
  92. bitmart/ccxt/static_dependencies/bip/conf/common/__init__.py +8 -0
  93. bitmart/ccxt/static_dependencies/bip/conf/common/atom_addr.py +104 -0
  94. bitmart/ccxt/static_dependencies/bip/conf/common/bip_bitcoin_cash_conf.py +106 -0
  95. bitmart/ccxt/static_dependencies/bip/conf/common/bip_coin_conf.py +217 -0
  96. bitmart/ccxt/static_dependencies/bip/conf/common/bip_coins.py +28 -0
  97. bitmart/ccxt/static_dependencies/bip/conf/common/bip_conf_const.py +30 -0
  98. bitmart/ccxt/static_dependencies/bip/conf/common/bip_litecoin_conf.py +121 -0
  99. bitmart/ccxt/static_dependencies/bip/ecc/__init__.py +42 -0
  100. bitmart/ccxt/static_dependencies/bip/ecc/common/__init__.py +0 -0
  101. bitmart/ccxt/static_dependencies/bip/ecc/common/dummy_point.py +219 -0
  102. bitmart/ccxt/static_dependencies/bip/ecc/common/ikeys.py +263 -0
  103. bitmart/ccxt/static_dependencies/bip/ecc/common/ipoint.py +190 -0
  104. bitmart/ccxt/static_dependencies/bip/ecc/conf.py +28 -0
  105. bitmart/ccxt/static_dependencies/bip/ecc/curve/__init__.py +0 -0
  106. bitmart/ccxt/static_dependencies/bip/ecc/curve/elliptic_curve.py +121 -0
  107. bitmart/ccxt/static_dependencies/bip/ecc/curve/elliptic_curve_getter.py +74 -0
  108. bitmart/ccxt/static_dependencies/bip/ecc/curve/elliptic_curve_types.py +37 -0
  109. bitmart/ccxt/static_dependencies/bip/ecc/ecdsa/__init__.py +0 -0
  110. bitmart/ccxt/static_dependencies/bip/ecc/ecdsa/ecdsa_keys.py +36 -0
  111. bitmart/ccxt/static_dependencies/bip/ecc/secp256k1/__init__.py +0 -0
  112. bitmart/ccxt/static_dependencies/bip/ecc/secp256k1/secp256k1.py +36 -0
  113. bitmart/ccxt/static_dependencies/bip/ecc/secp256k1/secp256k1_const.py +59 -0
  114. bitmart/ccxt/static_dependencies/bip/ecc/secp256k1/secp256k1_keys_ecdsa.py +248 -0
  115. bitmart/ccxt/static_dependencies/bip/ecc/secp256k1/secp256k1_point_ecdsa.py +234 -0
  116. bitmart/ccxt/static_dependencies/bip/slip/__init__.py +0 -0
  117. bitmart/ccxt/static_dependencies/bip/slip/slip173/__init__.py +1 -0
  118. bitmart/ccxt/static_dependencies/bip/slip/slip173/slip173.py +60 -0
  119. bitmart/ccxt/static_dependencies/bip/slip/slip32/__init__.py +4 -0
  120. bitmart/ccxt/static_dependencies/bip/slip/slip32/slip32.py +322 -0
  121. bitmart/ccxt/static_dependencies/bip/slip/slip32/slip32_key_net_ver.py +62 -0
  122. bitmart/ccxt/static_dependencies/bip/slip/slip44/__init__.py +1 -0
  123. bitmart/ccxt/static_dependencies/bip/slip/slip44/slip44.py +81 -0
  124. bitmart/ccxt/static_dependencies/bip/utils/__init__.py +0 -0
  125. bitmart/ccxt/static_dependencies/bip/utils/conf/__init__.py +1 -0
  126. bitmart/ccxt/static_dependencies/bip/utils/conf/coin_names.py +59 -0
  127. bitmart/ccxt/static_dependencies/bip/utils/crypto/__init__.py +10 -0
  128. bitmart/ccxt/static_dependencies/bip/utils/crypto/aes_ecb.py +152 -0
  129. bitmart/ccxt/static_dependencies/bip/utils/crypto/blake2.py +191 -0
  130. bitmart/ccxt/static_dependencies/bip/utils/crypto/chacha20_poly1305.py +101 -0
  131. bitmart/ccxt/static_dependencies/bip/utils/crypto/hash160.py +57 -0
  132. bitmart/ccxt/static_dependencies/bip/utils/crypto/hmac.py +118 -0
  133. bitmart/ccxt/static_dependencies/bip/utils/crypto/pbkdf2.py +66 -0
  134. bitmart/ccxt/static_dependencies/bip/utils/crypto/ripemd.py +58 -0
  135. bitmart/ccxt/static_dependencies/bip/utils/crypto/scrypt.py +66 -0
  136. bitmart/ccxt/static_dependencies/bip/utils/crypto/sha2.py +182 -0
  137. bitmart/ccxt/static_dependencies/bip/utils/crypto/sha3.py +99 -0
  138. bitmart/ccxt/static_dependencies/bip/utils/misc/__init__.py +7 -0
  139. bitmart/ccxt/static_dependencies/bip/utils/misc/algo.py +108 -0
  140. bitmart/ccxt/static_dependencies/bip/utils/misc/base32.py +151 -0
  141. bitmart/ccxt/static_dependencies/bip/utils/misc/bit.py +115 -0
  142. bitmart/ccxt/static_dependencies/bip/utils/misc/bytes.py +200 -0
  143. bitmart/ccxt/static_dependencies/bip/utils/misc/data_bytes.py +181 -0
  144. bitmart/ccxt/static_dependencies/bip/utils/misc/integer.py +97 -0
  145. bitmart/ccxt/static_dependencies/bip/utils/misc/string.py +54 -0
  146. bitmart/ccxt/static_dependencies/bip/utils/typing/__init__.py +1 -0
  147. bitmart/ccxt/static_dependencies/bip/utils/typing/literal.py +27 -0
  148. bitmart/ccxt/static_dependencies/bip/wif/__init__.py +1 -0
  149. bitmart/ccxt/static_dependencies/bip/wif/wif.py +144 -0
  150. bitmart/ccxt/static_dependencies/dydx_v4_client/amino/amino_pb2.py +31 -0
  151. bitmart/ccxt/static_dependencies/dydx_v4_client/cosmos/base/v1beta1/coin_pb2.py +47 -0
  152. bitmart/ccxt/static_dependencies/dydx_v4_client/cosmos/crypto/multisig/keys_pb2.py +33 -0
  153. bitmart/ccxt/static_dependencies/dydx_v4_client/cosmos/crypto/multisig/v1beta1/multisig_pb2.py +33 -0
  154. bitmart/ccxt/static_dependencies/dydx_v4_client/cosmos/crypto/secp256k1/keys_pb2.py +34 -0
  155. bitmart/ccxt/static_dependencies/dydx_v4_client/cosmos/msg/v1/msg_pb2.py +27 -0
  156. bitmart/ccxt/static_dependencies/dydx_v4_client/cosmos/tx/signing/v1beta1/signing_pb2.py +38 -0
  157. bitmart/ccxt/static_dependencies/dydx_v4_client/cosmos/tx/v1beta1/tx_pb2.py +75 -0
  158. bitmart/ccxt/static_dependencies/dydx_v4_client/cosmos_proto/cosmos_pb2.py +36 -0
  159. bitmart/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/accountplus/accountplus_pb2.py +31 -0
  160. bitmart/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/accountplus/genesis_pb2.py +40 -0
  161. bitmart/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/accountplus/models_pb2.py +26 -0
  162. bitmart/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/accountplus/params_pb2.py +29 -0
  163. bitmart/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/accountplus/query_pb2.py +57 -0
  164. bitmart/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/accountplus/tx_pb2.py +51 -0
  165. bitmart/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/clob/block_rate_limit_config_pb2.py +37 -0
  166. bitmart/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/clob/clob_pair_pb2.py +41 -0
  167. bitmart/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/clob/equity_tier_limit_config_pb2.py +35 -0
  168. bitmart/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/clob/finalize_block_pb2.py +27 -0
  169. bitmart/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/clob/liquidations_config_pb2.py +39 -0
  170. bitmart/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/clob/liquidations_pb2.py +38 -0
  171. bitmart/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/clob/matches_pb2.py +55 -0
  172. bitmart/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/clob/mev_pb2.py +49 -0
  173. bitmart/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/clob/operation_pb2.py +32 -0
  174. bitmart/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/clob/order_pb2.py +86 -0
  175. bitmart/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/clob/order_removals_pb2.py +32 -0
  176. bitmart/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/clob/process_proposer_matches_events_pb2.py +42 -0
  177. bitmart/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/clob/query_pb2.py +124 -0
  178. bitmart/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/clob/streaming_pb2.py +29 -0
  179. bitmart/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/clob/tx_pb2.py +117 -0
  180. bitmart/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/sending/genesis_pb2.py +26 -0
  181. bitmart/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/sending/query_pb2.py +26 -0
  182. bitmart/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/sending/transfer_pb2.py +61 -0
  183. bitmart/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/sending/tx_pb2.py +37 -0
  184. bitmart/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/subaccounts/asset_position_pb2.py +29 -0
  185. bitmart/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/subaccounts/genesis_pb2.py +30 -0
  186. bitmart/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/subaccounts/perpetual_position_pb2.py +33 -0
  187. bitmart/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/subaccounts/query_pb2.py +63 -0
  188. bitmart/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/subaccounts/streaming_pb2.py +31 -0
  189. bitmart/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/subaccounts/subaccount_pb2.py +33 -0
  190. bitmart/ccxt/static_dependencies/dydx_v4_client/gogoproto/gogo_pb2.py +102 -0
  191. bitmart/ccxt/static_dependencies/dydx_v4_client/registry.py +38 -0
  192. bitmart/ccxt/static_dependencies/ecdsa/__init__.py +14 -0
  193. bitmart/ccxt/static_dependencies/ecdsa/_version.py +520 -0
  194. bitmart/ccxt/static_dependencies/ecdsa/curves.py +56 -0
  195. bitmart/ccxt/static_dependencies/ecdsa/der.py +221 -0
  196. bitmart/ccxt/static_dependencies/ecdsa/ecdsa.py +310 -0
  197. bitmart/ccxt/static_dependencies/ecdsa/ellipticcurve.py +1039 -0
  198. bitmart/ccxt/static_dependencies/ecdsa/keys.py +343 -0
  199. bitmart/ccxt/static_dependencies/ecdsa/numbertheory.py +531 -0
  200. bitmart/ccxt/static_dependencies/ecdsa/rfc6979.py +100 -0
  201. bitmart/ccxt/static_dependencies/ecdsa/util.py +266 -0
  202. bitmart/ccxt/static_dependencies/ethereum/__init__.py +7 -0
  203. bitmart/ccxt/static_dependencies/ethereum/abi/__init__.py +16 -0
  204. bitmart/ccxt/static_dependencies/ethereum/abi/abi.py +19 -0
  205. bitmart/ccxt/static_dependencies/ethereum/abi/base.py +152 -0
  206. bitmart/ccxt/static_dependencies/ethereum/abi/codec.py +217 -0
  207. bitmart/ccxt/static_dependencies/ethereum/abi/constants.py +3 -0
  208. bitmart/ccxt/static_dependencies/ethereum/abi/decoding.py +565 -0
  209. bitmart/ccxt/static_dependencies/ethereum/abi/encoding.py +720 -0
  210. bitmart/ccxt/static_dependencies/ethereum/abi/exceptions.py +139 -0
  211. bitmart/ccxt/static_dependencies/ethereum/abi/grammar.py +443 -0
  212. bitmart/ccxt/static_dependencies/ethereum/abi/packed.py +13 -0
  213. bitmart/ccxt/static_dependencies/ethereum/abi/py.typed +0 -0
  214. bitmart/ccxt/static_dependencies/ethereum/abi/registry.py +643 -0
  215. bitmart/ccxt/static_dependencies/ethereum/abi/tools/__init__.py +3 -0
  216. bitmart/ccxt/static_dependencies/ethereum/abi/tools/_strategies.py +230 -0
  217. bitmart/ccxt/static_dependencies/ethereum/abi/utils/__init__.py +0 -0
  218. bitmart/ccxt/static_dependencies/ethereum/abi/utils/numeric.py +83 -0
  219. bitmart/ccxt/static_dependencies/ethereum/abi/utils/padding.py +27 -0
  220. bitmart/ccxt/static_dependencies/ethereum/abi/utils/string.py +19 -0
  221. bitmart/ccxt/static_dependencies/ethereum/account/__init__.py +3 -0
  222. bitmart/ccxt/static_dependencies/ethereum/account/encode_typed_data/__init__.py +4 -0
  223. bitmart/ccxt/static_dependencies/ethereum/account/encode_typed_data/encoding_and_hashing.py +239 -0
  224. bitmart/ccxt/static_dependencies/ethereum/account/encode_typed_data/helpers.py +40 -0
  225. bitmart/ccxt/static_dependencies/ethereum/account/messages.py +263 -0
  226. bitmart/ccxt/static_dependencies/ethereum/account/py.typed +0 -0
  227. bitmart/ccxt/static_dependencies/ethereum/hexbytes/__init__.py +5 -0
  228. bitmart/ccxt/static_dependencies/ethereum/hexbytes/_utils.py +54 -0
  229. bitmart/ccxt/static_dependencies/ethereum/hexbytes/main.py +65 -0
  230. bitmart/ccxt/static_dependencies/ethereum/hexbytes/py.typed +0 -0
  231. bitmart/ccxt/static_dependencies/ethereum/typing/__init__.py +63 -0
  232. bitmart/ccxt/static_dependencies/ethereum/typing/abi.py +6 -0
  233. bitmart/ccxt/static_dependencies/ethereum/typing/bls.py +7 -0
  234. bitmart/ccxt/static_dependencies/ethereum/typing/discovery.py +5 -0
  235. bitmart/ccxt/static_dependencies/ethereum/typing/encoding.py +7 -0
  236. bitmart/ccxt/static_dependencies/ethereum/typing/enums.py +17 -0
  237. bitmart/ccxt/static_dependencies/ethereum/typing/ethpm.py +9 -0
  238. bitmart/ccxt/static_dependencies/ethereum/typing/evm.py +20 -0
  239. bitmart/ccxt/static_dependencies/ethereum/typing/networks.py +1122 -0
  240. bitmart/ccxt/static_dependencies/ethereum/typing/py.typed +0 -0
  241. bitmart/ccxt/static_dependencies/ethereum/utils/__init__.py +115 -0
  242. bitmart/ccxt/static_dependencies/ethereum/utils/abi.py +72 -0
  243. bitmart/ccxt/static_dependencies/ethereum/utils/address.py +171 -0
  244. bitmart/ccxt/static_dependencies/ethereum/utils/applicators.py +151 -0
  245. bitmart/ccxt/static_dependencies/ethereum/utils/conversions.py +190 -0
  246. bitmart/ccxt/static_dependencies/ethereum/utils/currency.py +107 -0
  247. bitmart/ccxt/static_dependencies/ethereum/utils/curried/__init__.py +269 -0
  248. bitmart/ccxt/static_dependencies/ethereum/utils/debug.py +20 -0
  249. bitmart/ccxt/static_dependencies/ethereum/utils/decorators.py +132 -0
  250. bitmart/ccxt/static_dependencies/ethereum/utils/encoding.py +6 -0
  251. bitmart/ccxt/static_dependencies/ethereum/utils/exceptions.py +4 -0
  252. bitmart/ccxt/static_dependencies/ethereum/utils/functional.py +75 -0
  253. bitmart/ccxt/static_dependencies/ethereum/utils/hexadecimal.py +74 -0
  254. bitmart/ccxt/static_dependencies/ethereum/utils/humanize.py +188 -0
  255. bitmart/ccxt/static_dependencies/ethereum/utils/logging.py +159 -0
  256. bitmart/ccxt/static_dependencies/ethereum/utils/module_loading.py +31 -0
  257. bitmart/ccxt/static_dependencies/ethereum/utils/numeric.py +43 -0
  258. bitmart/ccxt/static_dependencies/ethereum/utils/py.typed +0 -0
  259. bitmart/ccxt/static_dependencies/ethereum/utils/toolz.py +76 -0
  260. bitmart/ccxt/static_dependencies/ethereum/utils/types.py +54 -0
  261. bitmart/ccxt/static_dependencies/ethereum/utils/typing/__init__.py +18 -0
  262. bitmart/ccxt/static_dependencies/ethereum/utils/typing/misc.py +14 -0
  263. bitmart/ccxt/static_dependencies/ethereum/utils/units.py +31 -0
  264. bitmart/ccxt/static_dependencies/keccak/__init__.py +3 -0
  265. bitmart/ccxt/static_dependencies/keccak/keccak.py +197 -0
  266. bitmart/ccxt/static_dependencies/lark/__init__.py +38 -0
  267. bitmart/ccxt/static_dependencies/lark/__pyinstaller/__init__.py +6 -0
  268. bitmart/ccxt/static_dependencies/lark/__pyinstaller/hook-lark.py +14 -0
  269. bitmart/ccxt/static_dependencies/lark/ast_utils.py +59 -0
  270. bitmart/ccxt/static_dependencies/lark/common.py +86 -0
  271. bitmart/ccxt/static_dependencies/lark/exceptions.py +292 -0
  272. bitmart/ccxt/static_dependencies/lark/grammar.py +130 -0
  273. bitmart/ccxt/static_dependencies/lark/grammars/__init__.py +0 -0
  274. bitmart/ccxt/static_dependencies/lark/grammars/common.lark +59 -0
  275. bitmart/ccxt/static_dependencies/lark/grammars/lark.lark +62 -0
  276. bitmart/ccxt/static_dependencies/lark/grammars/python.lark +302 -0
  277. bitmart/ccxt/static_dependencies/lark/grammars/unicode.lark +7 -0
  278. bitmart/ccxt/static_dependencies/lark/indenter.py +143 -0
  279. bitmart/ccxt/static_dependencies/lark/lark.py +658 -0
  280. bitmart/ccxt/static_dependencies/lark/lexer.py +678 -0
  281. bitmart/ccxt/static_dependencies/lark/load_grammar.py +1428 -0
  282. bitmart/ccxt/static_dependencies/lark/parse_tree_builder.py +391 -0
  283. bitmart/ccxt/static_dependencies/lark/parser_frontends.py +257 -0
  284. bitmart/ccxt/static_dependencies/lark/parsers/__init__.py +0 -0
  285. bitmart/ccxt/static_dependencies/lark/parsers/cyk.py +340 -0
  286. bitmart/ccxt/static_dependencies/lark/parsers/earley.py +314 -0
  287. bitmart/ccxt/static_dependencies/lark/parsers/earley_common.py +42 -0
  288. bitmart/ccxt/static_dependencies/lark/parsers/earley_forest.py +801 -0
  289. bitmart/ccxt/static_dependencies/lark/parsers/grammar_analysis.py +203 -0
  290. bitmart/ccxt/static_dependencies/lark/parsers/lalr_analysis.py +332 -0
  291. bitmart/ccxt/static_dependencies/lark/parsers/lalr_interactive_parser.py +158 -0
  292. bitmart/ccxt/static_dependencies/lark/parsers/lalr_parser.py +122 -0
  293. bitmart/ccxt/static_dependencies/lark/parsers/lalr_parser_state.py +110 -0
  294. bitmart/ccxt/static_dependencies/lark/parsers/xearley.py +165 -0
  295. bitmart/ccxt/static_dependencies/lark/py.typed +0 -0
  296. bitmart/ccxt/static_dependencies/lark/reconstruct.py +107 -0
  297. bitmart/ccxt/static_dependencies/lark/tools/__init__.py +70 -0
  298. bitmart/ccxt/static_dependencies/lark/tools/nearley.py +202 -0
  299. bitmart/ccxt/static_dependencies/lark/tools/serialize.py +32 -0
  300. bitmart/ccxt/static_dependencies/lark/tools/standalone.py +196 -0
  301. bitmart/ccxt/static_dependencies/lark/tree.py +267 -0
  302. bitmart/ccxt/static_dependencies/lark/tree_matcher.py +186 -0
  303. bitmart/ccxt/static_dependencies/lark/tree_templates.py +180 -0
  304. bitmart/ccxt/static_dependencies/lark/utils.py +343 -0
  305. bitmart/ccxt/static_dependencies/lark/visitors.py +596 -0
  306. bitmart/ccxt/static_dependencies/marshmallow/__init__.py +81 -0
  307. bitmart/ccxt/static_dependencies/marshmallow/base.py +65 -0
  308. bitmart/ccxt/static_dependencies/marshmallow/class_registry.py +94 -0
  309. bitmart/ccxt/static_dependencies/marshmallow/decorators.py +231 -0
  310. bitmart/ccxt/static_dependencies/marshmallow/error_store.py +60 -0
  311. bitmart/ccxt/static_dependencies/marshmallow/exceptions.py +71 -0
  312. bitmart/ccxt/static_dependencies/marshmallow/fields.py +2114 -0
  313. bitmart/ccxt/static_dependencies/marshmallow/orderedset.py +89 -0
  314. bitmart/ccxt/static_dependencies/marshmallow/py.typed +0 -0
  315. bitmart/ccxt/static_dependencies/marshmallow/schema.py +1228 -0
  316. bitmart/ccxt/static_dependencies/marshmallow/types.py +12 -0
  317. bitmart/ccxt/static_dependencies/marshmallow/utils.py +378 -0
  318. bitmart/ccxt/static_dependencies/marshmallow/validate.py +678 -0
  319. bitmart/ccxt/static_dependencies/marshmallow/warnings.py +2 -0
  320. bitmart/ccxt/static_dependencies/marshmallow_dataclass/__init__.py +1047 -0
  321. bitmart/ccxt/static_dependencies/marshmallow_dataclass/collection_field.py +51 -0
  322. bitmart/ccxt/static_dependencies/marshmallow_dataclass/lazy_class_attribute.py +45 -0
  323. bitmart/ccxt/static_dependencies/marshmallow_dataclass/mypy.py +71 -0
  324. bitmart/ccxt/static_dependencies/marshmallow_dataclass/py.typed +0 -0
  325. bitmart/ccxt/static_dependencies/marshmallow_dataclass/typing.py +14 -0
  326. bitmart/ccxt/static_dependencies/marshmallow_dataclass/union_field.py +82 -0
  327. bitmart/ccxt/static_dependencies/marshmallow_oneofschema/__init__.py +1 -0
  328. bitmart/ccxt/static_dependencies/marshmallow_oneofschema/one_of_schema.py +193 -0
  329. bitmart/ccxt/static_dependencies/marshmallow_oneofschema/py.typed +0 -0
  330. bitmart/ccxt/static_dependencies/mnemonic/__init__.py +4 -0
  331. bitmart/ccxt/static_dependencies/mnemonic/mnemonic.py +282 -0
  332. bitmart/ccxt/static_dependencies/mnemonic/py.typed +1 -0
  333. bitmart/ccxt/static_dependencies/mnemonic/wordlist/chinese_simplified.txt +2048 -0
  334. bitmart/ccxt/static_dependencies/mnemonic/wordlist/chinese_traditional.txt +2048 -0
  335. bitmart/ccxt/static_dependencies/mnemonic/wordlist/czech.txt +2048 -0
  336. bitmart/ccxt/static_dependencies/mnemonic/wordlist/english.txt +2048 -0
  337. bitmart/ccxt/static_dependencies/mnemonic/wordlist/french.txt +2048 -0
  338. bitmart/ccxt/static_dependencies/mnemonic/wordlist/italian.txt +2048 -0
  339. bitmart/ccxt/static_dependencies/mnemonic/wordlist/japanese.txt +2048 -0
  340. bitmart/ccxt/static_dependencies/mnemonic/wordlist/korean.txt +2048 -0
  341. bitmart/ccxt/static_dependencies/mnemonic/wordlist/portuguese.txt +2048 -0
  342. bitmart/ccxt/static_dependencies/mnemonic/wordlist/russian.txt +2048 -0
  343. bitmart/ccxt/static_dependencies/mnemonic/wordlist/spanish.txt +2048 -0
  344. bitmart/ccxt/static_dependencies/mnemonic/wordlist/turkish.txt +2048 -0
  345. bitmart/ccxt/static_dependencies/msgpack/__init__.py +55 -0
  346. bitmart/ccxt/static_dependencies/msgpack/_cmsgpack.pyx +11 -0
  347. bitmart/ccxt/static_dependencies/msgpack/_packer.pyx +374 -0
  348. bitmart/ccxt/static_dependencies/msgpack/_unpacker.pyx +547 -0
  349. bitmart/ccxt/static_dependencies/msgpack/buff_converter.h +8 -0
  350. bitmart/ccxt/static_dependencies/msgpack/exceptions.py +48 -0
  351. bitmart/ccxt/static_dependencies/msgpack/ext.py +168 -0
  352. bitmart/ccxt/static_dependencies/msgpack/fallback.py +951 -0
  353. bitmart/ccxt/static_dependencies/msgpack/pack.h +89 -0
  354. bitmart/ccxt/static_dependencies/msgpack/pack_template.h +820 -0
  355. bitmart/ccxt/static_dependencies/msgpack/sysdep.h +194 -0
  356. bitmart/ccxt/static_dependencies/msgpack/unpack.h +391 -0
  357. bitmart/ccxt/static_dependencies/msgpack/unpack_define.h +95 -0
  358. bitmart/ccxt/static_dependencies/msgpack/unpack_template.h +464 -0
  359. bitmart/ccxt/static_dependencies/parsimonious/__init__.py +10 -0
  360. bitmart/ccxt/static_dependencies/parsimonious/exceptions.py +105 -0
  361. bitmart/ccxt/static_dependencies/parsimonious/expressions.py +479 -0
  362. bitmart/ccxt/static_dependencies/parsimonious/grammar.py +487 -0
  363. bitmart/ccxt/static_dependencies/parsimonious/nodes.py +325 -0
  364. bitmart/ccxt/static_dependencies/parsimonious/utils.py +40 -0
  365. bitmart/ccxt/static_dependencies/starknet/__init__.py +0 -0
  366. bitmart/ccxt/static_dependencies/starknet/abi/v0/__init__.py +2 -0
  367. bitmart/ccxt/static_dependencies/starknet/abi/v0/model.py +44 -0
  368. bitmart/ccxt/static_dependencies/starknet/abi/v0/parser.py +216 -0
  369. bitmart/ccxt/static_dependencies/starknet/abi/v0/schemas.py +72 -0
  370. bitmart/ccxt/static_dependencies/starknet/abi/v0/shape.py +63 -0
  371. bitmart/ccxt/static_dependencies/starknet/abi/v1/__init__.py +2 -0
  372. bitmart/ccxt/static_dependencies/starknet/abi/v1/core_structures.json +14 -0
  373. bitmart/ccxt/static_dependencies/starknet/abi/v1/model.py +39 -0
  374. bitmart/ccxt/static_dependencies/starknet/abi/v1/parser.py +220 -0
  375. bitmart/ccxt/static_dependencies/starknet/abi/v1/parser_transformer.py +179 -0
  376. bitmart/ccxt/static_dependencies/starknet/abi/v1/schemas.py +66 -0
  377. bitmart/ccxt/static_dependencies/starknet/abi/v1/shape.py +47 -0
  378. bitmart/ccxt/static_dependencies/starknet/abi/v2/__init__.py +2 -0
  379. bitmart/ccxt/static_dependencies/starknet/abi/v2/model.py +89 -0
  380. bitmart/ccxt/static_dependencies/starknet/abi/v2/parser.py +293 -0
  381. bitmart/ccxt/static_dependencies/starknet/abi/v2/parser_transformer.py +192 -0
  382. bitmart/ccxt/static_dependencies/starknet/abi/v2/schemas.py +132 -0
  383. bitmart/ccxt/static_dependencies/starknet/abi/v2/shape.py +107 -0
  384. bitmart/ccxt/static_dependencies/starknet/cairo/__init__.py +0 -0
  385. bitmart/ccxt/static_dependencies/starknet/cairo/data_types.py +123 -0
  386. bitmart/ccxt/static_dependencies/starknet/cairo/deprecated_parse/__init__.py +0 -0
  387. bitmart/ccxt/static_dependencies/starknet/cairo/deprecated_parse/cairo_types.py +77 -0
  388. bitmart/ccxt/static_dependencies/starknet/cairo/deprecated_parse/parser.py +46 -0
  389. bitmart/ccxt/static_dependencies/starknet/cairo/deprecated_parse/parser_transformer.py +138 -0
  390. bitmart/ccxt/static_dependencies/starknet/cairo/felt.py +64 -0
  391. bitmart/ccxt/static_dependencies/starknet/cairo/type_parser.py +121 -0
  392. bitmart/ccxt/static_dependencies/starknet/cairo/v1/__init__.py +0 -0
  393. bitmart/ccxt/static_dependencies/starknet/cairo/v1/type_parser.py +59 -0
  394. bitmart/ccxt/static_dependencies/starknet/cairo/v2/__init__.py +0 -0
  395. bitmart/ccxt/static_dependencies/starknet/cairo/v2/type_parser.py +77 -0
  396. bitmart/ccxt/static_dependencies/starknet/ccxt_utils.py +7 -0
  397. bitmart/ccxt/static_dependencies/starknet/common.py +15 -0
  398. bitmart/ccxt/static_dependencies/starknet/constants.py +39 -0
  399. bitmart/ccxt/static_dependencies/starknet/hash/__init__.py +0 -0
  400. bitmart/ccxt/static_dependencies/starknet/hash/address.py +79 -0
  401. bitmart/ccxt/static_dependencies/starknet/hash/compiled_class_hash_objects.py +111 -0
  402. bitmart/ccxt/static_dependencies/starknet/hash/selector.py +16 -0
  403. bitmart/ccxt/static_dependencies/starknet/hash/storage.py +12 -0
  404. bitmart/ccxt/static_dependencies/starknet/hash/utils.py +78 -0
  405. bitmart/ccxt/static_dependencies/starknet/models/__init__.py +0 -0
  406. bitmart/ccxt/static_dependencies/starknet/models/typed_data.py +45 -0
  407. bitmart/ccxt/static_dependencies/starknet/serialization/__init__.py +24 -0
  408. bitmart/ccxt/static_dependencies/starknet/serialization/_calldata_reader.py +40 -0
  409. bitmart/ccxt/static_dependencies/starknet/serialization/_context.py +142 -0
  410. bitmart/ccxt/static_dependencies/starknet/serialization/data_serializers/__init__.py +10 -0
  411. bitmart/ccxt/static_dependencies/starknet/serialization/data_serializers/_common.py +82 -0
  412. bitmart/ccxt/static_dependencies/starknet/serialization/data_serializers/array_serializer.py +43 -0
  413. bitmart/ccxt/static_dependencies/starknet/serialization/data_serializers/bool_serializer.py +37 -0
  414. bitmart/ccxt/static_dependencies/starknet/serialization/data_serializers/byte_array_serializer.py +66 -0
  415. bitmart/ccxt/static_dependencies/starknet/serialization/data_serializers/cairo_data_serializer.py +71 -0
  416. bitmart/ccxt/static_dependencies/starknet/serialization/data_serializers/enum_serializer.py +71 -0
  417. bitmart/ccxt/static_dependencies/starknet/serialization/data_serializers/felt_serializer.py +50 -0
  418. bitmart/ccxt/static_dependencies/starknet/serialization/data_serializers/named_tuple_serializer.py +58 -0
  419. bitmart/ccxt/static_dependencies/starknet/serialization/data_serializers/option_serializer.py +43 -0
  420. bitmart/ccxt/static_dependencies/starknet/serialization/data_serializers/output_serializer.py +40 -0
  421. bitmart/ccxt/static_dependencies/starknet/serialization/data_serializers/payload_serializer.py +72 -0
  422. bitmart/ccxt/static_dependencies/starknet/serialization/data_serializers/struct_serializer.py +36 -0
  423. bitmart/ccxt/static_dependencies/starknet/serialization/data_serializers/tuple_serializer.py +36 -0
  424. bitmart/ccxt/static_dependencies/starknet/serialization/data_serializers/uint256_serializer.py +76 -0
  425. bitmart/ccxt/static_dependencies/starknet/serialization/data_serializers/uint_serializer.py +100 -0
  426. bitmart/ccxt/static_dependencies/starknet/serialization/data_serializers/unit_serializer.py +32 -0
  427. bitmart/ccxt/static_dependencies/starknet/serialization/errors.py +10 -0
  428. bitmart/ccxt/static_dependencies/starknet/serialization/factory.py +229 -0
  429. bitmart/ccxt/static_dependencies/starknet/serialization/function_serialization_adapter.py +110 -0
  430. bitmart/ccxt/static_dependencies/starknet/serialization/tuple_dataclass.py +59 -0
  431. bitmart/ccxt/static_dependencies/starknet/utils/__init__.py +0 -0
  432. bitmart/ccxt/static_dependencies/starknet/utils/constructor_args_translator.py +86 -0
  433. bitmart/ccxt/static_dependencies/starknet/utils/iterable.py +13 -0
  434. bitmart/ccxt/static_dependencies/starknet/utils/schema.py +13 -0
  435. bitmart/ccxt/static_dependencies/starknet/utils/typed_data.py +182 -0
  436. bitmart/ccxt/static_dependencies/starkware/__init__.py +0 -0
  437. bitmart/ccxt/static_dependencies/starkware/crypto/__init__.py +0 -0
  438. bitmart/ccxt/static_dependencies/starkware/crypto/fast_pedersen_hash.py +50 -0
  439. bitmart/ccxt/static_dependencies/starkware/crypto/math_utils.py +78 -0
  440. bitmart/ccxt/static_dependencies/starkware/crypto/signature.py +2344 -0
  441. bitmart/ccxt/static_dependencies/starkware/crypto/utils.py +63 -0
  442. bitmart/ccxt/static_dependencies/sympy/__init__.py +0 -0
  443. bitmart/ccxt/static_dependencies/sympy/core/__init__.py +0 -0
  444. bitmart/ccxt/static_dependencies/sympy/core/intfunc.py +35 -0
  445. bitmart/ccxt/static_dependencies/sympy/external/__init__.py +0 -0
  446. bitmart/ccxt/static_dependencies/sympy/external/gmpy.py +345 -0
  447. bitmart/ccxt/static_dependencies/sympy/external/importtools.py +187 -0
  448. bitmart/ccxt/static_dependencies/sympy/external/ntheory.py +637 -0
  449. bitmart/ccxt/static_dependencies/sympy/external/pythonmpq.py +341 -0
  450. bitmart/ccxt/static_dependencies/toolz/__init__.py +26 -0
  451. bitmart/ccxt/static_dependencies/toolz/_signatures.py +784 -0
  452. bitmart/ccxt/static_dependencies/toolz/_version.py +520 -0
  453. bitmart/ccxt/static_dependencies/toolz/compatibility.py +30 -0
  454. bitmart/ccxt/static_dependencies/toolz/curried/__init__.py +101 -0
  455. bitmart/ccxt/static_dependencies/toolz/curried/exceptions.py +22 -0
  456. bitmart/ccxt/static_dependencies/toolz/curried/operator.py +22 -0
  457. bitmart/ccxt/static_dependencies/toolz/dicttoolz.py +339 -0
  458. bitmart/ccxt/static_dependencies/toolz/functoolz.py +1049 -0
  459. bitmart/ccxt/static_dependencies/toolz/itertoolz.py +1057 -0
  460. bitmart/ccxt/static_dependencies/toolz/recipes.py +46 -0
  461. bitmart/ccxt/static_dependencies/toolz/utils.py +9 -0
  462. bitmart/ccxt/static_dependencies/typing_inspect/__init__.py +0 -0
  463. bitmart/ccxt/static_dependencies/typing_inspect/typing_inspect.py +851 -0
  464. bitmart-0.0.116.dist-info/METADATA +342 -0
  465. bitmart-0.0.116.dist-info/RECORD +466 -0
  466. bitmart-0.0.116.dist-info/WHEEL +4 -0
@@ -0,0 +1,2315 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ # -----------------------------------------------------------------------------
4
+
5
+ __version__ = '4.5.30'
6
+
7
+ # -----------------------------------------------------------------------------
8
+
9
+ import asyncio
10
+ import concurrent.futures
11
+ import socket
12
+ import certifi
13
+ import aiohttp
14
+ import ssl
15
+ import sys
16
+ import yarl
17
+ import math
18
+ from typing import Any, List
19
+ from ccxt.base.types import Int, Str, Num, Strings
20
+
21
+ # -----------------------------------------------------------------------------
22
+
23
+ from ccxt.async_support.base.throttler import Throttler
24
+
25
+ # -----------------------------------------------------------------------------
26
+
27
+ from ccxt.base.errors import BaseError, BadSymbol, BadRequest, BadResponse, ExchangeError, ExchangeNotAvailable, RequestTimeout, NotSupported, NullResponse, InvalidAddress, RateLimitExceeded, OperationFailed
28
+ from ccxt.base.types import ConstructorArgs, OrderType, OrderSide, OrderRequest, CancellationRequest, Order
29
+
30
+ # -----------------------------------------------------------------------------
31
+
32
+ from ccxt.base.exchange import Exchange as BaseExchange, ArgumentsRequired
33
+
34
+ # -----------------------------------------------------------------------------
35
+
36
+ from ccxt.async_support.base.ws.functions import inflate, inflate64, gunzip
37
+ from ccxt.async_support.base.ws.client import Client
38
+ from ccxt.async_support.base.ws.future import Future
39
+ from ccxt.async_support.base.ws.order_book import OrderBook, IndexedOrderBook, CountedOrderBook
40
+
41
+
42
+ # -----------------------------------------------------------------------------
43
+
44
+ try:
45
+ from aiohttp_socks import ProxyConnector as SocksProxyConnector
46
+ except ImportError:
47
+ SocksProxyConnector = None
48
+
49
+ # -----------------------------------------------------------------------------
50
+
51
+ __all__ = [
52
+ 'BaseExchange',
53
+ 'Exchange',
54
+ ]
55
+
56
+ # -----------------------------------------------------------------------------
57
+ # --- PROTO BUF IMPORTS
58
+ try:
59
+ from ccxt.protobuf.mexc import PushDataV3ApiWrapper_pb2
60
+ from google.protobuf.json_format import MessageToDict
61
+ except ImportError:
62
+ PushDataV3ApiWrapper_pb2 = None
63
+ MessageToDict = None
64
+
65
+ # -----------------------------------------------------------------------------
66
+
67
+
68
+ class Exchange(BaseExchange):
69
+ synchronous = False
70
+ streaming = {
71
+ 'maxPingPongMisses': 2,
72
+ 'keepAlive': 30000
73
+ }
74
+ ping = None
75
+ newUpdates = True
76
+ clients = {}
77
+ timeout_on_exit = 250 # needed for: https://github.com/ccxt/ccxt/pull/23470
78
+
79
+ def __init__(self, config: ConstructorArgs = {}):
80
+ if 'asyncio_loop' in config:
81
+ self.asyncio_loop = config['asyncio_loop']
82
+ self.aiohttp_trust_env = config.get('aiohttp_trust_env', self.aiohttp_trust_env)
83
+ self.verify = config.get('verify', self.verify)
84
+ self.own_session = 'session' not in config
85
+ self.cafile = config.get('cafile', certifi.where())
86
+ self.throttler = None
87
+ super(Exchange, self).__init__(config)
88
+ self.markets_loading = None
89
+ self.reloading_markets = False
90
+
91
+ def get_event_loop(self):
92
+ return self.asyncio_loop
93
+
94
+ def init_throttler(self, cost=None):
95
+ self.throttler = Throttler(self.tokenBucket, self.asyncio_loop)
96
+
97
+ async def throttle(self, cost=None):
98
+ return await self.throttler(cost)
99
+
100
+ def get_session(self):
101
+ return self.session
102
+
103
+ def __del__(self):
104
+ if self.session is not None or self.socks_proxy_sessions is not None:
105
+ self.logger.warning(self.id + " requires to release all resources with an explicit call to the .close() coroutine. If you are using the exchange instance with async coroutines, add `await exchange.close()` to your code into a place when you're done with the exchange and don't need the exchange instance anymore (at the end of your async coroutine).")
106
+
107
+ if sys.version_info >= (3, 5):
108
+ async def __aenter__(self):
109
+ self.open()
110
+ return self
111
+
112
+ async def __aexit__(self, exc_type, exc, tb):
113
+ await self.close()
114
+
115
+ def open(self):
116
+ if self.asyncio_loop is None:
117
+ if sys.version_info >= (3, 7):
118
+ self.asyncio_loop = asyncio.get_running_loop()
119
+ else:
120
+ self.asyncio_loop = asyncio.get_event_loop()
121
+ self.throttler.loop = self.asyncio_loop
122
+
123
+ if self.ssl_context is None:
124
+ # Create our SSL context object with our CA cert file
125
+ self.ssl_context = ssl.create_default_context(cafile=self.cafile) if self.verify else self.verify
126
+ if (self.ssl_context and self.safe_bool(self.options, 'include_OS_certificates', False)):
127
+ os_default_paths = ssl.get_default_verify_paths()
128
+ if os_default_paths.cafile and os_default_paths.cafile != self.cafile:
129
+ self.ssl_context.load_verify_locations(cafile=os_default_paths.cafile)
130
+
131
+ if self.own_session and self.session is None:
132
+ # Pass this SSL context to aiohttp and create a TCPConnector
133
+ self.tcp_connector = aiohttp.TCPConnector(ssl=self.ssl_context, loop=self.asyncio_loop, enable_cleanup_closed=True)
134
+ self.session = aiohttp.ClientSession(loop=self.asyncio_loop, connector=self.tcp_connector, trust_env=self.aiohttp_trust_env)
135
+
136
+ async def close(self):
137
+ await self.ws_close()
138
+ if self.session is not None:
139
+ if self.own_session:
140
+ await self.session.close()
141
+ self.session = None
142
+ await self.close_connector()
143
+ await self.close_proxy_sessions()
144
+ await self.sleep(self.timeout_on_exit)
145
+
146
+ async def close_connector(self):
147
+ if self.tcp_connector is not None:
148
+ await self.tcp_connector.close()
149
+ self.tcp_connector = None
150
+ if self.aiohttp_socks_connector is not None:
151
+ await self.aiohttp_socks_connector.close()
152
+ self.aiohttp_socks_connector = None
153
+
154
+ async def close_proxy_sessions(self):
155
+ if self.socks_proxy_sessions is not None:
156
+ for url in self.socks_proxy_sessions:
157
+ await self.socks_proxy_sessions[url].close()
158
+ self.socks_proxy_sessions = None
159
+
160
+ async def fetch(self, url, method='GET', headers=None, body=None):
161
+ """Perform a HTTP request and return decoded JSON data"""
162
+
163
+ # ##### PROXY & HEADERS #####
164
+ request_headers = self.prepare_request_headers(headers)
165
+ self.last_request_headers = request_headers
166
+ # proxy-url
167
+ proxyUrl = self.check_proxy_url_settings(url, method, headers, body)
168
+ if proxyUrl is not None:
169
+ request_headers.update({'Origin': self.origin})
170
+ url = proxyUrl + self.url_encoder_for_proxy_url(url)
171
+ # proxy agents
172
+ final_proxy = None # set default
173
+ proxy_session = None
174
+ httpProxy, httpsProxy, socksProxy = self.check_proxy_settings(url, method, headers, body)
175
+ if httpProxy:
176
+ final_proxy = httpProxy
177
+ elif httpsProxy:
178
+ final_proxy = httpsProxy
179
+ elif socksProxy:
180
+ if SocksProxyConnector is None:
181
+ raise NotSupported(self.id + ' - to use SOCKS proxy with ccxt, you need "aiohttp_socks" module that can be installed by "pip install aiohttp_socks"')
182
+ # override session
183
+ if (self.socks_proxy_sessions is None):
184
+ self.socks_proxy_sessions = {}
185
+ if (socksProxy not in self.socks_proxy_sessions):
186
+ # Create our SSL context object with our CA cert file
187
+ self.open() # ensure `asyncio_loop` is set
188
+ proxy_session = self.get_socks_proxy_session(socksProxy)
189
+ # add aiohttp_proxy for python as exclusion
190
+ elif self.aiohttp_proxy:
191
+ final_proxy = self.aiohttp_proxy
192
+
193
+ proxyAgentSet = final_proxy is not None or socksProxy is not None
194
+ self.check_conflicting_proxies(proxyAgentSet, proxyUrl)
195
+
196
+ # avoid old proxies mixing
197
+ if (self.aiohttp_proxy is not None) and (proxyUrl is not None or httpProxy is not None or httpsProxy is not None or socksProxy is not None):
198
+ raise NotSupported(self.id + ' you have set multiple proxies, please use one or another')
199
+
200
+ # log
201
+ if self.verbose:
202
+ self.log("\nfetch Request:", self.id, method, url, "RequestHeaders:", request_headers, "RequestBody:", body)
203
+ self.logger.debug("%s %s, Request: %s %s", method, url, headers, body)
204
+ # end of proxies & headers
205
+
206
+ request_body = body
207
+ encoded_body = body.encode() if body else None
208
+ self.open()
209
+ final_session = proxy_session if proxy_session is not None else self.session
210
+ session_method = getattr(final_session, method.lower())
211
+
212
+ http_response = None
213
+ http_status_code = None
214
+ http_status_text = None
215
+ json_response = None
216
+ try:
217
+ async with session_method(yarl.URL(url, encoded=True),
218
+ data=encoded_body,
219
+ headers=request_headers,
220
+ timeout=(self.timeout / 1000),
221
+ proxy=final_proxy) as response:
222
+ http_response = await response.text(errors='replace')
223
+ # CIMultiDictProxy
224
+ raw_headers = response.headers
225
+ headers = {}
226
+ for header in raw_headers:
227
+ if header in headers:
228
+ headers[header] = headers[header] + ', ' + raw_headers[header]
229
+ else:
230
+ headers[header] = raw_headers[header]
231
+ http_status_code = response.status
232
+ http_status_text = response.reason
233
+ http_response = self.on_rest_response(http_status_code, http_status_text, url, method, headers, http_response, request_headers, request_body)
234
+ json_response = self.parse_json(http_response)
235
+ if self.enableLastHttpResponse:
236
+ self.last_http_response = http_response
237
+ if self.enableLastResponseHeaders:
238
+ self.last_response_headers = headers
239
+ if self.enableLastJsonResponse:
240
+ self.last_json_response = json_response
241
+ if self.verbose:
242
+ self.log("\nfetch Response:", self.id, method, url, http_status_code, "ResponseHeaders:", headers, "ResponseBody:", http_response)
243
+ if json_response and not isinstance(json_response, list) and self.returnResponseHeaders:
244
+ json_response['responseHeaders'] = headers
245
+ self.logger.debug("%s %s, Response: %s %s %s", method, url, http_status_code, headers, http_response)
246
+
247
+ except socket.gaierror as e:
248
+ details = ' '.join([self.id, method, url])
249
+ raise ExchangeNotAvailable(details) from e
250
+
251
+ except (concurrent.futures.TimeoutError, asyncio.TimeoutError) as e:
252
+ details = ' '.join([self.id, method, url])
253
+ raise RequestTimeout(details) from e
254
+
255
+ except aiohttp.ClientConnectionError as e:
256
+ details = ' '.join([self.id, method, url])
257
+ raise ExchangeNotAvailable(details) from e
258
+
259
+ except aiohttp.ClientError as e: # base exception class
260
+ details = ' '.join([self.id, method, url])
261
+ raise ExchangeError(details) from e
262
+
263
+ self.handle_errors(http_status_code, http_status_text, url, method, headers, http_response, json_response, request_headers, request_body)
264
+ self.handle_http_status_code(http_status_code, http_status_text, url, method, http_response)
265
+ if json_response is not None:
266
+ return json_response
267
+ if self.is_text_response(headers):
268
+ return http_response
269
+ if http_response == '' or http_response is None:
270
+ return http_response
271
+ return response.content
272
+
273
+ def get_socks_proxy_session(self, socksProxy):
274
+ if (self.socks_proxy_sessions is None):
275
+ self.socks_proxy_sessions = {}
276
+ if (socksProxy not in self.socks_proxy_sessions):
277
+ reverse_dns = socksProxy.startswith('socks5h://')
278
+ socks_proxy_selected = socksProxy if not reverse_dns else socksProxy.replace('socks5h://', 'socks5://')
279
+ self.aiohttp_socks_connector = SocksProxyConnector.from_url(
280
+ socks_proxy_selected,
281
+ # extra args copied from self.open()
282
+ ssl=self.ssl_context,
283
+ loop=self.asyncio_loop,
284
+ enable_cleanup_closed=True,
285
+ rdns=reverse_dns if reverse_dns else None
286
+ )
287
+ self.socks_proxy_sessions[socksProxy] = aiohttp.ClientSession(loop=self.asyncio_loop, connector=self.aiohttp_socks_connector, trust_env=self.aiohttp_trust_env)
288
+ return self.socks_proxy_sessions[socksProxy]
289
+
290
+ async def load_markets_helper(self, reload=False, params={}):
291
+ if not reload:
292
+ if self.markets:
293
+ if not self.markets_by_id:
294
+ return self.set_markets(self.markets)
295
+ return self.markets
296
+ currencies = None
297
+ if self.has['fetchCurrencies'] is True:
298
+ currencies = await self.fetch_currencies()
299
+ self.options['cachedCurrencies'] = currencies
300
+ markets = await self.fetch_markets(params)
301
+ if 'cachedCurrencies' in self.options:
302
+ del self.options['cachedCurrencies']
303
+ return self.set_markets(markets, currencies)
304
+
305
+
306
+ async def load_markets(self, reload=False, params={}):
307
+ """
308
+ Loads and prepares the markets for trading.
309
+
310
+ Args:
311
+ reload (bool): If True, the markets will be reloaded from the exchange.
312
+ params (dict): Additional exchange-specific parameters for the request.
313
+
314
+ Returns:
315
+ dict: A dictionary of markets.
316
+
317
+ Raises:
318
+ Exception: If the markets cannot be loaded or prepared.
319
+
320
+ Notes:
321
+ This method is asynchronous.
322
+ It ensures that the markets are only loaded once, even if called multiple times.
323
+ If the markets are already loaded and `reload` is False or not provided, it returns the existing markets.
324
+ If a reload is in progress, it waits for completion before returning.
325
+ If an error occurs during loading or preparation, an exception is raised.
326
+ """
327
+ if (reload and not self.reloading_markets) or not self.markets_loading:
328
+ self.reloading_markets = True
329
+ coroutine = self.load_markets_helper(reload, params)
330
+ # coroutines can only be awaited once so we wrap it in a task
331
+ self.markets_loading = asyncio.ensure_future(coroutine)
332
+ try:
333
+ result = await self.markets_loading
334
+ except asyncio.CancelledError as e: # CancelledError is a base exception so we need to catch it explicitly
335
+ self.reloading_markets = False
336
+ self.markets_loading = None
337
+ raise e
338
+ except Exception as e:
339
+ self.reloading_markets = False
340
+ self.markets_loading = None
341
+ raise e
342
+ self.reloading_markets = False
343
+ return result
344
+
345
+ async def load_fees(self, reload=False):
346
+ if not reload:
347
+ if self.loaded_fees != Exchange.loaded_fees:
348
+ return self.loaded_fees
349
+ self.loaded_fees = self.deep_extend(self.loaded_fees, await self.fetch_fees())
350
+ return self.loaded_fees
351
+
352
+ async def fetch_markets(self, params={}):
353
+ # markets are returned as a list
354
+ # currencies are returned as a dict
355
+ # this is for historical reasons
356
+ # and may be changed for consistency later
357
+ return self.to_array(self.markets)
358
+
359
+ async def fetch_currencies(self, params={}):
360
+ # markets are returned as a list
361
+ # currencies are returned as a dict
362
+ # this is for historical reasons
363
+ # and may be changed for consistency later
364
+ return self.currencies
365
+
366
+ async def fetchOHLCVC(self, symbol, timeframe='1m', since=None, limit=None, params={}):
367
+ return await self.fetch_ohlcvc(symbol, timeframe, since, limit, params)
368
+
369
+ async def fetch_full_tickers(self, symbols=None, params={}):
370
+ return await self.fetch_tickers(symbols, params)
371
+
372
+ async def sleep(self, milliseconds):
373
+ return await asyncio.sleep(milliseconds / 1000)
374
+
375
+ async def spawn_async(self, method, *args):
376
+ try:
377
+ await method(*args)
378
+ except Exception:
379
+ # todo: handle spawned errors
380
+ pass
381
+
382
+ def spawn(self, method, *args):
383
+ def callback(asyncio_future):
384
+ exception = asyncio_future.exception()
385
+ if exception is None:
386
+ future.resolve(asyncio_future.result())
387
+ else:
388
+ future.reject(exception)
389
+ future = Future()
390
+ task = self.asyncio_loop.create_task(method(*args))
391
+ task.add_done_callback(callback)
392
+ return future
393
+
394
+ # -----------------------------------------------------------------------
395
+ # WS/PRO code
396
+
397
+ @staticmethod
398
+ def inflate(data):
399
+ return inflate(data)
400
+
401
+ @staticmethod
402
+ def inflate64(data):
403
+ return inflate64(data)
404
+
405
+ @staticmethod
406
+ def gunzip(data):
407
+ return gunzip(data)
408
+
409
+ def order_book(self, snapshot={}, depth=None):
410
+ return OrderBook(snapshot, depth)
411
+
412
+ def indexed_order_book(self, snapshot={}, depth=None):
413
+ return IndexedOrderBook(snapshot, depth)
414
+
415
+ def counted_order_book(self, snapshot={}, depth=None):
416
+ return CountedOrderBook(snapshot, depth)
417
+
418
+ def client(self, url):
419
+ self.clients = self.clients or {}
420
+ if url not in self.clients:
421
+ on_message = self.handle_message
422
+ on_error = self.on_error
423
+ on_close = self.on_close
424
+ on_connected = self.on_connected
425
+ # decide client type here: aiohttp ws / websockets / signalr / socketio
426
+ ws_options = self.safe_value(self.options, 'ws', {})
427
+ options = self.extend(self.streaming, {
428
+ 'log': getattr(self, 'log'),
429
+ 'ping': getattr(self, 'ping', None),
430
+ 'verbose': self.verbose,
431
+ 'throttle': Throttler(self.tokenBucket, self.asyncio_loop),
432
+ 'asyncio_loop': self.asyncio_loop,
433
+ 'decompressBinary': self.safe_bool(self.options, 'decompressBinary', True),
434
+ }, ws_options)
435
+ # we use aiohttp instead of fastClient now because of this
436
+ # https://github.com/ccxt/ccxt/pull/25995
437
+ self.clients[url] = Client(url, on_message, on_error, on_close, on_connected, options)
438
+ # set http/s proxy (socks proxy should be set in other place)
439
+ httpProxy, httpsProxy, socksProxy = self.check_ws_proxy_settings()
440
+ if (httpProxy or httpsProxy):
441
+ self.clients[url].proxy = httpProxy if httpProxy else httpsProxy
442
+ return self.clients[url]
443
+
444
+ def delay(self, timeout, method, *args):
445
+ return self.asyncio_loop.call_later(timeout / 1000, self.spawn, method, *args)
446
+
447
+ def handle_message(self, client, message):
448
+ always = True
449
+ if always:
450
+ raise NotSupported(self.id + '.handle_message() not implemented yet')
451
+ return {}
452
+
453
+ def watch_multiple(self, url, message_hashes, message=None, subscribe_hashes=None, subscription=None):
454
+ # base exchange self.open starts the aiohttp Session in an async context
455
+ self.open()
456
+ backoff_delay = 0
457
+ client = self.client(url)
458
+
459
+ future = Future.race([client.future(message_hash) for message_hash in message_hashes])
460
+
461
+ missing_subscriptions = []
462
+ if subscribe_hashes is not None:
463
+ for subscribe_hash in subscribe_hashes:
464
+ if subscribe_hash not in client.subscriptions:
465
+ missing_subscriptions.append(subscribe_hash)
466
+ client.subscriptions[subscribe_hash] = subscription or True
467
+
468
+ connected = client.connected if client.connected.done() \
469
+ else asyncio.ensure_future(client.connect(self.session, backoff_delay))
470
+
471
+ def after(fut):
472
+ # todo: decouple signing from subscriptions
473
+ options = self.safe_value(self.options, 'ws')
474
+ cost = self.safe_value(options, 'cost', 1)
475
+ if message:
476
+ async def send_message():
477
+ if self.enableRateLimit:
478
+ await client.throttle(cost)
479
+ try:
480
+ await client.send(message)
481
+ except ConnectionError as e:
482
+ client.on_error(e)
483
+ except Exception as e:
484
+ client.on_error(e)
485
+ asyncio.ensure_future(send_message())
486
+
487
+ if missing_subscriptions:
488
+ connected.add_done_callback(after)
489
+
490
+ return future
491
+
492
+ def watch(self, url, message_hash, message=None, subscribe_hash=None, subscription=None):
493
+ # base exchange self.open starts the aiohttp Session in an async context
494
+ self.open()
495
+ backoff_delay = 0
496
+ client = self.client(url)
497
+ if subscribe_hash is None and message_hash in client.futures:
498
+ return client.futures[message_hash]
499
+ future = client.future(message_hash)
500
+
501
+ subscribed = client.subscriptions.get(subscribe_hash)
502
+
503
+ if not subscribed:
504
+ client.subscriptions[subscribe_hash] = subscription or True
505
+
506
+ selected_session = self.session
507
+ # http/s proxy is being set in other places
508
+ httpProxy, httpsProxy, socksProxy = self.check_ws_proxy_settings()
509
+ if (socksProxy):
510
+ selected_session = self.get_socks_proxy_session(socksProxy)
511
+ connected = client.connected if client.connected.done() \
512
+ else asyncio.ensure_future(client.connect(selected_session, backoff_delay))
513
+
514
+ def after(fut):
515
+ # todo: decouple signing from subscriptions
516
+ options = self.safe_value(self.options, 'ws')
517
+ cost = self.safe_value(options, 'cost', 1)
518
+ if message:
519
+ async def send_message():
520
+ if self.enableRateLimit:
521
+ await client.throttle(cost)
522
+ try:
523
+ await client.send(message)
524
+ except ConnectionError as e:
525
+ client.on_error(e)
526
+ except Exception as e:
527
+ client.on_error(e)
528
+ asyncio.ensure_future(send_message())
529
+
530
+ if not subscribed:
531
+ connected.add_done_callback(after)
532
+
533
+ return future
534
+
535
+ def on_connected(self, client, message=None):
536
+ # for user hooks
537
+ # print('Connected to', client.url)
538
+ pass
539
+
540
+ def on_error(self, client, error):
541
+ if client.url in self.clients and self.clients[client.url].error:
542
+ del self.clients[client.url]
543
+
544
+ def on_close(self, client, error):
545
+ if client.error:
546
+ # connection closed by the user or due to an error
547
+ pass
548
+ else:
549
+ # server disconnected a working connection
550
+ if client.url in self.clients:
551
+ del self.clients[client.url]
552
+
553
+ async def ws_close(self):
554
+ if self.clients:
555
+ await asyncio.wait([asyncio.create_task(client.close()) for client in self.clients.values()], return_when=asyncio.ALL_COMPLETED)
556
+ for url in self.clients.copy():
557
+ del self.clients[url]
558
+
559
+ async def load_order_book(self, client, messageHash, symbol, limit=None, params={}):
560
+ if symbol not in self.orderbooks:
561
+ client.reject(ExchangeError(self.id + ' loadOrderBook() orderbook is not initiated'), messageHash)
562
+ return
563
+ try:
564
+ maxRetries = self.handle_option('watchOrderBook', 'maxRetries', 3)
565
+ tries = 0
566
+ stored = self.orderbooks[symbol]
567
+ while tries < maxRetries:
568
+ cache = stored.cache
569
+ order_book = await self.fetch_order_book(symbol, limit, params)
570
+ index = self.get_cache_index(order_book, cache)
571
+ if index >= 0:
572
+ stored.reset(order_book)
573
+ self.handle_deltas(stored, cache[index:])
574
+ cache.clear()
575
+ client.resolve(stored, messageHash)
576
+ return
577
+ tries += 1
578
+ client.reject(ExchangeError(self.id + ' nonce is behind cache after ' + str(maxRetries) + ' tries.'), messageHash)
579
+ del self.clients[client.url]
580
+ except BaseError as e:
581
+ client.reject(e, messageHash)
582
+ await self.load_order_book(client, messageHash, symbol, limit, params)
583
+
584
+ def format_scientific_notation_ftx(self, n):
585
+ if n == 0:
586
+ return '0e-00'
587
+ return format(n, 'g')
588
+
589
+ def decode_proto_msg(self, data):
590
+ if not MessageToDict:
591
+ raise NotSupported(self.id + ' requires protobuf to decode messages, please install it with `pip install "protobuf==5.29.5"`')
592
+ message = PushDataV3ApiWrapper_pb2.PushDataV3ApiWrapper()
593
+ message.ParseFromString(data)
594
+ dict_msg = MessageToDict(message)
595
+ # {
596
+ # "channel":"spot@public.kline.v3.api.pb@BTCUSDT@Min1",
597
+ # "symbol":"BTCUSDT",
598
+ # "symbolId":"2fb942154ef44a4ab2ef98c8afb6a4a7",
599
+ # "createTime":"1754735110559",
600
+ # "publicSpotKline":{
601
+ # "interval":"Min1",
602
+ # "windowStart":"1754735100",
603
+ # "openingPrice":"117792.45",
604
+ # "closingPrice":"117805.32",
605
+ # "highestPrice":"117814.63",
606
+ # "lowestPrice":"117792.45",
607
+ # "volume":"0.13425465",
608
+ # "amount":"15815.77",
609
+ # "windowEnd":"1754735160"
610
+ # }
611
+ # }
612
+ return dict_msg
613
+
614
+ async def load_dydx_protos(self):
615
+ return
616
+
617
+ # ########################################################################
618
+ # ########################################################################
619
+ # ########################################################################
620
+ # ########################################################################
621
+ # ######## ######## ########
622
+ # ######## ######## ########
623
+ # ######## ######## ########
624
+ # ######## ######## ########
625
+ # ######## ######################## ########################
626
+ # ######## ######################## ########################
627
+ # ######## ######################## ########################
628
+ # ######## ######################## ########################
629
+ # ######## ######## ########
630
+ # ######## ######## ########
631
+ # ######## ######## ########
632
+ # ######## ######## ########
633
+ # ########################################################################
634
+ # ########################################################################
635
+ # ########################################################################
636
+ # ########################################################################
637
+ # ######## ######## ######## ########
638
+ # ######## ######## ######## ########
639
+ # ######## ######## ######## ########
640
+ # ######## ######## ######## ########
641
+ # ################ ######################## ################
642
+ # ################ ######################## ################
643
+ # ################ ######################## ################
644
+ # ################ ######################## ################
645
+ # ######## ######## ################ ################
646
+ # ######## ######## ################ ################
647
+ # ######## ######## ################ ################
648
+ # ######## ######## ################ ################
649
+ # ########################################################################
650
+ # ########################################################################
651
+ # ########################################################################
652
+ # ########################################################################
653
+
654
+ # METHODS BELOW THIS LINE ARE TRANSPILED FROM TYPESCRIPT
655
+
656
+ async def fetch_accounts(self, params={}):
657
+ raise NotSupported(self.id + ' fetchAccounts() is not supported yet')
658
+
659
+ async def fetch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={}):
660
+ raise NotSupported(self.id + ' fetchTrades() is not supported yet')
661
+
662
+ async def fetch_trades_ws(self, symbol: str, since: Int = None, limit: Int = None, params={}):
663
+ raise NotSupported(self.id + ' fetchTradesWs() is not supported yet')
664
+
665
+ async def watch_liquidations(self, symbol: str, since: Int = None, limit: Int = None, params={}):
666
+ if self.has['watchLiquidationsForSymbols']:
667
+ return await self.watch_liquidations_for_symbols([symbol], since, limit, params)
668
+ raise NotSupported(self.id + ' watchLiquidations() is not supported yet')
669
+
670
+ async def watch_liquidations_for_symbols(self, symbols: List[str], since: Int = None, limit: Int = None, params={}):
671
+ raise NotSupported(self.id + ' watchLiquidationsForSymbols() is not supported yet')
672
+
673
+ async def watch_my_liquidations(self, symbol: str, since: Int = None, limit: Int = None, params={}):
674
+ if self.has['watchMyLiquidationsForSymbols']:
675
+ return self.watch_my_liquidations_for_symbols([symbol], since, limit, params)
676
+ raise NotSupported(self.id + ' watchMyLiquidations() is not supported yet')
677
+
678
+ async def watch_my_liquidations_for_symbols(self, symbols: List[str], since: Int = None, limit: Int = None, params={}):
679
+ raise NotSupported(self.id + ' watchMyLiquidationsForSymbols() is not supported yet')
680
+
681
+ async def watch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={}):
682
+ raise NotSupported(self.id + ' watchTrades() is not supported yet')
683
+
684
+ async def un_watch_orders(self, symbol: Str = None, params={}):
685
+ raise NotSupported(self.id + ' unWatchOrders() is not supported yet')
686
+
687
+ async def un_watch_trades(self, symbol: str, params={}):
688
+ raise NotSupported(self.id + ' unWatchTrades() is not supported yet')
689
+
690
+ async def watch_trades_for_symbols(self, symbols: List[str], since: Int = None, limit: Int = None, params={}):
691
+ raise NotSupported(self.id + ' watchTradesForSymbols() is not supported yet')
692
+
693
+ async def un_watch_trades_for_symbols(self, symbols: List[str], params={}):
694
+ raise NotSupported(self.id + ' unWatchTradesForSymbols() is not supported yet')
695
+
696
+ async def watch_my_trades_for_symbols(self, symbols: List[str], since: Int = None, limit: Int = None, params={}):
697
+ raise NotSupported(self.id + ' watchMyTradesForSymbols() is not supported yet')
698
+
699
+ async def watch_orders_for_symbols(self, symbols: List[str], since: Int = None, limit: Int = None, params={}):
700
+ raise NotSupported(self.id + ' watchOrdersForSymbols() is not supported yet')
701
+
702
+ async def watch_ohlcv_for_symbols(self, symbolsAndTimeframes: List[List[str]], since: Int = None, limit: Int = None, params={}):
703
+ raise NotSupported(self.id + ' watchOHLCVForSymbols() is not supported yet')
704
+
705
+ async def un_watch_ohlcv_for_symbols(self, symbolsAndTimeframes: List[List[str]], params={}):
706
+ raise NotSupported(self.id + ' unWatchOHLCVForSymbols() is not supported yet')
707
+
708
+ async def watch_order_book_for_symbols(self, symbols: List[str], limit: Int = None, params={}):
709
+ raise NotSupported(self.id + ' watchOrderBookForSymbols() is not supported yet')
710
+
711
+ async def un_watch_order_book_for_symbols(self, symbols: List[str], params={}):
712
+ raise NotSupported(self.id + ' unWatchOrderBookForSymbols() is not supported yet')
713
+
714
+ async def un_watch_positions(self, symbols: Strings = None, params={}):
715
+ raise NotSupported(self.id + ' unWatchPositions() is not supported yet')
716
+
717
+ async def un_watch_ticker(self, symbol: str, params={}):
718
+ raise NotSupported(self.id + ' unWatchTicker() is not supported yet')
719
+
720
+ async def un_watch_mark_price(self, symbol: str, params={}):
721
+ raise NotSupported(self.id + ' unWatchMarkPrice() is not supported yet')
722
+
723
+ async def un_watch_mark_prices(self, symbols: Strings = None, params={}):
724
+ raise NotSupported(self.id + ' unWatchMarkPrices() is not supported yet')
725
+
726
+ async def fetch_deposit_addresses(self, codes: Strings = None, params={}):
727
+ raise NotSupported(self.id + ' fetchDepositAddresses() is not supported yet')
728
+
729
+ async def fetch_order_book(self, symbol: str, limit: Int = None, params={}):
730
+ raise NotSupported(self.id + ' fetchOrderBook() is not supported yet')
731
+
732
+ async def fetch_order_book_ws(self, symbol: str, limit: Int = None, params={}):
733
+ raise NotSupported(self.id + ' fetchOrderBookWs() is not supported yet')
734
+
735
+ async def fetch_margin_mode(self, symbol: str, params={}):
736
+ if self.has['fetchMarginModes']:
737
+ marginModes = await self.fetch_margin_modes([symbol], params)
738
+ return self.safe_dict(marginModes, symbol)
739
+ else:
740
+ raise NotSupported(self.id + ' fetchMarginMode() is not supported yet')
741
+
742
+ async def fetch_margin_modes(self, symbols: Strings = None, params={}):
743
+ raise NotSupported(self.id + ' fetchMarginModes() is not supported yet')
744
+
745
+ async def fetch_rest_order_book_safe(self, symbol, limit=None, params={}):
746
+ fetchSnapshotMaxRetries = self.handle_option('watchOrderBook', 'maxRetries', 3)
747
+ for i in range(0, fetchSnapshotMaxRetries):
748
+ try:
749
+ orderBook = await self.fetch_order_book(symbol, limit, params)
750
+ return orderBook
751
+ except Exception as e:
752
+ if (i + 1) == fetchSnapshotMaxRetries:
753
+ raise e
754
+ return None
755
+
756
+ async def watch_order_book(self, symbol: str, limit: Int = None, params={}):
757
+ raise NotSupported(self.id + ' watchOrderBook() is not supported yet')
758
+
759
+ async def un_watch_order_book(self, symbol: str, params={}):
760
+ raise NotSupported(self.id + ' unWatchOrderBook() is not supported yet')
761
+
762
+ async def fetch_time(self, params={}):
763
+ raise NotSupported(self.id + ' fetchTime() is not supported yet')
764
+
765
+ async def fetch_trading_limits(self, symbols: Strings = None, params={}):
766
+ raise NotSupported(self.id + ' fetchTradingLimits() is not supported yet')
767
+
768
+ async def fetch_cross_borrow_rates(self, params={}):
769
+ raise NotSupported(self.id + ' fetchCrossBorrowRates() is not supported yet')
770
+
771
+ async def fetch_isolated_borrow_rates(self, params={}):
772
+ raise NotSupported(self.id + ' fetchIsolatedBorrowRates() is not supported yet')
773
+
774
+ async def fetch_leverage_tiers(self, symbols: Strings = None, params={}):
775
+ raise NotSupported(self.id + ' fetchLeverageTiers() is not supported yet')
776
+
777
+ async def fetch_funding_rates(self, symbols: Strings = None, params={}):
778
+ raise NotSupported(self.id + ' fetchFundingRates() is not supported yet')
779
+
780
+ async def fetch_funding_intervals(self, symbols: Strings = None, params={}):
781
+ raise NotSupported(self.id + ' fetchFundingIntervals() is not supported yet')
782
+
783
+ async def watch_funding_rate(self, symbol: str, params={}):
784
+ raise NotSupported(self.id + ' watchFundingRate() is not supported yet')
785
+
786
+ async def watch_funding_rates(self, symbols: List[str], params={}):
787
+ raise NotSupported(self.id + ' watchFundingRates() is not supported yet')
788
+
789
+ async def watch_funding_rates_for_symbols(self, symbols: List[str], params={}):
790
+ return await self.watch_funding_rates(symbols, params)
791
+
792
+ async def transfer(self, code: str, amount: float, fromAccount: str, toAccount: str, params={}):
793
+ raise NotSupported(self.id + ' transfer() is not supported yet')
794
+
795
+ async def withdraw(self, code: str, amount: float, address: str, tag: Str = None, params={}):
796
+ raise NotSupported(self.id + ' withdraw() is not supported yet')
797
+
798
+ async def create_deposit_address(self, code: str, params={}):
799
+ raise NotSupported(self.id + ' createDepositAddress() is not supported yet')
800
+
801
+ async def set_leverage(self, leverage: int, symbol: Str = None, params={}):
802
+ raise NotSupported(self.id + ' setLeverage() is not supported yet')
803
+
804
+ async def fetch_leverage(self, symbol: str, params={}):
805
+ if self.has['fetchLeverages']:
806
+ leverages = await self.fetch_leverages([symbol], params)
807
+ return self.safe_dict(leverages, symbol)
808
+ else:
809
+ raise NotSupported(self.id + ' fetchLeverage() is not supported yet')
810
+
811
+ async def fetch_leverages(self, symbols: Strings = None, params={}):
812
+ raise NotSupported(self.id + ' fetchLeverages() is not supported yet')
813
+
814
+ async def set_position_mode(self, hedged: bool, symbol: Str = None, params={}):
815
+ raise NotSupported(self.id + ' setPositionMode() is not supported yet')
816
+
817
+ async def add_margin(self, symbol: str, amount: float, params={}):
818
+ raise NotSupported(self.id + ' addMargin() is not supported yet')
819
+
820
+ async def reduce_margin(self, symbol: str, amount: float, params={}):
821
+ raise NotSupported(self.id + ' reduceMargin() is not supported yet')
822
+
823
+ async def set_margin(self, symbol: str, amount: float, params={}):
824
+ raise NotSupported(self.id + ' setMargin() is not supported yet')
825
+
826
+ async def fetch_long_short_ratio(self, symbol: str, timeframe: Str = None, params={}):
827
+ raise NotSupported(self.id + ' fetchLongShortRatio() is not supported yet')
828
+
829
+ async def fetch_long_short_ratio_history(self, symbol: Str = None, timeframe: Str = None, since: Int = None, limit: Int = None, params={}):
830
+ raise NotSupported(self.id + ' fetchLongShortRatioHistory() is not supported yet')
831
+
832
+ async def fetch_margin_adjustment_history(self, symbol: Str = None, type: Str = None, since: Num = None, limit: Num = None, params={}):
833
+ """
834
+ fetches the history of margin added or reduced from contract isolated positions
835
+ :param str [symbol]: unified market symbol
836
+ :param str [type]: "add" or "reduce"
837
+ :param int [since]: timestamp in ms of the earliest change to fetch
838
+ :param int [limit]: the maximum amount of changes to fetch
839
+ :param dict params: extra parameters specific to the exchange api endpoint
840
+ :returns dict[]: a list of `margin structures <https://docs.ccxt.com/?id=margin-loan-structure>`
841
+ """
842
+ raise NotSupported(self.id + ' fetchMarginAdjustmentHistory() is not supported yet')
843
+
844
+ async def set_margin_mode(self, marginMode: str, symbol: Str = None, params={}):
845
+ raise NotSupported(self.id + ' setMarginMode() is not supported yet')
846
+
847
+ async def fetch_deposit_addresses_by_network(self, code: str, params={}):
848
+ raise NotSupported(self.id + ' fetchDepositAddressesByNetwork() is not supported yet')
849
+
850
+ async def fetch_open_interest_history(self, symbol: str, timeframe: str = '1h', since: Int = None, limit: Int = None, params={}):
851
+ raise NotSupported(self.id + ' fetchOpenInterestHistory() is not supported yet')
852
+
853
+ async def fetch_open_interest(self, symbol: str, params={}):
854
+ raise NotSupported(self.id + ' fetchOpenInterest() is not supported yet')
855
+
856
+ async def fetch_open_interests(self, symbols: Strings = None, params={}):
857
+ raise NotSupported(self.id + ' fetchOpenInterests() is not supported yet')
858
+
859
+ async def sign_in(self, params={}):
860
+ raise NotSupported(self.id + ' signIn() is not supported yet')
861
+
862
+ async def fetch_payment_methods(self, params={}):
863
+ raise NotSupported(self.id + ' fetchPaymentMethods() is not supported yet')
864
+
865
+ async def fetch_borrow_rate(self, code: str, amount: float, params={}):
866
+ raise NotSupported(self.id + ' fetchBorrowRate is deprecated, please use fetchCrossBorrowRate or fetchIsolatedBorrowRate instead')
867
+
868
+ async def repay_cross_margin(self, code: str, amount: float, params={}):
869
+ raise NotSupported(self.id + ' repayCrossMargin is not support yet')
870
+
871
+ async def repay_isolated_margin(self, symbol: str, code: str, amount: float, params={}):
872
+ raise NotSupported(self.id + ' repayIsolatedMargin is not support yet')
873
+
874
+ async def borrow_cross_margin(self, code: str, amount: float, params={}):
875
+ raise NotSupported(self.id + ' borrowCrossMargin is not support yet')
876
+
877
+ async def borrow_isolated_margin(self, symbol: str, code: str, amount: float, params={}):
878
+ raise NotSupported(self.id + ' borrowIsolatedMargin is not support yet')
879
+
880
+ async def borrow_margin(self, code: str, amount: float, symbol: Str = None, params={}):
881
+ raise NotSupported(self.id + ' borrowMargin is deprecated, please use borrowCrossMargin or borrowIsolatedMargin instead')
882
+
883
+ async def repay_margin(self, code: str, amount: float, symbol: Str = None, params={}):
884
+ raise NotSupported(self.id + ' repayMargin is deprecated, please use repayCrossMargin or repayIsolatedMargin instead')
885
+
886
+ async def fetch_ohlcv(self, symbol: str, timeframe: str = '1m', since: Int = None, limit: Int = None, params={}):
887
+ message = ''
888
+ if self.has['fetchTrades']:
889
+ message = '. If you want to build OHLCV candles from trade executions data, visit https://github.com/ccxt/ccxt/tree/master/examples/ and see "build-ohlcv-bars" file'
890
+ raise NotSupported(self.id + ' fetchOHLCV() is not supported yet' + message)
891
+
892
+ async def fetch_ohlcv_ws(self, symbol: str, timeframe: str = '1m', since: Int = None, limit: Int = None, params={}):
893
+ message = ''
894
+ if self.has['fetchTradesWs']:
895
+ message = '. If you want to build OHLCV candles from trade executions data, visit https://github.com/ccxt/ccxt/tree/master/examples/ and see "build-ohlcv-bars" file'
896
+ raise NotSupported(self.id + ' fetchOHLCVWs() is not supported yet. Try using fetchOHLCV instead.' + message)
897
+
898
+ async def watch_ohlcv(self, symbol: str, timeframe: str = '1m', since: Int = None, limit: Int = None, params={}):
899
+ raise NotSupported(self.id + ' watchOHLCV() is not supported yet')
900
+
901
+ async def fetch_web_endpoint(self, method, endpointMethod, returnAsJson, startRegex=None, endRegex=None):
902
+ errorMessage = ''
903
+ options = self.safe_value(self.options, method, {})
904
+ muteOnFailure = self.safe_bool(options, 'webApiMuteFailure', True)
905
+ try:
906
+ # if it was not explicitly disabled, then don't fetch
907
+ if self.safe_bool(options, 'webApiEnable', True) is not True:
908
+ return None
909
+ maxRetries = self.safe_value(options, 'webApiRetries', 10)
910
+ response = None
911
+ retry = 0
912
+ shouldBreak = False
913
+ while(retry < maxRetries):
914
+ try:
915
+ response = await getattr(self, endpointMethod)({})
916
+ shouldBreak = True
917
+ break
918
+ except Exception as e:
919
+ retry = retry + 1
920
+ if retry == maxRetries:
921
+ raise e
922
+ if shouldBreak:
923
+ break # self is needed because of GO
924
+ content = response
925
+ if startRegex is not None:
926
+ splitted_by_start = content.split(startRegex)
927
+ content = splitted_by_start[1] # we need second part after start
928
+ if endRegex is not None:
929
+ splitted_by_end = content.split(endRegex)
930
+ content = splitted_by_end[0] # we need first part after start
931
+ if returnAsJson and (isinstance(content, str)):
932
+ jsoned = self.parse_json(content.strip()) # content should be trimmed before json parsing
933
+ if jsoned:
934
+ return jsoned # if parsing was not successfull, exception should be thrown
935
+ else:
936
+ raise BadResponse('could not parse the response into json')
937
+ else:
938
+ return content
939
+ except Exception as e:
940
+ errorMessage = self.id + ' ' + method + '() failed to fetch correct data from website. Probably webpage markup has been changed, breaking the page custom parser.'
941
+ if muteOnFailure:
942
+ return None
943
+ else:
944
+ raise BadResponse(errorMessage)
945
+
946
+ async def fetch_l2_order_book(self, symbol: str, limit: Int = None, params={}):
947
+ orderbook = await self.fetch_order_book(symbol, limit, params)
948
+ return self.extend(orderbook, {
949
+ 'asks': self.sort_by(self.aggregate(orderbook['asks']), 0),
950
+ 'bids': self.sort_by(self.aggregate(orderbook['bids']), 0, True),
951
+ })
952
+
953
+ async def load_trading_limits(self, symbols: Strings = None, reload=False, params={}):
954
+ if self.has['fetchTradingLimits']:
955
+ if reload or not ('limitsLoaded' in self.options):
956
+ response = await self.fetch_trading_limits(symbols)
957
+ for i in range(0, len(symbols)):
958
+ symbol = symbols[i]
959
+ self.markets[symbol] = self.deep_extend(self.markets[symbol], response[symbol])
960
+ self.options['limitsLoaded'] = self.milliseconds()
961
+ return self.markets
962
+
963
+ async def fetch2(self, path, api: Any = 'public', method='GET', params={}, headers: Any = None, body: Any = None, config={}):
964
+ if self.enableRateLimit:
965
+ cost = self.calculate_rate_limiter_cost(api, method, path, params, config)
966
+ await self.throttle(cost)
967
+ retries = None
968
+ retries, params = self.handle_option_and_params(params, path, 'maxRetriesOnFailure', 0)
969
+ retryDelay = None
970
+ retryDelay, params = self.handle_option_and_params(params, path, 'maxRetriesOnFailureDelay', 0)
971
+ self.lastRestRequestTimestamp = self.milliseconds()
972
+ request = self.sign(path, api, method, params, headers, body)
973
+ self.last_request_headers = request['headers']
974
+ self.last_request_body = request['body']
975
+ self.last_request_url = request['url']
976
+ for i in range(0, retries + 1):
977
+ try:
978
+ return await self.fetch(request['url'], request['method'], request['headers'], request['body'])
979
+ except Exception as e:
980
+ if isinstance(e, OperationFailed):
981
+ if i < retries:
982
+ if self.verbose:
983
+ index = i + 1
984
+ self.log('Request failed with the error: ' + str(e) + ', retrying ' + str(index) + ' of ' + str(retries) + '...')
985
+ if (retryDelay is not None) and (retryDelay != 0):
986
+ await self.sleep(retryDelay)
987
+ else:
988
+ raise e
989
+ else:
990
+ raise e
991
+ return None # self line is never reached, but exists for c# value return requirement
992
+
993
+ async def request(self, path, api: Any = 'public', method='GET', params={}, headers: Any = None, body: Any = None, config={}):
994
+ return await self.fetch2(path, api, method, params, headers, body, config)
995
+
996
+ async def load_accounts(self, reload=False, params={}):
997
+ if reload:
998
+ self.accounts = await self.fetch_accounts(params)
999
+ else:
1000
+ if self.accounts:
1001
+ return self.accounts
1002
+ else:
1003
+ self.accounts = await self.fetch_accounts(params)
1004
+ self.accountsById = self.index_by(self.accounts, 'id')
1005
+ return self.accounts
1006
+
1007
+ async def edit_limit_buy_order(self, id: str, symbol: str, amount: float, price: Num = None, params={}):
1008
+ return await self.edit_limit_order(id, symbol, 'buy', amount, price, params)
1009
+
1010
+ async def edit_limit_sell_order(self, id: str, symbol: str, amount: float, price: Num = None, params={}):
1011
+ return await self.edit_limit_order(id, symbol, 'sell', amount, price, params)
1012
+
1013
+ async def edit_limit_order(self, id: str, symbol: str, side: OrderSide, amount: float, price: Num = None, params={}):
1014
+ return await self.edit_order(id, symbol, 'limit', side, amount, price, params)
1015
+
1016
+ async def edit_order(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: Num = None, price: Num = None, params={}):
1017
+ await self.cancel_order(id, symbol)
1018
+ return await self.create_order(symbol, type, side, amount, price, params)
1019
+
1020
+ async def edit_order_with_client_order_id(self, clientOrderId: str, symbol: str, type: OrderType, side: OrderSide, amount: Num = None, price: Num = None, params={}):
1021
+ return await self.edit_order('', symbol, type, side, amount, price, self.extend({'clientOrderId': clientOrderId}, params))
1022
+
1023
+ async def edit_order_ws(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: Num = None, price: Num = None, params={}):
1024
+ await self.cancel_order_ws(id, symbol)
1025
+ return await self.create_order_ws(symbol, type, side, amount, price, params)
1026
+
1027
+ async def fetch_position(self, symbol: str, params={}):
1028
+ raise NotSupported(self.id + ' fetchPosition() is not supported yet')
1029
+
1030
+ async def fetch_position_ws(self, symbol: str, params={}):
1031
+ raise NotSupported(self.id + ' fetchPositionWs() is not supported yet')
1032
+
1033
+ async def watch_position(self, symbol: Str = None, params={}):
1034
+ raise NotSupported(self.id + ' watchPosition() is not supported yet')
1035
+
1036
+ async def watch_positions(self, symbols: Strings = None, since: Int = None, limit: Int = None, params={}):
1037
+ raise NotSupported(self.id + ' watchPositions() is not supported yet')
1038
+
1039
+ async def watch_position_for_symbols(self, symbols: Strings = None, since: Int = None, limit: Int = None, params={}):
1040
+ return await self.watch_positions(symbols, since, limit, params)
1041
+
1042
+ async def fetch_positions_for_symbol(self, symbol: str, params={}):
1043
+ """
1044
+ fetches all open positions for specific symbol, unlike fetchPositions(which is designed to work with multiple symbols) so self method might be preffered for one-market position, because of less rate-limit consumption and speed
1045
+ :param str symbol: unified market symbol
1046
+ :param dict params: extra parameters specific to the endpoint
1047
+ :returns dict[]: a list of `position structure <https://docs.ccxt.com/?id=position-structure>` with maximum 3 items - possible one position for "one-way" mode, and possible two positions(long & short) for "two-way"(a.k.a. hedge) mode
1048
+ """
1049
+ raise NotSupported(self.id + ' fetchPositionsForSymbol() is not supported yet')
1050
+
1051
+ async def fetch_positions_for_symbol_ws(self, symbol: str, params={}):
1052
+ """
1053
+ fetches all open positions for specific symbol, unlike fetchPositions(which is designed to work with multiple symbols) so self method might be preffered for one-market position, because of less rate-limit consumption and speed
1054
+ :param str symbol: unified market symbol
1055
+ :param dict params: extra parameters specific to the endpoint
1056
+ :returns dict[]: a list of `position structure <https://docs.ccxt.com/?id=position-structure>` with maximum 3 items - possible one position for "one-way" mode, and possible two positions(long & short) for "two-way"(a.k.a. hedge) mode
1057
+ """
1058
+ raise NotSupported(self.id + ' fetchPositionsForSymbol() is not supported yet')
1059
+
1060
+ async def fetch_positions(self, symbols: Strings = None, params={}):
1061
+ raise NotSupported(self.id + ' fetchPositions() is not supported yet')
1062
+
1063
+ async def fetch_positions_ws(self, symbols: Strings = None, params={}):
1064
+ raise NotSupported(self.id + ' fetchPositions() is not supported yet')
1065
+
1066
+ async def fetch_positions_risk(self, symbols: Strings = None, params={}):
1067
+ raise NotSupported(self.id + ' fetchPositionsRisk() is not supported yet')
1068
+
1069
+ async def fetch_bids_asks(self, symbols: Strings = None, params={}):
1070
+ raise NotSupported(self.id + ' fetchBidsAsks() is not supported yet')
1071
+
1072
+ async def fetch_borrow_interest(self, code: Str = None, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
1073
+ raise NotSupported(self.id + ' fetchBorrowInterest() is not supported yet')
1074
+
1075
+ async def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
1076
+ raise NotSupported(self.id + ' fetchLedger() is not supported yet')
1077
+
1078
+ async def fetch_ledger_entry(self, id: str, code: Str = None, params={}):
1079
+ raise NotSupported(self.id + ' fetchLedgerEntry() is not supported yet')
1080
+
1081
+ async def fetch_balance(self, params={}):
1082
+ raise NotSupported(self.id + ' fetchBalance() is not supported yet')
1083
+
1084
+ async def fetch_balance_ws(self, params={}):
1085
+ raise NotSupported(self.id + ' fetchBalanceWs() is not supported yet')
1086
+
1087
+ async def watch_balance(self, params={}):
1088
+ raise NotSupported(self.id + ' watchBalance() is not supported yet')
1089
+
1090
+ async def fetch_partial_balance(self, part, params={}):
1091
+ balance = await self.fetch_balance(params)
1092
+ return balance[part]
1093
+
1094
+ async def fetch_free_balance(self, params={}):
1095
+ return await self.fetch_partial_balance('free', params)
1096
+
1097
+ async def fetch_used_balance(self, params={}):
1098
+ return await self.fetch_partial_balance('used', params)
1099
+
1100
+ async def fetch_total_balance(self, params={}):
1101
+ return await self.fetch_partial_balance('total', params)
1102
+
1103
+ async def fetch_status(self, params={}):
1104
+ raise NotSupported(self.id + ' fetchStatus() is not supported yet')
1105
+
1106
+ async def fetch_transaction_fee(self, code: str, params={}):
1107
+ if not self.has['fetchTransactionFees']:
1108
+ raise NotSupported(self.id + ' fetchTransactionFee() is not supported yet')
1109
+ return await self.fetch_transaction_fees([code], params)
1110
+
1111
+ async def fetch_transaction_fees(self, codes: Strings = None, params={}):
1112
+ raise NotSupported(self.id + ' fetchTransactionFees() is not supported yet')
1113
+
1114
+ async def fetch_deposit_withdraw_fees(self, codes: Strings = None, params={}):
1115
+ raise NotSupported(self.id + ' fetchDepositWithdrawFees() is not supported yet')
1116
+
1117
+ async def fetch_deposit_withdraw_fee(self, code: str, params={}):
1118
+ if not self.has['fetchDepositWithdrawFees']:
1119
+ raise NotSupported(self.id + ' fetchDepositWithdrawFee() is not supported yet')
1120
+ fees = await self.fetch_deposit_withdraw_fees([code], params)
1121
+ return self.safe_value(fees, code)
1122
+
1123
+ async def fetch_cross_borrow_rate(self, code: str, params={}):
1124
+ await self.load_markets()
1125
+ if not self.has['fetchBorrowRates']:
1126
+ raise NotSupported(self.id + ' fetchCrossBorrowRate() is not supported yet')
1127
+ borrowRates = await self.fetch_cross_borrow_rates(params)
1128
+ rate = self.safe_value(borrowRates, code)
1129
+ if rate is None:
1130
+ raise ExchangeError(self.id + ' fetchCrossBorrowRate() could not find the borrow rate for currency code ' + code)
1131
+ return rate
1132
+
1133
+ async def fetch_isolated_borrow_rate(self, symbol: str, params={}):
1134
+ await self.load_markets()
1135
+ if not self.has['fetchBorrowRates']:
1136
+ raise NotSupported(self.id + ' fetchIsolatedBorrowRate() is not supported yet')
1137
+ borrowRates = await self.fetch_isolated_borrow_rates(params)
1138
+ rate = self.safe_dict(borrowRates, symbol)
1139
+ if rate is None:
1140
+ raise ExchangeError(self.id + ' fetchIsolatedBorrowRate() could not find the borrow rate for market symbol ' + symbol)
1141
+ return rate
1142
+
1143
+ async def fetch_ticker(self, symbol: str, params={}):
1144
+ if self.has['fetchTickers']:
1145
+ await self.load_markets()
1146
+ market = self.market(symbol)
1147
+ symbol = market['symbol']
1148
+ tickers = await self.fetch_tickers([symbol], params)
1149
+ ticker = self.safe_dict(tickers, symbol)
1150
+ if ticker is None:
1151
+ raise NullResponse(self.id + ' fetchTickers() could not find a ticker for ' + symbol)
1152
+ else:
1153
+ return ticker
1154
+ else:
1155
+ raise NotSupported(self.id + ' fetchTicker() is not supported yet')
1156
+
1157
+ async def fetch_mark_price(self, symbol: str, params={}):
1158
+ if self.has['fetchMarkPrices']:
1159
+ await self.load_markets()
1160
+ market = self.market(symbol)
1161
+ symbol = market['symbol']
1162
+ tickers = await self.fetch_mark_prices([symbol], params)
1163
+ ticker = self.safe_dict(tickers, symbol)
1164
+ if ticker is None:
1165
+ raise NullResponse(self.id + ' fetchMarkPrices() could not find a ticker for ' + symbol)
1166
+ else:
1167
+ return ticker
1168
+ else:
1169
+ raise NotSupported(self.id + ' fetchMarkPrices() is not supported yet')
1170
+
1171
+ async def fetch_ticker_ws(self, symbol: str, params={}):
1172
+ if self.has['fetchTickersWs']:
1173
+ await self.load_markets()
1174
+ market = self.market(symbol)
1175
+ symbol = market['symbol']
1176
+ tickers = await self.fetch_tickers_ws([symbol], params)
1177
+ ticker = self.safe_dict(tickers, symbol)
1178
+ if ticker is None:
1179
+ raise NullResponse(self.id + ' fetchTickerWs() could not find a ticker for ' + symbol)
1180
+ else:
1181
+ return ticker
1182
+ else:
1183
+ raise NotSupported(self.id + ' fetchTickerWs() is not supported yet')
1184
+
1185
+ async def watch_ticker(self, symbol: str, params={}):
1186
+ raise NotSupported(self.id + ' watchTicker() is not supported yet')
1187
+
1188
+ async def fetch_tickers(self, symbols: Strings = None, params={}):
1189
+ raise NotSupported(self.id + ' fetchTickers() is not supported yet')
1190
+
1191
+ async def fetch_mark_prices(self, symbols: Strings = None, params={}):
1192
+ raise NotSupported(self.id + ' fetchMarkPrices() is not supported yet')
1193
+
1194
+ async def fetch_tickers_ws(self, symbols: Strings = None, params={}):
1195
+ raise NotSupported(self.id + ' fetchTickers() is not supported yet')
1196
+
1197
+ async def fetch_order_books(self, symbols: Strings = None, limit: Int = None, params={}):
1198
+ raise NotSupported(self.id + ' fetchOrderBooks() is not supported yet')
1199
+
1200
+ async def watch_bids_asks(self, symbols: Strings = None, params={}):
1201
+ raise NotSupported(self.id + ' watchBidsAsks() is not supported yet')
1202
+
1203
+ async def watch_tickers(self, symbols: Strings = None, params={}):
1204
+ raise NotSupported(self.id + ' watchTickers() is not supported yet')
1205
+
1206
+ async def un_watch_tickers(self, symbols: Strings = None, params={}):
1207
+ raise NotSupported(self.id + ' unWatchTickers() is not supported yet')
1208
+
1209
+ async def fetch_order(self, id: str, symbol: Str = None, params={}):
1210
+ raise NotSupported(self.id + ' fetchOrder() is not supported yet')
1211
+
1212
+ async def fetch_order_with_client_order_id(self, clientOrderId: str, symbol: Str = None, params={}):
1213
+ """
1214
+ create a market order by providing the symbol, side and cost
1215
+ :param str clientOrderId: client order Id
1216
+ :param str symbol: unified symbol of the market to create an order in
1217
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1218
+ :returns dict: an `order structure <https://docs.ccxt.com/?id=order-structure>`
1219
+ """
1220
+ extendedParams = self.extend(params, {'clientOrderId': clientOrderId})
1221
+ return await self.fetch_order('', symbol, extendedParams)
1222
+
1223
+ async def fetch_order_ws(self, id: str, symbol: Str = None, params={}):
1224
+ raise NotSupported(self.id + ' fetchOrderWs() is not supported yet')
1225
+
1226
+ async def fetch_order_status(self, id: str, symbol: Str = None, params={}):
1227
+ # TODO: TypeScript: change method signature by replacing
1228
+ # Promise<string> with Promise<Order['status']>.
1229
+ order = await self.fetch_order(id, symbol, params)
1230
+ return order['status']
1231
+
1232
+ async def fetch_unified_order(self, order, params={}):
1233
+ return await self.fetch_order(self.safe_string(order, 'id'), self.safe_string(order, 'symbol'), params)
1234
+
1235
+ async def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
1236
+ raise NotSupported(self.id + ' createOrder() is not supported yet')
1237
+
1238
+ async def create_convert_trade(self, id: str, fromCode: str, toCode: str, amount: Num = None, params={}):
1239
+ raise NotSupported(self.id + ' createConvertTrade() is not supported yet')
1240
+
1241
+ async def fetch_convert_trade(self, id: str, code: Str = None, params={}):
1242
+ raise NotSupported(self.id + ' fetchConvertTrade() is not supported yet')
1243
+
1244
+ async def fetch_convert_trade_history(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
1245
+ raise NotSupported(self.id + ' fetchConvertTradeHistory() is not supported yet')
1246
+
1247
+ async def fetch_position_mode(self, symbol: Str = None, params={}):
1248
+ raise NotSupported(self.id + ' fetchPositionMode() is not supported yet')
1249
+
1250
+ async def create_trailing_amount_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, trailingAmount: Num = None, trailingTriggerPrice: Num = None, params={}):
1251
+ """
1252
+ create a trailing order by providing the symbol, type, side, amount, price and trailingAmount
1253
+ :param str symbol: unified symbol of the market to create an order in
1254
+ :param str type: 'market' or 'limit'
1255
+ :param str side: 'buy' or 'sell'
1256
+ :param float amount: how much you want to trade in units of the base currency, or number of contracts
1257
+ :param float [price]: the price for the order to be filled at, in units of the quote currency, ignored in market orders
1258
+ :param float trailingAmount: the quote amount to trail away from the current market price
1259
+ :param float [trailingTriggerPrice]: the price to activate a trailing order, default uses the price argument
1260
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1261
+ :returns dict: an `order structure <https://docs.ccxt.com/?id=order-structure>`
1262
+ """
1263
+ if trailingAmount is None:
1264
+ raise ArgumentsRequired(self.id + ' createTrailingAmountOrder() requires a trailingAmount argument')
1265
+ params['trailingAmount'] = trailingAmount
1266
+ if trailingTriggerPrice is not None:
1267
+ params['trailingTriggerPrice'] = trailingTriggerPrice
1268
+ if self.has['createTrailingAmountOrder']:
1269
+ return await self.create_order(symbol, type, side, amount, price, params)
1270
+ raise NotSupported(self.id + ' createTrailingAmountOrder() is not supported yet')
1271
+
1272
+ async def create_trailing_amount_order_ws(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, trailingAmount: Num = None, trailingTriggerPrice: Num = None, params={}):
1273
+ """
1274
+ create a trailing order by providing the symbol, type, side, amount, price and trailingAmount
1275
+ :param str symbol: unified symbol of the market to create an order in
1276
+ :param str type: 'market' or 'limit'
1277
+ :param str side: 'buy' or 'sell'
1278
+ :param float amount: how much you want to trade in units of the base currency, or number of contracts
1279
+ :param float [price]: the price for the order to be filled at, in units of the quote currency, ignored in market orders
1280
+ :param float trailingAmount: the quote amount to trail away from the current market price
1281
+ :param float [trailingTriggerPrice]: the price to activate a trailing order, default uses the price argument
1282
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1283
+ :returns dict: an `order structure <https://docs.ccxt.com/?id=order-structure>`
1284
+ """
1285
+ if trailingAmount is None:
1286
+ raise ArgumentsRequired(self.id + ' createTrailingAmountOrderWs() requires a trailingAmount argument')
1287
+ params['trailingAmount'] = trailingAmount
1288
+ if trailingTriggerPrice is not None:
1289
+ params['trailingTriggerPrice'] = trailingTriggerPrice
1290
+ if self.has['createTrailingAmountOrderWs']:
1291
+ return await self.create_order_ws(symbol, type, side, amount, price, params)
1292
+ raise NotSupported(self.id + ' createTrailingAmountOrderWs() is not supported yet')
1293
+
1294
+ async def create_trailing_percent_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, trailingPercent: Num = None, trailingTriggerPrice: Num = None, params={}):
1295
+ """
1296
+ create a trailing order by providing the symbol, type, side, amount, price and trailingPercent
1297
+ :param str symbol: unified symbol of the market to create an order in
1298
+ :param str type: 'market' or 'limit'
1299
+ :param str side: 'buy' or 'sell'
1300
+ :param float amount: how much you want to trade in units of the base currency, or number of contracts
1301
+ :param float [price]: the price for the order to be filled at, in units of the quote currency, ignored in market orders
1302
+ :param float trailingPercent: the percent to trail away from the current market price
1303
+ :param float [trailingTriggerPrice]: the price to activate a trailing order, default uses the price argument
1304
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1305
+ :returns dict: an `order structure <https://docs.ccxt.com/?id=order-structure>`
1306
+ """
1307
+ if trailingPercent is None:
1308
+ raise ArgumentsRequired(self.id + ' createTrailingPercentOrder() requires a trailingPercent argument')
1309
+ params['trailingPercent'] = trailingPercent
1310
+ if trailingTriggerPrice is not None:
1311
+ params['trailingTriggerPrice'] = trailingTriggerPrice
1312
+ if self.has['createTrailingPercentOrder']:
1313
+ return await self.create_order(symbol, type, side, amount, price, params)
1314
+ raise NotSupported(self.id + ' createTrailingPercentOrder() is not supported yet')
1315
+
1316
+ async def create_trailing_percent_order_ws(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, trailingPercent: Num = None, trailingTriggerPrice: Num = None, params={}):
1317
+ """
1318
+ create a trailing order by providing the symbol, type, side, amount, price and trailingPercent
1319
+ :param str symbol: unified symbol of the market to create an order in
1320
+ :param str type: 'market' or 'limit'
1321
+ :param str side: 'buy' or 'sell'
1322
+ :param float amount: how much you want to trade in units of the base currency, or number of contracts
1323
+ :param float [price]: the price for the order to be filled at, in units of the quote currency, ignored in market orders
1324
+ :param float trailingPercent: the percent to trail away from the current market price
1325
+ :param float [trailingTriggerPrice]: the price to activate a trailing order, default uses the price argument
1326
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1327
+ :returns dict: an `order structure <https://docs.ccxt.com/?id=order-structure>`
1328
+ """
1329
+ if trailingPercent is None:
1330
+ raise ArgumentsRequired(self.id + ' createTrailingPercentOrderWs() requires a trailingPercent argument')
1331
+ params['trailingPercent'] = trailingPercent
1332
+ if trailingTriggerPrice is not None:
1333
+ params['trailingTriggerPrice'] = trailingTriggerPrice
1334
+ if self.has['createTrailingPercentOrderWs']:
1335
+ return await self.create_order_ws(symbol, type, side, amount, price, params)
1336
+ raise NotSupported(self.id + ' createTrailingPercentOrderWs() is not supported yet')
1337
+
1338
+ async def create_market_order_with_cost(self, symbol: str, side: OrderSide, cost: float, params={}):
1339
+ """
1340
+ create a market order by providing the symbol, side and cost
1341
+ :param str symbol: unified symbol of the market to create an order in
1342
+ :param str side: 'buy' or 'sell'
1343
+ :param float cost: how much you want to trade in units of the quote currency
1344
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1345
+ :returns dict: an `order structure <https://docs.ccxt.com/?id=order-structure>`
1346
+ """
1347
+ if self.has['createMarketOrderWithCost'] or (self.has['createMarketBuyOrderWithCost'] and self.has['createMarketSellOrderWithCost']):
1348
+ return await self.create_order(symbol, 'market', side, cost, 1, params)
1349
+ raise NotSupported(self.id + ' createMarketOrderWithCost() is not supported yet')
1350
+
1351
+ async def create_market_buy_order_with_cost(self, symbol: str, cost: float, params={}):
1352
+ """
1353
+ create a market buy order by providing the symbol and cost
1354
+ :param str symbol: unified symbol of the market to create an order in
1355
+ :param float cost: how much you want to trade in units of the quote currency
1356
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1357
+ :returns dict: an `order structure <https://docs.ccxt.com/?id=order-structure>`
1358
+ """
1359
+ if self.options['createMarketBuyOrderRequiresPrice'] or self.has['createMarketBuyOrderWithCost']:
1360
+ return await self.create_order(symbol, 'market', 'buy', cost, 1, params)
1361
+ raise NotSupported(self.id + ' createMarketBuyOrderWithCost() is not supported yet')
1362
+
1363
+ async def create_market_sell_order_with_cost(self, symbol: str, cost: float, params={}):
1364
+ """
1365
+ create a market sell order by providing the symbol and cost
1366
+ :param str symbol: unified symbol of the market to create an order in
1367
+ :param float cost: how much you want to trade in units of the quote currency
1368
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1369
+ :returns dict: an `order structure <https://docs.ccxt.com/?id=order-structure>`
1370
+ """
1371
+ if self.options['createMarketSellOrderRequiresPrice'] or self.has['createMarketSellOrderWithCost']:
1372
+ return await self.create_order(symbol, 'market', 'sell', cost, 1, params)
1373
+ raise NotSupported(self.id + ' createMarketSellOrderWithCost() is not supported yet')
1374
+
1375
+ async def create_market_order_with_cost_ws(self, symbol: str, side: OrderSide, cost: float, params={}):
1376
+ """
1377
+ create a market order by providing the symbol, side and cost
1378
+ :param str symbol: unified symbol of the market to create an order in
1379
+ :param str side: 'buy' or 'sell'
1380
+ :param float cost: how much you want to trade in units of the quote currency
1381
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1382
+ :returns dict: an `order structure <https://docs.ccxt.com/?id=order-structure>`
1383
+ """
1384
+ if self.has['createMarketOrderWithCostWs'] or (self.has['createMarketBuyOrderWithCostWs'] and self.has['createMarketSellOrderWithCostWs']):
1385
+ return await self.create_order_ws(symbol, 'market', side, cost, 1, params)
1386
+ raise NotSupported(self.id + ' createMarketOrderWithCostWs() is not supported yet')
1387
+
1388
+ async def create_trigger_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, triggerPrice: Num = None, params={}):
1389
+ """
1390
+ create a trigger stop order(type 1)
1391
+ :param str symbol: unified symbol of the market to create an order in
1392
+ :param str type: 'market' or 'limit'
1393
+ :param str side: 'buy' or 'sell'
1394
+ :param float amount: how much you want to trade in units of the base currency or the number of contracts
1395
+ :param float [price]: the price to fulfill the order, in units of the quote currency, ignored in market orders
1396
+ :param float triggerPrice: the price to trigger the stop order, in units of the quote currency
1397
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1398
+ :returns dict: an `order structure <https://docs.ccxt.com/?id=order-structure>`
1399
+ """
1400
+ if triggerPrice is None:
1401
+ raise ArgumentsRequired(self.id + ' createTriggerOrder() requires a triggerPrice argument')
1402
+ params['triggerPrice'] = triggerPrice
1403
+ if self.has['createTriggerOrder']:
1404
+ return await self.create_order(symbol, type, side, amount, price, params)
1405
+ raise NotSupported(self.id + ' createTriggerOrder() is not supported yet')
1406
+
1407
+ async def create_trigger_order_ws(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, triggerPrice: Num = None, params={}):
1408
+ """
1409
+ create a trigger stop order(type 1)
1410
+ :param str symbol: unified symbol of the market to create an order in
1411
+ :param str type: 'market' or 'limit'
1412
+ :param str side: 'buy' or 'sell'
1413
+ :param float amount: how much you want to trade in units of the base currency or the number of contracts
1414
+ :param float [price]: the price to fulfill the order, in units of the quote currency, ignored in market orders
1415
+ :param float triggerPrice: the price to trigger the stop order, in units of the quote currency
1416
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1417
+ :returns dict: an `order structure <https://docs.ccxt.com/?id=order-structure>`
1418
+ """
1419
+ if triggerPrice is None:
1420
+ raise ArgumentsRequired(self.id + ' createTriggerOrderWs() requires a triggerPrice argument')
1421
+ params['triggerPrice'] = triggerPrice
1422
+ if self.has['createTriggerOrderWs']:
1423
+ return await self.create_order_ws(symbol, type, side, amount, price, params)
1424
+ raise NotSupported(self.id + ' createTriggerOrderWs() is not supported yet')
1425
+
1426
+ async def create_stop_loss_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, stopLossPrice: Num = None, params={}):
1427
+ """
1428
+ create a trigger stop loss order(type 2)
1429
+ :param str symbol: unified symbol of the market to create an order in
1430
+ :param str type: 'market' or 'limit'
1431
+ :param str side: 'buy' or 'sell'
1432
+ :param float amount: how much you want to trade in units of the base currency or the number of contracts
1433
+ :param float [price]: the price to fulfill the order, in units of the quote currency, ignored in market orders
1434
+ :param float stopLossPrice: the price to trigger the stop loss order, in units of the quote currency
1435
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1436
+ :returns dict: an `order structure <https://docs.ccxt.com/?id=order-structure>`
1437
+ """
1438
+ if stopLossPrice is None:
1439
+ raise ArgumentsRequired(self.id + ' createStopLossOrder() requires a stopLossPrice argument')
1440
+ params['stopLossPrice'] = stopLossPrice
1441
+ if self.has['createStopLossOrder']:
1442
+ return await self.create_order(symbol, type, side, amount, price, params)
1443
+ raise NotSupported(self.id + ' createStopLossOrder() is not supported yet')
1444
+
1445
+ async def create_stop_loss_order_ws(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, stopLossPrice: Num = None, params={}):
1446
+ """
1447
+ create a trigger stop loss order(type 2)
1448
+ :param str symbol: unified symbol of the market to create an order in
1449
+ :param str type: 'market' or 'limit'
1450
+ :param str side: 'buy' or 'sell'
1451
+ :param float amount: how much you want to trade in units of the base currency or the number of contracts
1452
+ :param float [price]: the price to fulfill the order, in units of the quote currency, ignored in market orders
1453
+ :param float stopLossPrice: the price to trigger the stop loss order, in units of the quote currency
1454
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1455
+ :returns dict: an `order structure <https://docs.ccxt.com/?id=order-structure>`
1456
+ """
1457
+ if stopLossPrice is None:
1458
+ raise ArgumentsRequired(self.id + ' createStopLossOrderWs() requires a stopLossPrice argument')
1459
+ params['stopLossPrice'] = stopLossPrice
1460
+ if self.has['createStopLossOrderWs']:
1461
+ return await self.create_order_ws(symbol, type, side, amount, price, params)
1462
+ raise NotSupported(self.id + ' createStopLossOrderWs() is not supported yet')
1463
+
1464
+ async def create_take_profit_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, takeProfitPrice: Num = None, params={}):
1465
+ """
1466
+ create a trigger take profit order(type 2)
1467
+ :param str symbol: unified symbol of the market to create an order in
1468
+ :param str type: 'market' or 'limit'
1469
+ :param str side: 'buy' or 'sell'
1470
+ :param float amount: how much you want to trade in units of the base currency or the number of contracts
1471
+ :param float [price]: the price to fulfill the order, in units of the quote currency, ignored in market orders
1472
+ :param float takeProfitPrice: the price to trigger the take profit order, in units of the quote currency
1473
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1474
+ :returns dict: an `order structure <https://docs.ccxt.com/?id=order-structure>`
1475
+ """
1476
+ if takeProfitPrice is None:
1477
+ raise ArgumentsRequired(self.id + ' createTakeProfitOrder() requires a takeProfitPrice argument')
1478
+ params['takeProfitPrice'] = takeProfitPrice
1479
+ if self.has['createTakeProfitOrder']:
1480
+ return await self.create_order(symbol, type, side, amount, price, params)
1481
+ raise NotSupported(self.id + ' createTakeProfitOrder() is not supported yet')
1482
+
1483
+ async def create_take_profit_order_ws(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, takeProfitPrice: Num = None, params={}):
1484
+ """
1485
+ create a trigger take profit order(type 2)
1486
+ :param str symbol: unified symbol of the market to create an order in
1487
+ :param str type: 'market' or 'limit'
1488
+ :param str side: 'buy' or 'sell'
1489
+ :param float amount: how much you want to trade in units of the base currency or the number of contracts
1490
+ :param float [price]: the price to fulfill the order, in units of the quote currency, ignored in market orders
1491
+ :param float takeProfitPrice: the price to trigger the take profit order, in units of the quote currency
1492
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1493
+ :returns dict: an `order structure <https://docs.ccxt.com/?id=order-structure>`
1494
+ """
1495
+ if takeProfitPrice is None:
1496
+ raise ArgumentsRequired(self.id + ' createTakeProfitOrderWs() requires a takeProfitPrice argument')
1497
+ params['takeProfitPrice'] = takeProfitPrice
1498
+ if self.has['createTakeProfitOrderWs']:
1499
+ return await self.create_order_ws(symbol, type, side, amount, price, params)
1500
+ raise NotSupported(self.id + ' createTakeProfitOrderWs() is not supported yet')
1501
+
1502
+ async def create_order_with_take_profit_and_stop_loss(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, takeProfit: Num = None, stopLoss: Num = None, params={}):
1503
+ """
1504
+ create an order with a stop loss or take profit attached(type 3)
1505
+ :param str symbol: unified symbol of the market to create an order in
1506
+ :param str type: 'market' or 'limit'
1507
+ :param str side: 'buy' or 'sell'
1508
+ :param float amount: how much you want to trade in units of the base currency or the number of contracts
1509
+ :param float [price]: the price to fulfill the order, in units of the quote currency, ignored in market orders
1510
+ :param float [takeProfit]: the take profit price, in units of the quote currency
1511
+ :param float [stopLoss]: the stop loss price, in units of the quote currency
1512
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1513
+ :param str [params.takeProfitType]: *not available on all exchanges* 'limit' or 'market'
1514
+ :param str [params.stopLossType]: *not available on all exchanges* 'limit' or 'market'
1515
+ :param str [params.takeProfitPriceType]: *not available on all exchanges* 'last', 'mark' or 'index'
1516
+ :param str [params.stopLossPriceType]: *not available on all exchanges* 'last', 'mark' or 'index'
1517
+ :param float [params.takeProfitLimitPrice]: *not available on all exchanges* limit price for a limit take profit order
1518
+ :param float [params.stopLossLimitPrice]: *not available on all exchanges* stop loss for a limit stop loss order
1519
+ :param float [params.takeProfitAmount]: *not available on all exchanges* the amount for a take profit
1520
+ :param float [params.stopLossAmount]: *not available on all exchanges* the amount for a stop loss
1521
+ :returns dict: an `order structure <https://docs.ccxt.com/?id=order-structure>`
1522
+ """
1523
+ params = self.set_take_profit_and_stop_loss_params(symbol, type, side, amount, price, takeProfit, stopLoss, params)
1524
+ if self.has['createOrderWithTakeProfitAndStopLoss']:
1525
+ return await self.create_order(symbol, type, side, amount, price, params)
1526
+ raise NotSupported(self.id + ' createOrderWithTakeProfitAndStopLoss() is not supported yet')
1527
+
1528
+ async def create_order_with_take_profit_and_stop_loss_ws(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, takeProfit: Num = None, stopLoss: Num = None, params={}):
1529
+ """
1530
+ create an order with a stop loss or take profit attached(type 3)
1531
+ :param str symbol: unified symbol of the market to create an order in
1532
+ :param str type: 'market' or 'limit'
1533
+ :param str side: 'buy' or 'sell'
1534
+ :param float amount: how much you want to trade in units of the base currency or the number of contracts
1535
+ :param float [price]: the price to fulfill the order, in units of the quote currency, ignored in market orders
1536
+ :param float [takeProfit]: the take profit price, in units of the quote currency
1537
+ :param float [stopLoss]: the stop loss price, in units of the quote currency
1538
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1539
+ :param str [params.takeProfitType]: *not available on all exchanges* 'limit' or 'market'
1540
+ :param str [params.stopLossType]: *not available on all exchanges* 'limit' or 'market'
1541
+ :param str [params.takeProfitPriceType]: *not available on all exchanges* 'last', 'mark' or 'index'
1542
+ :param str [params.stopLossPriceType]: *not available on all exchanges* 'last', 'mark' or 'index'
1543
+ :param float [params.takeProfitLimitPrice]: *not available on all exchanges* limit price for a limit take profit order
1544
+ :param float [params.stopLossLimitPrice]: *not available on all exchanges* stop loss for a limit stop loss order
1545
+ :param float [params.takeProfitAmount]: *not available on all exchanges* the amount for a take profit
1546
+ :param float [params.stopLossAmount]: *not available on all exchanges* the amount for a stop loss
1547
+ :returns dict: an `order structure <https://docs.ccxt.com/?id=order-structure>`
1548
+ """
1549
+ params = self.set_take_profit_and_stop_loss_params(symbol, type, side, amount, price, takeProfit, stopLoss, params)
1550
+ if self.has['createOrderWithTakeProfitAndStopLossWs']:
1551
+ return await self.create_order_ws(symbol, type, side, amount, price, params)
1552
+ raise NotSupported(self.id + ' createOrderWithTakeProfitAndStopLossWs() is not supported yet')
1553
+
1554
+ async def create_orders(self, orders: List[OrderRequest], params={}):
1555
+ raise NotSupported(self.id + ' createOrders() is not supported yet')
1556
+
1557
+ async def edit_orders(self, orders: List[OrderRequest], params={}):
1558
+ raise NotSupported(self.id + ' editOrders() is not supported yet')
1559
+
1560
+ async def create_order_ws(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
1561
+ raise NotSupported(self.id + ' createOrderWs() is not supported yet')
1562
+
1563
+ async def cancel_order(self, id: str, symbol: Str = None, params={}):
1564
+ raise NotSupported(self.id + ' cancelOrder() is not supported yet')
1565
+
1566
+ async def cancel_order_with_client_order_id(self, clientOrderId: str, symbol: Str = None, params={}):
1567
+ """
1568
+ create a market order by providing the symbol, side and cost
1569
+ :param str clientOrderId: client order Id
1570
+ :param str symbol: unified symbol of the market to create an order in
1571
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1572
+ :returns dict: an `order structure <https://docs.ccxt.com/?id=order-structure>`
1573
+ """
1574
+ extendedParams = self.extend(params, {'clientOrderId': clientOrderId})
1575
+ return await self.cancel_order('', symbol, extendedParams)
1576
+
1577
+ async def cancel_order_ws(self, id: str, symbol: Str = None, params={}):
1578
+ raise NotSupported(self.id + ' cancelOrderWs() is not supported yet')
1579
+
1580
+ async def cancel_orders(self, ids: List[str], symbol: Str = None, params={}):
1581
+ raise NotSupported(self.id + ' cancelOrders() is not supported yet')
1582
+
1583
+ async def cancel_orders_with_client_order_ids(self, clientOrderIds: List[str], symbol: Str = None, params={}):
1584
+ """
1585
+ create a market order by providing the symbol, side and cost
1586
+ :param str[] clientOrderIds: client order Ids
1587
+ :param str symbol: unified symbol of the market to create an order in
1588
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1589
+ :returns dict: an `order structure <https://docs.ccxt.com/?id=order-structure>`
1590
+ """
1591
+ extendedParams = self.extend(params, {'clientOrderIds': clientOrderIds})
1592
+ return await self.cancel_orders([], symbol, extendedParams)
1593
+
1594
+ async def cancel_orders_ws(self, ids: List[str], symbol: Str = None, params={}):
1595
+ raise NotSupported(self.id + ' cancelOrdersWs() is not supported yet')
1596
+
1597
+ async def cancel_all_orders(self, symbol: Str = None, params={}):
1598
+ raise NotSupported(self.id + ' cancelAllOrders() is not supported yet')
1599
+
1600
+ async def cancel_all_orders_after(self, timeout: Int, params={}):
1601
+ raise NotSupported(self.id + ' cancelAllOrdersAfter() is not supported yet')
1602
+
1603
+ async def cancel_orders_for_symbols(self, orders: List[CancellationRequest], params={}):
1604
+ raise NotSupported(self.id + ' cancelOrdersForSymbols() is not supported yet')
1605
+
1606
+ async def cancel_all_orders_ws(self, symbol: Str = None, params={}):
1607
+ raise NotSupported(self.id + ' cancelAllOrdersWs() is not supported yet')
1608
+
1609
+ async def cancel_unified_order(self, order: Order, params={}):
1610
+ return self.cancel_order(self.safe_string(order, 'id'), self.safe_string(order, 'symbol'), params)
1611
+
1612
+ async def fetch_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
1613
+ if self.has['fetchOpenOrders'] and self.has['fetchClosedOrders']:
1614
+ raise NotSupported(self.id + ' fetchOrders() is not supported yet, consider using fetchOpenOrders() and fetchClosedOrders() instead')
1615
+ raise NotSupported(self.id + ' fetchOrders() is not supported yet')
1616
+
1617
+ async def fetch_orders_ws(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
1618
+ raise NotSupported(self.id + ' fetchOrdersWs() is not supported yet')
1619
+
1620
+ async def fetch_order_trades(self, id: str, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
1621
+ raise NotSupported(self.id + ' fetchOrderTrades() is not supported yet')
1622
+
1623
+ async def watch_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
1624
+ raise NotSupported(self.id + ' watchOrders() is not supported yet')
1625
+
1626
+ async def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
1627
+ if self.has['fetchOrders']:
1628
+ orders = await self.fetch_orders(symbol, since, limit, params)
1629
+ return self.filter_by(orders, 'status', 'open')
1630
+ raise NotSupported(self.id + ' fetchOpenOrders() is not supported yet')
1631
+
1632
+ async def fetch_open_orders_ws(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
1633
+ if self.has['fetchOrdersWs']:
1634
+ orders = await self.fetch_orders_ws(symbol, since, limit, params)
1635
+ return self.filter_by(orders, 'status', 'open')
1636
+ raise NotSupported(self.id + ' fetchOpenOrdersWs() is not supported yet')
1637
+
1638
+ async def fetch_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
1639
+ if self.has['fetchOrders']:
1640
+ orders = await self.fetch_orders(symbol, since, limit, params)
1641
+ return self.filter_by(orders, 'status', 'closed')
1642
+ raise NotSupported(self.id + ' fetchClosedOrders() is not supported yet')
1643
+
1644
+ async def fetch_canceled_and_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
1645
+ raise NotSupported(self.id + ' fetchCanceledAndClosedOrders() is not supported yet')
1646
+
1647
+ async def fetch_closed_orders_ws(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
1648
+ if self.has['fetchOrdersWs']:
1649
+ orders = await self.fetch_orders_ws(symbol, since, limit, params)
1650
+ return self.filter_by(orders, 'status', 'closed')
1651
+ raise NotSupported(self.id + ' fetchClosedOrdersWs() is not supported yet')
1652
+
1653
+ async def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
1654
+ raise NotSupported(self.id + ' fetchMyTrades() is not supported yet')
1655
+
1656
+ async def fetch_my_liquidations(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
1657
+ raise NotSupported(self.id + ' fetchMyLiquidations() is not supported yet')
1658
+
1659
+ async def fetch_liquidations(self, symbol: str, since: Int = None, limit: Int = None, params={}):
1660
+ raise NotSupported(self.id + ' fetchLiquidations() is not supported yet')
1661
+
1662
+ async def fetch_my_trades_ws(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
1663
+ raise NotSupported(self.id + ' fetchMyTradesWs() is not supported yet')
1664
+
1665
+ async def watch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
1666
+ raise NotSupported(self.id + ' watchMyTrades() is not supported yet')
1667
+
1668
+ async def fetch_greeks(self, symbol: str, params={}):
1669
+ raise NotSupported(self.id + ' fetchGreeks() is not supported yet')
1670
+
1671
+ async def fetch_all_greeks(self, symbols: Strings = None, params={}):
1672
+ raise NotSupported(self.id + ' fetchAllGreeks() is not supported yet')
1673
+
1674
+ async def fetch_option_chain(self, code: str, params={}):
1675
+ raise NotSupported(self.id + ' fetchOptionChain() is not supported yet')
1676
+
1677
+ async def fetch_option(self, symbol: str, params={}):
1678
+ raise NotSupported(self.id + ' fetchOption() is not supported yet')
1679
+
1680
+ async def fetch_convert_quote(self, fromCode: str, toCode: str, amount: Num = None, params={}):
1681
+ raise NotSupported(self.id + ' fetchConvertQuote() is not supported yet')
1682
+
1683
+ async def fetch_deposits_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
1684
+ """
1685
+ fetch history of deposits and withdrawals
1686
+ :param str [code]: unified currency code for the currency of the deposit/withdrawals, default is None
1687
+ :param int [since]: timestamp in ms of the earliest deposit/withdrawal, default is None
1688
+ :param int [limit]: max number of deposit/withdrawals to return, default is None
1689
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1690
+ :returns dict: a list of `transaction structures <https://docs.ccxt.com/?id=transaction-structure>`
1691
+ """
1692
+ raise NotSupported(self.id + ' fetchDepositsWithdrawals() is not supported yet')
1693
+
1694
+ async def fetch_deposits(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
1695
+ raise NotSupported(self.id + ' fetchDeposits() is not supported yet')
1696
+
1697
+ async def fetch_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
1698
+ raise NotSupported(self.id + ' fetchWithdrawals() is not supported yet')
1699
+
1700
+ async def fetch_deposits_ws(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
1701
+ raise NotSupported(self.id + ' fetchDepositsWs() is not supported yet')
1702
+
1703
+ async def fetch_withdrawals_ws(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
1704
+ raise NotSupported(self.id + ' fetchWithdrawalsWs() is not supported yet')
1705
+
1706
+ async def fetch_funding_rate_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
1707
+ raise NotSupported(self.id + ' fetchFundingRateHistory() is not supported yet')
1708
+
1709
+ async def fetch_funding_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
1710
+ raise NotSupported(self.id + ' fetchFundingHistory() is not supported yet')
1711
+
1712
+ async def close_position(self, symbol: str, side: OrderSide = None, params={}):
1713
+ raise NotSupported(self.id + ' closePosition() is not supported yet')
1714
+
1715
+ async def close_all_positions(self, params={}):
1716
+ raise NotSupported(self.id + ' closeAllPositions() is not supported yet')
1717
+
1718
+ async def fetch_l3_order_book(self, symbol: str, limit: Int = None, params={}):
1719
+ raise BadRequest(self.id + ' fetchL3OrderBook() is not supported yet')
1720
+
1721
+ async def fetch_deposit_address(self, code: str, params={}):
1722
+ if self.has['fetchDepositAddresses']:
1723
+ depositAddresses = await self.fetch_deposit_addresses([code], params)
1724
+ depositAddress = self.safe_value(depositAddresses, code)
1725
+ if depositAddress is None:
1726
+ raise InvalidAddress(self.id + ' fetchDepositAddress() could not find a deposit address for ' + code + ', make sure you have created a corresponding deposit address in your wallet on the exchange website')
1727
+ else:
1728
+ return depositAddress
1729
+ elif self.has['fetchDepositAddressesByNetwork']:
1730
+ network = self.safe_string(params, 'network')
1731
+ params = self.omit(params, 'network')
1732
+ addressStructures = await self.fetch_deposit_addresses_by_network(code, params)
1733
+ if network is not None:
1734
+ return self.safe_dict(addressStructures, network)
1735
+ else:
1736
+ keys = list(addressStructures.keys())
1737
+ key = self.safe_string(keys, 0)
1738
+ return self.safe_dict(addressStructures, key)
1739
+ else:
1740
+ raise NotSupported(self.id + ' fetchDepositAddress() is not supported yet')
1741
+
1742
+ async def create_limit_order(self, symbol: str, side: OrderSide, amount: float, price: float, params={}):
1743
+ return await self.create_order(symbol, 'limit', side, amount, price, params)
1744
+
1745
+ async def create_limit_order_ws(self, symbol: str, side: OrderSide, amount: float, price: float, params={}):
1746
+ return await self.create_order_ws(symbol, 'limit', side, amount, price, params)
1747
+
1748
+ async def create_market_order(self, symbol: str, side: OrderSide, amount: float, price: Num = None, params={}):
1749
+ return await self.create_order(symbol, 'market', side, amount, price, params)
1750
+
1751
+ async def create_market_order_ws(self, symbol: str, side: OrderSide, amount: float, price: Num = None, params={}):
1752
+ return await self.create_order_ws(symbol, 'market', side, amount, price, params)
1753
+
1754
+ async def create_limit_buy_order(self, symbol: str, amount: float, price: float, params={}):
1755
+ return await self.create_order(symbol, 'limit', 'buy', amount, price, params)
1756
+
1757
+ async def create_limit_buy_order_ws(self, symbol: str, amount: float, price: float, params={}):
1758
+ return await self.create_order_ws(symbol, 'limit', 'buy', amount, price, params)
1759
+
1760
+ async def create_limit_sell_order(self, symbol: str, amount: float, price: float, params={}):
1761
+ return await self.create_order(symbol, 'limit', 'sell', amount, price, params)
1762
+
1763
+ async def create_limit_sell_order_ws(self, symbol: str, amount: float, price: float, params={}):
1764
+ return await self.create_order_ws(symbol, 'limit', 'sell', amount, price, params)
1765
+
1766
+ async def create_market_buy_order(self, symbol: str, amount: float, params={}):
1767
+ return await self.create_order(symbol, 'market', 'buy', amount, None, params)
1768
+
1769
+ async def create_market_buy_order_ws(self, symbol: str, amount: float, params={}):
1770
+ return await self.create_order_ws(symbol, 'market', 'buy', amount, None, params)
1771
+
1772
+ async def create_market_sell_order(self, symbol: str, amount: float, params={}):
1773
+ return await self.create_order(symbol, 'market', 'sell', amount, None, params)
1774
+
1775
+ async def create_market_sell_order_ws(self, symbol: str, amount: float, params={}):
1776
+ return await self.create_order_ws(symbol, 'market', 'sell', amount, None, params)
1777
+
1778
+ async def load_time_difference(self, params={}):
1779
+ serverTime = await self.fetch_time(params)
1780
+ after = self.milliseconds()
1781
+ self.options['timeDifference'] = after - serverTime
1782
+ return self.options['timeDifference']
1783
+
1784
+ async def fetch_market_leverage_tiers(self, symbol: str, params={}):
1785
+ if self.has['fetchLeverageTiers']:
1786
+ market = self.market(symbol)
1787
+ if not market['contract']:
1788
+ raise BadSymbol(self.id + ' fetchMarketLeverageTiers() supports contract markets only')
1789
+ tiers = await self.fetch_leverage_tiers([symbol])
1790
+ return self.safe_value(tiers, symbol)
1791
+ else:
1792
+ raise NotSupported(self.id + ' fetchMarketLeverageTiers() is not supported yet')
1793
+
1794
+ async def create_post_only_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
1795
+ if not self.has['createPostOnlyOrder']:
1796
+ raise NotSupported(self.id + ' createPostOnlyOrder() is not supported yet')
1797
+ query = self.extend(params, {'postOnly': True})
1798
+ return await self.create_order(symbol, type, side, amount, price, query)
1799
+
1800
+ async def create_post_only_order_ws(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
1801
+ if not self.has['createPostOnlyOrderWs']:
1802
+ raise NotSupported(self.id + ' createPostOnlyOrderWs() is not supported yet')
1803
+ query = self.extend(params, {'postOnly': True})
1804
+ return await self.create_order_ws(symbol, type, side, amount, price, query)
1805
+
1806
+ async def create_reduce_only_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
1807
+ if not self.has['createReduceOnlyOrder']:
1808
+ raise NotSupported(self.id + ' createReduceOnlyOrder() is not supported yet')
1809
+ query = self.extend(params, {'reduceOnly': True})
1810
+ return await self.create_order(symbol, type, side, amount, price, query)
1811
+
1812
+ async def create_reduce_only_order_ws(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
1813
+ if not self.has['createReduceOnlyOrderWs']:
1814
+ raise NotSupported(self.id + ' createReduceOnlyOrderWs() is not supported yet')
1815
+ query = self.extend(params, {'reduceOnly': True})
1816
+ return await self.create_order_ws(symbol, type, side, amount, price, query)
1817
+
1818
+ async def create_stop_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, triggerPrice: Num = None, params={}):
1819
+ if not self.has['createStopOrder']:
1820
+ raise NotSupported(self.id + ' createStopOrder() is not supported yet')
1821
+ if triggerPrice is None:
1822
+ raise ArgumentsRequired(self.id + ' create_stop_order() requires a stopPrice argument')
1823
+ query = self.extend(params, {'stopPrice': triggerPrice})
1824
+ return await self.create_order(symbol, type, side, amount, price, query)
1825
+
1826
+ async def create_stop_order_ws(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, triggerPrice: Num = None, params={}):
1827
+ if not self.has['createStopOrderWs']:
1828
+ raise NotSupported(self.id + ' createStopOrderWs() is not supported yet')
1829
+ if triggerPrice is None:
1830
+ raise ArgumentsRequired(self.id + ' createStopOrderWs() requires a stopPrice argument')
1831
+ query = self.extend(params, {'stopPrice': triggerPrice})
1832
+ return await self.create_order_ws(symbol, type, side, amount, price, query)
1833
+
1834
+ async def create_stop_limit_order(self, symbol: str, side: OrderSide, amount: float, price: float, triggerPrice: float, params={}):
1835
+ if not self.has['createStopLimitOrder']:
1836
+ raise NotSupported(self.id + ' createStopLimitOrder() is not supported yet')
1837
+ query = self.extend(params, {'stopPrice': triggerPrice})
1838
+ return await self.create_order(symbol, 'limit', side, amount, price, query)
1839
+
1840
+ async def create_stop_limit_order_ws(self, symbol: str, side: OrderSide, amount: float, price: float, triggerPrice: float, params={}):
1841
+ if not self.has['createStopLimitOrderWs']:
1842
+ raise NotSupported(self.id + ' createStopLimitOrderWs() is not supported yet')
1843
+ query = self.extend(params, {'stopPrice': triggerPrice})
1844
+ return await self.create_order_ws(symbol, 'limit', side, amount, price, query)
1845
+
1846
+ async def create_stop_market_order(self, symbol: str, side: OrderSide, amount: float, triggerPrice: float, params={}):
1847
+ if not self.has['createStopMarketOrder']:
1848
+ raise NotSupported(self.id + ' createStopMarketOrder() is not supported yet')
1849
+ query = self.extend(params, {'stopPrice': triggerPrice})
1850
+ return await self.create_order(symbol, 'market', side, amount, None, query)
1851
+
1852
+ async def create_stop_market_order_ws(self, symbol: str, side: OrderSide, amount: float, triggerPrice: float, params={}):
1853
+ if not self.has['createStopMarketOrderWs']:
1854
+ raise NotSupported(self.id + ' createStopMarketOrderWs() is not supported yet')
1855
+ query = self.extend(params, {'stopPrice': triggerPrice})
1856
+ return await self.create_order_ws(symbol, 'market', side, amount, None, query)
1857
+
1858
+ async def create_sub_account(self, name: str, params={}):
1859
+ raise NotSupported(self.id + ' createSubAccount() is not supported yet')
1860
+
1861
+ async def fetch_last_prices(self, symbols: Strings = None, params={}):
1862
+ raise NotSupported(self.id + ' fetchLastPrices() is not supported yet')
1863
+
1864
+ async def fetch_trading_fees(self, params={}):
1865
+ raise NotSupported(self.id + ' fetchTradingFees() is not supported yet')
1866
+
1867
+ async def fetch_trading_fees_ws(self, params={}):
1868
+ raise NotSupported(self.id + ' fetchTradingFeesWs() is not supported yet')
1869
+
1870
+ async def fetch_trading_fee(self, symbol: str, params={}):
1871
+ if not self.has['fetchTradingFees']:
1872
+ raise NotSupported(self.id + ' fetchTradingFee() is not supported yet')
1873
+ fees = await self.fetch_trading_fees(params)
1874
+ return self.safe_dict(fees, symbol)
1875
+
1876
+ async def fetch_convert_currencies(self, params={}):
1877
+ raise NotSupported(self.id + ' fetchConvertCurrencies() is not supported yet')
1878
+
1879
+ async def fetch_funding_rate(self, symbol: str, params={}):
1880
+ if self.has['fetchFundingRates']:
1881
+ await self.load_markets()
1882
+ market = self.market(symbol)
1883
+ symbol = market['symbol']
1884
+ if not market['contract']:
1885
+ raise BadSymbol(self.id + ' fetchFundingRate() supports contract markets only')
1886
+ rates = await self.fetch_funding_rates([symbol], params)
1887
+ rate = self.safe_value(rates, symbol)
1888
+ if rate is None:
1889
+ raise NullResponse(self.id + ' fetchFundingRate() returned no data for ' + symbol)
1890
+ else:
1891
+ return rate
1892
+ else:
1893
+ raise NotSupported(self.id + ' fetchFundingRate() is not supported yet')
1894
+
1895
+ async def fetch_funding_interval(self, symbol: str, params={}):
1896
+ if self.has['fetchFundingIntervals']:
1897
+ await self.load_markets()
1898
+ market = self.market(symbol)
1899
+ symbol = market['symbol']
1900
+ if not market['contract']:
1901
+ raise BadSymbol(self.id + ' fetchFundingInterval() supports contract markets only')
1902
+ rates = await self.fetch_funding_intervals([symbol], params)
1903
+ rate = self.safe_value(rates, symbol)
1904
+ if rate is None:
1905
+ raise NullResponse(self.id + ' fetchFundingInterval() returned no data for ' + symbol)
1906
+ else:
1907
+ return rate
1908
+ else:
1909
+ raise NotSupported(self.id + ' fetchFundingInterval() is not supported yet')
1910
+
1911
+ async def fetch_mark_ohlcv(self, symbol: str, timeframe: str = '1m', since: Int = None, limit: Int = None, params={}):
1912
+ """
1913
+ fetches historical mark price candlestick data containing the open, high, low, and close price of a market
1914
+ :param str symbol: unified symbol of the market to fetch OHLCV data for
1915
+ :param str timeframe: the length of time each candle represents
1916
+ :param int [since]: timestamp in ms of the earliest candle to fetch
1917
+ :param int [limit]: the maximum amount of candles to fetch
1918
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1919
+ :returns float[][]: A list of candles ordered, open, high, low, close, None
1920
+ """
1921
+ if self.has['fetchMarkOHLCV']:
1922
+ request: dict = {
1923
+ 'price': 'mark',
1924
+ }
1925
+ return await self.fetch_ohlcv(symbol, timeframe, since, limit, self.extend(request, params))
1926
+ else:
1927
+ raise NotSupported(self.id + ' fetchMarkOHLCV() is not supported yet')
1928
+
1929
+ async def fetch_index_ohlcv(self, symbol: str, timeframe: str = '1m', since: Int = None, limit: Int = None, params={}):
1930
+ """
1931
+ fetches historical index price candlestick data containing the open, high, low, and close price of a market
1932
+ :param str symbol: unified symbol of the market to fetch OHLCV data for
1933
+ :param str timeframe: the length of time each candle represents
1934
+ :param int [since]: timestamp in ms of the earliest candle to fetch
1935
+ :param int [limit]: the maximum amount of candles to fetch
1936
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1937
+ @returns {} A list of candles ordered, open, high, low, close, None
1938
+ """
1939
+ if self.has['fetchIndexOHLCV']:
1940
+ request: dict = {
1941
+ 'price': 'index',
1942
+ }
1943
+ return await self.fetch_ohlcv(symbol, timeframe, since, limit, self.extend(request, params))
1944
+ else:
1945
+ raise NotSupported(self.id + ' fetchIndexOHLCV() is not supported yet')
1946
+
1947
+ async def fetch_premium_index_ohlcv(self, symbol: str, timeframe: str = '1m', since: Int = None, limit: Int = None, params={}):
1948
+ """
1949
+ fetches historical premium index price candlestick data containing the open, high, low, and close price of a market
1950
+ :param str symbol: unified symbol of the market to fetch OHLCV data for
1951
+ :param str timeframe: the length of time each candle represents
1952
+ :param int [since]: timestamp in ms of the earliest candle to fetch
1953
+ :param int [limit]: the maximum amount of candles to fetch
1954
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1955
+ :returns float[][]: A list of candles ordered, open, high, low, close, None
1956
+ """
1957
+ if self.has['fetchPremiumIndexOHLCV']:
1958
+ request: dict = {
1959
+ 'price': 'premiumIndex',
1960
+ }
1961
+ return await self.fetch_ohlcv(symbol, timeframe, since, limit, self.extend(request, params))
1962
+ else:
1963
+ raise NotSupported(self.id + ' fetchPremiumIndexOHLCV() is not supported yet')
1964
+
1965
+ async def fetch_transactions(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
1966
+ """
1967
+ @deprecated
1968
+ *DEPRECATED* use fetchDepositsWithdrawals instead
1969
+ :param str code: unified currency code for the currency of the deposit/withdrawals, default is None
1970
+ :param int [since]: timestamp in ms of the earliest deposit/withdrawal, default is None
1971
+ :param int [limit]: max number of deposit/withdrawals to return, default is None
1972
+ :param dict [params]: extra parameters specific to the exchange API endpoint
1973
+ :returns dict: a list of `transaction structures <https://docs.ccxt.com/?id=transaction-structure>`
1974
+ """
1975
+ if self.has['fetchDepositsWithdrawals']:
1976
+ return await self.fetch_deposits_withdrawals(code, since, limit, params)
1977
+ else:
1978
+ raise NotSupported(self.id + ' fetchTransactions() is not supported yet')
1979
+
1980
+ async def fetch_paginated_call_dynamic(self, method: str, symbol: Str = None, since: Int = None, limit: Int = None, params={}, maxEntriesPerRequest: Int = None, removeRepeated=True):
1981
+ maxCalls = None
1982
+ maxCalls, params = self.handle_option_and_params(params, method, 'paginationCalls', 10)
1983
+ maxRetries = None
1984
+ maxRetries, params = self.handle_option_and_params(params, method, 'maxRetries', 3)
1985
+ paginationDirection = None
1986
+ paginationDirection, params = self.handle_option_and_params(params, method, 'paginationDirection', 'backward')
1987
+ paginationTimestamp = None
1988
+ removeRepeatedOption = removeRepeated
1989
+ removeRepeatedOption, params = self.handle_option_and_params(params, method, 'removeRepeated', removeRepeated)
1990
+ calls = 0
1991
+ result = []
1992
+ errors = 0
1993
+ until = self.safe_integer_n(params, ['until', 'untill', 'till']) # do not omit it from params here
1994
+ maxEntriesPerRequest, params = self.handle_max_entries_per_request_and_params(method, maxEntriesPerRequest, params)
1995
+ if (paginationDirection == 'forward'):
1996
+ if since is None:
1997
+ raise ArgumentsRequired(self.id + ' pagination requires a since argument when paginationDirection set to forward')
1998
+ paginationTimestamp = since
1999
+ while((calls < maxCalls)):
2000
+ calls += 1
2001
+ try:
2002
+ if paginationDirection == 'backward':
2003
+ # do it backwards, starting from the last
2004
+ # UNTIL filtering is required in order to work
2005
+ if paginationTimestamp is not None:
2006
+ params['until'] = paginationTimestamp - 1
2007
+ response = await getattr(self, method)(symbol, None, maxEntriesPerRequest, params)
2008
+ responseLength = len(response)
2009
+ if self.verbose:
2010
+ backwardMessage = 'Dynamic pagination call ' + self.number_to_string(calls) + ' method ' + method + ' response length ' + self.number_to_string(responseLength)
2011
+ if paginationTimestamp is not None:
2012
+ backwardMessage += ' timestamp ' + self.number_to_string(paginationTimestamp)
2013
+ self.log(backwardMessage)
2014
+ if responseLength == 0:
2015
+ break
2016
+ errors = 0
2017
+ result = self.array_concat(result, response)
2018
+ firstElement = self.safe_value(response, 0)
2019
+ paginationTimestamp = self.safe_integer_2(firstElement, 'timestamp', 0)
2020
+ if (since is not None) and (paginationTimestamp <= since):
2021
+ break
2022
+ else:
2023
+ # do it forwards, starting from the since
2024
+ response = await getattr(self, method)(symbol, paginationTimestamp, maxEntriesPerRequest, params)
2025
+ responseLength = len(response)
2026
+ if self.verbose:
2027
+ forwardMessage = 'Dynamic pagination call ' + self.number_to_string(calls) + ' method ' + method + ' response length ' + self.number_to_string(responseLength)
2028
+ if paginationTimestamp is not None:
2029
+ forwardMessage += ' timestamp ' + self.number_to_string(paginationTimestamp)
2030
+ self.log(forwardMessage)
2031
+ if responseLength == 0:
2032
+ break
2033
+ errors = 0
2034
+ result = self.array_concat(result, response)
2035
+ last = self.safe_value(response, responseLength - 1)
2036
+ paginationTimestamp = self.safe_integer(last, 'timestamp') + 1
2037
+ if (until is not None) and (paginationTimestamp >= until):
2038
+ break
2039
+ except Exception as e:
2040
+ errors += 1
2041
+ if errors > maxRetries:
2042
+ raise e
2043
+ uniqueResults = result
2044
+ if removeRepeatedOption:
2045
+ uniqueResults = self.remove_repeated_elements_from_array(result)
2046
+ key = 0 if (method == 'fetchOHLCV') else 'timestamp'
2047
+ return self.filter_by_since_limit(uniqueResults, since, limit, key)
2048
+
2049
+ async def safe_deterministic_call(self, method: str, symbol: Str = None, since: Int = None, limit: Int = None, timeframe: Str = None, params={}):
2050
+ maxRetries = None
2051
+ maxRetries, params = self.handle_option_and_params(params, method, 'maxRetries', 3)
2052
+ errors = 0
2053
+ while(errors <= maxRetries):
2054
+ try:
2055
+ if timeframe and method != 'fetchFundingRateHistory':
2056
+ return await getattr(self, method)(symbol, timeframe, since, limit, params)
2057
+ else:
2058
+ return await getattr(self, method)(symbol, since, limit, params)
2059
+ except Exception as e:
2060
+ if isinstance(e, RateLimitExceeded):
2061
+ raise e # if we are rate limited, we should not retry and fail fast
2062
+ errors += 1
2063
+ if errors > maxRetries:
2064
+ raise e
2065
+ return []
2066
+
2067
+ async def fetch_paginated_call_deterministic(self, method: str, symbol: Str = None, since: Int = None, limit: Int = None, timeframe: Str = None, params={}, maxEntriesPerRequest=None):
2068
+ maxCalls = None
2069
+ maxCalls, params = self.handle_option_and_params(params, method, 'paginationCalls', 10)
2070
+ maxEntriesPerRequest, params = self.handle_max_entries_per_request_and_params(method, maxEntriesPerRequest, params)
2071
+ current = self.milliseconds()
2072
+ tasks = []
2073
+ time = self.parse_timeframe(timeframe) * 1000
2074
+ step = time * maxEntriesPerRequest
2075
+ currentSince = current - (maxCalls * step) - 1
2076
+ if since is not None:
2077
+ currentSince = max(currentSince, since)
2078
+ else:
2079
+ currentSince = max(currentSince, 1241440531000) # avoid timestamps older than 2009
2080
+ until = self.safe_integer_2(params, 'until', 'till') # do not omit it here
2081
+ if until is not None:
2082
+ requiredCalls = int(math.ceil((until - since)) / step)
2083
+ if requiredCalls > maxCalls:
2084
+ raise BadRequest(self.id + ' the number of required calls is greater than the max number of calls allowed, either increase the paginationCalls or decrease the since-until gap. Current paginationCalls limit is ' + str(maxCalls) + ' required calls is ' + str(requiredCalls))
2085
+ for i in range(0, maxCalls):
2086
+ if (until is not None) and (currentSince >= until):
2087
+ break
2088
+ if currentSince >= current:
2089
+ break
2090
+ tasks.append(self.safe_deterministic_call(method, symbol, currentSince, maxEntriesPerRequest, timeframe, params))
2091
+ currentSince = self.sum(currentSince, step) - 1
2092
+ results = await asyncio.gather(*tasks)
2093
+ result = []
2094
+ for i in range(0, len(results)):
2095
+ result = self.array_concat(result, results[i])
2096
+ uniqueResults = self.remove_repeated_elements_from_array(result)
2097
+ key = 0 if (method == 'fetchOHLCV') else 'timestamp'
2098
+ return self.filter_by_since_limit(uniqueResults, since, limit, key)
2099
+
2100
+ async def fetch_paginated_call_cursor(self, method: str, symbol: Str = None, since=None, limit=None, params={}, cursorReceived=None, cursorSent=None, cursorIncrement=None, maxEntriesPerRequest=None):
2101
+ maxCalls = None
2102
+ maxCalls, params = self.handle_option_and_params(params, method, 'paginationCalls', 10)
2103
+ maxRetries = None
2104
+ maxRetries, params = self.handle_option_and_params(params, method, 'maxRetries', 3)
2105
+ maxEntriesPerRequest, params = self.handle_max_entries_per_request_and_params(method, maxEntriesPerRequest, params)
2106
+ cursorValue = None
2107
+ i = 0
2108
+ errors = 0
2109
+ result = []
2110
+ timeframe = self.safe_string(params, 'timeframe')
2111
+ params = self.omit(params, 'timeframe') # reading the timeframe from the method arguments to avoid changing the signature
2112
+ while(i < maxCalls):
2113
+ try:
2114
+ if cursorValue is not None:
2115
+ if cursorIncrement is not None:
2116
+ cursorValue = self.parse_to_int(cursorValue) + cursorIncrement
2117
+ params[cursorSent] = cursorValue
2118
+ response = None
2119
+ if method == 'fetchAccounts':
2120
+ response = await getattr(self, method)(params)
2121
+ elif method == 'getLeverageTiersPaginated' or method == 'fetchPositions':
2122
+ response = await getattr(self, method)(symbol, params)
2123
+ elif method == 'fetchOpenInterestHistory':
2124
+ response = await getattr(self, method)(symbol, timeframe, since, maxEntriesPerRequest, params)
2125
+ else:
2126
+ response = await getattr(self, method)(symbol, since, maxEntriesPerRequest, params)
2127
+ errors = 0
2128
+ responseLength = len(response)
2129
+ if self.verbose:
2130
+ cursorString = '' if (cursorValue is None) else cursorValue
2131
+ iteration = (i + 1)
2132
+ cursorMessage = 'Cursor pagination call ' + str(iteration) + ' method ' + method + ' response length ' + str(responseLength) + ' cursor ' + cursorString
2133
+ self.log(cursorMessage)
2134
+ if responseLength == 0:
2135
+ break
2136
+ result = self.array_concat(result, response)
2137
+ last = self.safe_dict(response, responseLength - 1)
2138
+ # cursorValue = self.safe_value(last['info'], cursorReceived)
2139
+ cursorValue = None # search for the cursor
2140
+ for j in range(0, responseLength):
2141
+ index = responseLength - j - 1
2142
+ entry = self.safe_dict(response, index)
2143
+ info = self.safe_dict(entry, 'info')
2144
+ cursor = self.safe_value(info, cursorReceived)
2145
+ if cursor is not None:
2146
+ cursorValue = cursor
2147
+ break
2148
+ if cursorValue is None:
2149
+ break
2150
+ lastTimestamp = self.safe_integer(last, 'timestamp')
2151
+ if lastTimestamp is not None and lastTimestamp < since:
2152
+ break
2153
+ except Exception as e:
2154
+ errors += 1
2155
+ if errors > maxRetries:
2156
+ raise e
2157
+ i += 1
2158
+ sorted = self.sort_cursor_paginated_result(result)
2159
+ key = 0 if (method == 'fetchOHLCV') else 'timestamp'
2160
+ return self.filter_by_since_limit(sorted, since, limit, key)
2161
+
2162
+ async def fetch_paginated_call_incremental(self, method: str, symbol: Str = None, since=None, limit=None, params={}, pageKey=None, maxEntriesPerRequest=None):
2163
+ maxCalls = None
2164
+ maxCalls, params = self.handle_option_and_params(params, method, 'paginationCalls', 10)
2165
+ maxRetries = None
2166
+ maxRetries, params = self.handle_option_and_params(params, method, 'maxRetries', 3)
2167
+ maxEntriesPerRequest, params = self.handle_max_entries_per_request_and_params(method, maxEntriesPerRequest, params)
2168
+ i = 0
2169
+ errors = 0
2170
+ result = []
2171
+ while(i < maxCalls):
2172
+ try:
2173
+ params[pageKey] = i + 1
2174
+ response = await getattr(self, method)(symbol, since, maxEntriesPerRequest, params)
2175
+ errors = 0
2176
+ responseLength = len(response)
2177
+ if self.verbose:
2178
+ iteration = (i + str(1))
2179
+ incrementalMessage = 'Incremental pagination call ' + iteration + ' method ' + method + ' response length ' + str(responseLength)
2180
+ self.log(incrementalMessage)
2181
+ if responseLength == 0:
2182
+ break
2183
+ result = self.array_concat(result, response)
2184
+ except Exception as e:
2185
+ errors += 1
2186
+ if errors > maxRetries:
2187
+ raise e
2188
+ i += 1
2189
+ sorted = self.sort_cursor_paginated_result(result)
2190
+ key = 0 if (method == 'fetchOHLCV') else 'timestamp'
2191
+ return self.filter_by_since_limit(sorted, since, limit, key)
2192
+
2193
+ async def fetch_position_history(self, symbol: str, since: Int = None, limit: Int = None, params={}):
2194
+ """
2195
+ fetches the history of margin added or reduced from contract isolated positions
2196
+ :param str [symbol]: unified market symbol
2197
+ :param int [since]: timestamp in ms of the position
2198
+ :param int [limit]: the maximum amount of candles to fetch, default=1000
2199
+ :param dict params: extra parameters specific to the exchange api endpoint
2200
+ :returns dict[]: a list of `position structures <https://docs.ccxt.com/?id=position-structure>`
2201
+ """
2202
+ if self.has['fetchPositionsHistory']:
2203
+ positions = await self.fetch_positions_history([symbol], since, limit, params)
2204
+ return positions
2205
+ else:
2206
+ raise NotSupported(self.id + ' fetchPositionHistory() is not supported yet')
2207
+
2208
+ async def fetch_positions_history(self, symbols: Strings = None, since: Int = None, limit: Int = None, params={}):
2209
+ """
2210
+ fetches the history of margin added or reduced from contract isolated positions
2211
+ :param str [symbol]: unified market symbol
2212
+ :param int [since]: timestamp in ms of the position
2213
+ :param int [limit]: the maximum amount of candles to fetch, default=1000
2214
+ :param dict params: extra parameters specific to the exchange api endpoint
2215
+ :returns dict[]: a list of `position structures <https://docs.ccxt.com/?id=position-structure>`
2216
+ """
2217
+ raise NotSupported(self.id + ' fetchPositionsHistory() is not supported yet')
2218
+
2219
+ async def fetch_transfer(self, id: str, code: Str = None, params={}):
2220
+ """
2221
+ fetches a transfer
2222
+ :param str id: transfer id
2223
+ :param [str] code: unified currency code
2224
+ :param dict params: extra parameters specific to the exchange api endpoint
2225
+ :returns dict: a `transfer structure <https://docs.ccxt.com/?id=transfer-structure>`
2226
+ """
2227
+ raise NotSupported(self.id + ' fetchTransfer() is not supported yet')
2228
+
2229
+ async def fetch_transfers(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
2230
+ """
2231
+ fetches a transfer
2232
+ :param str id: transfer id
2233
+ :param int [since]: timestamp in ms of the earliest transfer to fetch
2234
+ :param int [limit]: the maximum amount of transfers to fetch
2235
+ :param dict params: extra parameters specific to the exchange api endpoint
2236
+ :returns dict: a `transfer structure <https://docs.ccxt.com/?id=transfer-structure>`
2237
+ """
2238
+ raise NotSupported(self.id + ' fetchTransfers() is not supported yet')
2239
+
2240
+ async def un_watch_ohlcv(self, symbol: str, timeframe: str = '1m', params={}):
2241
+ """
2242
+ watches historical candlestick data containing the open, high, low, and close price, and the volume of a market
2243
+ :param str symbol: unified symbol of the market to fetch OHLCV data for
2244
+ :param str timeframe: the length of time each candle represents
2245
+ :param dict [params]: extra parameters specific to the exchange API endpoint
2246
+ :returns int[][]: A list of candles ordered, open, high, low, close, volume
2247
+ """
2248
+ raise NotSupported(self.id + ' unWatchOHLCV() is not supported yet')
2249
+
2250
+ async def watch_mark_price(self, symbol: str, params={}):
2251
+ """
2252
+ watches a mark price for a specific market
2253
+ :param str symbol: unified symbol of the market to fetch the ticker for
2254
+ :param dict [params]: extra parameters specific to the exchange API endpoint
2255
+ :returns dict: a `ticker structure <https://docs.ccxt.com/?id=ticker-structure>`
2256
+ """
2257
+ raise NotSupported(self.id + ' watchMarkPrice() is not supported yet')
2258
+
2259
+ async def watch_mark_prices(self, symbols: Strings = None, params={}):
2260
+ """
2261
+ watches the mark price for all markets
2262
+ :param str[] symbols: unified symbol of the market to fetch the ticker for
2263
+ :param dict [params]: extra parameters specific to the exchange API endpoint
2264
+ :returns dict: a `ticker structure <https://docs.ccxt.com/?id=ticker-structure>`
2265
+ """
2266
+ raise NotSupported(self.id + ' watchMarkPrices() is not supported yet')
2267
+
2268
+ async def withdraw_ws(self, code: str, amount: float, address: str, tag: Str = None, params={}):
2269
+ """
2270
+ make a withdrawal
2271
+ :param str code: unified currency code
2272
+ :param float amount: the amount to withdraw
2273
+ :param str address: the address to withdraw to
2274
+ :param str tag:
2275
+ :param dict [params]: extra parameters specific to the bitvavo api endpoint
2276
+ :returns dict: a `transaction structure <https://docs.ccxt.com/?id=transaction-structure>`
2277
+ """
2278
+ raise NotSupported(self.id + ' withdrawWs() is not supported yet')
2279
+
2280
+ async def un_watch_my_trades(self, symbol: Str = None, params={}):
2281
+ """
2282
+ unWatches information on multiple trades made by the user
2283
+ :param str symbol: unified market symbol of the market orders were made in
2284
+ :param dict [params]: extra parameters specific to the exchange API endpoint
2285
+ :returns dict[]: a list of `order structures <https://docs.ccxt.com/?id=order-structure>`
2286
+ """
2287
+ raise NotSupported(self.id + ' unWatchMyTrades() is not supported yet')
2288
+
2289
+ async def create_orders_ws(self, orders: List[OrderRequest], params={}):
2290
+ """
2291
+ create a list of trade orders
2292
+ :param Array orders: list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
2293
+ :param dict [params]: extra parameters specific to the exchange API endpoint
2294
+ :returns dict: an `order structure <https://docs.ccxt.com/?id=order-structure>`
2295
+ """
2296
+ raise NotSupported(self.id + ' createOrdersWs() is not supported yet')
2297
+
2298
+ async def fetch_orders_by_status_ws(self, status: str, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
2299
+ """
2300
+ watches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
2301
+ :param str symbol: unified symbol of the market to fetch the order book for
2302
+ :param int [limit]: the maximum amount of order book entries to return
2303
+ :param dict [params]: extra parameters specific to the exchange API endpoint
2304
+ :returns dict: A dictionary of `order book structures <https://docs.ccxt.com/?id=order-book-structure>` indexed by market symbols
2305
+ """
2306
+ raise NotSupported(self.id + ' fetchOrdersByStatusWs() is not supported yet')
2307
+
2308
+ async def un_watch_bids_asks(self, symbols: Strings = None, params={}):
2309
+ """
2310
+ unWatches best bid & ask for symbols
2311
+ :param str[] symbols: unified symbol of the market to fetch the ticker for
2312
+ :param dict [params]: extra parameters specific to the exchange API endpoint
2313
+ :returns dict: a `ticker structure <https://docs.ccxt.com/?id=ticker-structure>`
2314
+ """
2315
+ raise NotSupported(self.id + ' unWatchBidsAsks() is not supported yet')