ccxt 4.2.76__py2.py3-none-any.whl → 4.4.48__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (546) hide show
  1. ccxt/__init__.py +36 -14
  2. ccxt/abstract/alpaca.py +4 -0
  3. ccxt/abstract/bigone.py +1 -1
  4. ccxt/abstract/binance.py +112 -48
  5. ccxt/abstract/binancecoinm.py +112 -48
  6. ccxt/abstract/binanceus.py +147 -83
  7. ccxt/abstract/binanceusdm.py +112 -48
  8. ccxt/abstract/bingx.py +133 -78
  9. ccxt/abstract/bitbank.py +5 -0
  10. ccxt/abstract/bitfinex.py +136 -65
  11. ccxt/abstract/bitfinex1.py +69 -0
  12. ccxt/abstract/bitflyer.py +1 -0
  13. ccxt/abstract/bitget.py +8 -1
  14. ccxt/abstract/bitmart.py +13 -1
  15. ccxt/abstract/bitopro.py +1 -0
  16. ccxt/abstract/bitpanda.py +0 -12
  17. ccxt/abstract/bitrue.py +3 -3
  18. ccxt/abstract/bitstamp.py +26 -3
  19. ccxt/abstract/blofin.py +24 -0
  20. ccxt/abstract/btcbox.py +1 -0
  21. ccxt/abstract/bybit.py +29 -14
  22. ccxt/abstract/cex.py +28 -29
  23. ccxt/abstract/coinbase.py +6 -0
  24. ccxt/abstract/coinbaseadvanced.py +94 -0
  25. ccxt/abstract/{coinbasepro.py → coinbaseexchange.py} +1 -0
  26. ccxt/abstract/coinbaseinternational.py +1 -1
  27. ccxt/abstract/coincatch.py +94 -0
  28. ccxt/abstract/coinex.py +233 -123
  29. ccxt/abstract/coinmetro.py +1 -0
  30. ccxt/abstract/cryptocom.py +14 -0
  31. ccxt/abstract/defx.py +69 -0
  32. ccxt/abstract/deribit.py +1 -0
  33. ccxt/abstract/digifinex.py +1 -0
  34. ccxt/abstract/ellipx.py +25 -0
  35. ccxt/abstract/gate.py +20 -0
  36. ccxt/abstract/gateio.py +20 -0
  37. ccxt/abstract/gemini.py +1 -0
  38. ccxt/abstract/hashkey.py +67 -0
  39. ccxt/abstract/hyperliquid.py +1 -1
  40. ccxt/abstract/independentreserve.py +6 -0
  41. ccxt/abstract/kraken.py +4 -3
  42. ccxt/abstract/krakenfutures.py +4 -0
  43. ccxt/abstract/kucoin.py +25 -0
  44. ccxt/abstract/kucoinfutures.py +35 -0
  45. ccxt/abstract/luno.py +2 -0
  46. ccxt/abstract/mexc.py +4 -0
  47. ccxt/abstract/myokx.py +340 -0
  48. ccxt/abstract/oceanex.py +5 -0
  49. ccxt/abstract/okx.py +30 -0
  50. ccxt/abstract/onetrading.py +0 -12
  51. ccxt/abstract/oxfun.py +34 -0
  52. ccxt/abstract/paradex.py +40 -0
  53. ccxt/abstract/phemex.py +1 -0
  54. ccxt/abstract/upbit.py +4 -0
  55. ccxt/abstract/vertex.py +19 -0
  56. ccxt/abstract/whitebit.py +31 -1
  57. ccxt/abstract/woo.py +6 -2
  58. ccxt/abstract/woofipro.py +119 -0
  59. ccxt/abstract/xt.py +153 -0
  60. ccxt/abstract/zonda.py +6 -0
  61. ccxt/ace.py +164 -60
  62. ccxt/alpaca.py +727 -63
  63. ccxt/ascendex.py +395 -249
  64. ccxt/async_support/__init__.py +36 -14
  65. ccxt/async_support/ace.py +164 -60
  66. ccxt/async_support/alpaca.py +727 -63
  67. ccxt/async_support/ascendex.py +396 -249
  68. ccxt/async_support/base/exchange.py +531 -155
  69. ccxt/async_support/base/ws/aiohttp_client.py +28 -5
  70. ccxt/async_support/base/ws/cache.py +3 -2
  71. ccxt/async_support/base/ws/client.py +26 -5
  72. ccxt/async_support/base/ws/fast_client.py +4 -3
  73. ccxt/async_support/base/ws/functions.py +1 -1
  74. ccxt/async_support/base/ws/future.py +40 -31
  75. ccxt/async_support/base/ws/order_book_side.py +3 -0
  76. ccxt/async_support/bequant.py +1 -1
  77. ccxt/async_support/bigone.py +329 -202
  78. ccxt/async_support/binance.py +3513 -1511
  79. ccxt/async_support/binancecoinm.py +2 -1
  80. ccxt/async_support/binanceus.py +12 -1
  81. ccxt/async_support/binanceusdm.py +3 -1
  82. ccxt/async_support/bingx.py +3105 -881
  83. ccxt/async_support/bit2c.py +119 -38
  84. ccxt/async_support/bitbank.py +215 -76
  85. ccxt/async_support/bitbns.py +124 -53
  86. ccxt/async_support/bitfinex.py +3236 -1078
  87. ccxt/async_support/bitfinex1.py +1711 -0
  88. ccxt/async_support/bitflyer.py +239 -50
  89. ccxt/async_support/bitget.py +1513 -563
  90. ccxt/async_support/bithumb.py +201 -67
  91. ccxt/async_support/bitmart.py +1320 -435
  92. ccxt/async_support/bitmex.py +308 -111
  93. ccxt/async_support/bitopro.py +256 -96
  94. ccxt/async_support/bitrue.py +365 -233
  95. ccxt/async_support/bitso.py +201 -89
  96. ccxt/async_support/bitstamp.py +438 -269
  97. ccxt/async_support/bitteam.py +179 -73
  98. ccxt/async_support/bitvavo.py +180 -70
  99. ccxt/async_support/bl3p.py +92 -25
  100. ccxt/async_support/blockchaincom.py +193 -79
  101. ccxt/async_support/blofin.py +403 -150
  102. ccxt/async_support/btcalpha.py +161 -55
  103. ccxt/async_support/btcbox.py +250 -34
  104. ccxt/async_support/btcmarkets.py +232 -85
  105. ccxt/async_support/btcturk.py +159 -60
  106. ccxt/async_support/bybit.py +2326 -1255
  107. ccxt/async_support/cex.py +1409 -1329
  108. ccxt/async_support/coinbase.py +1455 -288
  109. ccxt/async_support/coinbaseadvanced.py +17 -0
  110. ccxt/async_support/{coinbasepro.py → coinbaseexchange.py} +233 -99
  111. ccxt/async_support/coinbaseinternational.py +428 -88
  112. ccxt/async_support/coincatch.py +5152 -0
  113. ccxt/async_support/coincheck.py +121 -38
  114. ccxt/async_support/coinex.py +4020 -3339
  115. ccxt/async_support/coinlist.py +273 -116
  116. ccxt/async_support/coinmate.py +204 -97
  117. ccxt/async_support/coinmetro.py +203 -110
  118. ccxt/async_support/coinone.py +142 -68
  119. ccxt/async_support/coinsph.py +206 -89
  120. ccxt/async_support/coinspot.py +137 -62
  121. ccxt/async_support/cryptocom.py +515 -185
  122. ccxt/async_support/currencycom.py +203 -85
  123. ccxt/async_support/defx.py +2066 -0
  124. ccxt/async_support/delta.py +467 -158
  125. ccxt/async_support/deribit.py +558 -324
  126. ccxt/async_support/digifinex.py +340 -223
  127. ccxt/async_support/ellipx.py +1826 -0
  128. ccxt/async_support/exmo.py +259 -128
  129. ccxt/async_support/gate.py +1473 -464
  130. ccxt/async_support/gemini.py +206 -84
  131. ccxt/async_support/hashkey.py +4164 -0
  132. ccxt/async_support/hitbtc.py +334 -178
  133. ccxt/async_support/hollaex.py +134 -83
  134. ccxt/async_support/htx.py +1095 -563
  135. ccxt/async_support/huobijp.py +105 -56
  136. ccxt/async_support/hyperliquid.py +1634 -269
  137. ccxt/async_support/idex.py +148 -95
  138. ccxt/async_support/independentreserve.py +236 -31
  139. ccxt/async_support/indodax.py +165 -62
  140. ccxt/async_support/kraken.py +871 -354
  141. ccxt/async_support/krakenfutures.py +324 -100
  142. ccxt/async_support/kucoin.py +1050 -355
  143. ccxt/async_support/kucoinfutures.py +1004 -149
  144. ccxt/async_support/kuna.py +138 -106
  145. ccxt/async_support/latoken.py +135 -79
  146. ccxt/async_support/lbank.py +290 -113
  147. ccxt/async_support/luno.py +112 -62
  148. ccxt/async_support/lykke.py +104 -55
  149. ccxt/async_support/mercado.py +36 -29
  150. ccxt/async_support/mexc.py +995 -429
  151. ccxt/async_support/myokx.py +43 -0
  152. ccxt/async_support/ndax.py +163 -82
  153. ccxt/async_support/novadax.py +121 -75
  154. ccxt/async_support/oceanex.py +175 -59
  155. ccxt/async_support/okcoin.py +222 -163
  156. ccxt/async_support/okx.py +1777 -455
  157. ccxt/async_support/onetrading.py +132 -414
  158. ccxt/async_support/oxfun.py +2832 -0
  159. ccxt/async_support/p2b.py +79 -51
  160. ccxt/async_support/paradex.py +2017 -0
  161. ccxt/async_support/paymium.py +56 -32
  162. ccxt/async_support/phemex.py +572 -196
  163. ccxt/async_support/poloniex.py +218 -95
  164. ccxt/async_support/poloniexfutures.py +260 -92
  165. ccxt/async_support/probit.py +143 -110
  166. ccxt/async_support/timex.py +123 -70
  167. ccxt/async_support/tokocrypto.py +129 -93
  168. ccxt/async_support/tradeogre.py +39 -25
  169. ccxt/async_support/upbit.py +322 -113
  170. ccxt/async_support/vertex.py +2983 -0
  171. ccxt/async_support/wavesexchange.py +227 -173
  172. ccxt/async_support/wazirx.py +145 -65
  173. ccxt/async_support/whitebit.py +533 -138
  174. ccxt/async_support/woo.py +1155 -295
  175. ccxt/async_support/woofipro.py +2716 -0
  176. ccxt/async_support/xt.py +4628 -0
  177. ccxt/async_support/yobit.py +160 -92
  178. ccxt/async_support/zaif.py +80 -33
  179. ccxt/async_support/zonda.py +140 -69
  180. ccxt/base/errors.py +51 -20
  181. ccxt/base/exchange.py +1729 -482
  182. ccxt/base/precise.py +10 -0
  183. ccxt/base/types.py +223 -4
  184. ccxt/bequant.py +1 -1
  185. ccxt/bigone.py +329 -202
  186. ccxt/binance.py +3513 -1511
  187. ccxt/binancecoinm.py +2 -1
  188. ccxt/binanceus.py +12 -1
  189. ccxt/binanceusdm.py +3 -1
  190. ccxt/bingx.py +3105 -881
  191. ccxt/bit2c.py +119 -38
  192. ccxt/bitbank.py +215 -76
  193. ccxt/bitbns.py +124 -53
  194. ccxt/bitfinex.py +3235 -1078
  195. ccxt/bitfinex1.py +1710 -0
  196. ccxt/bitflyer.py +239 -50
  197. ccxt/bitget.py +1513 -563
  198. ccxt/bithumb.py +200 -67
  199. ccxt/bitmart.py +1320 -435
  200. ccxt/bitmex.py +308 -111
  201. ccxt/bitopro.py +256 -96
  202. ccxt/bitrue.py +365 -233
  203. ccxt/bitso.py +201 -89
  204. ccxt/bitstamp.py +438 -269
  205. ccxt/bitteam.py +179 -73
  206. ccxt/bitvavo.py +180 -70
  207. ccxt/bl3p.py +92 -25
  208. ccxt/blockchaincom.py +193 -79
  209. ccxt/blofin.py +403 -150
  210. ccxt/btcalpha.py +161 -55
  211. ccxt/btcbox.py +250 -34
  212. ccxt/btcmarkets.py +232 -85
  213. ccxt/btcturk.py +159 -60
  214. ccxt/bybit.py +2326 -1255
  215. ccxt/cex.py +1408 -1329
  216. ccxt/coinbase.py +1455 -288
  217. ccxt/coinbaseadvanced.py +17 -0
  218. ccxt/{coinbasepro.py → coinbaseexchange.py} +233 -99
  219. ccxt/coinbaseinternational.py +428 -88
  220. ccxt/coincatch.py +5152 -0
  221. ccxt/coincheck.py +121 -38
  222. ccxt/coinex.py +4020 -3339
  223. ccxt/coinlist.py +273 -116
  224. ccxt/coinmate.py +204 -97
  225. ccxt/coinmetro.py +203 -110
  226. ccxt/coinone.py +142 -68
  227. ccxt/coinsph.py +206 -89
  228. ccxt/coinspot.py +137 -62
  229. ccxt/cryptocom.py +515 -185
  230. ccxt/currencycom.py +203 -85
  231. ccxt/defx.py +2065 -0
  232. ccxt/delta.py +467 -158
  233. ccxt/deribit.py +558 -324
  234. ccxt/digifinex.py +340 -223
  235. ccxt/ellipx.py +1826 -0
  236. ccxt/exmo.py +259 -128
  237. ccxt/gate.py +1473 -464
  238. ccxt/gemini.py +206 -84
  239. ccxt/hashkey.py +4164 -0
  240. ccxt/hitbtc.py +334 -178
  241. ccxt/hollaex.py +134 -83
  242. ccxt/htx.py +1095 -563
  243. ccxt/huobijp.py +105 -56
  244. ccxt/hyperliquid.py +1633 -269
  245. ccxt/idex.py +148 -95
  246. ccxt/independentreserve.py +235 -31
  247. ccxt/indodax.py +165 -62
  248. ccxt/kraken.py +871 -354
  249. ccxt/krakenfutures.py +324 -100
  250. ccxt/kucoin.py +1050 -355
  251. ccxt/kucoinfutures.py +1004 -149
  252. ccxt/kuna.py +138 -106
  253. ccxt/latoken.py +135 -79
  254. ccxt/lbank.py +290 -113
  255. ccxt/luno.py +112 -62
  256. ccxt/lykke.py +104 -55
  257. ccxt/mercado.py +36 -29
  258. ccxt/mexc.py +994 -429
  259. ccxt/myokx.py +43 -0
  260. ccxt/ndax.py +163 -82
  261. ccxt/novadax.py +121 -75
  262. ccxt/oceanex.py +175 -59
  263. ccxt/okcoin.py +222 -163
  264. ccxt/okx.py +1777 -455
  265. ccxt/onetrading.py +132 -414
  266. ccxt/oxfun.py +2831 -0
  267. ccxt/p2b.py +79 -51
  268. ccxt/paradex.py +2017 -0
  269. ccxt/paymium.py +56 -32
  270. ccxt/phemex.py +572 -196
  271. ccxt/poloniex.py +218 -95
  272. ccxt/poloniexfutures.py +260 -92
  273. ccxt/pro/__init__.py +29 -5
  274. ccxt/pro/alpaca.py +32 -17
  275. ccxt/pro/ascendex.py +63 -15
  276. ccxt/pro/bequant.py +4 -0
  277. ccxt/pro/binance.py +1596 -329
  278. ccxt/pro/binancecoinm.py +1 -0
  279. ccxt/pro/binanceus.py +2 -9
  280. ccxt/pro/binanceusdm.py +2 -0
  281. ccxt/pro/bingx.py +527 -134
  282. ccxt/pro/bitcoincom.py +4 -1
  283. ccxt/pro/bitfinex.py +731 -266
  284. ccxt/pro/bitfinex1.py +635 -0
  285. ccxt/pro/bitget.py +726 -357
  286. ccxt/pro/bithumb.py +380 -0
  287. ccxt/pro/bitmart.py +138 -39
  288. ccxt/pro/bitmex.py +199 -40
  289. ccxt/pro/bitopro.py +25 -13
  290. ccxt/pro/bitrue.py +31 -32
  291. ccxt/pro/bitstamp.py +7 -6
  292. ccxt/pro/bitvavo.py +204 -82
  293. ccxt/pro/blockchaincom.py +30 -17
  294. ccxt/pro/blofin.py +692 -0
  295. ccxt/pro/bybit.py +791 -82
  296. ccxt/pro/cex.py +99 -51
  297. ccxt/pro/coinbase.py +220 -30
  298. ccxt/{async_support/hitbtc3.py → pro/coinbaseadvanced.py} +5 -5
  299. ccxt/pro/{coinbasepro.py → coinbaseexchange.py} +19 -19
  300. ccxt/pro/coinbaseinternational.py +193 -30
  301. ccxt/pro/coincatch.py +1464 -0
  302. ccxt/pro/coincheck.py +11 -6
  303. ccxt/pro/coinex.py +967 -661
  304. ccxt/pro/coinone.py +17 -10
  305. ccxt/pro/cryptocom.py +446 -66
  306. ccxt/pro/currencycom.py +11 -10
  307. ccxt/pro/defx.py +832 -0
  308. ccxt/pro/deribit.py +168 -32
  309. ccxt/pro/exmo.py +253 -21
  310. ccxt/pro/gate.py +729 -64
  311. ccxt/pro/gemini.py +44 -26
  312. ccxt/pro/hashkey.py +802 -0
  313. ccxt/pro/hitbtc.py +208 -103
  314. ccxt/pro/hollaex.py +25 -9
  315. ccxt/pro/htx.py +83 -39
  316. ccxt/pro/huobijp.py +17 -16
  317. ccxt/pro/hyperliquid.py +502 -31
  318. ccxt/pro/idex.py +28 -13
  319. ccxt/pro/independentreserve.py +21 -16
  320. ccxt/pro/kraken.py +298 -51
  321. ccxt/pro/krakenfutures.py +166 -75
  322. ccxt/pro/kucoin.py +395 -77
  323. ccxt/pro/kucoinfutures.py +400 -99
  324. ccxt/pro/lbank.py +52 -31
  325. ccxt/pro/luno.py +12 -10
  326. ccxt/pro/mexc.py +400 -50
  327. ccxt/pro/myokx.py +28 -0
  328. ccxt/pro/ndax.py +25 -12
  329. ccxt/pro/okcoin.py +28 -9
  330. ccxt/pro/okx.py +935 -124
  331. ccxt/pro/onetrading.py +41 -24
  332. ccxt/pro/oxfun.py +1054 -0
  333. ccxt/pro/p2b.py +100 -24
  334. ccxt/pro/paradex.py +352 -0
  335. ccxt/pro/phemex.py +93 -34
  336. ccxt/pro/poloniex.py +129 -50
  337. ccxt/pro/poloniexfutures.py +53 -32
  338. ccxt/pro/probit.py +93 -86
  339. ccxt/pro/upbit.py +401 -8
  340. ccxt/pro/vertex.py +943 -0
  341. ccxt/pro/wazirx.py +46 -28
  342. ccxt/pro/whitebit.py +65 -12
  343. ccxt/pro/woo.py +486 -70
  344. ccxt/pro/woofipro.py +1271 -0
  345. ccxt/pro/xt.py +1067 -0
  346. ccxt/probit.py +143 -110
  347. ccxt/static_dependencies/__init__.py +1 -1
  348. ccxt/static_dependencies/lark/__init__.py +38 -0
  349. ccxt/static_dependencies/lark/__pyinstaller/__init__.py +6 -0
  350. ccxt/static_dependencies/lark/__pyinstaller/hook-lark.py +14 -0
  351. ccxt/static_dependencies/lark/ast_utils.py +59 -0
  352. ccxt/static_dependencies/lark/common.py +86 -0
  353. ccxt/static_dependencies/lark/exceptions.py +292 -0
  354. ccxt/static_dependencies/lark/grammar.py +130 -0
  355. ccxt/static_dependencies/lark/grammars/__init__.py +0 -0
  356. ccxt/static_dependencies/lark/indenter.py +143 -0
  357. ccxt/static_dependencies/lark/lark.py +658 -0
  358. ccxt/static_dependencies/lark/lexer.py +678 -0
  359. ccxt/static_dependencies/lark/load_grammar.py +1428 -0
  360. ccxt/static_dependencies/lark/parse_tree_builder.py +391 -0
  361. ccxt/static_dependencies/lark/parser_frontends.py +257 -0
  362. ccxt/static_dependencies/lark/parsers/__init__.py +0 -0
  363. ccxt/static_dependencies/lark/parsers/cyk.py +340 -0
  364. ccxt/static_dependencies/lark/parsers/earley.py +314 -0
  365. ccxt/static_dependencies/lark/parsers/earley_common.py +42 -0
  366. ccxt/static_dependencies/lark/parsers/earley_forest.py +801 -0
  367. ccxt/static_dependencies/lark/parsers/grammar_analysis.py +203 -0
  368. ccxt/static_dependencies/lark/parsers/lalr_analysis.py +332 -0
  369. ccxt/static_dependencies/lark/parsers/lalr_interactive_parser.py +158 -0
  370. ccxt/static_dependencies/lark/parsers/lalr_parser.py +122 -0
  371. ccxt/static_dependencies/lark/parsers/lalr_parser_state.py +110 -0
  372. ccxt/static_dependencies/lark/parsers/xearley.py +165 -0
  373. ccxt/static_dependencies/lark/py.typed +0 -0
  374. ccxt/static_dependencies/lark/reconstruct.py +107 -0
  375. ccxt/static_dependencies/lark/tools/__init__.py +70 -0
  376. ccxt/static_dependencies/lark/tools/nearley.py +202 -0
  377. ccxt/static_dependencies/lark/tools/serialize.py +32 -0
  378. ccxt/static_dependencies/lark/tools/standalone.py +196 -0
  379. ccxt/static_dependencies/lark/tree.py +267 -0
  380. ccxt/static_dependencies/lark/tree_matcher.py +186 -0
  381. ccxt/static_dependencies/lark/tree_templates.py +180 -0
  382. ccxt/static_dependencies/lark/utils.py +343 -0
  383. ccxt/static_dependencies/lark/visitors.py +596 -0
  384. ccxt/static_dependencies/marshmallow/__init__.py +81 -0
  385. ccxt/static_dependencies/marshmallow/base.py +65 -0
  386. ccxt/static_dependencies/marshmallow/class_registry.py +94 -0
  387. ccxt/static_dependencies/marshmallow/decorators.py +231 -0
  388. ccxt/static_dependencies/marshmallow/error_store.py +60 -0
  389. ccxt/static_dependencies/marshmallow/exceptions.py +71 -0
  390. ccxt/static_dependencies/marshmallow/fields.py +2114 -0
  391. ccxt/static_dependencies/marshmallow/orderedset.py +89 -0
  392. ccxt/static_dependencies/marshmallow/py.typed +0 -0
  393. ccxt/static_dependencies/marshmallow/schema.py +1228 -0
  394. ccxt/static_dependencies/marshmallow/types.py +12 -0
  395. ccxt/static_dependencies/marshmallow/utils.py +378 -0
  396. ccxt/static_dependencies/marshmallow/validate.py +678 -0
  397. ccxt/static_dependencies/marshmallow/warnings.py +2 -0
  398. ccxt/static_dependencies/marshmallow_dataclass/__init__.py +1047 -0
  399. ccxt/static_dependencies/marshmallow_dataclass/collection_field.py +51 -0
  400. ccxt/static_dependencies/marshmallow_dataclass/lazy_class_attribute.py +45 -0
  401. ccxt/static_dependencies/marshmallow_dataclass/mypy.py +71 -0
  402. ccxt/static_dependencies/marshmallow_dataclass/py.typed +0 -0
  403. ccxt/static_dependencies/marshmallow_dataclass/typing.py +14 -0
  404. ccxt/static_dependencies/marshmallow_dataclass/union_field.py +82 -0
  405. ccxt/static_dependencies/marshmallow_oneofschema/__init__.py +1 -0
  406. ccxt/static_dependencies/marshmallow_oneofschema/one_of_schema.py +193 -0
  407. ccxt/static_dependencies/marshmallow_oneofschema/py.typed +0 -0
  408. ccxt/static_dependencies/starknet/__init__.py +0 -0
  409. ccxt/static_dependencies/starknet/cairo/__init__.py +0 -0
  410. ccxt/static_dependencies/starknet/cairo/data_types.py +123 -0
  411. ccxt/static_dependencies/starknet/cairo/deprecated_parse/__init__.py +0 -0
  412. ccxt/static_dependencies/starknet/cairo/deprecated_parse/cairo_types.py +77 -0
  413. ccxt/static_dependencies/starknet/cairo/deprecated_parse/parser.py +46 -0
  414. ccxt/static_dependencies/starknet/cairo/deprecated_parse/parser_transformer.py +138 -0
  415. ccxt/static_dependencies/starknet/cairo/felt.py +64 -0
  416. ccxt/static_dependencies/starknet/cairo/type_parser.py +121 -0
  417. ccxt/static_dependencies/starknet/cairo/v1/__init__.py +0 -0
  418. ccxt/static_dependencies/starknet/cairo/v1/type_parser.py +59 -0
  419. ccxt/static_dependencies/starknet/cairo/v2/__init__.py +0 -0
  420. ccxt/static_dependencies/starknet/cairo/v2/type_parser.py +77 -0
  421. ccxt/static_dependencies/starknet/ccxt_utils.py +7 -0
  422. ccxt/static_dependencies/starknet/common.py +15 -0
  423. ccxt/static_dependencies/starknet/constants.py +39 -0
  424. ccxt/static_dependencies/starknet/hash/__init__.py +0 -0
  425. ccxt/static_dependencies/starknet/hash/address.py +79 -0
  426. ccxt/static_dependencies/starknet/hash/compiled_class_hash_objects.py +111 -0
  427. ccxt/static_dependencies/starknet/hash/selector.py +16 -0
  428. ccxt/static_dependencies/starknet/hash/storage.py +12 -0
  429. ccxt/static_dependencies/starknet/hash/utils.py +78 -0
  430. ccxt/static_dependencies/starknet/models/__init__.py +0 -0
  431. ccxt/static_dependencies/starknet/models/typed_data.py +45 -0
  432. ccxt/static_dependencies/starknet/serialization/__init__.py +24 -0
  433. ccxt/static_dependencies/starknet/serialization/_calldata_reader.py +40 -0
  434. ccxt/static_dependencies/starknet/serialization/_context.py +142 -0
  435. ccxt/static_dependencies/starknet/serialization/data_serializers/__init__.py +10 -0
  436. ccxt/static_dependencies/starknet/serialization/data_serializers/_common.py +82 -0
  437. ccxt/static_dependencies/starknet/serialization/data_serializers/array_serializer.py +43 -0
  438. ccxt/static_dependencies/starknet/serialization/data_serializers/bool_serializer.py +37 -0
  439. ccxt/static_dependencies/starknet/serialization/data_serializers/byte_array_serializer.py +66 -0
  440. ccxt/static_dependencies/starknet/serialization/data_serializers/cairo_data_serializer.py +71 -0
  441. ccxt/static_dependencies/starknet/serialization/data_serializers/enum_serializer.py +71 -0
  442. ccxt/static_dependencies/starknet/serialization/data_serializers/felt_serializer.py +50 -0
  443. ccxt/static_dependencies/starknet/serialization/data_serializers/named_tuple_serializer.py +58 -0
  444. ccxt/static_dependencies/starknet/serialization/data_serializers/option_serializer.py +43 -0
  445. ccxt/static_dependencies/starknet/serialization/data_serializers/output_serializer.py +40 -0
  446. ccxt/static_dependencies/starknet/serialization/data_serializers/payload_serializer.py +72 -0
  447. ccxt/static_dependencies/starknet/serialization/data_serializers/struct_serializer.py +36 -0
  448. ccxt/static_dependencies/starknet/serialization/data_serializers/tuple_serializer.py +36 -0
  449. ccxt/static_dependencies/starknet/serialization/data_serializers/uint256_serializer.py +76 -0
  450. ccxt/static_dependencies/starknet/serialization/data_serializers/uint_serializer.py +100 -0
  451. ccxt/static_dependencies/starknet/serialization/data_serializers/unit_serializer.py +32 -0
  452. ccxt/static_dependencies/starknet/serialization/errors.py +10 -0
  453. ccxt/static_dependencies/starknet/serialization/factory.py +229 -0
  454. ccxt/static_dependencies/starknet/serialization/function_serialization_adapter.py +110 -0
  455. ccxt/static_dependencies/starknet/serialization/tuple_dataclass.py +59 -0
  456. ccxt/static_dependencies/starknet/utils/__init__.py +0 -0
  457. ccxt/static_dependencies/starknet/utils/constructor_args_translator.py +86 -0
  458. ccxt/static_dependencies/starknet/utils/iterable.py +13 -0
  459. ccxt/static_dependencies/starknet/utils/schema.py +13 -0
  460. ccxt/static_dependencies/starknet/utils/typed_data.py +182 -0
  461. ccxt/static_dependencies/starkware/__init__.py +0 -0
  462. ccxt/static_dependencies/starkware/crypto/__init__.py +0 -0
  463. ccxt/static_dependencies/starkware/crypto/fast_pedersen_hash.py +50 -0
  464. ccxt/static_dependencies/starkware/crypto/math_utils.py +78 -0
  465. ccxt/static_dependencies/starkware/crypto/signature.py +2344 -0
  466. ccxt/static_dependencies/starkware/crypto/utils.py +63 -0
  467. ccxt/static_dependencies/sympy/__init__.py +0 -0
  468. ccxt/static_dependencies/sympy/core/__init__.py +0 -0
  469. ccxt/static_dependencies/sympy/core/intfunc.py +35 -0
  470. ccxt/static_dependencies/sympy/external/__init__.py +0 -0
  471. ccxt/static_dependencies/sympy/external/gmpy.py +345 -0
  472. ccxt/static_dependencies/sympy/external/importtools.py +187 -0
  473. ccxt/static_dependencies/sympy/external/ntheory.py +637 -0
  474. ccxt/static_dependencies/sympy/external/pythonmpq.py +341 -0
  475. ccxt/static_dependencies/typing_inspect/__init__.py +0 -0
  476. ccxt/static_dependencies/typing_inspect/typing_inspect.py +851 -0
  477. ccxt/test/{test_async.py → tests_async.py} +465 -407
  478. ccxt/test/tests_helpers.py +285 -0
  479. ccxt/test/tests_init.py +39 -0
  480. ccxt/test/{test_sync.py → tests_sync.py} +465 -409
  481. ccxt/timex.py +123 -70
  482. ccxt/tokocrypto.py +129 -93
  483. ccxt/tradeogre.py +39 -25
  484. ccxt/upbit.py +322 -113
  485. ccxt/vertex.py +2983 -0
  486. ccxt/wavesexchange.py +227 -173
  487. ccxt/wazirx.py +145 -65
  488. ccxt/whitebit.py +533 -138
  489. ccxt/woo.py +1155 -295
  490. ccxt/woofipro.py +2716 -0
  491. ccxt/xt.py +4627 -0
  492. ccxt/yobit.py +159 -92
  493. ccxt/zaif.py +80 -33
  494. ccxt/zonda.py +140 -69
  495. ccxt-4.4.48.dist-info/LICENSE.txt +21 -0
  496. ccxt-4.4.48.dist-info/METADATA +646 -0
  497. ccxt-4.4.48.dist-info/RECORD +669 -0
  498. {ccxt-4.2.76.dist-info → ccxt-4.4.48.dist-info}/WHEEL +1 -1
  499. ccxt/abstract/bitbay.py +0 -47
  500. ccxt/abstract/bitfinex2.py +0 -139
  501. ccxt/abstract/hitbtc3.py +0 -115
  502. ccxt/async_support/bitbay.py +0 -17
  503. ccxt/async_support/bitfinex2.py +0 -3496
  504. ccxt/async_support/flowbtc.py +0 -34
  505. ccxt/bitbay.py +0 -17
  506. ccxt/bitfinex2.py +0 -3496
  507. ccxt/flowbtc.py +0 -34
  508. ccxt/hitbtc3.py +0 -16
  509. ccxt/pro/bitfinex2.py +0 -1081
  510. ccxt/test/base/__init__.py +0 -28
  511. ccxt/test/base/test_account.py +0 -26
  512. ccxt/test/base/test_balance.py +0 -56
  513. ccxt/test/base/test_borrow_interest.py +0 -35
  514. ccxt/test/base/test_borrow_rate.py +0 -32
  515. ccxt/test/base/test_calculate_fee.py +0 -51
  516. ccxt/test/base/test_crypto.py +0 -127
  517. ccxt/test/base/test_currency.py +0 -76
  518. ccxt/test/base/test_datetime.py +0 -103
  519. ccxt/test/base/test_decimal_to_precision.py +0 -392
  520. ccxt/test/base/test_deep_extend.py +0 -68
  521. ccxt/test/base/test_deposit_withdrawal.py +0 -50
  522. ccxt/test/base/test_exchange_datetime_functions.py +0 -76
  523. ccxt/test/base/test_funding_rate_history.py +0 -29
  524. ccxt/test/base/test_last_price.py +0 -32
  525. ccxt/test/base/test_ledger_entry.py +0 -45
  526. ccxt/test/base/test_ledger_item.py +0 -48
  527. ccxt/test/base/test_leverage_tier.py +0 -33
  528. ccxt/test/base/test_margin_mode.py +0 -24
  529. ccxt/test/base/test_margin_modification.py +0 -35
  530. ccxt/test/base/test_market.py +0 -190
  531. ccxt/test/base/test_number.py +0 -411
  532. ccxt/test/base/test_ohlcv.py +0 -32
  533. ccxt/test/base/test_open_interest.py +0 -32
  534. ccxt/test/base/test_order.py +0 -64
  535. ccxt/test/base/test_order_book.py +0 -63
  536. ccxt/test/base/test_position.py +0 -60
  537. ccxt/test/base/test_shared_methods.py +0 -345
  538. ccxt/test/base/test_status.py +0 -24
  539. ccxt/test/base/test_throttle.py +0 -126
  540. ccxt/test/base/test_ticker.py +0 -86
  541. ccxt/test/base/test_trade.py +0 -47
  542. ccxt/test/base/test_trading_fee.py +0 -26
  543. ccxt/test/base/test_transaction.py +0 -39
  544. ccxt-4.2.76.dist-info/METADATA +0 -626
  545. ccxt-4.2.76.dist-info/RECORD +0 -534
  546. {ccxt-4.2.76.dist-info → ccxt-4.4.48.dist-info}/top_level.txt +0 -0
