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.
- ccxt/__init__.py +36 -14
- ccxt/abstract/alpaca.py +4 -0
- ccxt/abstract/bigone.py +1 -1
- ccxt/abstract/binance.py +112 -48
- ccxt/abstract/binancecoinm.py +112 -48
- ccxt/abstract/binanceus.py +147 -83
- ccxt/abstract/binanceusdm.py +112 -48
- ccxt/abstract/bingx.py +133 -78
- ccxt/abstract/bitbank.py +5 -0
- ccxt/abstract/bitfinex.py +136 -65
- ccxt/abstract/bitfinex1.py +69 -0
- ccxt/abstract/bitflyer.py +1 -0
- ccxt/abstract/bitget.py +8 -1
- ccxt/abstract/bitmart.py +13 -1
- ccxt/abstract/bitopro.py +1 -0
- ccxt/abstract/bitpanda.py +0 -12
- ccxt/abstract/bitrue.py +3 -3
- ccxt/abstract/bitstamp.py +26 -3
- ccxt/abstract/blofin.py +24 -0
- ccxt/abstract/btcbox.py +1 -0
- ccxt/abstract/bybit.py +29 -14
- ccxt/abstract/cex.py +28 -29
- ccxt/abstract/coinbase.py +6 -0
- ccxt/abstract/coinbaseadvanced.py +94 -0
- ccxt/abstract/{coinbasepro.py → coinbaseexchange.py} +1 -0
- ccxt/abstract/coinbaseinternational.py +1 -1
- ccxt/abstract/coincatch.py +94 -0
- ccxt/abstract/coinex.py +233 -123
- ccxt/abstract/coinmetro.py +1 -0
- ccxt/abstract/cryptocom.py +14 -0
- ccxt/abstract/defx.py +69 -0
- ccxt/abstract/deribit.py +1 -0
- ccxt/abstract/digifinex.py +1 -0
- ccxt/abstract/ellipx.py +25 -0
- ccxt/abstract/gate.py +20 -0
- ccxt/abstract/gateio.py +20 -0
- ccxt/abstract/gemini.py +1 -0
- ccxt/abstract/hashkey.py +67 -0
- ccxt/abstract/hyperliquid.py +1 -1
- ccxt/abstract/independentreserve.py +6 -0
- ccxt/abstract/kraken.py +4 -3
- ccxt/abstract/krakenfutures.py +4 -0
- ccxt/abstract/kucoin.py +25 -0
- ccxt/abstract/kucoinfutures.py +35 -0
- ccxt/abstract/luno.py +2 -0
- ccxt/abstract/mexc.py +4 -0
- ccxt/abstract/myokx.py +340 -0
- ccxt/abstract/oceanex.py +5 -0
- ccxt/abstract/okx.py +30 -0
- ccxt/abstract/onetrading.py +0 -12
- ccxt/abstract/oxfun.py +34 -0
- ccxt/abstract/paradex.py +40 -0
- ccxt/abstract/phemex.py +1 -0
- ccxt/abstract/upbit.py +4 -0
- ccxt/abstract/vertex.py +19 -0
- ccxt/abstract/whitebit.py +31 -1
- ccxt/abstract/woo.py +6 -2
- ccxt/abstract/woofipro.py +119 -0
- ccxt/abstract/xt.py +153 -0
- ccxt/abstract/zonda.py +6 -0
- ccxt/ace.py +164 -60
- ccxt/alpaca.py +727 -63
- ccxt/ascendex.py +395 -249
- ccxt/async_support/__init__.py +36 -14
- ccxt/async_support/ace.py +164 -60
- ccxt/async_support/alpaca.py +727 -63
- ccxt/async_support/ascendex.py +396 -249
- ccxt/async_support/base/exchange.py +531 -155
- ccxt/async_support/base/ws/aiohttp_client.py +28 -5
- ccxt/async_support/base/ws/cache.py +3 -2
- ccxt/async_support/base/ws/client.py +26 -5
- ccxt/async_support/base/ws/fast_client.py +4 -3
- ccxt/async_support/base/ws/functions.py +1 -1
- ccxt/async_support/base/ws/future.py +40 -31
- ccxt/async_support/base/ws/order_book_side.py +3 -0
- ccxt/async_support/bequant.py +1 -1
- ccxt/async_support/bigone.py +329 -202
- ccxt/async_support/binance.py +3513 -1511
- ccxt/async_support/binancecoinm.py +2 -1
- ccxt/async_support/binanceus.py +12 -1
- ccxt/async_support/binanceusdm.py +3 -1
- ccxt/async_support/bingx.py +3105 -881
- ccxt/async_support/bit2c.py +119 -38
- ccxt/async_support/bitbank.py +215 -76
- ccxt/async_support/bitbns.py +124 -53
- ccxt/async_support/bitfinex.py +3236 -1078
- ccxt/async_support/bitfinex1.py +1711 -0
- ccxt/async_support/bitflyer.py +239 -50
- ccxt/async_support/bitget.py +1513 -563
- ccxt/async_support/bithumb.py +201 -67
- ccxt/async_support/bitmart.py +1320 -435
- ccxt/async_support/bitmex.py +308 -111
- ccxt/async_support/bitopro.py +256 -96
- ccxt/async_support/bitrue.py +365 -233
- ccxt/async_support/bitso.py +201 -89
- ccxt/async_support/bitstamp.py +438 -269
- ccxt/async_support/bitteam.py +179 -73
- ccxt/async_support/bitvavo.py +180 -70
- ccxt/async_support/bl3p.py +92 -25
- ccxt/async_support/blockchaincom.py +193 -79
- ccxt/async_support/blofin.py +403 -150
- ccxt/async_support/btcalpha.py +161 -55
- ccxt/async_support/btcbox.py +250 -34
- ccxt/async_support/btcmarkets.py +232 -85
- ccxt/async_support/btcturk.py +159 -60
- ccxt/async_support/bybit.py +2326 -1255
- ccxt/async_support/cex.py +1409 -1329
- ccxt/async_support/coinbase.py +1455 -288
- ccxt/async_support/coinbaseadvanced.py +17 -0
- ccxt/async_support/{coinbasepro.py → coinbaseexchange.py} +233 -99
- ccxt/async_support/coinbaseinternational.py +428 -88
- ccxt/async_support/coincatch.py +5152 -0
- ccxt/async_support/coincheck.py +121 -38
- ccxt/async_support/coinex.py +4020 -3339
- ccxt/async_support/coinlist.py +273 -116
- ccxt/async_support/coinmate.py +204 -97
- ccxt/async_support/coinmetro.py +203 -110
- ccxt/async_support/coinone.py +142 -68
- ccxt/async_support/coinsph.py +206 -89
- ccxt/async_support/coinspot.py +137 -62
- ccxt/async_support/cryptocom.py +515 -185
- ccxt/async_support/currencycom.py +203 -85
- ccxt/async_support/defx.py +2066 -0
- ccxt/async_support/delta.py +467 -158
- ccxt/async_support/deribit.py +558 -324
- ccxt/async_support/digifinex.py +340 -223
- ccxt/async_support/ellipx.py +1826 -0
- ccxt/async_support/exmo.py +259 -128
- ccxt/async_support/gate.py +1473 -464
- ccxt/async_support/gemini.py +206 -84
- ccxt/async_support/hashkey.py +4164 -0
- ccxt/async_support/hitbtc.py +334 -178
- ccxt/async_support/hollaex.py +134 -83
- ccxt/async_support/htx.py +1095 -563
- ccxt/async_support/huobijp.py +105 -56
- ccxt/async_support/hyperliquid.py +1634 -269
- ccxt/async_support/idex.py +148 -95
- ccxt/async_support/independentreserve.py +236 -31
- ccxt/async_support/indodax.py +165 -62
- ccxt/async_support/kraken.py +871 -354
- ccxt/async_support/krakenfutures.py +324 -100
- ccxt/async_support/kucoin.py +1050 -355
- ccxt/async_support/kucoinfutures.py +1004 -149
- ccxt/async_support/kuna.py +138 -106
- ccxt/async_support/latoken.py +135 -79
- ccxt/async_support/lbank.py +290 -113
- ccxt/async_support/luno.py +112 -62
- ccxt/async_support/lykke.py +104 -55
- ccxt/async_support/mercado.py +36 -29
- ccxt/async_support/mexc.py +995 -429
- ccxt/async_support/myokx.py +43 -0
- ccxt/async_support/ndax.py +163 -82
- ccxt/async_support/novadax.py +121 -75
- ccxt/async_support/oceanex.py +175 -59
- ccxt/async_support/okcoin.py +222 -163
- ccxt/async_support/okx.py +1777 -455
- ccxt/async_support/onetrading.py +132 -414
- ccxt/async_support/oxfun.py +2832 -0
- ccxt/async_support/p2b.py +79 -51
- ccxt/async_support/paradex.py +2017 -0
- ccxt/async_support/paymium.py +56 -32
- ccxt/async_support/phemex.py +572 -196
- ccxt/async_support/poloniex.py +218 -95
- ccxt/async_support/poloniexfutures.py +260 -92
- ccxt/async_support/probit.py +143 -110
- ccxt/async_support/timex.py +123 -70
- ccxt/async_support/tokocrypto.py +129 -93
- ccxt/async_support/tradeogre.py +39 -25
- ccxt/async_support/upbit.py +322 -113
- ccxt/async_support/vertex.py +2983 -0
- ccxt/async_support/wavesexchange.py +227 -173
- ccxt/async_support/wazirx.py +145 -65
- ccxt/async_support/whitebit.py +533 -138
- ccxt/async_support/woo.py +1155 -295
- ccxt/async_support/woofipro.py +2716 -0
- ccxt/async_support/xt.py +4628 -0
- ccxt/async_support/yobit.py +160 -92
- ccxt/async_support/zaif.py +80 -33
- ccxt/async_support/zonda.py +140 -69
- ccxt/base/errors.py +51 -20
- ccxt/base/exchange.py +1729 -482
- ccxt/base/precise.py +10 -0
- ccxt/base/types.py +223 -4
- ccxt/bequant.py +1 -1
- ccxt/bigone.py +329 -202
- ccxt/binance.py +3513 -1511
- ccxt/binancecoinm.py +2 -1
- ccxt/binanceus.py +12 -1
- ccxt/binanceusdm.py +3 -1
- ccxt/bingx.py +3105 -881
- ccxt/bit2c.py +119 -38
- ccxt/bitbank.py +215 -76
- ccxt/bitbns.py +124 -53
- ccxt/bitfinex.py +3235 -1078
- ccxt/bitfinex1.py +1710 -0
- ccxt/bitflyer.py +239 -50
- ccxt/bitget.py +1513 -563
- ccxt/bithumb.py +200 -67
- ccxt/bitmart.py +1320 -435
- ccxt/bitmex.py +308 -111
- ccxt/bitopro.py +256 -96
- ccxt/bitrue.py +365 -233
- ccxt/bitso.py +201 -89
- ccxt/bitstamp.py +438 -269
- ccxt/bitteam.py +179 -73
- ccxt/bitvavo.py +180 -70
- ccxt/bl3p.py +92 -25
- ccxt/blockchaincom.py +193 -79
- ccxt/blofin.py +403 -150
- ccxt/btcalpha.py +161 -55
- ccxt/btcbox.py +250 -34
- ccxt/btcmarkets.py +232 -85
- ccxt/btcturk.py +159 -60
- ccxt/bybit.py +2326 -1255
- ccxt/cex.py +1408 -1329
- ccxt/coinbase.py +1455 -288
- ccxt/coinbaseadvanced.py +17 -0
- ccxt/{coinbasepro.py → coinbaseexchange.py} +233 -99
- ccxt/coinbaseinternational.py +428 -88
- ccxt/coincatch.py +5152 -0
- ccxt/coincheck.py +121 -38
- ccxt/coinex.py +4020 -3339
- ccxt/coinlist.py +273 -116
- ccxt/coinmate.py +204 -97
- ccxt/coinmetro.py +203 -110
- ccxt/coinone.py +142 -68
- ccxt/coinsph.py +206 -89
- ccxt/coinspot.py +137 -62
- ccxt/cryptocom.py +515 -185
- ccxt/currencycom.py +203 -85
- ccxt/defx.py +2065 -0
- ccxt/delta.py +467 -158
- ccxt/deribit.py +558 -324
- ccxt/digifinex.py +340 -223
- ccxt/ellipx.py +1826 -0
- ccxt/exmo.py +259 -128
- ccxt/gate.py +1473 -464
- ccxt/gemini.py +206 -84
- ccxt/hashkey.py +4164 -0
- ccxt/hitbtc.py +334 -178
- ccxt/hollaex.py +134 -83
- ccxt/htx.py +1095 -563
- ccxt/huobijp.py +105 -56
- ccxt/hyperliquid.py +1633 -269
- ccxt/idex.py +148 -95
- ccxt/independentreserve.py +235 -31
- ccxt/indodax.py +165 -62
- ccxt/kraken.py +871 -354
- ccxt/krakenfutures.py +324 -100
- ccxt/kucoin.py +1050 -355
- ccxt/kucoinfutures.py +1004 -149
- ccxt/kuna.py +138 -106
- ccxt/latoken.py +135 -79
- ccxt/lbank.py +290 -113
- ccxt/luno.py +112 -62
- ccxt/lykke.py +104 -55
- ccxt/mercado.py +36 -29
- ccxt/mexc.py +994 -429
- ccxt/myokx.py +43 -0
- ccxt/ndax.py +163 -82
- ccxt/novadax.py +121 -75
- ccxt/oceanex.py +175 -59
- ccxt/okcoin.py +222 -163
- ccxt/okx.py +1777 -455
- ccxt/onetrading.py +132 -414
- ccxt/oxfun.py +2831 -0
- ccxt/p2b.py +79 -51
- ccxt/paradex.py +2017 -0
- ccxt/paymium.py +56 -32
- ccxt/phemex.py +572 -196
- ccxt/poloniex.py +218 -95
- ccxt/poloniexfutures.py +260 -92
- ccxt/pro/__init__.py +29 -5
- ccxt/pro/alpaca.py +32 -17
- ccxt/pro/ascendex.py +63 -15
- ccxt/pro/bequant.py +4 -0
- ccxt/pro/binance.py +1596 -329
- ccxt/pro/binancecoinm.py +1 -0
- ccxt/pro/binanceus.py +2 -9
- ccxt/pro/binanceusdm.py +2 -0
- ccxt/pro/bingx.py +527 -134
- ccxt/pro/bitcoincom.py +4 -1
- ccxt/pro/bitfinex.py +731 -266
- ccxt/pro/bitfinex1.py +635 -0
- ccxt/pro/bitget.py +726 -357
- ccxt/pro/bithumb.py +380 -0
- ccxt/pro/bitmart.py +138 -39
- ccxt/pro/bitmex.py +199 -40
- ccxt/pro/bitopro.py +25 -13
- ccxt/pro/bitrue.py +31 -32
- ccxt/pro/bitstamp.py +7 -6
- ccxt/pro/bitvavo.py +204 -82
- ccxt/pro/blockchaincom.py +30 -17
- ccxt/pro/blofin.py +692 -0
- ccxt/pro/bybit.py +791 -82
- ccxt/pro/cex.py +99 -51
- ccxt/pro/coinbase.py +220 -30
- ccxt/{async_support/hitbtc3.py → pro/coinbaseadvanced.py} +5 -5
- ccxt/pro/{coinbasepro.py → coinbaseexchange.py} +19 -19
- ccxt/pro/coinbaseinternational.py +193 -30
- ccxt/pro/coincatch.py +1464 -0
- ccxt/pro/coincheck.py +11 -6
- ccxt/pro/coinex.py +967 -661
- ccxt/pro/coinone.py +17 -10
- ccxt/pro/cryptocom.py +446 -66
- ccxt/pro/currencycom.py +11 -10
- ccxt/pro/defx.py +832 -0
- ccxt/pro/deribit.py +168 -32
- ccxt/pro/exmo.py +253 -21
- ccxt/pro/gate.py +729 -64
- ccxt/pro/gemini.py +44 -26
- ccxt/pro/hashkey.py +802 -0
- ccxt/pro/hitbtc.py +208 -103
- ccxt/pro/hollaex.py +25 -9
- ccxt/pro/htx.py +83 -39
- ccxt/pro/huobijp.py +17 -16
- ccxt/pro/hyperliquid.py +502 -31
- ccxt/pro/idex.py +28 -13
- ccxt/pro/independentreserve.py +21 -16
- ccxt/pro/kraken.py +298 -51
- ccxt/pro/krakenfutures.py +166 -75
- ccxt/pro/kucoin.py +395 -77
- ccxt/pro/kucoinfutures.py +400 -99
- ccxt/pro/lbank.py +52 -31
- ccxt/pro/luno.py +12 -10
- ccxt/pro/mexc.py +400 -50
- ccxt/pro/myokx.py +28 -0
- ccxt/pro/ndax.py +25 -12
- ccxt/pro/okcoin.py +28 -9
- ccxt/pro/okx.py +935 -124
- ccxt/pro/onetrading.py +41 -24
- ccxt/pro/oxfun.py +1054 -0
- ccxt/pro/p2b.py +100 -24
- ccxt/pro/paradex.py +352 -0
- ccxt/pro/phemex.py +93 -34
- ccxt/pro/poloniex.py +129 -50
- ccxt/pro/poloniexfutures.py +53 -32
- ccxt/pro/probit.py +93 -86
- ccxt/pro/upbit.py +401 -8
- ccxt/pro/vertex.py +943 -0
- ccxt/pro/wazirx.py +46 -28
- ccxt/pro/whitebit.py +65 -12
- ccxt/pro/woo.py +486 -70
- ccxt/pro/woofipro.py +1271 -0
- ccxt/pro/xt.py +1067 -0
- ccxt/probit.py +143 -110
- ccxt/static_dependencies/__init__.py +1 -1
- ccxt/static_dependencies/lark/__init__.py +38 -0
- ccxt/static_dependencies/lark/__pyinstaller/__init__.py +6 -0
- ccxt/static_dependencies/lark/__pyinstaller/hook-lark.py +14 -0
- ccxt/static_dependencies/lark/ast_utils.py +59 -0
- ccxt/static_dependencies/lark/common.py +86 -0
- ccxt/static_dependencies/lark/exceptions.py +292 -0
- ccxt/static_dependencies/lark/grammar.py +130 -0
- ccxt/static_dependencies/lark/grammars/__init__.py +0 -0
- ccxt/static_dependencies/lark/indenter.py +143 -0
- ccxt/static_dependencies/lark/lark.py +658 -0
- ccxt/static_dependencies/lark/lexer.py +678 -0
- ccxt/static_dependencies/lark/load_grammar.py +1428 -0
- ccxt/static_dependencies/lark/parse_tree_builder.py +391 -0
- ccxt/static_dependencies/lark/parser_frontends.py +257 -0
- ccxt/static_dependencies/lark/parsers/__init__.py +0 -0
- ccxt/static_dependencies/lark/parsers/cyk.py +340 -0
- ccxt/static_dependencies/lark/parsers/earley.py +314 -0
- ccxt/static_dependencies/lark/parsers/earley_common.py +42 -0
- ccxt/static_dependencies/lark/parsers/earley_forest.py +801 -0
- ccxt/static_dependencies/lark/parsers/grammar_analysis.py +203 -0
- ccxt/static_dependencies/lark/parsers/lalr_analysis.py +332 -0
- ccxt/static_dependencies/lark/parsers/lalr_interactive_parser.py +158 -0
- ccxt/static_dependencies/lark/parsers/lalr_parser.py +122 -0
- ccxt/static_dependencies/lark/parsers/lalr_parser_state.py +110 -0
- ccxt/static_dependencies/lark/parsers/xearley.py +165 -0
- ccxt/static_dependencies/lark/py.typed +0 -0
- ccxt/static_dependencies/lark/reconstruct.py +107 -0
- ccxt/static_dependencies/lark/tools/__init__.py +70 -0
- ccxt/static_dependencies/lark/tools/nearley.py +202 -0
- ccxt/static_dependencies/lark/tools/serialize.py +32 -0
- ccxt/static_dependencies/lark/tools/standalone.py +196 -0
- ccxt/static_dependencies/lark/tree.py +267 -0
- ccxt/static_dependencies/lark/tree_matcher.py +186 -0
- ccxt/static_dependencies/lark/tree_templates.py +180 -0
- ccxt/static_dependencies/lark/utils.py +343 -0
- ccxt/static_dependencies/lark/visitors.py +596 -0
- ccxt/static_dependencies/marshmallow/__init__.py +81 -0
- ccxt/static_dependencies/marshmallow/base.py +65 -0
- ccxt/static_dependencies/marshmallow/class_registry.py +94 -0
- ccxt/static_dependencies/marshmallow/decorators.py +231 -0
- ccxt/static_dependencies/marshmallow/error_store.py +60 -0
- ccxt/static_dependencies/marshmallow/exceptions.py +71 -0
- ccxt/static_dependencies/marshmallow/fields.py +2114 -0
- ccxt/static_dependencies/marshmallow/orderedset.py +89 -0
- ccxt/static_dependencies/marshmallow/py.typed +0 -0
- ccxt/static_dependencies/marshmallow/schema.py +1228 -0
- ccxt/static_dependencies/marshmallow/types.py +12 -0
- ccxt/static_dependencies/marshmallow/utils.py +378 -0
- ccxt/static_dependencies/marshmallow/validate.py +678 -0
- ccxt/static_dependencies/marshmallow/warnings.py +2 -0
- ccxt/static_dependencies/marshmallow_dataclass/__init__.py +1047 -0
- ccxt/static_dependencies/marshmallow_dataclass/collection_field.py +51 -0
- ccxt/static_dependencies/marshmallow_dataclass/lazy_class_attribute.py +45 -0
- ccxt/static_dependencies/marshmallow_dataclass/mypy.py +71 -0
- ccxt/static_dependencies/marshmallow_dataclass/py.typed +0 -0
- ccxt/static_dependencies/marshmallow_dataclass/typing.py +14 -0
- ccxt/static_dependencies/marshmallow_dataclass/union_field.py +82 -0
- ccxt/static_dependencies/marshmallow_oneofschema/__init__.py +1 -0
- ccxt/static_dependencies/marshmallow_oneofschema/one_of_schema.py +193 -0
- ccxt/static_dependencies/marshmallow_oneofschema/py.typed +0 -0
- ccxt/static_dependencies/starknet/__init__.py +0 -0
- ccxt/static_dependencies/starknet/cairo/__init__.py +0 -0
- ccxt/static_dependencies/starknet/cairo/data_types.py +123 -0
- ccxt/static_dependencies/starknet/cairo/deprecated_parse/__init__.py +0 -0
- ccxt/static_dependencies/starknet/cairo/deprecated_parse/cairo_types.py +77 -0
- ccxt/static_dependencies/starknet/cairo/deprecated_parse/parser.py +46 -0
- ccxt/static_dependencies/starknet/cairo/deprecated_parse/parser_transformer.py +138 -0
- ccxt/static_dependencies/starknet/cairo/felt.py +64 -0
- ccxt/static_dependencies/starknet/cairo/type_parser.py +121 -0
- ccxt/static_dependencies/starknet/cairo/v1/__init__.py +0 -0
- ccxt/static_dependencies/starknet/cairo/v1/type_parser.py +59 -0
- ccxt/static_dependencies/starknet/cairo/v2/__init__.py +0 -0
- ccxt/static_dependencies/starknet/cairo/v2/type_parser.py +77 -0
- ccxt/static_dependencies/starknet/ccxt_utils.py +7 -0
- ccxt/static_dependencies/starknet/common.py +15 -0
- ccxt/static_dependencies/starknet/constants.py +39 -0
- ccxt/static_dependencies/starknet/hash/__init__.py +0 -0
- ccxt/static_dependencies/starknet/hash/address.py +79 -0
- ccxt/static_dependencies/starknet/hash/compiled_class_hash_objects.py +111 -0
- ccxt/static_dependencies/starknet/hash/selector.py +16 -0
- ccxt/static_dependencies/starknet/hash/storage.py +12 -0
- ccxt/static_dependencies/starknet/hash/utils.py +78 -0
- ccxt/static_dependencies/starknet/models/__init__.py +0 -0
- ccxt/static_dependencies/starknet/models/typed_data.py +45 -0
- ccxt/static_dependencies/starknet/serialization/__init__.py +24 -0
- ccxt/static_dependencies/starknet/serialization/_calldata_reader.py +40 -0
- ccxt/static_dependencies/starknet/serialization/_context.py +142 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/__init__.py +10 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/_common.py +82 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/array_serializer.py +43 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/bool_serializer.py +37 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/byte_array_serializer.py +66 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/cairo_data_serializer.py +71 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/enum_serializer.py +71 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/felt_serializer.py +50 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/named_tuple_serializer.py +58 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/option_serializer.py +43 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/output_serializer.py +40 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/payload_serializer.py +72 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/struct_serializer.py +36 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/tuple_serializer.py +36 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/uint256_serializer.py +76 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/uint_serializer.py +100 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/unit_serializer.py +32 -0
- ccxt/static_dependencies/starknet/serialization/errors.py +10 -0
- ccxt/static_dependencies/starknet/serialization/factory.py +229 -0
- ccxt/static_dependencies/starknet/serialization/function_serialization_adapter.py +110 -0
- ccxt/static_dependencies/starknet/serialization/tuple_dataclass.py +59 -0
- ccxt/static_dependencies/starknet/utils/__init__.py +0 -0
- ccxt/static_dependencies/starknet/utils/constructor_args_translator.py +86 -0
- ccxt/static_dependencies/starknet/utils/iterable.py +13 -0
- ccxt/static_dependencies/starknet/utils/schema.py +13 -0
- ccxt/static_dependencies/starknet/utils/typed_data.py +182 -0
- ccxt/static_dependencies/starkware/__init__.py +0 -0
- ccxt/static_dependencies/starkware/crypto/__init__.py +0 -0
- ccxt/static_dependencies/starkware/crypto/fast_pedersen_hash.py +50 -0
- ccxt/static_dependencies/starkware/crypto/math_utils.py +78 -0
- ccxt/static_dependencies/starkware/crypto/signature.py +2344 -0
- ccxt/static_dependencies/starkware/crypto/utils.py +63 -0
- ccxt/static_dependencies/sympy/__init__.py +0 -0
- ccxt/static_dependencies/sympy/core/__init__.py +0 -0
- ccxt/static_dependencies/sympy/core/intfunc.py +35 -0
- ccxt/static_dependencies/sympy/external/__init__.py +0 -0
- ccxt/static_dependencies/sympy/external/gmpy.py +345 -0
- ccxt/static_dependencies/sympy/external/importtools.py +187 -0
- ccxt/static_dependencies/sympy/external/ntheory.py +637 -0
- ccxt/static_dependencies/sympy/external/pythonmpq.py +341 -0
- ccxt/static_dependencies/typing_inspect/__init__.py +0 -0
- ccxt/static_dependencies/typing_inspect/typing_inspect.py +851 -0
- ccxt/test/{test_async.py → tests_async.py} +465 -407
- ccxt/test/tests_helpers.py +285 -0
- ccxt/test/tests_init.py +39 -0
- ccxt/test/{test_sync.py → tests_sync.py} +465 -409
- ccxt/timex.py +123 -70
- ccxt/tokocrypto.py +129 -93
- ccxt/tradeogre.py +39 -25
- ccxt/upbit.py +322 -113
- ccxt/vertex.py +2983 -0
- ccxt/wavesexchange.py +227 -173
- ccxt/wazirx.py +145 -65
- ccxt/whitebit.py +533 -138
- ccxt/woo.py +1155 -295
- ccxt/woofipro.py +2716 -0
- ccxt/xt.py +4627 -0
- ccxt/yobit.py +159 -92
- ccxt/zaif.py +80 -33
- ccxt/zonda.py +140 -69
- ccxt-4.4.48.dist-info/LICENSE.txt +21 -0
- ccxt-4.4.48.dist-info/METADATA +646 -0
- ccxt-4.4.48.dist-info/RECORD +669 -0
- {ccxt-4.2.76.dist-info → ccxt-4.4.48.dist-info}/WHEEL +1 -1
- ccxt/abstract/bitbay.py +0 -47
- ccxt/abstract/bitfinex2.py +0 -139
- ccxt/abstract/hitbtc3.py +0 -115
- ccxt/async_support/bitbay.py +0 -17
- ccxt/async_support/bitfinex2.py +0 -3496
- ccxt/async_support/flowbtc.py +0 -34
- ccxt/bitbay.py +0 -17
- ccxt/bitfinex2.py +0 -3496
- ccxt/flowbtc.py +0 -34
- ccxt/hitbtc3.py +0 -16
- ccxt/pro/bitfinex2.py +0 -1081
- ccxt/test/base/__init__.py +0 -28
- ccxt/test/base/test_account.py +0 -26
- ccxt/test/base/test_balance.py +0 -56
- ccxt/test/base/test_borrow_interest.py +0 -35
- ccxt/test/base/test_borrow_rate.py +0 -32
- ccxt/test/base/test_calculate_fee.py +0 -51
- ccxt/test/base/test_crypto.py +0 -127
- ccxt/test/base/test_currency.py +0 -76
- ccxt/test/base/test_datetime.py +0 -103
- ccxt/test/base/test_decimal_to_precision.py +0 -392
- ccxt/test/base/test_deep_extend.py +0 -68
- ccxt/test/base/test_deposit_withdrawal.py +0 -50
- ccxt/test/base/test_exchange_datetime_functions.py +0 -76
- ccxt/test/base/test_funding_rate_history.py +0 -29
- ccxt/test/base/test_last_price.py +0 -32
- ccxt/test/base/test_ledger_entry.py +0 -45
- ccxt/test/base/test_ledger_item.py +0 -48
- ccxt/test/base/test_leverage_tier.py +0 -33
- ccxt/test/base/test_margin_mode.py +0 -24
- ccxt/test/base/test_margin_modification.py +0 -35
- ccxt/test/base/test_market.py +0 -190
- ccxt/test/base/test_number.py +0 -411
- ccxt/test/base/test_ohlcv.py +0 -32
- ccxt/test/base/test_open_interest.py +0 -32
- ccxt/test/base/test_order.py +0 -64
- ccxt/test/base/test_order_book.py +0 -63
- ccxt/test/base/test_position.py +0 -60
- ccxt/test/base/test_shared_methods.py +0 -345
- ccxt/test/base/test_status.py +0 -24
- ccxt/test/base/test_throttle.py +0 -126
- ccxt/test/base/test_ticker.py +0 -86
- ccxt/test/base/test_trade.py +0 -47
- ccxt/test/base/test_trading_fee.py +0 -26
- ccxt/test/base/test_transaction.py +0 -39
- ccxt-4.2.76.dist-info/METADATA +0 -626
- ccxt-4.2.76.dist-info/RECORD +0 -534
- {ccxt-4.2.76.dist-info → ccxt-4.4.48.dist-info}/top_level.txt +0 -0
ccxt/async_support/okcoin.py
CHANGED
@@ -6,9 +6,10 @@
|
|
6
6
|
from ccxt.async_support.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.okcoin 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, 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 AccountNotEnabled
|
14
15
|
from ccxt.base.errors import AccountSuspended
|
@@ -19,7 +20,6 @@ from ccxt.base.errors import InsufficientFunds
|
|
19
20
|
from ccxt.base.errors import InvalidAddress
|
20
21
|
from ccxt.base.errors import InvalidOrder
|
21
22
|
from ccxt.base.errors import OrderNotFound
|
22
|
-
from ccxt.base.errors import CancelPending
|
23
23
|
from ccxt.base.errors import NotSupported
|
24
24
|
from ccxt.base.errors import NetworkError
|
25
25
|
from ccxt.base.errors import RateLimitExceeded
|
@@ -27,7 +27,7 @@ from ccxt.base.errors import ExchangeNotAvailable
|
|
27
27
|
from ccxt.base.errors import OnMaintenance
|
28
28
|
from ccxt.base.errors import InvalidNonce
|
29
29
|
from ccxt.base.errors import RequestTimeout
|
30
|
-
from ccxt.base.errors import
|
30
|
+
from ccxt.base.errors import CancelPending
|
31
31
|
from ccxt.base.decimal_to_precision import TICK_SIZE
|
32
32
|
from ccxt.base.precise import Precise
|
33
33
|
|
@@ -56,6 +56,8 @@ class okcoin(Exchange, ImplicitAPI):
|
|
56
56
|
'createMarketOrderWithCost': False,
|
57
57
|
'createMarketSellOrderWithCost': False,
|
58
58
|
'createOrder': True,
|
59
|
+
'createStopOrder': True,
|
60
|
+
'createTriggerOrder': True,
|
59
61
|
'fetchBalance': True,
|
60
62
|
'fetchBorrowInterest': False,
|
61
63
|
'fetchBorrowRate': False,
|
@@ -66,10 +68,13 @@ class okcoin(Exchange, ImplicitAPI):
|
|
66
68
|
'fetchClosedOrders': True,
|
67
69
|
'fetchCurrencies': True, # see below
|
68
70
|
'fetchDepositAddress': True,
|
71
|
+
'fetchDepositAddresses': False,
|
72
|
+
'fetchDepositAddressesByNetwork': False,
|
69
73
|
'fetchDeposits': True,
|
70
74
|
'fetchFundingHistory': False,
|
71
75
|
'fetchFundingRate': False,
|
72
76
|
'fetchFundingRateHistory': False,
|
77
|
+
'fetchFundingRates': False,
|
73
78
|
'fetchLedger': True,
|
74
79
|
'fetchMarkets': True,
|
75
80
|
'fetchMyTrades': True,
|
@@ -266,6 +271,16 @@ class okcoin(Exchange, ImplicitAPI):
|
|
266
271
|
'50026': ExchangeNotAvailable, # System error, please try again later.
|
267
272
|
'50027': PermissionDenied, # The account is restricted from trading
|
268
273
|
'50028': ExchangeError, # Unable to take the order, please reach out to support center for details
|
274
|
+
'50029': ExchangeError, # This instrument({0}) is unavailable at present due to risk management. Please contact customer service for help.
|
275
|
+
'50030': PermissionDenied, # No permission to use self API
|
276
|
+
'50032': AccountSuspended, # This asset is blocked, allow its trading and try again
|
277
|
+
'50033': AccountSuspended, # This instrument is blocked, allow its trading and try again
|
278
|
+
'50035': BadRequest, # This endpoint requires that APIKey must be bound to IP
|
279
|
+
'50036': BadRequest, # Invalid expTime
|
280
|
+
'50037': BadRequest, # Order expired
|
281
|
+
'50038': ExchangeError, # This feature is temporarily unavailable in demo trading
|
282
|
+
'50039': ExchangeError, # The before parameter is not available for implementing timestamp pagination
|
283
|
+
'50041': ExchangeError, # You are not currently on the whitelist, please contact customer service
|
269
284
|
'50044': BadRequest, # Must select one broker type
|
270
285
|
# API Class
|
271
286
|
'50100': ExchangeError, # API frozen, please contact customer service
|
@@ -309,9 +324,25 @@ class okcoin(Exchange, ImplicitAPI):
|
|
309
324
|
'51024': AccountSuspended, # Unified accountblocked
|
310
325
|
'51025': ExchangeError, # Order count exceeds the limit
|
311
326
|
'51026': BadSymbol, # Instrument type does not match underlying index
|
327
|
+
'51030': InvalidOrder, # Funding fee is being settled.
|
328
|
+
'51031': InvalidOrder, # This order price is not within the closing price range
|
329
|
+
'51032': InvalidOrder, # Closing all positions at market price.
|
330
|
+
'51033': InvalidOrder, # The total amount per order for self pair has reached the upper limit.
|
331
|
+
'51037': InvalidOrder, # The current account risk status only supports you to place IOC orders that can reduce the risk of your account.
|
332
|
+
'51038': InvalidOrder, # There is already an IOC order under the current risk module that reduces the risk of the account.
|
333
|
+
'51044': InvalidOrder, # The order type {0}, {1} is not allowed to set stop loss and take profit
|
312
334
|
'51046': InvalidOrder, # The take profit trigger price must be higher than the order price
|
313
335
|
'51047': InvalidOrder, # The stop loss trigger price must be lower than the order price
|
314
|
-
'
|
336
|
+
'51048': InvalidOrder, # The take profit trigger price should be lower than the order price
|
337
|
+
'51049': InvalidOrder, # The stop loss trigger price should be higher than the order price
|
338
|
+
'51050': InvalidOrder, # The take profit trigger price should be higher than the best ask price
|
339
|
+
'51051': InvalidOrder, # The stop loss trigger price should be lower than the best ask price
|
340
|
+
'51052': InvalidOrder, # The take profit trigger price should be lower than the best bid price
|
341
|
+
'51053': InvalidOrder, # The stop loss trigger price should be higher than the best bid price
|
342
|
+
'51054': BadRequest, # Getting information timed out, please try again later
|
343
|
+
'51056': InvalidOrder, # Action not allowed
|
344
|
+
'51058': InvalidOrder, # No available position for self algo order
|
345
|
+
'51059': InvalidOrder, # Strategy for the current state does not support self operation
|
315
346
|
'51100': InvalidOrder, # Trading amount does not meet the min tradable amount
|
316
347
|
'51102': InvalidOrder, # Entered amount exceeds the max pending count
|
317
348
|
'51103': InvalidOrder, # Entered amount exceeds the max pending order count of the underlying asset
|
@@ -572,6 +603,9 @@ class okcoin(Exchange, ImplicitAPI):
|
|
572
603
|
'defaultNetwork': 'ERC20',
|
573
604
|
'networks': {
|
574
605
|
'ERC20': 'Ethereum',
|
606
|
+
'BTC': 'Bitcoin',
|
607
|
+
'OMNI': 'Omni',
|
608
|
+
'TRC20': 'TRON',
|
575
609
|
},
|
576
610
|
},
|
577
611
|
'commonCurrencies': {
|
@@ -603,21 +637,23 @@ class okcoin(Exchange, ImplicitAPI):
|
|
603
637
|
#
|
604
638
|
return self.parse8601(self.safe_string(response, 'iso'))
|
605
639
|
|
606
|
-
async def fetch_markets(self, params={}):
|
640
|
+
async def fetch_markets(self, params={}) -> List[Market]:
|
607
641
|
"""
|
608
|
-
|
642
|
+
|
643
|
+
https://www.okcoin.com/docs-v5/en/#rest-api-public-data-get-instruments
|
644
|
+
|
609
645
|
retrieves data on all markets for okcoin
|
610
646
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
611
647
|
:returns dict[]: an array of objects representing market data
|
612
648
|
"""
|
613
|
-
request = {
|
649
|
+
request: dict = {
|
614
650
|
'instType': 'SPOT',
|
615
651
|
}
|
616
652
|
response = await self.publicGetPublicInstruments(self.extend(request, params))
|
617
653
|
markets = self.safe_value(response, 'data', [])
|
618
654
|
return self.parse_markets(markets)
|
619
655
|
|
620
|
-
def parse_market(self, market) -> Market:
|
656
|
+
def parse_market(self, market: dict) -> Market:
|
621
657
|
#
|
622
658
|
# spot markets
|
623
659
|
#
|
@@ -699,15 +735,7 @@ class okcoin(Exchange, ImplicitAPI):
|
|
699
735
|
'info': market,
|
700
736
|
})
|
701
737
|
|
702
|
-
def
|
703
|
-
networksById = {
|
704
|
-
'Bitcoin': 'BTC',
|
705
|
-
'Omni': 'OMNI',
|
706
|
-
'TRON': 'TRC20',
|
707
|
-
}
|
708
|
-
return self.safe_string(networksById, networkId, networkId)
|
709
|
-
|
710
|
-
async def fetch_currencies(self, params={}):
|
738
|
+
async def fetch_currencies(self, params={}) -> Currencies:
|
711
739
|
"""
|
712
740
|
fetches all available currencies on an exchange
|
713
741
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -720,7 +748,7 @@ class okcoin(Exchange, ImplicitAPI):
|
|
720
748
|
else:
|
721
749
|
response = await self.privateGetAssetCurrencies(params)
|
722
750
|
data = self.safe_value(response, 'data', [])
|
723
|
-
result = {}
|
751
|
+
result: dict = {}
|
724
752
|
dataByCurrencyId = self.group_by(data, 'ccy')
|
725
753
|
currencyIds = list(dataByCurrencyId.keys())
|
726
754
|
for i in range(0, len(currencyIds)):
|
@@ -728,7 +756,7 @@ class okcoin(Exchange, ImplicitAPI):
|
|
728
756
|
currency = self.safe_currency(currencyId)
|
729
757
|
code = currency['code']
|
730
758
|
chains = dataByCurrencyId[currencyId]
|
731
|
-
networks = {}
|
759
|
+
networks: dict = {}
|
732
760
|
currencyActive = False
|
733
761
|
depositEnabled = False
|
734
762
|
withdrawEnabled = False
|
@@ -746,7 +774,7 @@ class okcoin(Exchange, ImplicitAPI):
|
|
746
774
|
if (networkId is not None) and (networkId.find('-') >= 0):
|
747
775
|
parts = networkId.split('-')
|
748
776
|
chainPart = self.safe_string(parts, 1, networkId)
|
749
|
-
networkCode = self.
|
777
|
+
networkCode = self.network_id_to_code(chainPart)
|
750
778
|
precision = self.parse_precision(self.safe_string(chain, 'wdTickSz'))
|
751
779
|
if maxPrecision is None:
|
752
780
|
maxPrecision = precision
|
@@ -791,7 +819,9 @@ class okcoin(Exchange, ImplicitAPI):
|
|
791
819
|
|
792
820
|
async def fetch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook:
|
793
821
|
"""
|
794
|
-
|
822
|
+
|
823
|
+
https://www.okcoin.com/docs-v5/en/#rest-api-market-data-get-order-book
|
824
|
+
|
795
825
|
fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
|
796
826
|
:param str symbol: unified symbol of the market to fetch the order book for
|
797
827
|
:param int [limit]: the maximum amount of order book entries to return
|
@@ -800,7 +830,7 @@ class okcoin(Exchange, ImplicitAPI):
|
|
800
830
|
"""
|
801
831
|
await self.load_markets()
|
802
832
|
market = self.market(symbol)
|
803
|
-
request = {
|
833
|
+
request: dict = {
|
804
834
|
'instId': market['id'],
|
805
835
|
}
|
806
836
|
limit = 20 if (limit is None) else limit
|
@@ -833,7 +863,7 @@ class okcoin(Exchange, ImplicitAPI):
|
|
833
863
|
timestamp = self.safe_integer(first, 'ts')
|
834
864
|
return self.parse_order_book(first, symbol, timestamp)
|
835
865
|
|
836
|
-
def parse_ticker(self, ticker, market: Market = None) -> Ticker:
|
866
|
+
def parse_ticker(self, ticker: dict, market: Market = None) -> Ticker:
|
837
867
|
#
|
838
868
|
# {
|
839
869
|
# "instType": "SPOT",
|
@@ -890,7 +920,9 @@ class okcoin(Exchange, ImplicitAPI):
|
|
890
920
|
|
891
921
|
async def fetch_ticker(self, symbol: str, params={}) -> Ticker:
|
892
922
|
"""
|
893
|
-
|
923
|
+
|
924
|
+
https://www.okcoin.com/docs-v5/en/#rest-api-market-data-get-ticker
|
925
|
+
|
894
926
|
fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
895
927
|
:param str symbol: unified symbol of the market to fetch the ticker for
|
896
928
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -898,7 +930,7 @@ class okcoin(Exchange, ImplicitAPI):
|
|
898
930
|
"""
|
899
931
|
await self.load_markets()
|
900
932
|
market = self.market(symbol)
|
901
|
-
request = {
|
933
|
+
request: dict = {
|
902
934
|
'instId': market['id'],
|
903
935
|
}
|
904
936
|
response = await self.publicGetMarketTicker(self.extend(request, params))
|
@@ -934,21 +966,23 @@ class okcoin(Exchange, ImplicitAPI):
|
|
934
966
|
|
935
967
|
async def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
|
936
968
|
"""
|
937
|
-
|
969
|
+
|
970
|
+
https://www.okcoin.com/docs-v5/en/#rest-api-market-data-get-tickers
|
971
|
+
|
938
972
|
fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
939
973
|
:param str[]|None symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
940
974
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
941
975
|
:returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
|
942
976
|
"""
|
943
977
|
symbols = self.market_symbols(symbols)
|
944
|
-
request = {
|
978
|
+
request: dict = {
|
945
979
|
'instType': 'SPOT',
|
946
980
|
}
|
947
981
|
response = await self.publicGetMarketTickers(self.extend(request, params))
|
948
|
-
data = self.
|
982
|
+
data = self.safe_list(response, 'data', [])
|
949
983
|
return self.parse_tickers(data, symbols, params)
|
950
984
|
|
951
|
-
def parse_trade(self, trade, market: Market = None) -> Trade:
|
985
|
+
def parse_trade(self, trade: dict, market: Market = None) -> Trade:
|
952
986
|
#
|
953
987
|
# public fetchTrades
|
954
988
|
#
|
@@ -1023,8 +1057,10 @@ class okcoin(Exchange, ImplicitAPI):
|
|
1023
1057
|
|
1024
1058
|
async def fetch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
|
1025
1059
|
"""
|
1026
|
-
|
1027
|
-
|
1060
|
+
|
1061
|
+
https://www.okcoin.com/docs-v5/en/#rest-api-market-data-get-trades
|
1062
|
+
https://www.okcoin.com/docs-v5/en/#rest-api-market-data-get-trades-history
|
1063
|
+
|
1028
1064
|
get the list of most recent trades for a particular symbol
|
1029
1065
|
:param str symbol: unified symbol of the market to fetch trades for
|
1030
1066
|
:param int [since]: timestamp in ms of the earliest trade to fetch
|
@@ -1036,7 +1072,7 @@ class okcoin(Exchange, ImplicitAPI):
|
|
1036
1072
|
market = self.market(symbol)
|
1037
1073
|
if (limit is None) or (limit > 100):
|
1038
1074
|
limit = 100 # maximum = default = 100
|
1039
|
-
request = {
|
1075
|
+
request: dict = {
|
1040
1076
|
'instId': market['id'],
|
1041
1077
|
}
|
1042
1078
|
method = None
|
@@ -1046,7 +1082,7 @@ class okcoin(Exchange, ImplicitAPI):
|
|
1046
1082
|
response = await self.publicGetMarketTrades(self.extend(request, params))
|
1047
1083
|
else:
|
1048
1084
|
response = await self.publicGetMarketHistoryTrades(self.extend(request, params))
|
1049
|
-
data = self.
|
1085
|
+
data = self.safe_list(response, 'data', [])
|
1050
1086
|
return self.parse_trades(data, market, since, limit)
|
1051
1087
|
|
1052
1088
|
def parse_ohlcv(self, ohlcv, market: Market = None) -> list:
|
@@ -1074,8 +1110,10 @@ class okcoin(Exchange, ImplicitAPI):
|
|
1074
1110
|
|
1075
1111
|
async def fetch_ohlcv(self, symbol: str, timeframe='1m', since: Int = None, limit: Int = None, params={}) -> List[list]:
|
1076
1112
|
"""
|
1077
|
-
|
1078
|
-
|
1113
|
+
|
1114
|
+
https://www.okcoin.com/docs-v5/en/#rest-api-market-data-get-candlesticks
|
1115
|
+
https://www.okcoin.com/docs-v5/en/#rest-api-market-data-get-candlesticks-history
|
1116
|
+
|
1079
1117
|
fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
1080
1118
|
:param str symbol: unified symbol of the market to fetch OHLCV data for
|
1081
1119
|
:param str timeframe: the length of time each candle represents
|
@@ -1092,11 +1130,12 @@ class okcoin(Exchange, ImplicitAPI):
|
|
1092
1130
|
timezone = self.safe_string(options, 'timezone', 'UTC')
|
1093
1131
|
if (timezone == 'UTC') and (duration >= 21600): # if utc and timeframe >= 6h
|
1094
1132
|
bar += timezone.lower()
|
1095
|
-
request = {
|
1133
|
+
request: dict = {
|
1096
1134
|
'instId': market['id'],
|
1097
1135
|
'bar': bar,
|
1098
|
-
'limit': limit,
|
1099
1136
|
}
|
1137
|
+
if limit is not None:
|
1138
|
+
request['limit'] = limit # default 100, max 100
|
1100
1139
|
method = None
|
1101
1140
|
method, params = self.handle_option_and_params(params, 'fetchOHLCV', 'method', 'publicGetMarketCandles')
|
1102
1141
|
response = None
|
@@ -1104,7 +1143,7 @@ class okcoin(Exchange, ImplicitAPI):
|
|
1104
1143
|
response = await self.publicGetMarketCandles(self.extend(request, params))
|
1105
1144
|
else:
|
1106
1145
|
response = await self.publicGetMarketHistoryCandles(self.extend(request, params))
|
1107
|
-
data = self.
|
1146
|
+
data = self.safe_list(response, 'data', [])
|
1108
1147
|
return self.parse_ohlcvs(data, market, timeframe, since, limit)
|
1109
1148
|
|
1110
1149
|
def parse_account_balance(self, response):
|
@@ -1149,7 +1188,7 @@ class okcoin(Exchange, ImplicitAPI):
|
|
1149
1188
|
# }
|
1150
1189
|
# ]
|
1151
1190
|
#
|
1152
|
-
result = {
|
1191
|
+
result: dict = {
|
1153
1192
|
'info': response,
|
1154
1193
|
'timestamp': None,
|
1155
1194
|
'datetime': None,
|
@@ -1173,7 +1212,7 @@ class okcoin(Exchange, ImplicitAPI):
|
|
1173
1212
|
"""
|
1174
1213
|
await self.load_markets()
|
1175
1214
|
marketType, query = self.handle_market_type_and_params('fetchBalance', None, params)
|
1176
|
-
request = {
|
1215
|
+
request: dict = {
|
1177
1216
|
# 'ccy': 'BTC,ETH', # comma-separated list of currency ids
|
1178
1217
|
}
|
1179
1218
|
response = None
|
@@ -1205,7 +1244,7 @@ class okcoin(Exchange, ImplicitAPI):
|
|
1205
1244
|
return self.parse_trading_balance(response)
|
1206
1245
|
|
1207
1246
|
def parse_trading_balance(self, response):
|
1208
|
-
result = {'info': response}
|
1247
|
+
result: dict = {'info': response}
|
1209
1248
|
data = self.safe_value(response, 'data', [])
|
1210
1249
|
first = self.safe_value(data, 0, {})
|
1211
1250
|
timestamp = self.safe_integer(first, 'uTime')
|
@@ -1230,7 +1269,7 @@ class okcoin(Exchange, ImplicitAPI):
|
|
1230
1269
|
return self.safe_balance(result)
|
1231
1270
|
|
1232
1271
|
def parse_funding_balance(self, response):
|
1233
|
-
result = {'info': response}
|
1272
|
+
result: dict = {'info': response}
|
1234
1273
|
data = self.safe_value(response, 'data', [])
|
1235
1274
|
for i in range(0, len(data)):
|
1236
1275
|
balance = data[i]
|
@@ -1247,7 +1286,9 @@ class okcoin(Exchange, ImplicitAPI):
|
|
1247
1286
|
async def create_market_buy_order_with_cost(self, symbol: str, cost: float, params={}):
|
1248
1287
|
"""
|
1249
1288
|
create a market buy order by providing the symbol and cost
|
1250
|
-
|
1289
|
+
|
1290
|
+
https://www.okcoin.com/docs-v5/en/#rest-api-trade-place-order
|
1291
|
+
|
1251
1292
|
:param str symbol: unified symbol of the market to create an order in
|
1252
1293
|
:param float cost: how much you want to trade in units of the quote currency
|
1253
1294
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -1263,16 +1304,18 @@ class okcoin(Exchange, ImplicitAPI):
|
|
1263
1304
|
|
1264
1305
|
async def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
|
1265
1306
|
"""
|
1266
|
-
|
1267
|
-
|
1268
|
-
|
1269
|
-
|
1307
|
+
|
1308
|
+
https://www.okcoin.com/docs-v5/en/#rest-api-trade-place-order
|
1309
|
+
https://www.okcoin.com/docs-v5/en/#rest-api-trade-place-algo-order
|
1310
|
+
https://www.okcoin.com/docs-v5/en/#rest-api-trade-place-multiple-orders
|
1311
|
+
https://www.okcoin.com/docs-v5/en/#rest-api-trade-cancel-advance-algo-order
|
1312
|
+
|
1270
1313
|
create a trade order
|
1271
1314
|
:param str symbol: unified symbol of the market to create an order in
|
1272
1315
|
:param str type: 'market' or 'limit'
|
1273
1316
|
:param str side: 'buy' or 'sell'
|
1274
1317
|
:param float amount: how much of currency you want to trade in units of base currency
|
1275
|
-
:param float price: the price at which the order is to be
|
1318
|
+
:param float price: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
1276
1319
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1277
1320
|
:param bool [params.reduceOnly]: MARGIN orders only, or swap/future orders in net mode
|
1278
1321
|
:param bool [params.postOnly]: True to place a post only order
|
@@ -1318,7 +1361,7 @@ class okcoin(Exchange, ImplicitAPI):
|
|
1318
1361
|
|
1319
1362
|
def create_order_request(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
|
1320
1363
|
market = self.market(symbol)
|
1321
|
-
request = {
|
1364
|
+
request: dict = {
|
1322
1365
|
'instId': market['id'],
|
1323
1366
|
# 'ccy': currency['id'], # only applicable to cross MARGIN orders in single-currency margin
|
1324
1367
|
# 'clOrdId': clientOrderId, # up to 32 characters, must be unique
|
@@ -1511,27 +1554,29 @@ class okcoin(Exchange, ImplicitAPI):
|
|
1511
1554
|
|
1512
1555
|
async def cancel_order(self, id: str, symbol: Str = None, params={}):
|
1513
1556
|
"""
|
1514
|
-
|
1515
|
-
|
1516
|
-
|
1557
|
+
|
1558
|
+
https://www.okcoin.com/docs-v5/en/#rest-api-trade-cancel-order
|
1559
|
+
https://www.okcoin.com/docs-v5/en/#rest-api-trade-cancel-algo-order
|
1560
|
+
https://www.okcoin.com/docs-v5/en/#rest-api-trade-cancel-advance-algo-order
|
1561
|
+
|
1517
1562
|
cancels an open order
|
1518
1563
|
:param str id: order id
|
1519
1564
|
:param str symbol: unified symbol of the market the order was made in
|
1520
1565
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1521
|
-
:param bool [params.
|
1566
|
+
:param bool [params.trigger]: True if cancel trigger or conditional orders
|
1522
1567
|
:param bool [params.advanced]: True if canceling advanced orders only
|
1523
1568
|
:returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
1524
1569
|
"""
|
1525
1570
|
if symbol is None:
|
1526
1571
|
raise ArgumentsRequired(self.id + ' cancelOrder() requires a symbol argument')
|
1527
1572
|
await self.load_markets()
|
1528
|
-
|
1573
|
+
trigger = self.safe_value_2(params, 'stop', 'trigger')
|
1529
1574
|
advanced = self.safe_value(params, 'advanced')
|
1530
|
-
if
|
1575
|
+
if trigger or advanced:
|
1531
1576
|
orderInner = await self.cancel_orders([id], symbol, params)
|
1532
1577
|
return self.safe_value(orderInner, 0)
|
1533
1578
|
market = self.market(symbol)
|
1534
|
-
request = {
|
1579
|
+
request: dict = {
|
1535
1580
|
'instId': market['id'],
|
1536
1581
|
# 'ordId': id, # either ordId or clOrdId is required
|
1537
1582
|
# 'clOrdId': clientOrderId,
|
@@ -1545,12 +1590,12 @@ class okcoin(Exchange, ImplicitAPI):
|
|
1545
1590
|
response = await self.privatePostTradeCancelOrder(self.extend(request, query))
|
1546
1591
|
# {"code":"0","data":[{"clOrdId":"","ordId":"317251910906576896","sCode":"0","sMsg":""}],"msg":""}
|
1547
1592
|
data = self.safe_value(response, 'data', [])
|
1548
|
-
order = self.
|
1593
|
+
order = self.safe_dict(data, 0)
|
1549
1594
|
return self.parse_order(order, market)
|
1550
1595
|
|
1551
1596
|
def parse_ids(self, ids):
|
1552
1597
|
"""
|
1553
|
-
|
1598
|
+
@ignore
|
1554
1599
|
:param string[]|str ids: order ids
|
1555
1600
|
:returns str[]: list of order ids
|
1556
1601
|
"""
|
@@ -1562,9 +1607,11 @@ class okcoin(Exchange, ImplicitAPI):
|
|
1562
1607
|
async def cancel_orders(self, ids, symbol: Str = None, params={}):
|
1563
1608
|
"""
|
1564
1609
|
cancel multiple orders
|
1565
|
-
|
1566
|
-
|
1567
|
-
|
1610
|
+
|
1611
|
+
https://www.okcoin.com/docs-v5/en/#rest-api-trade-cancel-multiple-orders
|
1612
|
+
https://www.okcoin.com/docs-v5/en/#rest-api-trade-cancel-algo-order
|
1613
|
+
https://www.okcoin.com/docs-v5/en/#rest-api-trade-cancel-advance-algo-order
|
1614
|
+
|
1568
1615
|
:param str[] ids: order ids
|
1569
1616
|
:param str symbol: unified market symbol
|
1570
1617
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -1573,7 +1620,7 @@ class okcoin(Exchange, ImplicitAPI):
|
|
1573
1620
|
if symbol is None:
|
1574
1621
|
raise ArgumentsRequired(self.id + ' cancelOrders() requires a symbol argument')
|
1575
1622
|
await self.load_markets()
|
1576
|
-
|
1623
|
+
trigger = self.safe_value_2(params, 'stop', 'trigger')
|
1577
1624
|
advanced = self.safe_value(params, 'advanced')
|
1578
1625
|
params = self.omit(params, ['stop', 'trigger', 'advanced'])
|
1579
1626
|
market = self.market(symbol)
|
@@ -1589,7 +1636,7 @@ class okcoin(Exchange, ImplicitAPI):
|
|
1589
1636
|
'instId': market['id'],
|
1590
1637
|
})
|
1591
1638
|
for i in range(0, len(ids)):
|
1592
|
-
if
|
1639
|
+
if trigger or advanced:
|
1593
1640
|
request.append({
|
1594
1641
|
'algoId': ids[i],
|
1595
1642
|
'instId': market['id'],
|
@@ -1606,7 +1653,7 @@ class okcoin(Exchange, ImplicitAPI):
|
|
1606
1653
|
'clOrdId': clientOrderIds[i],
|
1607
1654
|
})
|
1608
1655
|
response = None
|
1609
|
-
if
|
1656
|
+
if trigger:
|
1610
1657
|
response = await self.privatePostTradeCancelAlgos(request)
|
1611
1658
|
elif advanced:
|
1612
1659
|
response = await self.privatePostTradeCancelAdvanceAlgos(request)
|
@@ -1628,11 +1675,11 @@ class okcoin(Exchange, ImplicitAPI):
|
|
1628
1675
|
# }
|
1629
1676
|
#
|
1630
1677
|
#
|
1631
|
-
ordersData = self.
|
1678
|
+
ordersData = self.safe_list(response, 'data', [])
|
1632
1679
|
return self.parse_orders(ordersData, market, None, None, params)
|
1633
1680
|
|
1634
|
-
def parse_order_status(self, status):
|
1635
|
-
statuses = {
|
1681
|
+
def parse_order_status(self, status: Str):
|
1682
|
+
statuses: dict = {
|
1636
1683
|
'canceled': 'canceled',
|
1637
1684
|
'live': 'open',
|
1638
1685
|
'partially_filled': 'open',
|
@@ -1641,7 +1688,7 @@ class okcoin(Exchange, ImplicitAPI):
|
|
1641
1688
|
}
|
1642
1689
|
return self.safe_string(statuses, status, status)
|
1643
1690
|
|
1644
|
-
def parse_order(self, order, market: Market = None) -> Order:
|
1691
|
+
def parse_order(self, order: dict, market: Market = None) -> Order:
|
1645
1692
|
#
|
1646
1693
|
# createOrder
|
1647
1694
|
#
|
@@ -1798,7 +1845,6 @@ class okcoin(Exchange, ImplicitAPI):
|
|
1798
1845
|
clientOrderId = None # fix empty clientOrderId string
|
1799
1846
|
stopLossPrice = self.safe_number_2(order, 'slTriggerPx', 'slOrdPx')
|
1800
1847
|
takeProfitPrice = self.safe_number_2(order, 'tpTriggerPx', 'tpOrdPx')
|
1801
|
-
stopPrice = self.safe_number_n(order, ['triggerPx', 'moveTriggerPx'])
|
1802
1848
|
reduceOnlyRaw = self.safe_string(order, 'reduceOnly')
|
1803
1849
|
reduceOnly = False
|
1804
1850
|
if reduceOnly is not None:
|
@@ -1819,8 +1865,7 @@ class okcoin(Exchange, ImplicitAPI):
|
|
1819
1865
|
'price': price,
|
1820
1866
|
'stopLossPrice': stopLossPrice,
|
1821
1867
|
'takeProfitPrice': takeProfitPrice,
|
1822
|
-
'
|
1823
|
-
'triggerPrice': stopPrice,
|
1868
|
+
'triggerPrice': self.safe_number_n(order, ['triggerPx', 'moveTriggerPx']),
|
1824
1869
|
'average': average,
|
1825
1870
|
'cost': cost,
|
1826
1871
|
'amount': amount,
|
@@ -1834,9 +1879,12 @@ class okcoin(Exchange, ImplicitAPI):
|
|
1834
1879
|
|
1835
1880
|
async def fetch_order(self, id: str, symbol: Str = None, params={}):
|
1836
1881
|
"""
|
1837
|
-
|
1838
|
-
|
1882
|
+
|
1883
|
+
https://www.okcoin.com/docs-v5/en/#rest-api-trade-get-order-details
|
1884
|
+
https://www.okcoin.com/docs-v5/en/#rest-api-trade-get-algo-order-list
|
1885
|
+
|
1839
1886
|
fetches information on an order made by the user
|
1887
|
+
:param str id: order id
|
1840
1888
|
:param str symbol: unified symbol of the market the order was made in
|
1841
1889
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1842
1890
|
:returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
@@ -1845,14 +1893,14 @@ class okcoin(Exchange, ImplicitAPI):
|
|
1845
1893
|
raise ArgumentsRequired(self.id + ' fetchOrder() requires a symbol argument')
|
1846
1894
|
await self.load_markets()
|
1847
1895
|
market = self.market(symbol)
|
1848
|
-
request = {
|
1896
|
+
request: dict = {
|
1849
1897
|
'instId': market['id'],
|
1850
1898
|
# 'clOrdId': 'abcdef12345', # optional, [a-z0-9]{1,32}
|
1851
1899
|
# 'ordId': id,
|
1852
1900
|
}
|
1853
1901
|
clientOrderId = self.safe_string_2(params, 'clOrdId', 'clientOrderId')
|
1854
|
-
|
1855
|
-
if
|
1902
|
+
trigger = self.safe_value_2(params, 'stop', 'trigger')
|
1903
|
+
if trigger:
|
1856
1904
|
if clientOrderId is not None:
|
1857
1905
|
request['algoClOrdId'] = clientOrderId
|
1858
1906
|
else:
|
@@ -1864,29 +1912,31 @@ class okcoin(Exchange, ImplicitAPI):
|
|
1864
1912
|
request['ordId'] = id
|
1865
1913
|
query = self.omit(params, ['clientOrderId', 'stop', 'trigger'])
|
1866
1914
|
response = None
|
1867
|
-
if
|
1915
|
+
if trigger:
|
1868
1916
|
response = await self.privateGetTradeOrderAlgo(self.extend(request, query))
|
1869
1917
|
else:
|
1870
1918
|
response = await self.privateGetTradeOrder(self.extend(request, query))
|
1871
1919
|
data = self.safe_value(response, 'data', [])
|
1872
|
-
order = self.
|
1920
|
+
order = self.safe_dict(data, 0)
|
1873
1921
|
return self.parse_order(order)
|
1874
1922
|
|
1875
1923
|
async def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
1876
1924
|
"""
|
1877
|
-
|
1878
|
-
|
1925
|
+
|
1926
|
+
https://www.okcoin.com/docs-v5/en/#rest-api-trade-get-order-list
|
1927
|
+
https://www.okcoin.com/docs-v5/en/#rest-api-trade-get-algo-order-list
|
1928
|
+
|
1879
1929
|
fetch all unfilled currently open orders
|
1880
1930
|
:param str symbol: unified market symbol
|
1881
1931
|
:param int [since]: the earliest time in ms to fetch open orders for
|
1882
1932
|
:param int [limit]: the maximum number of open orders structures to retrieve
|
1883
1933
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1884
|
-
:param bool [params.
|
1934
|
+
:param bool [params.trigger]: True if fetching trigger or conditional orders
|
1885
1935
|
:param str [params.ordType]: "conditional", "oco", "trigger", "move_order_stop", "iceberg", or "twap"
|
1886
1936
|
:returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
1887
1937
|
"""
|
1888
1938
|
await self.load_markets()
|
1889
|
-
request = {
|
1939
|
+
request: dict = {
|
1890
1940
|
# 'instId': market['id'],
|
1891
1941
|
# 'ordType': 'limit', # market, limit, post_only, fok, ioc, comma-separated, stop orders: conditional, oco, trigger, move_order_stop, iceberg, or twap
|
1892
1942
|
# 'state': 'live', # live, partially_filled
|
@@ -1901,34 +1951,36 @@ class okcoin(Exchange, ImplicitAPI):
|
|
1901
1951
|
if limit is not None:
|
1902
1952
|
request['limit'] = limit # default 100, max 100
|
1903
1953
|
ordType = self.safe_string(params, 'ordType')
|
1904
|
-
|
1905
|
-
if
|
1954
|
+
trigger = self.safe_value(params, 'stop') or (self.safe_string(params, 'ordType') is not None)
|
1955
|
+
if trigger and (ordType is None):
|
1906
1956
|
request['ordType'] = 'trigger' # default to trigger
|
1907
1957
|
params = self.omit(params, ['stop'])
|
1908
1958
|
response = None
|
1909
|
-
if
|
1959
|
+
if trigger:
|
1910
1960
|
response = await self.privateGetTradeOrdersAlgoPending(self.extend(request, params))
|
1911
1961
|
else:
|
1912
1962
|
response = await self.privateGetTradeOrdersPending(self.extend(request, params))
|
1913
|
-
data = self.
|
1963
|
+
data = self.safe_list(response, 'data', [])
|
1914
1964
|
return self.parse_orders(data, market, since, limit)
|
1915
1965
|
|
1916
1966
|
async def fetch_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
1917
1967
|
"""
|
1918
|
-
|
1919
|
-
|
1920
|
-
|
1968
|
+
|
1969
|
+
https://www.okcoin.com/docs-v5/en/#rest-api-trade-get-algo-order-history
|
1970
|
+
https://www.okcoin.com/docs-v5/en/#rest-api-trade-get-order-history-last-3-months
|
1971
|
+
https://www.okcoin.com/docs-v5/en/#rest-api-trade-get-order-history-last-7-days
|
1972
|
+
|
1921
1973
|
fetches information on multiple closed orders made by the user
|
1922
1974
|
:param str symbol: unified market symbol of the market orders were made in
|
1923
1975
|
:param int [since]: the earliest time in ms to fetch orders for
|
1924
1976
|
:param int [limit]: the maximum number of order structures to retrieve
|
1925
1977
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1926
|
-
:param bool [params.
|
1978
|
+
:param bool [params.trigger]: True if fetching trigger or conditional orders
|
1927
1979
|
:param str [params.ordType]: "conditional", "oco", "trigger", "move_order_stop", "iceberg", or "twap"
|
1928
1980
|
:returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
1929
1981
|
"""
|
1930
1982
|
await self.load_markets()
|
1931
|
-
request = {
|
1983
|
+
request: dict = {
|
1932
1984
|
'instType': 'SPOT',
|
1933
1985
|
}
|
1934
1986
|
market = None
|
@@ -1936,12 +1988,12 @@ class okcoin(Exchange, ImplicitAPI):
|
|
1936
1988
|
market = self.market(symbol)
|
1937
1989
|
request['instId'] = market['id']
|
1938
1990
|
ordType = self.safe_string(params, 'ordType')
|
1939
|
-
|
1940
|
-
if
|
1991
|
+
trigger = self.safe_value(params, 'stop') or (self.safe_string(params, 'ordType') is not None)
|
1992
|
+
if trigger and (ordType is None):
|
1941
1993
|
request['ordType'] = 'trigger' # default to trigger
|
1942
1994
|
params = self.omit(params, ['stop'])
|
1943
1995
|
response = None
|
1944
|
-
if
|
1996
|
+
if trigger:
|
1945
1997
|
response = await self.privateGetTradeOrdersAlgoHistory(self.extend(request, params))
|
1946
1998
|
else:
|
1947
1999
|
method = None
|
@@ -1991,10 +2043,10 @@ class okcoin(Exchange, ImplicitAPI):
|
|
1991
2043
|
# "msg":""
|
1992
2044
|
# }
|
1993
2045
|
#
|
1994
|
-
data = self.
|
2046
|
+
data = self.safe_list(response, 'data', [])
|
1995
2047
|
return self.parse_orders(data, market, since, limit)
|
1996
2048
|
|
1997
|
-
def parse_deposit_address(self, depositAddress, currency: Currency = None):
|
2049
|
+
def parse_deposit_address(self, depositAddress, currency: Currency = None) -> DepositAddress:
|
1998
2050
|
#
|
1999
2051
|
# {
|
2000
2052
|
# "addr": "okbtothemoon",
|
@@ -2077,17 +2129,19 @@ class okcoin(Exchange, ImplicitAPI):
|
|
2077
2129
|
#
|
2078
2130
|
self.check_address(address)
|
2079
2131
|
return {
|
2132
|
+
'info': depositAddress,
|
2080
2133
|
'currency': code,
|
2134
|
+
'network': network,
|
2081
2135
|
'address': address,
|
2082
2136
|
'tag': tag,
|
2083
|
-
'network': network,
|
2084
|
-
'info': depositAddress,
|
2085
2137
|
}
|
2086
2138
|
|
2087
|
-
async def fetch_deposit_address(self, code: str, params={}):
|
2139
|
+
async def fetch_deposit_address(self, code: str, params={}) -> DepositAddress:
|
2088
2140
|
"""
|
2089
2141
|
fetch the deposit address for a currency associated with self account
|
2090
|
-
|
2142
|
+
|
2143
|
+
https://www.okx.com/docs-v5/en/#funding-account-rest-api-get-deposit-address
|
2144
|
+
|
2091
2145
|
:param str code: unified currency code
|
2092
2146
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2093
2147
|
:returns dict: an `address structure <https://docs.ccxt.com/#/?id=address-structure>`
|
@@ -2103,17 +2157,19 @@ class okcoin(Exchange, ImplicitAPI):
|
|
2103
2157
|
raise InvalidAddress(self.id + ' fetchDepositAddress() cannot find ' + networkCode + ' deposit address for ' + code)
|
2104
2158
|
return result
|
2105
2159
|
|
2106
|
-
async def fetch_deposit_addresses_by_network(self, code: str, params={}):
|
2160
|
+
async def fetch_deposit_addresses_by_network(self, code: str, params={}) -> List[DepositAddress]:
|
2107
2161
|
"""
|
2108
2162
|
fetch a dictionary of addresses for a currency, indexed by network
|
2109
|
-
|
2163
|
+
|
2164
|
+
https://www.okx.com/docs-v5/en/#funding-account-rest-api-get-deposit-address
|
2165
|
+
|
2110
2166
|
:param str code: unified currency code of the currency for the deposit address
|
2111
2167
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2112
2168
|
:returns dict: a dictionary of `address structures <https://docs.ccxt.com/#/?id=address-structure>` indexed by the network
|
2113
2169
|
"""
|
2114
2170
|
await self.load_markets()
|
2115
2171
|
currency = self.currency(code)
|
2116
|
-
request = {
|
2172
|
+
request: dict = {
|
2117
2173
|
'ccy': currency['id'],
|
2118
2174
|
}
|
2119
2175
|
response = await self.privateGetAssetDepositAddress(self.extend(request, params))
|
@@ -2145,7 +2201,9 @@ class okcoin(Exchange, ImplicitAPI):
|
|
2145
2201
|
|
2146
2202
|
async def transfer(self, code: str, amount: float, fromAccount: str, toAccount: str, params={}) -> TransferEntry:
|
2147
2203
|
"""
|
2148
|
-
|
2204
|
+
|
2205
|
+
https://www.okcoin.com/docs-v5/en/#rest-api-funding-funds-transfer
|
2206
|
+
|
2149
2207
|
transfer currency internally between wallets on the same account
|
2150
2208
|
:param str code: unified currency code
|
2151
2209
|
:param float amount: amount to transfer
|
@@ -2159,7 +2217,7 @@ class okcoin(Exchange, ImplicitAPI):
|
|
2159
2217
|
accountsByType = self.safe_value(self.options, 'accountsByType', {})
|
2160
2218
|
fromId = self.safe_string(accountsByType, fromAccount, fromAccount)
|
2161
2219
|
toId = self.safe_string(accountsByType, toAccount, toAccount)
|
2162
|
-
request = {
|
2220
|
+
request: dict = {
|
2163
2221
|
'ccy': currency['id'],
|
2164
2222
|
'amt': self.currency_to_precision(code, amount),
|
2165
2223
|
'type': '0', # 0 = transfer within account by default, 1 = master account to sub-account, 2 = sub-account to master account, 3 = sub-account to master account(Only applicable to APIKey from sub-account), 4 = sub-account to sub-account
|
@@ -2197,10 +2255,10 @@ class okcoin(Exchange, ImplicitAPI):
|
|
2197
2255
|
# }
|
2198
2256
|
#
|
2199
2257
|
data = self.safe_value(response, 'data', [])
|
2200
|
-
rawTransfer = self.
|
2258
|
+
rawTransfer = self.safe_dict(data, 0, {})
|
2201
2259
|
return self.parse_transfer(rawTransfer, currency)
|
2202
2260
|
|
2203
|
-
def parse_transfer(self, transfer, currency: Currency = None):
|
2261
|
+
def parse_transfer(self, transfer: dict, currency: Currency = None) -> TransferEntry:
|
2204
2262
|
#
|
2205
2263
|
# transfer
|
2206
2264
|
#
|
@@ -2276,15 +2334,17 @@ class okcoin(Exchange, ImplicitAPI):
|
|
2276
2334
|
'status': self.parse_transfer_status(self.safe_string(transfer, 'state')),
|
2277
2335
|
}
|
2278
2336
|
|
2279
|
-
def parse_transfer_status(self, status):
|
2280
|
-
statuses = {
|
2337
|
+
def parse_transfer_status(self, status: Str) -> Str:
|
2338
|
+
statuses: dict = {
|
2281
2339
|
'success': 'ok',
|
2282
2340
|
}
|
2283
2341
|
return self.safe_string(statuses, status, status)
|
2284
2342
|
|
2285
|
-
async def withdraw(self, code: str, amount: float, address, tag=None, params={}):
|
2343
|
+
async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
|
2286
2344
|
"""
|
2287
|
-
|
2345
|
+
|
2346
|
+
https://www.okcoin.com/docs-v5/en/#rest-api-funding-withdrawal
|
2347
|
+
|
2288
2348
|
make a withdrawal
|
2289
2349
|
:param str code: unified currency code
|
2290
2350
|
:param float amount: the amount to withdraw
|
@@ -2299,7 +2359,7 @@ class okcoin(Exchange, ImplicitAPI):
|
|
2299
2359
|
currency = self.currency(code)
|
2300
2360
|
if (tag is not None) and (len(tag) > 0):
|
2301
2361
|
address = address + ':' + tag
|
2302
|
-
request = {
|
2362
|
+
request: dict = {
|
2303
2363
|
'ccy': currency['id'],
|
2304
2364
|
'toAddr': address,
|
2305
2365
|
'dest': '4',
|
@@ -2333,12 +2393,14 @@ class okcoin(Exchange, ImplicitAPI):
|
|
2333
2393
|
# }
|
2334
2394
|
#
|
2335
2395
|
data = self.safe_value(response, 'data', [])
|
2336
|
-
transaction = self.
|
2396
|
+
transaction = self.safe_dict(data, 0)
|
2337
2397
|
return self.parse_transaction(transaction, currency)
|
2338
2398
|
|
2339
2399
|
async def fetch_deposits(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
|
2340
2400
|
"""
|
2341
|
-
|
2401
|
+
|
2402
|
+
https://www.okcoin.com/docs-v5/en/#rest-api-funding-get-deposit-history
|
2403
|
+
|
2342
2404
|
fetch all deposits made to an account
|
2343
2405
|
:param str code: unified currency code
|
2344
2406
|
:param int [since]: the earliest time in ms to fetch deposits for
|
@@ -2347,7 +2409,7 @@ class okcoin(Exchange, ImplicitAPI):
|
|
2347
2409
|
:returns dict[]: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
|
2348
2410
|
"""
|
2349
2411
|
await self.load_markets()
|
2350
|
-
request = {
|
2412
|
+
request: dict = {
|
2351
2413
|
# 'ccy': currency['id'],
|
2352
2414
|
# 'state': 2, # 0 waiting for confirmation, 1 deposit credited, 2 deposit successful
|
2353
2415
|
# 'after': since,
|
@@ -2402,12 +2464,14 @@ class okcoin(Exchange, ImplicitAPI):
|
|
2402
2464
|
# ]
|
2403
2465
|
# }
|
2404
2466
|
#
|
2405
|
-
data = self.
|
2467
|
+
data = self.safe_list(response, 'data', [])
|
2406
2468
|
return self.parse_transactions(data, currency, since, limit, params)
|
2407
2469
|
|
2408
2470
|
async def fetch_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
|
2409
2471
|
"""
|
2410
|
-
|
2472
|
+
|
2473
|
+
https://www.okcoin.com/docs-v5/en/#rest-api-funding-get-withdrawal-history
|
2474
|
+
|
2411
2475
|
fetch all withdrawals made from an account
|
2412
2476
|
:param str code: unified currency code
|
2413
2477
|
:param int [since]: the earliest time in ms to fetch withdrawals for
|
@@ -2416,7 +2480,7 @@ class okcoin(Exchange, ImplicitAPI):
|
|
2416
2480
|
:returns dict[]: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
|
2417
2481
|
"""
|
2418
2482
|
await self.load_markets()
|
2419
|
-
request = {
|
2483
|
+
request: dict = {
|
2420
2484
|
# 'ccy': currency['id'],
|
2421
2485
|
# 'state': 2, # -3: pending cancel, -2 canceled, -1 failed, 0, pending, 1 sending, 2 sent, 3 awaiting email verification, 4 awaiting manual verification, 5 awaiting identity verification
|
2422
2486
|
# 'after': since,
|
@@ -2463,10 +2527,10 @@ class okcoin(Exchange, ImplicitAPI):
|
|
2463
2527
|
# ]
|
2464
2528
|
# }
|
2465
2529
|
#
|
2466
|
-
data = self.
|
2530
|
+
data = self.safe_list(response, 'data', [])
|
2467
2531
|
return self.parse_transactions(data, currency, since, limit, params)
|
2468
2532
|
|
2469
|
-
def parse_transaction_status(self, status):
|
2533
|
+
def parse_transaction_status(self, status: Str):
|
2470
2534
|
#
|
2471
2535
|
# deposit statuses
|
2472
2536
|
#
|
@@ -2490,7 +2554,7 @@ class okcoin(Exchange, ImplicitAPI):
|
|
2490
2554
|
# "5": "awaiting identity confirmation"
|
2491
2555
|
# }
|
2492
2556
|
#
|
2493
|
-
statuses = {
|
2557
|
+
statuses: dict = {
|
2494
2558
|
'-3': 'pending',
|
2495
2559
|
'-2': 'canceled',
|
2496
2560
|
'-1': 'failed',
|
@@ -2503,7 +2567,7 @@ class okcoin(Exchange, ImplicitAPI):
|
|
2503
2567
|
}
|
2504
2568
|
return self.safe_string(statuses, status, status)
|
2505
2569
|
|
2506
|
-
def parse_transaction(self, transaction, currency: Currency = None) -> Transaction:
|
2570
|
+
def parse_transaction(self, transaction: dict, currency: Currency = None) -> Transaction:
|
2507
2571
|
#
|
2508
2572
|
# withdraw
|
2509
2573
|
#
|
@@ -2598,8 +2662,10 @@ class okcoin(Exchange, ImplicitAPI):
|
|
2598
2662
|
|
2599
2663
|
async def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
2600
2664
|
"""
|
2601
|
-
|
2602
|
-
|
2665
|
+
|
2666
|
+
https://www.okcoin.com/docs-v5/en/#rest-api-trade-get-transaction-details-last-3-days
|
2667
|
+
https://www.okcoin.com/docs-v5/en/#rest-api-trade-get-transaction-details-last-3-months
|
2668
|
+
|
2603
2669
|
fetch all trades made by the user
|
2604
2670
|
:param str symbol: unified market symbol
|
2605
2671
|
:param int [since]: the earliest time in ms to fetch trades for
|
@@ -2608,7 +2674,7 @@ class okcoin(Exchange, ImplicitAPI):
|
|
2608
2674
|
:returns Trade[]: a list of `trade structures <https://docs.ccxt.com/#/?id=trade-structure>`
|
2609
2675
|
"""
|
2610
2676
|
await self.load_markets()
|
2611
|
-
request = {
|
2677
|
+
request: dict = {
|
2612
2678
|
'instType': 'SPOT',
|
2613
2679
|
}
|
2614
2680
|
if (limit is not None) and (limit > 100):
|
@@ -2624,7 +2690,7 @@ class okcoin(Exchange, ImplicitAPI):
|
|
2624
2690
|
response = await self.privateGetTradeFillsHistory(self.extend(request, params))
|
2625
2691
|
else:
|
2626
2692
|
response = await self.privateGetTradeFills(self.extend(request, params))
|
2627
|
-
data = self.
|
2693
|
+
data = self.safe_list(response, 'data', [])
|
2628
2694
|
return self.parse_trades(data, market, since, limit)
|
2629
2695
|
|
2630
2696
|
async def fetch_order_trades(self, id: str, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
@@ -2637,7 +2703,7 @@ class okcoin(Exchange, ImplicitAPI):
|
|
2637
2703
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2638
2704
|
:returns dict[]: a list of `trade structures <https://docs.ccxt.com/#/?id=trade-structure>`
|
2639
2705
|
"""
|
2640
|
-
request = {
|
2706
|
+
request: dict = {
|
2641
2707
|
# 'instrument_id': market['id'],
|
2642
2708
|
'order_id': id,
|
2643
2709
|
# 'after': '1', # return the page after the specified page number
|
@@ -2646,22 +2712,24 @@ class okcoin(Exchange, ImplicitAPI):
|
|
2646
2712
|
}
|
2647
2713
|
return await self.fetch_my_trades(symbol, since, limit, self.extend(request, params))
|
2648
2714
|
|
2649
|
-
async def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
|
2715
|
+
async def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[LedgerEntry]:
|
2650
2716
|
"""
|
2651
|
-
|
2652
|
-
|
2653
|
-
|
2654
|
-
|
2655
|
-
|
2717
|
+
fetch the history of changes, actions done by the user or operations that altered the balance of the user
|
2718
|
+
|
2719
|
+
https://www.okcoin.com/docs-v5/en/#rest-api-funding-asset-bills-details
|
2720
|
+
https://www.okcoin.com/docs-v5/en/#rest-api-account-get-bills-details-last-7-days
|
2721
|
+
https://www.okcoin.com/docs-v5/en/#rest-api-account-get-bills-details-last-3-months
|
2722
|
+
|
2723
|
+
:param str [code]: unified currency code, default is None
|
2656
2724
|
:param int [since]: timestamp in ms of the earliest ledger entry, default is None
|
2657
|
-
:param int [limit]: max number of ledger
|
2725
|
+
:param int [limit]: max number of ledger entries to return, default is None
|
2658
2726
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2659
|
-
:returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger
|
2727
|
+
:returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger>`
|
2660
2728
|
"""
|
2661
2729
|
await self.load_markets()
|
2662
2730
|
method = None
|
2663
2731
|
method, params = self.handle_option_and_params(params, 'fetchLedger', 'method', 'privateGetAccountBills')
|
2664
|
-
request = {
|
2732
|
+
request: dict = {
|
2665
2733
|
# 'instType': None, # 'SPOT', 'MARGIN', 'SWAP', 'FUTURES", 'OPTION'
|
2666
2734
|
# 'ccy': None, # currency['id'],
|
2667
2735
|
# 'ctType': None, # 'linear', 'inverse', only applicable to FUTURES/SWAP
|
@@ -2739,7 +2807,7 @@ class okcoin(Exchange, ImplicitAPI):
|
|
2739
2807
|
return self.parse_ledger(data, currency, since, limit)
|
2740
2808
|
|
2741
2809
|
def parse_ledger_entry_type(self, type):
|
2742
|
-
types = {
|
2810
|
+
types: dict = {
|
2743
2811
|
'1': 'transfer', # transfer
|
2744
2812
|
'2': 'trade', # trade
|
2745
2813
|
'3': 'trade', # delivery
|
@@ -2754,7 +2822,7 @@ class okcoin(Exchange, ImplicitAPI):
|
|
2754
2822
|
}
|
2755
2823
|
return self.safe_string(types, type, type)
|
2756
2824
|
|
2757
|
-
def parse_ledger_entry(self, item, currency: Currency = None):
|
2825
|
+
def parse_ledger_entry(self, item: dict, currency: Currency = None) -> LedgerEntry:
|
2758
2826
|
#
|
2759
2827
|
# privateGetAccountBills, privateGetAccountBillsArchive
|
2760
2828
|
#
|
@@ -2791,45 +2859,36 @@ class okcoin(Exchange, ImplicitAPI):
|
|
2791
2859
|
# "ts": "1597026383085"
|
2792
2860
|
# }
|
2793
2861
|
#
|
2794
|
-
|
2795
|
-
|
2796
|
-
|
2797
|
-
referenceAccount = None
|
2798
|
-
type = self.parse_ledger_entry_type(self.safe_string(item, 'type'))
|
2799
|
-
code = self.safe_currency_code(self.safe_string(item, 'ccy'), currency)
|
2800
|
-
amountString = self.safe_string(item, 'balChg')
|
2801
|
-
amount = self.parse_number(amountString)
|
2862
|
+
currencyId = self.safe_string(item, 'ccy')
|
2863
|
+
code = self.safe_currency_code(currencyId, currency)
|
2864
|
+
currency = self.safe_currency(currencyId, currency)
|
2802
2865
|
timestamp = self.safe_integer(item, 'ts')
|
2803
2866
|
feeCostString = self.safe_string(item, 'fee')
|
2804
2867
|
fee = None
|
2805
2868
|
if feeCostString is not None:
|
2806
2869
|
fee = {
|
2807
|
-
'cost': self.
|
2870
|
+
'cost': self.parse_to_numeric(Precise.string_neg(feeCostString)),
|
2808
2871
|
'currency': code,
|
2809
2872
|
}
|
2810
|
-
before = None
|
2811
|
-
afterString = self.safe_string(item, 'bal')
|
2812
|
-
after = self.parse_number(afterString)
|
2813
|
-
status = 'ok'
|
2814
2873
|
marketId = self.safe_string(item, 'instId')
|
2815
2874
|
symbol = self.safe_symbol(marketId, None, '-')
|
2816
|
-
return {
|
2817
|
-
'id': id,
|
2875
|
+
return self.safe_ledger_entry({
|
2818
2876
|
'info': item,
|
2877
|
+
'id': self.safe_string(item, 'billId'),
|
2819
2878
|
'timestamp': timestamp,
|
2820
2879
|
'datetime': self.iso8601(timestamp),
|
2821
|
-
'account':
|
2822
|
-
'referenceId':
|
2823
|
-
'referenceAccount':
|
2824
|
-
'type': type,
|
2880
|
+
'account': None,
|
2881
|
+
'referenceId': self.safe_string(item, 'ordId'),
|
2882
|
+
'referenceAccount': None,
|
2883
|
+
'type': self.parse_ledger_entry_type(self.safe_string(item, 'type')),
|
2825
2884
|
'currency': code,
|
2826
2885
|
'symbol': symbol,
|
2827
|
-
'amount':
|
2828
|
-
'before':
|
2829
|
-
'after':
|
2830
|
-
'status':
|
2886
|
+
'amount': self.safe_number(item, 'balChg'),
|
2887
|
+
'before': None, # balance before
|
2888
|
+
'after': self.safe_number(item, 'bal'), # balance after
|
2889
|
+
'status': 'ok',
|
2831
2890
|
'fee': fee,
|
2832
|
-
}
|
2891
|
+
}, currency)
|
2833
2892
|
|
2834
2893
|
def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
|
2835
2894
|
isArray = isinstance(params, list)
|
@@ -2871,7 +2930,7 @@ class okcoin(Exchange, ImplicitAPI):
|
|
2871
2930
|
else:
|
2872
2931
|
return self.parse_trading_balance(response)
|
2873
2932
|
|
2874
|
-
def handle_errors(self, httpCode, reason, url, method, headers, body, response, requestHeaders, requestBody):
|
2933
|
+
def handle_errors(self, httpCode: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
|
2875
2934
|
if not response:
|
2876
2935
|
return None # fallback to default error handler
|
2877
2936
|
#
|