ccxt/bitstamp.py CHANGED
@@ -6,9 +6,10 @@
6
6
  from ccxt.base.exchange import Exchange
7
7
  from ccxt.abstract.bitstamp import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
9
+ from ccxt.base.types import Balances, Currencies, Currency, DepositAddress, Int, LedgerEntry, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
+ from ccxt.base.errors import AuthenticationError
12
13
  from ccxt.base.errors import PermissionDenied
13
14
  from ccxt.base.errors import BadRequest
14
15
  from ccxt.base.errors import InsufficientFunds
@@ -19,7 +20,6 @@ from ccxt.base.errors import NotSupported
19
20
  from ccxt.base.errors import ExchangeNotAvailable
20
21
  from ccxt.base.errors import OnMaintenance
21
22
  from ccxt.base.errors import InvalidNonce
22
- from ccxt.base.errors import AuthenticationError
23
23
  from ccxt.base.decimal_to_precision import TICK_SIZE
24
24
  from ccxt.base.precise import Precise
25
25
 
@@ -60,6 +60,8 @@ class bitstamp(Exchange, ImplicitAPI):
60
60
  'fetchCrossBorrowRates': False,
61
61
  'fetchCurrencies': True,
62
62
  'fetchDepositAddress': True,
63
+ 'fetchDepositAddresses': False,
64
+ 'fetchDepositAddressesByNetwork': False,
63
65
  'fetchDepositsWithdrawals': True,
64
66
  'fetchDepositWithdrawFee': 'emulated',
65
67
  'fetchDepositWithdrawFees': True,
@@ -82,8 +84,11 @@ class bitstamp(Exchange, ImplicitAPI):
82
84
  'fetchOrder': True,
83
85
  'fetchOrderBook': True,
84
86
  'fetchPosition': False,
87
+ 'fetchPositionHistory': False,
85
88
  'fetchPositionMode': False,
86
89
  'fetchPositions': False,
90
+ 'fetchPositionsForSymbol': False,
91
+ 'fetchPositionsHistory': False,
87
92
  'fetchPositionsRisk': False,
88
93
  'fetchPremiumIndexOHLCV': False,
89
94
  'fetchTicker': True,
@@ -102,7 +107,7 @@ class bitstamp(Exchange, ImplicitAPI):
102
107
  'withdraw': True,
103
108
  },
104
109
  'urls': {
105
- 'logo': 'https://user-images.githubusercontent.com/1294454/27786377-8c8ab57e-5fe9-11e7-8ea4-2b05b6bcceec.jpg',
110
+ 'logo': 'https://github.com/user-attachments/assets/d5480572-1fee-43cb-b900-d38c522d0024',
106
111
  'api': {
107
112
  'public': 'https://www.bitstamp.net/api',
108
113
  'private': 'https://www.bitstamp.net/api',
@@ -160,6 +165,7 @@ class bitstamp(Exchange, ImplicitAPI):
160
165
  'user_transactions/': 1,
161
166
  'user_transactions/{pair}/': 1,
162
167
  'crypto-transactions/': 1,
168
+ 'open_order': 1,
163
169
  'open_orders/all/': 1,
164
170
  'open_orders/{pair}/': 1,
165
171
  'order_status/': 1,
@@ -176,7 +182,7 @@ class bitstamp(Exchange, ImplicitAPI):
176
182
  'transfer-from-main/': 1,
177
183
  'my_trading_pairs/': 1,
178
184
  'fees/trading/': 1,
179
- 'fees/trading/{pair}': 1,
185
+ 'fees/trading/{market_symbol}': 1,
180
186
  'fees/withdrawal/': 1,
181
187
  'fees/withdrawal/{currency}/': 1,
182
188
  'withdrawal-requests/': 1,
@@ -229,7 +235,7 @@ class bitstamp(Exchange, ImplicitAPI):
229
235
  'uni_withdrawal/': 1,
230
236
  'uni_address/': 1,
231
237
  'yfi_withdrawal/': 1,
232
- 'yfi_address': 1,
238
+ 'yfi_address/': 1,
233
239
  'audio_withdrawal/': 1,
234
240
  'audio_address/': 1,
235
241
  'crv_withdrawal/': 1,
@@ -238,7 +244,7 @@ class bitstamp(Exchange, ImplicitAPI):
238
244
  'algo_address/': 1,
239
245
  'comp_withdrawal/': 1,
240
246
  'comp_address/': 1,
241
- 'grt_withdrawal': 1,
247
+ 'grt_withdrawal/': 1,
242
248
  'grt_address/': 1,
243
249
  'usdt_withdrawal/': 1,
244
250
  'usdt_address/': 1,
@@ -370,6 +376,28 @@ class bitstamp(Exchange, ImplicitAPI):
370
376
  'blur_address/': 1,
371
377
  'vext_withdrawal/': 1,
372
378
  'vext_address/': 1,
379
+ 'cspr_withdrawal/': 1,
380
+ 'cspr_address/': 1,
381
+ 'vchf_withdrawal/': 1,
382
+ 'vchf_address/': 1,
383
+ 'veur_withdrawal/': 1,
384
+ 'veur_address/': 1,
385
+ 'truf_withdrawal/': 1,
386
+ 'truf_address/': 1,
387
+ 'wif_withdrawal/': 1,
388
+ 'wif_address/': 1,
389
+ 'smt_withdrawal/': 1,
390
+ 'smt_address/': 1,
391
+ 'sui_withdrawal/': 1,
392
+ 'sui_address/': 1,
393
+ 'jup_withdrawal/': 1,
394
+ 'jup_address/': 1,
395
+ 'ondo_withdrawal/': 1,
396
+ 'ondo_address/': 1,
397
+ 'boba_withdrawal/': 1,
398
+ 'boba_address/': 1,
399
+ 'pyth_withdrawal/': 1,
400
+ 'pyth_address/': 1,
373
401
  },
374
402
  },
375
403
  },
@@ -377,46 +405,34 @@ class bitstamp(Exchange, ImplicitAPI):
377
405
  'trading': {
378
406
  'tierBased': True,
379
407
  'percentage': True,
380
- 'taker': self.parse_number('0.005'),
381
- 'maker': self.parse_number('0.005'),
408
+ 'taker': self.parse_number('0.004'),
409
+ 'maker': self.parse_number('0.004'),
382
410
  'tiers': {
383
411
  'taker': [
384
- [self.parse_number('0'), self.parse_number('0.005')],
385
- [self.parse_number('20000'), self.parse_number('0.0025')],
386
- [self.parse_number('100000'), self.parse_number('0.0024')],
387
- [self.parse_number('200000'), self.parse_number('0.0022')],
388
- [self.parse_number('400000'), self.parse_number('0.0020')],
389
- [self.parse_number('600000'), self.parse_number('0.0015')],
390
- [self.parse_number('1000000'), self.parse_number('0.0014')],
391
- [self.parse_number('2000000'), self.parse_number('0.0013')],
392
- [self.parse_number('4000000'), self.parse_number('0.0012')],
393
- [self.parse_number('20000000'), self.parse_number('0.0011')],
394
- [self.parse_number('50000000'), self.parse_number('0.0010')],
395
- [self.parse_number('100000000'), self.parse_number('0.0007')],
396
- [self.parse_number('500000000'), self.parse_number('0.0005')],
397
- [self.parse_number('2000000000'), self.parse_number('0.0003')],
398
- [self.parse_number('6000000000'), self.parse_number('0.0001')],
399
- [self.parse_number('20000000000'), self.parse_number('0.00005')],
400
- [self.parse_number('20000000001'), self.parse_number('0')],
412
+ [self.parse_number('0'), self.parse_number('0.004')],
413
+ [self.parse_number('10000'), self.parse_number('0.003')],
414
+ [self.parse_number('100000'), self.parse_number('0.002')],
415
+ [self.parse_number('500000'), self.parse_number('0.0018')],
416
+ [self.parse_number('1500000'), self.parse_number('0.0016')],
417
+ [self.parse_number('5000000'), self.parse_number('0.0012')],
418
+ [self.parse_number('20000000'), self.parse_number('0.001')],
419
+ [self.parse_number('50000000'), self.parse_number('0.0008')],
420
+ [self.parse_number('100000000'), self.parse_number('0.0006')],
421
+ [self.parse_number('250000000'), self.parse_number('0.0005')],
422
+ [self.parse_number('1000000000'), self.parse_number('0.0003')],
401
423
  ],
402
424
  'maker': [
403
- [self.parse_number('0'), self.parse_number('0.005')],
404
- [self.parse_number('20000'), self.parse_number('0.0025')],
405
- [self.parse_number('100000'), self.parse_number('0.0024')],
406
- [self.parse_number('200000'), self.parse_number('0.0022')],
407
- [self.parse_number('400000'), self.parse_number('0.0020')],
408
- [self.parse_number('600000'), self.parse_number('0.0015')],
409
- [self.parse_number('1000000'), self.parse_number('0.0014')],
410
- [self.parse_number('2000000'), self.parse_number('0.0013')],
411
- [self.parse_number('4000000'), self.parse_number('0.0012')],
412
- [self.parse_number('20000000'), self.parse_number('0.0011')],
413
- [self.parse_number('50000000'), self.parse_number('0.0010')],
414
- [self.parse_number('100000000'), self.parse_number('0.0007')],
415
- [self.parse_number('500000000'), self.parse_number('0.0005')],
416
- [self.parse_number('2000000000'), self.parse_number('0.0003')],
417
- [self.parse_number('6000000000'), self.parse_number('0.0001')],
418
- [self.parse_number('20000000000'), self.parse_number('0.00005')],
419
- [self.parse_number('20000000001'), self.parse_number('0')],
425
+ [self.parse_number('0'), self.parse_number('0.003')],
426
+ [self.parse_number('10000'), self.parse_number('0.002')],
427
+ [self.parse_number('100000'), self.parse_number('0.001')],
428
+ [self.parse_number('500000'), self.parse_number('0.0008')],
429
+ [self.parse_number('1500000'), self.parse_number('0.0006')],
430
+ [self.parse_number('5000000'), self.parse_number('0.0003')],
431
+ [self.parse_number('20000000'), self.parse_number('0.002')],
432
+ [self.parse_number('50000000'), self.parse_number('0.0001')],
433
+ [self.parse_number('100000000'), self.parse_number('0')],
434
+ [self.parse_number('250000000'), self.parse_number('0')],
435
+ [self.parse_number('1000000000'), self.parse_number('0')],
420
436
  ],
421
437
  },
422
438
  },
@@ -441,6 +457,30 @@ class bitstamp(Exchange, ImplicitAPI):
441
457
  'commonCurrencies': {
442
458
  'UST': 'USTC',
443
459
  },
460
+ # exchange-specific options
461
+ 'options': {
462
+ 'networksById': {
463
+ 'bitcoin-cash': 'BCH',
464
+ 'bitcoin': 'BTC',
465
+ 'ethereum': 'ERC20',
466
+ 'litecoin': 'LTC',
467
+ 'stellar': 'XLM',
468
+ 'xrpl': 'XRP',
469
+ 'tron': 'TRC20',
470
+ 'algorand': 'ALGO',
471
+ 'flare': 'FLR',
472
+ 'hedera': 'HBAR',
473
+ 'cardana': 'ADA',
474
+ 'songbird': 'FLR',
475
+ 'avalanche-c-chain': 'AVAX',
476
+ 'solana': 'SOL',
477
+ 'polkadot': 'DOT',
478
+ 'near': 'NEAR',
479
+ 'doge': 'DOGE',
480
+ 'sui': 'SUI',
481
+ 'casper': 'CSRP',
482
+ },
483
+ },
444
484
  'exceptions': {
445
485
  'exact': {
446
486
  'No permission found': PermissionDenied,
@@ -466,12 +506,72 @@ class bitstamp(Exchange, ImplicitAPI):
466
506
  'Ensure that there are no more than': InvalidOrder, # {"status": "error", "reason": {"amount": ["Ensure that there are no more than 0 decimal places."], "__all__": [""]}}
467
507
  },
468
508
  },
509
+ 'features': {
510
+ 'spot': {
511
+ 'sandbox': False,
512
+ 'createOrder': {
513
+ 'marginMode': False,
514
+ 'triggerPrice': False,
515
+ 'triggerPriceType': None,
516
+ 'triggerDirection': False,
517
+ 'stopLossPrice': False,
518
+ 'takeProfitPrice': False,
519
+ 'attachedStopLossTakeProfit': None,
520
+ 'timeInForce': {
521
+ 'IOC': True,
522
+ 'FOK': True,
523
+ 'PO': True,
524
+ 'GTD': True,
525
+ },
526
+ 'hedged': False,
527
+ 'trailing': False,
528
+ 'leverage': False,
529
+ 'marketBuyByCost': False,
530
+ 'marketBuyRequiresPrice': False,
531
+ 'selfTradePrevention': False,
532
+ 'iceberg': False,
533
+ },
534
+ 'createOrders': None,
535
+ 'fetchMyTrades': {
536
+ 'marginMode': False,
537
+ 'limit': 1000,
538
+ 'daysBack': None,
539
+ 'untilDays': 30,
540
+ },
541
+ 'fetchOrder': {
542
+ 'marginMode': False,
543
+ 'trigger': False,
544
+ 'trailing': False,
545
+ },
546
+ 'fetchOpenOrders': {
547
+ 'marginMode': False,
548
+ 'limit': None,
549
+ 'trigger': False,
550
+ 'trailing': False,
551
+ },
552
+ 'fetchOrders': None,
553
+ 'fetchClosedOrders': None,
554
+ 'fetchOHLCV': {
555
+ 'limit': 1000,
556
+ },
557
+ },
558
+ 'swap': {
559
+ 'linear': None,
560
+ 'inverse': None,
561
+ },
562
+ 'future': {
563
+ 'linear': None,
564
+ 'inverse': None,
565
+ },
566
+ },
469
567
  })
470
568
 
471
- def fetch_markets(self, params={}):
569
+ def fetch_markets(self, params={}) -> List[Market]:
472
570
  """
473
571
  retrieves data on all markets for bitstamp
474
- :see: https://www.bitstamp.net/api/#tag/Market-info/operation/GetTradingPairsInfo
572
+
573
+ https://www.bitstamp.net/api/#tag/Market-info/operation/GetTradingPairsInfo
574
+
475
575
  :param dict [params]: extra parameters specific to the exchange API endpoint
476
576
  :returns dict[]: an array of objects representing market data
477
577
  """
@@ -607,10 +707,12 @@ class bitstamp(Exchange, ImplicitAPI):
607
707
  })
608
708
  return self.safe_value(self.options['fetchMarkets'], 'response')
609
709
 
610
- def fetch_currencies(self, params={}):
710
+ def fetch_currencies(self, params={}) -> Currencies:
611
711
  """
612
712
  fetches all available currencies on an exchange
613
- :see: https://www.bitstamp.net/api/#tag/Market-info/operation/GetTradingPairsInfo
713
+
714
+ https://www.bitstamp.net/api/#tag/Market-info/operation/GetTradingPairsInfo
715
+
614
716
  :param dict [params]: extra parameters specific to the exchange API endpoint
615
717
  :returns dict: an associative dictionary of currencies
616
718
  """
@@ -629,7 +731,7 @@ class bitstamp(Exchange, ImplicitAPI):
629
731
  # },
630
732
  # ]
631
733
  #
632
- result = {}
734
+ result: dict = {}
633
735
  for i in range(0, len(response)):
634
736
  market = response[i]
635
737
  name = self.safe_string(market, 'name')
@@ -654,7 +756,9 @@ class bitstamp(Exchange, ImplicitAPI):
654
756
  def fetch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook:
655
757
  """
656
758
  fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
657
- :see: https://www.bitstamp.net/api/#tag/Order-book/operation/GetOrderBook
759
+
760
+ https://www.bitstamp.net/api/#tag/Order-book/operation/GetOrderBook
761
+
658
762
  :param str symbol: unified symbol of the market to fetch the order book for
659
763
  :param int [limit]: the maximum amount of order book entries to return
660
764
  :param dict [params]: extra parameters specific to the exchange API endpoint
@@ -662,7 +766,7 @@ class bitstamp(Exchange, ImplicitAPI):
662
766
  """
663
767
  self.load_markets()
664
768
  market = self.market(symbol)
665
- request = {
769
+ request: dict = {
666
770
  'pair': market['id'],
667
771
  }
668
772
  response = self.publicGetOrderBookPair(self.extend(request, params))
@@ -688,7 +792,7 @@ class bitstamp(Exchange, ImplicitAPI):
688
792
  orderbook['nonce'] = microtimestamp
689
793
  return orderbook
690
794
 
691
- def parse_ticker(self, ticker, market: Market = None) -> Ticker:
795
+ def parse_ticker(self, ticker: dict, market: Market = None) -> Ticker:
692
796
  #
693
797
  # {
694
798
  # "timestamp": "1686068944",
@@ -738,14 +842,16 @@ class bitstamp(Exchange, ImplicitAPI):
738
842
  def fetch_ticker(self, symbol: str, params={}) -> Ticker:
739
843
  """
740
844
  fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
741
- :see: https://www.bitstamp.net/api/#tag/Tickers/operation/GetMarketTicker
845
+
846
+ https://www.bitstamp.net/api/#tag/Tickers/operation/GetMarketTicker
847
+
742
848
  :param str symbol: unified symbol of the market to fetch the ticker for
743
849
  :param dict [params]: extra parameters specific to the exchange API endpoint
744
850
  :returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
745
851
  """
746
852
  self.load_markets()
747
853
  market = self.market(symbol)
748
- request = {
854
+ request: dict = {
749
855
  'pair': market['id'],
750
856
  }
751
857
  ticker = self.publicGetTickerPair(self.extend(request, params))
@@ -769,7 +875,9 @@ class bitstamp(Exchange, ImplicitAPI):
769
875
  def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
770
876
  """
771
877
  fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
772
- :see: https://www.bitstamp.net/api/#tag/Tickers/operation/GetCurrencyPairTickers
878
+
879
+ https://www.bitstamp.net/api/#tag/Tickers/operation/GetCurrencyPairTickers
880
+
773
881
  :param str[]|None symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
774
882
  :param dict [params]: extra parameters specific to the exchange API endpoint
775
883
  :returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
@@ -851,7 +959,7 @@ class bitstamp(Exchange, ImplicitAPI):
851
959
  return self.safe_market(marketId)
852
960
  return None
853
961
 
854
- def parse_trade(self, trade, market: Market = None) -> Trade:
962
+ def parse_trade(self, trade: dict, market: Market = None) -> Trade:
855
963
  #
856
964
  # fetchTrades(public)
857
965
  #
@@ -972,7 +1080,9 @@ class bitstamp(Exchange, ImplicitAPI):
972
1080
  def fetch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
973
1081
  """
974
1082
  get the list of most recent trades for a particular symbol
975
- :see: https://www.bitstamp.net/api/#tag/Transactions-public/operation/GetTransactions
1083
+
1084
+ https://www.bitstamp.net/api/#tag/Transactions-public/operation/GetTransactions
1085
+
976
1086
  :param str symbol: unified symbol of the market to fetch trades for
977
1087
  :param int [since]: timestamp in ms of the earliest trade to fetch
978
1088
  :param int [limit]: the maximum amount of trades to fetch
@@ -981,7 +1091,7 @@ class bitstamp(Exchange, ImplicitAPI):
981
1091
  """
982
1092
  self.load_markets()
983
1093
  market = self.market(symbol)
984
- request = {
1094
+ request: dict = {
985
1095
  'pair': market['id'],
986
1096
  'time': 'hour',
987
1097
  }
@@ -1029,7 +1139,9 @@ class bitstamp(Exchange, ImplicitAPI):
1029
1139
  def fetch_ohlcv(self, symbol: str, timeframe='1m', since: Int = None, limit: Int = None, params={}) -> List[list]:
1030
1140
  """
1031
1141
  fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
1032
- :see: https://www.bitstamp.net/api/#tag/Market-info/operation/GetOHLCData
1142
+
1143
+ https://www.bitstamp.net/api/#tag/Market-info/operation/GetOHLCData
1144
+
1033
1145
  :param str symbol: unified symbol of the market to fetch OHLCV data for
1034
1146
  :param str timeframe: the length of time each candle represents
1035
1147
  :param int [since]: timestamp in ms of the earliest candle to fetch
@@ -1039,7 +1151,7 @@ class bitstamp(Exchange, ImplicitAPI):
1039
1151
  """
1040
1152
  self.load_markets()
1041
1153
  market = self.market(symbol)
1042
- request = {
1154
+ request: dict = {
1043
1155
  'pair': market['id'],
1044
1156
  'step': self.safe_string(self.timeframes, timeframe, timeframe),
1045
1157
  }
@@ -1073,245 +1185,246 @@ class bitstamp(Exchange, ImplicitAPI):
1073
1185
  # }
1074
1186
  #
1075
1187
  data = self.safe_value(response, 'data', {})
1076
- ohlc = self.safe_value(data, 'ohlc', [])
1188
+ ohlc = self.safe_list(data, 'ohlc', [])
1077
1189
  return self.parse_ohlcvs(ohlc, market, timeframe, since, limit)
1078
1190
 
1079
1191
  def parse_balance(self, response) -> Balances:
1080
- result = {
1192
+ result: dict = {
1081
1193
  'info': response,
1082
1194
  'timestamp': None,
1083
1195
  'datetime': None,
1084
1196
  }
1085
- codes = list(self.currencies.keys())
1086
- for i in range(0, len(codes)):
1087
- code = codes[i]
1088
- currency = self.currency(code)
1089
- currencyId = currency['id']
1197
+ if response is None:
1198
+ response = []
1199
+ for i in range(0, len(response)):
1200
+ currencyBalance = response[i]
1201
+ currencyId = self.safe_string(currencyBalance, 'currency')
1202
+ currencyCode = self.safe_currency_code(currencyId)
1090
1203
  account = self.account()
1091
- account['free'] = self.safe_string(response, currencyId + '_available')
1092
- account['used'] = self.safe_string(response, currencyId + '_reserved')
1093
- account['total'] = self.safe_string(response, currencyId + '_balance')
1094
- result[code] = account
1204
+ account['free'] = self.safe_string(currencyBalance, 'available')
1205
+ account['used'] = self.safe_string(currencyBalance, 'reserved')
1206
+ account['total'] = self.safe_string(currencyBalance, 'total')
1207
+ result[currencyCode] = account
1095
1208
  return self.safe_balance(result)
1096
1209
 
1097
1210
  def fetch_balance(self, params={}) -> Balances:
1098
1211
  """
1099
1212
  query for balance and get the amount of funds available for trading or funds locked in orders
1100
- :see: https://www.bitstamp.net/api/#tag/Account-balances/operation/GetAccountBalances
1213
+
1214
+ https://www.bitstamp.net/api/#tag/Account-balances/operation/GetAccountBalances
1215
+
1101
1216
  :param dict [params]: extra parameters specific to the exchange API endpoint
1102
1217
  :returns dict: a `balance structure <https://docs.ccxt.com/#/?id=balance-structure>`
1103
1218
  """
1104
1219
  self.load_markets()
1105
- response = self.privatePostBalance(params)
1220
+ response = self.privatePostAccountBalances(params)
1106
1221
  #
1107
- # {
1108
- # "aave_available": "0.00000000",
1109
- # "aave_balance": "0.00000000",
1110
- # "aave_reserved": "0.00000000",
1111
- # "aave_withdrawal_fee": "0.07000000",
1112
- # "aavebtc_fee": "0.000",
1113
- # "aaveeur_fee": "0.000",
1114
- # "aaveusd_fee": "0.000",
1115
- # "bat_available": "0.00000000",
1116
- # "bat_balance": "0.00000000",
1117
- # "bat_reserved": "0.00000000",
1118
- # "bat_withdrawal_fee": "5.00000000",
1119
- # "batbtc_fee": "0.000",
1120
- # "bateur_fee": "0.000",
1121
- # "batusd_fee": "0.000",
1122
- # }
1222
+ # [
1223
+ # {
1224
+ # "currency": "usdt",
1225
+ # "total": "7.00000",
1226
+ # "available": "7.00000",
1227
+ # "reserved": "0.00000"
1228
+ # },
1229
+ # ...
1230
+ # ]
1123
1231
  #
1124
1232
  return self.parse_balance(response)
1125
1233
 
1126
- def fetch_trading_fee(self, symbol: str, params={}):
1234
+ def fetch_trading_fee(self, symbol: str, params={}) -> TradingFeeInterface:
1127
1235
  """
1128
1236
  fetch the trading fees for a market
1129
- :see: https://www.bitstamp.net/api/#tag/Fees/operation/GetAllTradingFees
1237
+
1238
+ https://www.bitstamp.net/api/#tag/Fees/operation/GetTradingFeesForCurrency
1239
+
1130
1240
  :param str symbol: unified market symbol
1131
1241
  :param dict [params]: extra parameters specific to the exchange API endpoint
1132
1242
  :returns dict: a `fee structure <https://docs.ccxt.com/#/?id=fee-structure>`
1133
1243
  """
1134
1244
  self.load_markets()
1135
1245
  market = self.market(symbol)
1136
- request = {
1137
- 'pair': market['id'],
1246
+ request: dict = {
1247
+ 'market_symbol': market['id'],
1138
1248
  }
1139
- response = self.privatePostBalancePair(self.extend(request, params))
1140
- return self.parse_trading_fee(response, market)
1141
-
1142
- def parse_trading_fee(self, fee, market: Market = None):
1143
- market = self.safe_market(None, market)
1144
- feeString = self.safe_string(fee, market['id'] + '_fee')
1145
- dividedFeeString = Precise.string_div(feeString, '100')
1146
- tradeFee = self.parse_number(dividedFeeString)
1249
+ response = self.privatePostFeesTrading(self.extend(request, params))
1250
+ #
1251
+ # [
1252
+ # {
1253
+ # "currency_pair": "btcusd",
1254
+ # "fees":
1255
+ # {
1256
+ # "maker": "0.15000",
1257
+ # "taker": "0.16000"
1258
+ # },
1259
+ # "market": "btcusd"
1260
+ # }
1261
+ # ...
1262
+ # ]
1263
+ #
1264
+ tradingFeesByMarketId = self.index_by(response, 'currency_pair')
1265
+ tradingFee = self.safe_dict(tradingFeesByMarketId, market['id'])
1266
+ return self.parse_trading_fee(tradingFee, market)
1267
+
1268
+ def parse_trading_fee(self, fee: dict, market: Market = None) -> TradingFeeInterface:
1269
+ marketId = self.safe_string(fee, 'market')
1270
+ fees = self.safe_dict(fee, 'fees', {})
1147
1271
  return {
1148
1272
  'info': fee,
1149
- 'symbol': market['symbol'],
1150
- 'maker': tradeFee,
1151
- 'taker': tradeFee,
1273
+ 'symbol': self.safe_symbol(marketId, market),
1274
+ 'maker': self.safe_number(fees, 'maker'),
1275
+ 'taker': self.safe_number(fees, 'taker'),
1276
+ 'percentage': None,
1277
+ 'tierBased': None,
1152
1278
  }
1153
1279
 
1154
1280
  def parse_trading_fees(self, fees):
1155
- result = {'info': fees}
1281
+ result: dict = {'info': fees}
1156
1282
  symbols = self.symbols
1157
1283
  for i in range(0, len(symbols)):
1158
1284
  symbol = symbols[i]
1159
- market = self.market(symbol)
1160
- fee = self.parse_trading_fee(fees, market)
1285
+ fee = self.parse_trading_fee(fees[i])
1161
1286
  result[symbol] = fee
1162
1287
  return result
1163
1288
 
1164
- def fetch_trading_fees(self, params={}):
1289
+ def fetch_trading_fees(self, params={}) -> TradingFees:
1165
1290
  """
1166
1291
  fetch the trading fees for multiple markets
1167
- :see: https://www.bitstamp.net/api/#tag/Fees/operation/GetAllTradingFees
1292
+
1293
+ https://www.bitstamp.net/api/#tag/Fees/operation/GetAllTradingFees
1294
+
1168
1295
  :param dict [params]: extra parameters specific to the exchange API endpoint
1169
1296
  :returns dict: a dictionary of `fee structures <https://docs.ccxt.com/#/?id=fee-structure>` indexed by market symbols
1170
1297
  """
1171
1298
  self.load_markets()
1172
- response = self.privatePostBalance(params)
1299
+ response = self.privatePostFeesTrading(params)
1300
+ #
1301
+ # [
1302
+ # {
1303
+ # "currency_pair": "btcusd",
1304
+ # "fees":
1305
+ # {
1306
+ # "maker": "0.15000",
1307
+ # "taker": "0.16000"
1308
+ # },
1309
+ # "market": "btcusd"
1310
+ # }
1311
+ # ...
1312
+ # ]
1313
+ #
1173
1314
  return self.parse_trading_fees(response)
1174
1315
 
1175
- def fetch_transaction_fees(self, codes: List[str] = None, params={}):
1316
+ def fetch_transaction_fees(self, codes: Strings = None, params={}):
1176
1317
  """
1177
- * @deprecated
1318
+ @deprecated
1178
1319
  please use fetchDepositWithdrawFees instead
1179
- :see: https://www.bitstamp.net/api/#balance
1320
+
1321
+ https://www.bitstamp.net/api/#tag/Fees
1322
+
1180
1323
  :param str[]|None codes: list of unified currency codes
1181
1324
  :param dict [params]: extra parameters specific to the exchange API endpoint
1182
1325
  :returns dict[]: a list of `fee structures <https://docs.ccxt.com/#/?id=fee-structure>`
1183
1326
  """
1184
1327
  self.load_markets()
1185
- balance = self.privatePostBalance(params)
1186
- return self.parse_transaction_fees(balance)
1328
+ response = self.privatePostFeesWithdrawal(params)
1329
+ #
1330
+ # [
1331
+ # {
1332
+ # "currency": "btc",
1333
+ # "fee": "0.00015000",
1334
+ # "network": "bitcoin"
1335
+ # }
1336
+ # ...
1337
+ # ]
1338
+ #
1339
+ return self.parse_transaction_fees(response)
1187
1340
 
1188
1341
  def parse_transaction_fees(self, response, codes=None):
1189
- #
1190
- # {
1191
- # "yfi_available": "0.00000000",
1192
- # "yfi_balance": "0.00000000",
1193
- # "yfi_reserved": "0.00000000",
1194
- # "yfi_withdrawal_fee": "0.00070000",
1195
- # "yfieur_fee": "0.000",
1196
- # "yfiusd_fee": "0.000",
1197
- # "zrx_available": "0.00000000",
1198
- # "zrx_balance": "0.00000000",
1199
- # "zrx_reserved": "0.00000000",
1200
- # "zrx_withdrawal_fee": "12.00000000",
1201
- # "zrxeur_fee": "0.000",
1202
- # "zrxusd_fee": "0.000",
1203
- # ...
1204
- # }
1205
- #
1206
- if codes is None:
1207
- codes = list(self.currencies.keys())
1208
- result = {}
1209
- mainCurrencyId = None
1210
- ids = list(response.keys())
1342
+ result: dict = {}
1343
+ currencies = self.index_by(response, 'currency')
1344
+ ids = list(currencies.keys())
1211
1345
  for i in range(0, len(ids)):
1212
1346
  id = ids[i]
1213
- currencyId = id.split('_')[0]
1214
- code = self.safe_currency_code(currencyId)
1215
- if codes is not None and not self.in_array(code, codes):
1347
+ fees = self.safe_value(response, i, {})
1348
+ code = self.safe_currency_code(id)
1349
+ if (codes is not None) and not self.in_array(code, codes):
1216
1350
  continue
1217
- if id.find('_available') >= 0:
1218
- mainCurrencyId = currencyId
1219
- result[code] = {
1220
- 'deposit': None,
1221
- 'withdraw': None,
1222
- 'info': {},
1223
- }
1224
- if currencyId == mainCurrencyId:
1225
- result[code]['info'][id] = self.safe_number(response, id)
1226
- if id.find('_withdrawal_fee') >= 0:
1227
- result[code]['withdraw'] = self.safe_number(response, id)
1351
+ result[code] = {
1352
+ 'withdraw_fee': self.safe_number(fees, 'fee'),
1353
+ 'deposit': {},
1354
+ 'info': self.safe_dict(currencies, id),
1355
+ }
1228
1356
  return result
1229
1357
 
1230
- def fetch_deposit_withdraw_fees(self, codes: Strings = None, params={}):
1358
+ def fetch_deposit_withdraw_fees(self, codes=None, params={}):
1231
1359
  """
1232
1360
  fetch deposit and withdraw fees
1233
- :see: https://www.bitstamp.net/api/#tag/Fees/operation/GetAllWithdrawalFees
1361
+
1362
+ https://www.bitstamp.net/api/#tag/Fees/operation/GetAllWithdrawalFees
1363
+
1234
1364
  :param str[]|None codes: list of unified currency codes
1235
1365
  :param dict [params]: extra parameters specific to the exchange API endpoint
1236
1366
  :returns dict[]: a list of `fee structures <https://docs.ccxt.com/#/?id=fee-structure>`
1237
1367
  """
1238
1368
  self.load_markets()
1239
- response = self.privatePostBalance(params)
1369
+ response = self.privatePostFeesWithdrawal(params)
1240
1370
  #
1241
- # {
1242
- # "yfi_available": "0.00000000",
1243
- # "yfi_balance": "0.00000000",
1244
- # "yfi_reserved": "0.00000000",
1245
- # "yfi_withdrawal_fee": "0.00070000",
1246
- # "yfieur_fee": "0.000",
1247
- # "yfiusd_fee": "0.000",
1248
- # "zrx_available": "0.00000000",
1249
- # "zrx_balance": "0.00000000",
1250
- # "zrx_reserved": "0.00000000",
1251
- # "zrx_withdrawal_fee": "12.00000000",
1252
- # "zrxeur_fee": "0.000",
1253
- # "zrxusd_fee": "0.000",
1254
- # ...
1255
- # }
1371
+ # [
1372
+ # {
1373
+ # "currency": "btc",
1374
+ # "fee": "0.00015000",
1375
+ # "network": "bitcoin"
1376
+ # }
1377
+ # ...
1378
+ # ]
1256
1379
  #
1257
- return self.parse_deposit_withdraw_fees(response, codes)
1380
+ responseByCurrencyId = self.group_by(response, 'currency')
1381
+ return self.parse_deposit_withdraw_fees(responseByCurrencyId, codes)
1258
1382
 
1259
- def parse_deposit_withdraw_fees(self, response, codes=None, currencyIdKey=None):
1260
- #
1261
- # {
1262
- # "yfi_available": "0.00000000",
1263
- # "yfi_balance": "0.00000000",
1264
- # "yfi_reserved": "0.00000000",
1265
- # "yfi_withdrawal_fee": "0.00070000",
1266
- # "yfieur_fee": "0.000",
1267
- # "yfiusd_fee": "0.000",
1268
- # "zrx_available": "0.00000000",
1269
- # "zrx_balance": "0.00000000",
1270
- # "zrx_reserved": "0.00000000",
1271
- # "zrx_withdrawal_fee": "12.00000000",
1272
- # "zrxeur_fee": "0.000",
1273
- # "zrxusd_fee": "0.000",
1274
- # ...
1275
- # }
1276
- #
1277
- result = {}
1278
- ids = list(response.keys())
1279
- for i in range(0, len(ids)):
1280
- id = ids[i]
1281
- currencyId = id.split('_')[0]
1282
- code = self.safe_currency_code(currencyId)
1283
- dictValue = self.safe_number(response, id)
1284
- if codes is not None and not self.in_array(code, codes):
1285
- continue
1286
- if id.find('_available') >= 0:
1287
- result[code] = self.deposit_withdraw_fee({})
1288
- if id.find('_withdrawal_fee') >= 0:
1289
- result[code]['withdraw']['fee'] = dictValue
1290
- resultValue = self.safe_value(result, code)
1291
- if resultValue is not None:
1292
- result[code]['info'][id] = dictValue
1383
+ def parse_deposit_withdraw_fee(self, fee, currency=None):
1384
+ result = self.deposit_withdraw_fee(fee)
1385
+ for j in range(0, len(fee)):
1386
+ networkEntry = fee[j]
1387
+ networkId = self.safe_string(networkEntry, 'network')
1388
+ networkCode = self.network_id_to_code(networkId)
1389
+ withdrawFee = self.safe_number(networkEntry, 'fee')
1390
+ result['withdraw'] = {
1391
+ 'fee': withdrawFee,
1392
+ 'percentage': None,
1393
+ }
1394
+ result['networks'][networkCode] = {
1395
+ 'withdraw': {
1396
+ 'fee': withdrawFee,
1397
+ 'percentage': None,
1398
+ },
1399
+ 'deposit': {
1400
+ 'fee': None,
1401
+ 'percentage': None,
1402
+ },
1403
+ }
1293
1404
  return result
1294
1405
 
1295
1406
  def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
1296
1407
  """
1297
1408
  create a trade order
1298
- :see: https://www.bitstamp.net/api/#tag/Orders/operation/OpenInstantBuyOrder
1299
- :see: https://www.bitstamp.net/api/#tag/Orders/operation/OpenMarketBuyOrder
1300
- :see: https://www.bitstamp.net/api/#tag/Orders/operation/OpenLimitBuyOrder
1301
- :see: https://www.bitstamp.net/api/#tag/Orders/operation/OpenInstantSellOrder
1302
- :see: https://www.bitstamp.net/api/#tag/Orders/operation/OpenMarketSellOrder
1303
- :see: https://www.bitstamp.net/api/#tag/Orders/operation/OpenLimitSellOrder
1409
+
1410
+ https://www.bitstamp.net/api/#tag/Orders/operation/OpenInstantBuyOrder
1411
+ https://www.bitstamp.net/api/#tag/Orders/operation/OpenMarketBuyOrder
1412
+ https://www.bitstamp.net/api/#tag/Orders/operation/OpenLimitBuyOrder
1413
+ https://www.bitstamp.net/api/#tag/Orders/operation/OpenInstantSellOrder
1414
+ https://www.bitstamp.net/api/#tag/Orders/operation/OpenMarketSellOrder
1415
+ https://www.bitstamp.net/api/#tag/Orders/operation/OpenLimitSellOrder
1416
+
1304
1417
  :param str symbol: unified symbol of the market to create an order in
1305
1418
  :param str type: 'market' or 'limit'
1306
1419
  :param str side: 'buy' or 'sell'
1307
1420
  :param float amount: how much of currency you want to trade in units of base currency
1308
- :param float [price]: the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
1421
+ :param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
1309
1422
  :param dict [params]: extra parameters specific to the exchange API endpoint
1310
1423
  :returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
1311
1424
  """
1312
1425
  self.load_markets()
1313
1426
  market = self.market(symbol)
1314
- request = {
1427
+ request: dict = {
1315
1428
  'pair': market['id'],
1316
1429
  'amount': self.amount_to_precision(symbol, amount),
1317
1430
  }
@@ -1344,30 +1457,44 @@ class bitstamp(Exchange, ImplicitAPI):
1344
1457
  def cancel_order(self, id: str, symbol: Str = None, params={}):
1345
1458
  """
1346
1459
  cancels an open order
1347
- :see: https://www.bitstamp.net/api/#tag/Orders/operation/CancelOrder
1460
+
1461
+ https://www.bitstamp.net/api/#tag/Orders/operation/CancelOrder
1462
+
1348
1463
  :param str id: order id
1349
1464
  :param str symbol: unified symbol of the market the order was made in
1350
1465
  :param dict [params]: extra parameters specific to the exchange API endpoint
1351
1466
  :returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
1352
1467
  """
1353
1468
  self.load_markets()
1354
- request = {
1469
+ request: dict = {
1355
1470
  'id': id,
1356
1471
  }
1357
- return self.privatePostCancelOrder(self.extend(request, params))
1472
+ response = self.privatePostCancelOrder(self.extend(request, params))
1473
+ #
1474
+ # {
1475
+ # "id": 1453282316578816,
1476
+ # "amount": "0.02035278",
1477
+ # "price": "2100.45",
1478
+ # "type": 0,
1479
+ # "market": "BTC/USD"
1480
+ # }
1481
+ #
1482
+ return self.parse_order(response)
1358
1483
 
1359
1484
  def cancel_all_orders(self, symbol: Str = None, params={}):
1360
1485
  """
1361
1486
  cancel all open orders
1362
- :see: https://www.bitstamp.net/api/#tag/Orders/operation/CancelAllOrders
1363
- :see: https://www.bitstamp.net/api/#tag/Orders/operation/CancelOrdersForMarket
1487
+
1488
+ https://www.bitstamp.net/api/#tag/Orders/operation/CancelAllOrders
1489
+ https://www.bitstamp.net/api/#tag/Orders/operation/CancelOrdersForMarket
1490
+
1364
1491
  :param str symbol: unified market symbol, only orders in the market of self symbol are cancelled when symbol is not None
1365
1492
  :param dict [params]: extra parameters specific to the exchange API endpoint
1366
1493
  :returns dict[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
1367
1494
  """
1368
1495
  self.load_markets()
1369
1496
  market = None
1370
- request = {}
1497
+ request: dict = {}
1371
1498
  response = None
1372
1499
  if symbol is not None:
1373
1500
  market = self.market(symbol)
@@ -1375,10 +1502,26 @@ class bitstamp(Exchange, ImplicitAPI):
1375
1502
  response = self.privatePostCancelAllOrdersPair(self.extend(request, params))
1376
1503
  else:
1377
1504
  response = self.privatePostCancelAllOrders(self.extend(request, params))
1378
- return response
1505
+ #
1506
+ # {
1507
+ # "canceled": [
1508
+ # {
1509
+ # "id": 1453282316578816,
1510
+ # "amount": "0.02035278",
1511
+ # "price": "2100.45",
1512
+ # "type": 0,
1513
+ # "currency_pair": "BTC/USD",
1514
+ # "market": "BTC/USD"
1515
+ # }
1516
+ # ],
1517
+ # "success": True
1518
+ # }
1519
+ #
1520
+ canceled = self.safe_list(response, 'canceled')
1521
+ return self.parse_orders(canceled)
1379
1522
 
1380
- def parse_order_status(self, status):
1381
- statuses = {
1523
+ def parse_order_status(self, status: Str):
1524
+ statuses: dict = {
1382
1525
  'In Queue': 'open',
1383
1526
  'Open': 'open',
1384
1527
  'Finished': 'closed',
@@ -1389,7 +1532,7 @@ class bitstamp(Exchange, ImplicitAPI):
1389
1532
  def fetch_order_status(self, id: str, symbol: Str = None, params={}):
1390
1533
  self.load_markets()
1391
1534
  clientOrderId = self.safe_value_2(params, 'client_order_id', 'clientOrderId')
1392
- request = {}
1535
+ request: dict = {}
1393
1536
  if clientOrderId is not None:
1394
1537
  request['client_order_id'] = clientOrderId
1395
1538
  params = self.omit(params, ['client_order_id', 'clientOrderId'])
@@ -1401,7 +1544,10 @@ class bitstamp(Exchange, ImplicitAPI):
1401
1544
  def fetch_order(self, id: str, symbol: Str = None, params={}):
1402
1545
  """
1403
1546
  fetches information on an order made by the user
1404
- :see: https://www.bitstamp.net/api/#tag/Orders/operation/GetOrderStatus
1547
+
1548
+ https://www.bitstamp.net/api/#tag/Orders/operation/GetOrderStatus
1549
+
1550
+ :param str id: the order id
1405
1551
  :param str symbol: unified symbol of the market the order was made in
1406
1552
  :param dict [params]: extra parameters specific to the exchange API endpoint
1407
1553
  :returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
@@ -1411,7 +1557,7 @@ class bitstamp(Exchange, ImplicitAPI):
1411
1557
  if symbol is not None:
1412
1558
  market = self.market(symbol)
1413
1559
  clientOrderId = self.safe_value_2(params, 'client_order_id', 'clientOrderId')
1414
- request = {}
1560
+ request: dict = {}
1415
1561
  if clientOrderId is not None:
1416
1562
  request['client_order_id'] = clientOrderId
1417
1563
  params = self.omit(params, ['client_order_id', 'clientOrderId'])
@@ -1441,8 +1587,10 @@ class bitstamp(Exchange, ImplicitAPI):
1441
1587
  def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
1442
1588
  """
1443
1589
  fetch all trades made by the user
1444
- :see: https://www.bitstamp.net/api/#tag/Transactions-private/operation/GetUserTransactions
1445
- :see: https://www.bitstamp.net/api/#tag/Transactions-private/operation/GetUserTransactionsForMarket
1590
+
1591
+ https://www.bitstamp.net/api/#tag/Transactions-private/operation/GetUserTransactions
1592
+ https://www.bitstamp.net/api/#tag/Transactions-private/operation/GetUserTransactionsForMarket
1593
+
1446
1594
  :param str symbol: unified market symbol
1447
1595
  :param int [since]: the earliest time in ms to fetch trades for
1448
1596
  :param int [limit]: the maximum number of trades structures to retrieve
@@ -1450,7 +1598,7 @@ class bitstamp(Exchange, ImplicitAPI):
1450
1598
  :returns Trade[]: a list of `trade structures <https://docs.ccxt.com/#/?id=trade-structure>`
1451
1599
  """
1452
1600
  self.load_markets()
1453
- request = {}
1601
+ request: dict = {}
1454
1602
  method = 'privatePostUserTransactions'
1455
1603
  market = None
1456
1604
  if symbol is not None:
@@ -1466,7 +1614,9 @@ class bitstamp(Exchange, ImplicitAPI):
1466
1614
  def fetch_deposits_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
1467
1615
  """
1468
1616
  fetch history of deposits and withdrawals
1469
- :see: https://www.bitstamp.net/api/#tag/Transactions-private/operation/GetUserTransactions
1617
+
1618
+ https://www.bitstamp.net/api/#tag/Transactions-private/operation/GetUserTransactions
1619
+
1470
1620
  :param str [code]: unified currency code for the currency of the deposit/withdrawals, default is None
1471
1621
  :param int [since]: timestamp in ms of the earliest deposit/withdrawal, default is None
1472
1622
  :param int [limit]: max number of deposit/withdrawals to return, default is None
@@ -1474,7 +1624,7 @@ class bitstamp(Exchange, ImplicitAPI):
1474
1624
  :returns dict: a list of `transaction structure <https://docs.ccxt.com/#/?id=transaction-structure>`
1475
1625
  """
1476
1626
  self.load_markets()
1477
- request = {}
1627
+ request: dict = {}
1478
1628
  if limit is not None:
1479
1629
  request['limit'] = limit
1480
1630
  response = self.privatePostUserTransactions(self.extend(request, params))
@@ -1513,7 +1663,9 @@ class bitstamp(Exchange, ImplicitAPI):
1513
1663
  def fetch_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
1514
1664
  """
1515
1665
  fetch all withdrawals made from an account
1516
- :see: https://www.bitstamp.net/api/#tag/Withdrawals/operation/GetWithdrawalRequests
1666
+
1667
+ https://www.bitstamp.net/api/#tag/Withdrawals/operation/GetWithdrawalRequests
1668
+
1517
1669
  :param str code: unified currency code
1518
1670
  :param int [since]: the earliest time in ms to fetch withdrawals for
1519
1671
  :param int [limit]: the maximum number of withdrawals structures to retrieve
@@ -1521,7 +1673,7 @@ class bitstamp(Exchange, ImplicitAPI):
1521
1673
  :returns dict[]: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
1522
1674
  """
1523
1675
  self.load_markets()
1524
- request = {}
1676
+ request: dict = {}
1525
1677
  if since is not None:
1526
1678
  request['timedelta'] = self.milliseconds() - since
1527
1679
  else:
@@ -1553,7 +1705,7 @@ class bitstamp(Exchange, ImplicitAPI):
1553
1705
  #
1554
1706
  return self.parse_transactions(response, None, since, limit)
1555
1707
 
1556
- def parse_transaction(self, transaction, currency: Currency = None) -> Transaction:
1708
+ def parse_transaction(self, transaction: dict, currency: Currency = None) -> Transaction:
1557
1709
  #
1558
1710
  # fetchDepositsWithdrawals
1559
1711
  #
@@ -1667,12 +1819,12 @@ class bitstamp(Exchange, ImplicitAPI):
1667
1819
  'fee': fee,
1668
1820
  }
1669
1821
 
1670
- def parse_transaction_status(self, status):
1822
+ def parse_transaction_status(self, status: Str):
1671
1823
  #
1672
1824
  # withdrawals:
1673
1825
  # 0(open), 1(in process), 2(finished), 3(canceled) or 4(failed).
1674
1826
  #
1675
- statuses = {
1827
+ statuses: dict = {
1676
1828
  '0': 'pending', # Open
1677
1829
  '1': 'pending', # In process
1678
1830
  '2': 'ok', # Finished
@@ -1681,7 +1833,7 @@ class bitstamp(Exchange, ImplicitAPI):
1681
1833
  }
1682
1834
  return self.safe_string(statuses, status, status)
1683
1835
 
1684
- def parse_order(self, order, market: Market = None) -> Order:
1836
+ def parse_order(self, order: dict, market: Market = None) -> Order:
1685
1837
  #
1686
1838
  # from fetch order:
1687
1839
  # {status: "Finished",
@@ -1721,6 +1873,16 @@ class bitstamp(Exchange, ImplicitAPI):
1721
1873
  # "id": "2814205012"
1722
1874
  # }
1723
1875
  #
1876
+ # cancelOrder
1877
+ #
1878
+ # {
1879
+ # "id": 1453282316578816,
1880
+ # "amount": "0.02035278",
1881
+ # "price": "2100.45",
1882
+ # "type": 0,
1883
+ # "market": "BTC/USD"
1884
+ # }
1885
+ #
1724
1886
  id = self.safe_string(order, 'id')
1725
1887
  clientOrderId = self.safe_string(order, 'client_order_id')
1726
1888
  side = self.safe_string(order, 'type')
@@ -1747,7 +1909,6 @@ class bitstamp(Exchange, ImplicitAPI):
1747
1909
  'postOnly': None,
1748
1910
  'side': side,
1749
1911
  'price': price,
1750
- 'stopPrice': None,
1751
1912
  'triggerPrice': None,
1752
1913
  'cost': None,
1753
1914
  'amount': amount,
@@ -1760,7 +1921,7 @@ class bitstamp(Exchange, ImplicitAPI):
1760
1921
  }, market)
1761
1922
 
1762
1923
  def parse_ledger_entry_type(self, type):
1763
- types = {
1924
+ types: dict = {
1764
1925
  '0': 'transaction',
1765
1926
  '1': 'transaction',
1766
1927
  '2': 'trade',
@@ -1768,7 +1929,7 @@ class bitstamp(Exchange, ImplicitAPI):
1768
1929
  }
1769
1930
  return self.safe_string(types, type, type)
1770
1931
 
1771
- def parse_ledger_entry(self, item, currency: Currency = None):
1932
+ def parse_ledger_entry(self, item: dict, currency: Currency = None) -> LedgerEntry:
1772
1933
  #
1773
1934
  # [
1774
1935
  # {
@@ -1809,9 +1970,9 @@ class bitstamp(Exchange, ImplicitAPI):
1809
1970
  if market is None:
1810
1971
  market = self.get_market_from_trade(item)
1811
1972
  direction = 'in' if (parsedTrade['side'] == 'buy') else 'out'
1812
- return {
1813
- 'id': parsedTrade['id'],
1973
+ return self.safe_ledger_entry({
1814
1974
  'info': item,
1975
+ 'id': parsedTrade['id'],
1815
1976
  'timestamp': parsedTrade['timestamp'],
1816
1977
  'datetime': parsedTrade['datetime'],
1817
1978
  'direction': direction,
@@ -1825,7 +1986,7 @@ class bitstamp(Exchange, ImplicitAPI):
1825
1986
  'after': None,
1826
1987
  'status': 'ok',
1827
1988
  'fee': parsedTrade['fee'],
1828
- }
1989
+ }, currency)
1829
1990
  else:
1830
1991
  parsedTransaction = self.parse_transaction(item, currency)
1831
1992
  direction = None
@@ -1837,9 +1998,9 @@ class bitstamp(Exchange, ImplicitAPI):
1837
1998
  currency = self.currency(currencyCode)
1838
1999
  amount = self.safe_string(item, currency['id'])
1839
2000
  direction = 'in' if Precise.string_gt(amount, '0') else 'out'
1840
- return {
1841
- 'id': parsedTransaction['id'],
2001
+ return self.safe_ledger_entry({
1842
2002
  'info': item,
2003
+ 'id': parsedTransaction['id'],
1843
2004
  'timestamp': parsedTransaction['timestamp'],
1844
2005
  'datetime': parsedTransaction['datetime'],
1845
2006
  'direction': direction,
@@ -1853,20 +2014,22 @@ class bitstamp(Exchange, ImplicitAPI):
1853
2014
  'after': None,
1854
2015
  'status': parsedTransaction['status'],
1855
2016
  'fee': parsedTransaction['fee'],
1856
- }
2017
+ }, currency)
1857
2018
 
1858
- def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
2019
+ def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[LedgerEntry]:
1859
2020
  """
1860
- fetch the history of changes, actions done by the user or operations that altered balance of the user
1861
- :see: https://www.bitstamp.net/api/#tag/Transactions-private/operation/GetUserTransactions
1862
- :param str code: unified currency code, default is None
2021
+ fetch the history of changes, actions done by the user or operations that altered the balance of the user
2022
+
2023
+ https://www.bitstamp.net/api/#tag/Transactions-private/operation/GetUserTransactions
2024
+
2025
+ :param str [code]: unified currency code, default is None
1863
2026
  :param int [since]: timestamp in ms of the earliest ledger entry, default is None
1864
- :param int [limit]: max number of ledger entrys to return, default is None
2027
+ :param int [limit]: max number of ledger entries to return, default is None
1865
2028
  :param dict [params]: extra parameters specific to the exchange API endpoint
1866
- :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger-structure>`
2029
+ :returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger>`
1867
2030
  """
1868
2031
  self.load_markets()
1869
- request = {}
2032
+ request: dict = {}
1870
2033
  if limit is not None:
1871
2034
  request['limit'] = limit
1872
2035
  response = self.privatePostUserTransactions(self.extend(request, params))
@@ -1878,8 +2041,10 @@ class bitstamp(Exchange, ImplicitAPI):
1878
2041
  def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
1879
2042
  """
1880
2043
  fetch all unfilled currently open orders
1881
- :see: https://www.bitstamp.net/api/#tag/Orders/operation/GetAllOpenOrders
1882
- :see: https://www.bitstamp.net/api/#tag/Orders/operation/GetOpenOrdersForMarket
2044
+
2045
+ https://www.bitstamp.net/api/#tag/Orders/operation/GetAllOpenOrders
2046
+ https://www.bitstamp.net/api/#tag/Orders/operation/GetOpenOrdersForMarket
2047
+
1883
2048
  :param str symbol: unified market symbol
1884
2049
  :param int [since]: the earliest time in ms to fetch open orders for
1885
2050
  :param int [limit]: the maximum number of open orders structures to retrieve
@@ -1911,7 +2076,7 @@ class bitstamp(Exchange, ImplicitAPI):
1911
2076
 
1912
2077
  def get_currency_name(self, code):
1913
2078
  """
1914
- * @ignore
2079
+ @ignore
1915
2080
  :param str code: Unified currency code
1916
2081
  :returns str: lowercase version of code
1917
2082
  """
@@ -1920,10 +2085,12 @@ class bitstamp(Exchange, ImplicitAPI):
1920
2085
  def is_fiat(self, code):
1921
2086
  return code == 'USD' or code == 'EUR' or code == 'GBP'
1922
2087
 
1923
- def fetch_deposit_address(self, code: str, params={}):
2088
+ def fetch_deposit_address(self, code: str, params={}) -> DepositAddress:
1924
2089
  """
1925
2090
  fetch the deposit address for a currency associated with self account
1926
- :see: https://www.bitstamp.net/api/#tag/Deposits/operation/GetCryptoDepositAddress
2091
+
2092
+ https://www.bitstamp.net/api/#tag/Deposits/operation/GetCryptoDepositAddress
2093
+
1927
2094
  :param str code: unified currency code
1928
2095
  :param dict [params]: extra parameters specific to the exchange API endpoint
1929
2096
  :returns dict: an `address structure <https://docs.ccxt.com/#/?id=address-structure>`
@@ -1937,18 +2104,20 @@ class bitstamp(Exchange, ImplicitAPI):
1937
2104
  tag = self.safe_string_2(response, 'memo_id', 'destination_tag')
1938
2105
  self.check_address(address)
1939
2106
  return {
2107
+ 'info': response,
1940
2108
  'currency': code,
2109
+ 'network': None,
1941
2110
  'address': address,
1942
2111
  'tag': tag,
1943
- 'network': None,
1944
- 'info': response,
1945
2112
  }
1946
2113
 
1947
- def withdraw(self, code: str, amount: float, address, tag=None, params={}):
2114
+ def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
1948
2115
  """
1949
2116
  make a withdrawal
1950
- :see: https://www.bitstamp.net/api/#tag/Withdrawals/operation/RequestFiatWithdrawal
1951
- :see: https://www.bitstamp.net/api/#tag/Withdrawals/operation/RequestCryptoWithdrawal
2117
+
2118
+ https://www.bitstamp.net/api/#tag/Withdrawals/operation/RequestFiatWithdrawal
2119
+ https://www.bitstamp.net/api/#tag/Withdrawals/operation/RequestCryptoWithdrawal
2120
+
1952
2121
  :param str code: unified currency code
1953
2122
  :param float amount: the amount to withdraw
1954
2123
  :param str address: the address to withdraw to
@@ -1961,7 +2130,7 @@ class bitstamp(Exchange, ImplicitAPI):
1961
2130
  tag, params = self.handle_withdraw_tag_and_params(tag, params)
1962
2131
  self.load_markets()
1963
2132
  self.check_address(address)
1964
- request = {
2133
+ request: dict = {
1965
2134
  'amount': amount,
1966
2135
  }
1967
2136
  currency = None
@@ -1987,8 +2156,10 @@ class bitstamp(Exchange, ImplicitAPI):
1987
2156
  def transfer(self, code: str, amount: float, fromAccount: str, toAccount: str, params={}) -> TransferEntry:
1988
2157
  """
1989
2158
  transfer currency internally between wallets on the same account
1990
- :see: https://www.bitstamp.net/api/#tag/Sub-account/operation/TransferFromMainToSub
1991
- :see: https://www.bitstamp.net/api/#tag/Sub-account/operation/TransferFromSubToMain
2159
+
2160
+ https://www.bitstamp.net/api/#tag/Sub-account/operation/TransferFromMainToSub
2161
+ https://www.bitstamp.net/api/#tag/Sub-account/operation/TransferFromSubToMain
2162
+
1992
2163
  :param str code: unified currency code
1993
2164
  :param float amount: amount to transfer
1994
2165
  :param str fromAccount: account to transfer from
@@ -1998,10 +2169,8 @@ class bitstamp(Exchange, ImplicitAPI):
1998
2169
  """
1999
2170
  self.load_markets()
2000
2171
  currency = self.currency(code)
2001
- amount = self.currency_to_precision(code, amount)
2002
- amount = self.parse_to_numeric(amount)
2003
- request = {
2004
- 'amount': amount,
2172
+ request: dict = {
2173
+ 'amount': self.parse_to_numeric(self.currency_to_precision(code, amount)),
2005
2174
  'currency': currency['id'].upper(),
2006
2175
  }
2007
2176
  response = None
@@ -2039,8 +2208,8 @@ class bitstamp(Exchange, ImplicitAPI):
2039
2208
  'status': self.parse_transfer_status(status),
2040
2209
  }
2041
2210
 
2042
- def parse_transfer_status(self, status):
2043
- statuses = {
2211
+ def parse_transfer_status(self, status: Str) -> Str:
2212
+ statuses: dict = {
2044
2213
  'ok': 'ok',
2045
2214
  'error': 'failed',
2046
2215
  }
@@ -2089,7 +2258,7 @@ class bitstamp(Exchange, ImplicitAPI):
2089
2258
  headers['X-Auth-Signature'] = signature
2090
2259
  return {'url': url, 'method': method, 'body': body, 'headers': headers}
2091
2260
 
2092
- def handle_errors(self, httpCode, reason, url, method, headers, body, response, requestHeaders, requestBody):
2261
+ def handle_errors(self, httpCode: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
2093
2262
  if response is None:
2094
2263
  return None
2095
2264
  #