ccxt 4.2.77__py2.py3-none-any.whl → 4.4.49__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 +24 -0
- ccxt/abstract/kucoinfutures.py +34 -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 +3030 -1087
- 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 +3205 -937
- 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 +238 -49
- ccxt/async_support/bitget.py +1525 -573
- ccxt/async_support/bithumb.py +199 -65
- 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 +392 -148
- 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 +2231 -1193
- ccxt/async_support/cex.py +1409 -1329
- ccxt/async_support/coinbase.py +1454 -287
- 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 +223 -97
- 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 +404 -109
- ccxt/async_support/deribit.py +639 -323
- ccxt/async_support/digifinex.py +465 -233
- ccxt/async_support/ellipx.py +1887 -0
- ccxt/async_support/exmo.py +317 -128
- ccxt/async_support/gate.py +1472 -463
- ccxt/async_support/gemini.py +206 -84
- ccxt/async_support/hashkey.py +4164 -0
- ccxt/async_support/hitbtc.py +433 -178
- ccxt/async_support/hollaex.py +207 -83
- ccxt/async_support/htx.py +1095 -563
- ccxt/async_support/huobijp.py +178 -56
- ccxt/async_support/hyperliquid.py +1678 -292
- ccxt/async_support/idex.py +219 -95
- ccxt/async_support/independentreserve.py +300 -31
- ccxt/async_support/indodax.py +226 -62
- ccxt/async_support/kraken.py +871 -354
- ccxt/async_support/krakenfutures.py +324 -100
- ccxt/async_support/kucoin.py +917 -357
- ccxt/async_support/kucoinfutures.py +1004 -149
- ccxt/async_support/kuna.py +198 -107
- ccxt/async_support/latoken.py +199 -79
- ccxt/async_support/lbank.py +360 -113
- ccxt/async_support/luno.py +185 -62
- ccxt/async_support/lykke.py +168 -55
- ccxt/async_support/mercado.py +101 -29
- ccxt/async_support/mexc.py +995 -429
- ccxt/async_support/myokx.py +53 -0
- ccxt/async_support/ndax.py +234 -82
- ccxt/async_support/novadax.py +195 -75
- ccxt/async_support/oceanex.py +244 -59
- ccxt/async_support/okcoin.py +301 -165
- ccxt/async_support/okx.py +1776 -454
- ccxt/async_support/onetrading.py +198 -414
- ccxt/async_support/oxfun.py +2898 -0
- ccxt/async_support/p2b.py +142 -52
- ccxt/async_support/paradex.py +2085 -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 +1137 -296
- 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 +1722 -480
- 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 +3030 -1087
- ccxt/binancecoinm.py +2 -1
- ccxt/binanceus.py +12 -1
- ccxt/binanceusdm.py +3 -1
- ccxt/bingx.py +3205 -937
- 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 +238 -49
- ccxt/bitget.py +1525 -573
- ccxt/bithumb.py +198 -65
- 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 +392 -148
- ccxt/btcalpha.py +161 -55
- ccxt/btcbox.py +250 -34
- ccxt/btcmarkets.py +232 -85
- ccxt/btcturk.py +159 -60
- ccxt/bybit.py +2231 -1193
- ccxt/cex.py +1408 -1329
- ccxt/coinbase.py +1454 -287
- 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 +223 -97
- ccxt/coinspot.py +137 -62
- ccxt/cryptocom.py +515 -185
- ccxt/currencycom.py +203 -85
- ccxt/defx.py +2065 -0
- ccxt/delta.py +404 -109
- ccxt/deribit.py +639 -323
- ccxt/digifinex.py +465 -233
- ccxt/ellipx.py +1887 -0
- ccxt/exmo.py +317 -128
- ccxt/gate.py +1472 -463
- ccxt/gemini.py +206 -84
- ccxt/hashkey.py +4164 -0
- ccxt/hitbtc.py +433 -178
- ccxt/hollaex.py +207 -83
- ccxt/htx.py +1095 -563
- ccxt/huobijp.py +178 -56
- ccxt/hyperliquid.py +1677 -292
- ccxt/idex.py +219 -95
- ccxt/independentreserve.py +299 -31
- ccxt/indodax.py +226 -62
- ccxt/kraken.py +871 -354
- ccxt/krakenfutures.py +324 -100
- ccxt/kucoin.py +917 -357
- ccxt/kucoinfutures.py +1004 -149
- ccxt/kuna.py +198 -107
- ccxt/latoken.py +199 -79
- ccxt/lbank.py +360 -113
- ccxt/luno.py +185 -62
- ccxt/lykke.py +168 -55
- ccxt/mercado.py +101 -29
- ccxt/mexc.py +994 -429
- ccxt/myokx.py +53 -0
- ccxt/ndax.py +234 -82
- ccxt/novadax.py +195 -75
- ccxt/oceanex.py +244 -59
- ccxt/okcoin.py +301 -165
- ccxt/okx.py +1776 -454
- ccxt/onetrading.py +198 -414
- ccxt/oxfun.py +2897 -0
- ccxt/p2b.py +142 -52
- ccxt/paradex.py +2085 -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 +62 -14
- 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 +143 -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 +203 -81
- 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 +965 -665
- 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 +167 -31
- ccxt/pro/exmo.py +252 -20
- 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 +92 -33
- ccxt/pro/poloniex.py +128 -49
- ccxt/pro/poloniexfutures.py +53 -32
- ccxt/pro/probit.py +92 -85
- 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 +437 -65
- 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} +456 -391
- ccxt/test/tests_helpers.py +285 -0
- ccxt/test/tests_init.py +39 -0
- ccxt/test/{test_sync.py → tests_sync.py} +456 -393
- 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 +1137 -296
- 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.49.dist-info/LICENSE.txt +21 -0
- ccxt-4.4.49.dist-info/METADATA +646 -0
- ccxt-4.4.49.dist-info/RECORD +669 -0
- {ccxt-4.2.77.dist-info → ccxt-4.4.49.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.77.dist-info/METADATA +0 -626
- ccxt-4.2.77.dist-info/RECORD +0 -534
- {ccxt-4.2.77.dist-info → ccxt-4.4.49.dist-info}/top_level.txt +0 -0
ccxt/krakenfutures.py
CHANGED
@@ -6,9 +6,10 @@
|
|
6
6
|
from ccxt.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.krakenfutures import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Balances, Currency, Int, Leverage, Leverages, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TransferEntry
|
9
|
+
from ccxt.base.types import Balances, Currency, Int, Leverage, Leverages, LeverageTier, LeverageTiers, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, Trade, 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 ArgumentsRequired
|
13
14
|
from ccxt.base.errors import BadRequest
|
14
15
|
from ccxt.base.errors import InsufficientFunds
|
@@ -17,12 +18,11 @@ from ccxt.base.errors import OrderNotFound
|
|
17
18
|
from ccxt.base.errors import OrderImmediatelyFillable
|
18
19
|
from ccxt.base.errors import OrderNotFillable
|
19
20
|
from ccxt.base.errors import DuplicateOrderId
|
21
|
+
from ccxt.base.errors import ContractUnavailable
|
20
22
|
from ccxt.base.errors import DDoSProtection
|
21
23
|
from ccxt.base.errors import RateLimitExceeded
|
22
24
|
from ccxt.base.errors import ExchangeNotAvailable
|
23
25
|
from ccxt.base.errors import InvalidNonce
|
24
|
-
from ccxt.base.errors import AuthenticationError
|
25
|
-
from ccxt.base.errors import ContractUnavailable
|
26
26
|
from ccxt.base.decimal_to_precision import TICK_SIZE
|
27
27
|
from ccxt.base.precise import Precise
|
28
28
|
|
@@ -46,10 +46,13 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
46
46
|
'future': True,
|
47
47
|
'option': False,
|
48
48
|
'cancelAllOrders': True,
|
49
|
+
'cancelAllOrdersAfter': True,
|
49
50
|
'cancelOrder': True,
|
50
51
|
'cancelOrders': True,
|
51
52
|
'createMarketOrder': False,
|
52
53
|
'createOrder': True,
|
54
|
+
'createStopOrder': True,
|
55
|
+
'createTriggerOrder': True,
|
53
56
|
'editOrder': True,
|
54
57
|
'fetchBalance': True,
|
55
58
|
'fetchBorrowRateHistories': False,
|
@@ -85,6 +88,7 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
85
88
|
'fetchPremiumIndexOHLCV': False,
|
86
89
|
'fetchTickers': True,
|
87
90
|
'fetchTrades': True,
|
91
|
+
'sandbox': True,
|
88
92
|
'setLeverage': True,
|
89
93
|
'setMarginMode': False,
|
90
94
|
'transfer': True,
|
@@ -94,6 +98,7 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
94
98
|
'public': 'https://demo-futures.kraken.com/derivatives/api/',
|
95
99
|
'private': 'https://demo-futures.kraken.com/derivatives/api/',
|
96
100
|
'charts': 'https://demo-futures.kraken.com/api/charts/',
|
101
|
+
'history': 'https://demo-futures.kraken.com/api/history/',
|
97
102
|
'www': 'https://demo-futures.kraken.com',
|
98
103
|
},
|
99
104
|
'logo': 'https://user-images.githubusercontent.com/24300605/81436764-b22fd580-9172-11ea-9703-742783e6376d.jpg',
|
@@ -134,6 +139,8 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
134
139
|
'transfers',
|
135
140
|
'leveragepreferences',
|
136
141
|
'pnlpreferences',
|
142
|
+
'assignmentprogram/current',
|
143
|
+
'assignmentprogram/history',
|
137
144
|
],
|
138
145
|
'post': [
|
139
146
|
'sendorder',
|
@@ -144,6 +151,8 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
144
151
|
'cancelallorders',
|
145
152
|
'cancelallordersafter',
|
146
153
|
'withdrawal', # for futures wallet -> kraken spot wallet
|
154
|
+
'assignmentprogram/add',
|
155
|
+
'assignmentprogram/delete',
|
147
156
|
],
|
148
157
|
'put': [
|
149
158
|
'leveragepreferences',
|
@@ -209,7 +218,7 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
209
218
|
'invalidAmount': BadRequest,
|
210
219
|
'insufficientFunds': InsufficientFunds,
|
211
220
|
'Bad Request': BadRequest, # The URL contains invalid characters.(Please encode the json URL parameter)
|
212
|
-
'Unavailable':
|
221
|
+
'Unavailable': ExchangeNotAvailable, # https://github.com/ccxt/ccxt/issues/24338
|
213
222
|
'invalidUnit': BadRequest,
|
214
223
|
'Json Parse Error': ExchangeError,
|
215
224
|
'nonceBelowThreshold': InvalidNonce,
|
@@ -267,6 +276,83 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
267
276
|
'method': 'historyGetMarketSymbolExecutions', # historyGetMarketSymbolExecutions, publicGetHistory
|
268
277
|
},
|
269
278
|
},
|
279
|
+
'features': {
|
280
|
+
'default': {
|
281
|
+
'sandbox': True,
|
282
|
+
'createOrder': {
|
283
|
+
'marginMode': False,
|
284
|
+
'triggerPrice': True,
|
285
|
+
'triggerPriceType': {
|
286
|
+
'last': True,
|
287
|
+
'mark': True,
|
288
|
+
'index': True,
|
289
|
+
},
|
290
|
+
'triggerDirection': False,
|
291
|
+
'stopLossPrice': True,
|
292
|
+
'takeProfitPrice': True,
|
293
|
+
'attachedStopLossTakeProfit': None,
|
294
|
+
'timeInForce': {
|
295
|
+
'IOC': True,
|
296
|
+
'FOK': True,
|
297
|
+
'PO': True,
|
298
|
+
'GTD': False,
|
299
|
+
},
|
300
|
+
'hedged': False,
|
301
|
+
'trailing': False,
|
302
|
+
'leverage': False,
|
303
|
+
'marketBuyByCost': False,
|
304
|
+
'marketBuyRequiresPrice': False,
|
305
|
+
'selfTradePrevention': False,
|
306
|
+
'iceberg': False,
|
307
|
+
},
|
308
|
+
'createOrders': {
|
309
|
+
'max': 100,
|
310
|
+
},
|
311
|
+
'fetchMyTrades': {
|
312
|
+
'marginMode': False,
|
313
|
+
'limit': None,
|
314
|
+
'daysBack': None,
|
315
|
+
'untilDays': 100000,
|
316
|
+
},
|
317
|
+
'fetchOrder': None,
|
318
|
+
'fetchOpenOrders': {
|
319
|
+
'marginMode': False,
|
320
|
+
'limit': None,
|
321
|
+
'trigger': False,
|
322
|
+
'trailing': False,
|
323
|
+
},
|
324
|
+
'fetchOrders': None,
|
325
|
+
'fetchClosedOrders': {
|
326
|
+
'marginMode': False,
|
327
|
+
'limit': None,
|
328
|
+
'daysBack': None,
|
329
|
+
'daysBackCanceled': None,
|
330
|
+
'untilDays': None,
|
331
|
+
'trigger': False,
|
332
|
+
'trailing': False,
|
333
|
+
},
|
334
|
+
'fetchOHLCV': {
|
335
|
+
'limit': 5000,
|
336
|
+
},
|
337
|
+
},
|
338
|
+
'spot': None,
|
339
|
+
'swap': {
|
340
|
+
'linear': {
|
341
|
+
'extends': 'default',
|
342
|
+
},
|
343
|
+
'inverse': {
|
344
|
+
'extends': 'default',
|
345
|
+
},
|
346
|
+
},
|
347
|
+
'future': {
|
348
|
+
'linear': {
|
349
|
+
'extends': 'default',
|
350
|
+
},
|
351
|
+
'inverse': {
|
352
|
+
'extends': 'default',
|
353
|
+
},
|
354
|
+
},
|
355
|
+
},
|
270
356
|
'timeframes': {
|
271
357
|
'1m': '1m',
|
272
358
|
'5m': '5m',
|
@@ -280,10 +366,12 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
280
366
|
},
|
281
367
|
})
|
282
368
|
|
283
|
-
def fetch_markets(self, params={}):
|
369
|
+
def fetch_markets(self, params={}) -> List[Market]:
|
284
370
|
"""
|
285
371
|
Fetches the available trading markets from the exchange, Multi-collateral markets are returned markets, but can be settled in multiple currencies
|
286
|
-
|
372
|
+
|
373
|
+
https://docs.futures.kraken.com/#http-api-trading-v3-api-instrument-details-get-instruments
|
374
|
+
|
287
375
|
:param dict [params]: exchange specific params
|
288
376
|
:returns: An array of market structures
|
289
377
|
"""
|
@@ -363,7 +451,8 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
363
451
|
# swap == perpetual
|
364
452
|
settle = None
|
365
453
|
settleId = None
|
366
|
-
|
454
|
+
cvtp = self.safe_string(market, 'contractValueTradePrecision')
|
455
|
+
amountPrecision = self.parse_number(self.integer_precision_to_amount(cvtp))
|
367
456
|
pricePrecision = self.safe_number(market, 'tickSize')
|
368
457
|
contract = (swap or future or index)
|
369
458
|
swapOrFutures = (swap or future)
|
@@ -447,7 +536,9 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
447
536
|
|
448
537
|
def fetch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook:
|
449
538
|
"""
|
450
|
-
|
539
|
+
|
540
|
+
https://docs.futures.kraken.com/#http-api-trading-v3-api-market-data-get-orderbook
|
541
|
+
|
451
542
|
Fetches a list of open orders in a market
|
452
543
|
:param str symbol: Unified market symbol
|
453
544
|
:param int [limit]: Not used by krakenfutures
|
@@ -456,7 +547,7 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
456
547
|
"""
|
457
548
|
self.load_markets()
|
458
549
|
market = self.market(symbol)
|
459
|
-
request = {
|
550
|
+
request: dict = {
|
460
551
|
'symbol': market['id'],
|
461
552
|
}
|
462
553
|
response = self.publicGetOrderbook(self.extend(request, params))
|
@@ -496,7 +587,9 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
496
587
|
def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
|
497
588
|
"""
|
498
589
|
fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
499
|
-
|
590
|
+
|
591
|
+
https://docs.futures.kraken.com/#http-api-trading-v3-api-market-data-get-tickers
|
592
|
+
|
500
593
|
:param str[] symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
501
594
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
502
595
|
:returns dict: an array of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
|
@@ -535,10 +628,10 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
535
628
|
# "serverTime": "2022-02-18T14:16:29.440Z"
|
536
629
|
# }
|
537
630
|
#
|
538
|
-
tickers = self.
|
631
|
+
tickers = self.safe_list(response, 'tickers')
|
539
632
|
return self.parse_tickers(tickers, symbols)
|
540
633
|
|
541
|
-
def parse_ticker(self, ticker, market: Market = None) -> Ticker:
|
634
|
+
def parse_ticker(self, ticker: dict, market: Market = None) -> Ticker:
|
542
635
|
#
|
543
636
|
# {
|
544
637
|
# "tag": 'semiannual', # 'month', 'quarter', "perpetual", "semiannual",
|
@@ -603,12 +696,16 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
603
696
|
'average': average,
|
604
697
|
'baseVolume': baseVolume,
|
605
698
|
'quoteVolume': quoteVolume,
|
699
|
+
'markPrice': self.safe_string(ticker, 'markPrice'),
|
700
|
+
'indexPrice': self.safe_string(ticker, 'indexPrice'),
|
606
701
|
'info': ticker,
|
607
702
|
})
|
608
703
|
|
609
704
|
def fetch_ohlcv(self, symbol: str, timeframe='1m', since: Int = None, limit: Int = None, params={}) -> List[list]:
|
610
705
|
"""
|
611
|
-
|
706
|
+
|
707
|
+
https://docs.futures.kraken.com/#http-api-charts-candles
|
708
|
+
|
612
709
|
fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
613
710
|
:param str symbol: unified symbol of the market to fetch OHLCV data for
|
614
711
|
:param str timeframe: the length of time each candle represents
|
@@ -624,7 +721,7 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
624
721
|
paginate, params = self.handle_option_and_params(params, 'fetchOHLCV', 'paginate')
|
625
722
|
if paginate:
|
626
723
|
return self.fetch_paginated_call_deterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 5000)
|
627
|
-
request = {
|
724
|
+
request: dict = {
|
628
725
|
'symbol': market['id'],
|
629
726
|
'price_type': self.safe_string(params, 'price', 'trade'),
|
630
727
|
'interval': self.timeframes[timeframe],
|
@@ -635,14 +732,12 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
635
732
|
request['from'] = self.parse_to_int(since / 1000)
|
636
733
|
if limit is None:
|
637
734
|
limit = 5000
|
638
|
-
|
639
|
-
raise BadRequest(self.id + ' fetchOHLCV() limit cannot exceed 5000')
|
735
|
+
limit = min(limit, 5000)
|
640
736
|
toTimestamp = self.sum(request['from'], limit * duration - 1)
|
641
737
|
currentTimestamp = self.seconds()
|
642
738
|
request['to'] = min(toTimestamp, currentTimestamp)
|
643
739
|
elif limit is not None:
|
644
|
-
|
645
|
-
raise BadRequest(self.id + ' fetchOHLCV() limit cannot exceed 5000')
|
740
|
+
limit = min(limit, 5000)
|
646
741
|
duration = self.parse_timeframe(timeframe)
|
647
742
|
request['to'] = self.seconds()
|
648
743
|
request['from'] = self.parse_to_int(request['to'] - (duration * limit))
|
@@ -662,7 +757,7 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
662
757
|
# "more_candles": True
|
663
758
|
# }
|
664
759
|
#
|
665
|
-
candles = self.
|
760
|
+
candles = self.safe_list(response, 'candles')
|
666
761
|
return self.parse_ohlcvs(candles, market, timeframe, since, limit)
|
667
762
|
|
668
763
|
def parse_ohlcv(self, ohlcv, market: Market = None) -> list:
|
@@ -687,8 +782,10 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
687
782
|
|
688
783
|
def fetch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
|
689
784
|
"""
|
690
|
-
|
691
|
-
|
785
|
+
|
786
|
+
https://docs.futures.kraken.com/#http-api-trading-v3-api-market-data-get-trade-history
|
787
|
+
https://docs.futures.kraken.com/#http-api-history-market-history-get-public-execution-events
|
788
|
+
|
692
789
|
Fetch a history of filled trades that self account has made
|
693
790
|
:param str symbol: Unified CCXT market symbol
|
694
791
|
:param int [since]: Timestamp in ms of earliest trade. Not used by krakenfutures except in combination with params.until
|
@@ -705,7 +802,7 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
705
802
|
if paginate:
|
706
803
|
return self.fetch_paginated_call_dynamic('fetchTrades', symbol, since, limit, params)
|
707
804
|
market = self.market(symbol)
|
708
|
-
request = {
|
805
|
+
request: dict = {
|
709
806
|
'symbol': market['id'],
|
710
807
|
}
|
711
808
|
method = None
|
@@ -804,7 +901,7 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
804
901
|
rawTrades = self.safe_list(response, 'history', [])
|
805
902
|
return self.parse_trades(rawTrades, market, since, limit)
|
806
903
|
|
807
|
-
def parse_trade(self, trade, market: Market = None) -> Trade:
|
904
|
+
def parse_trade(self, trade: dict, market: Market = None) -> Trade:
|
808
905
|
#
|
809
906
|
# fetchTrades(recent trades)
|
810
907
|
#
|
@@ -949,7 +1046,7 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
949
1046
|
type = 'lmt'
|
950
1047
|
elif type == 'market':
|
951
1048
|
type = 'mkt'
|
952
|
-
request = {
|
1049
|
+
request: dict = {
|
953
1050
|
'symbol': market['id'],
|
954
1051
|
'side': side,
|
955
1052
|
'size': self.amount_to_precision(symbol, amount),
|
@@ -990,12 +1087,15 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
990
1087
|
def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
|
991
1088
|
"""
|
992
1089
|
Create an order on the exchange
|
993
|
-
|
1090
|
+
|
1091
|
+
https://docs.kraken.com/api/docs/futures-api/trading/send-order
|
1092
|
+
|
994
1093
|
:param str symbol: unified market symbol
|
995
1094
|
:param str type: 'limit' or 'market'
|
996
1095
|
:param str side: 'buy' or 'sell'
|
997
1096
|
:param float amount: number of contracts
|
998
1097
|
:param float [price]: limit order price
|
1098
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
999
1099
|
:param bool [params.reduceOnly]: set if you wish the order to only reduce an existing position, any order which increases an existing position will be rejected, default is False
|
1000
1100
|
:param bool [params.postOnly]: set if you wish to make a postOnly order, default is False
|
1001
1101
|
:param str [params.clientOrderId]: UUID The order identity that is specified from the user, It must be globally unique
|
@@ -1003,6 +1103,7 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
1003
1103
|
:param float [params.stopLossPrice]: the price that a stop loss order is triggered at
|
1004
1104
|
:param float [params.takeProfitPrice]: the price that a take profit order is triggered at
|
1005
1105
|
:param str [params.triggerSignal]: for triggerPrice, stopLossPrice and takeProfitPrice orders, the trigger price type, 'last', 'mark' or 'index', default is 'last'
|
1106
|
+
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
1006
1107
|
"""
|
1007
1108
|
self.load_markets()
|
1008
1109
|
market = self.market(symbol)
|
@@ -1046,8 +1147,11 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
1046
1147
|
def create_orders(self, orders: List[OrderRequest], params={}):
|
1047
1148
|
"""
|
1048
1149
|
create a list of trade orders
|
1049
|
-
|
1150
|
+
|
1151
|
+
https://docs.kraken.com/api/docs/futures-api/trading/send-batch-order
|
1152
|
+
|
1050
1153
|
:param Array orders: list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
|
1154
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1051
1155
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
1052
1156
|
"""
|
1053
1157
|
self.load_markets()
|
@@ -1067,7 +1171,7 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
1067
1171
|
extendedParams['order'] = 'send'
|
1068
1172
|
orderRequest = self.create_order_request(marketId, type, side, amount, price, extendedParams)
|
1069
1173
|
ordersRequests.append(orderRequest)
|
1070
|
-
request = {
|
1174
|
+
request: dict = {
|
1071
1175
|
'batchOrder': ordersRequests,
|
1072
1176
|
}
|
1073
1177
|
response = self.privatePostBatchorder(self.extend(request, params))
|
@@ -1087,12 +1191,14 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
1087
1191
|
# ]
|
1088
1192
|
# }
|
1089
1193
|
#
|
1090
|
-
data = self.
|
1194
|
+
data = self.safe_list(response, 'batchStatus', [])
|
1091
1195
|
return self.parse_orders(data)
|
1092
1196
|
|
1093
1197
|
def edit_order(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: Num = None, price: Num = None, params={}):
|
1094
1198
|
"""
|
1095
|
-
|
1199
|
+
|
1200
|
+
https://docs.futures.kraken.com/#http-api-trading-v3-api-order-management-edit-order
|
1201
|
+
|
1096
1202
|
Edit an open order on the exchange
|
1097
1203
|
:param str id: order id
|
1098
1204
|
:param str symbol: Not used by Krakenfutures
|
@@ -1104,7 +1210,7 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
1104
1210
|
:returns: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
1105
1211
|
"""
|
1106
1212
|
self.load_markets()
|
1107
|
-
request = {
|
1213
|
+
request: dict = {
|
1108
1214
|
'orderId': id,
|
1109
1215
|
}
|
1110
1216
|
if amount is not None:
|
@@ -1120,7 +1226,9 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
1120
1226
|
|
1121
1227
|
def cancel_order(self, id: str, symbol: Str = None, params={}):
|
1122
1228
|
"""
|
1123
|
-
|
1229
|
+
|
1230
|
+
https://docs.futures.kraken.com/#http-api-trading-v3-api-order-management-cancel-order
|
1231
|
+
|
1124
1232
|
Cancel an open order on the exchange
|
1125
1233
|
:param str id: Order id
|
1126
1234
|
:param str symbol: Not used by Krakenfutures
|
@@ -1131,7 +1239,7 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
1131
1239
|
response = self.privatePostCancelorder(self.extend({'order_id': id}, params))
|
1132
1240
|
status = self.safe_string(self.safe_value(response, 'cancelStatus', {}), 'status')
|
1133
1241
|
self.verify_order_action_success(status, 'cancelOrder')
|
1134
|
-
order = {}
|
1242
|
+
order: dict = {}
|
1135
1243
|
if 'cancelStatus' in response:
|
1136
1244
|
order = self.parse_order(response['cancelStatus'])
|
1137
1245
|
return self.extend({'info': response}, order)
|
@@ -1139,12 +1247,14 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
1139
1247
|
def cancel_orders(self, ids: List[str], symbol: Str = None, params={}):
|
1140
1248
|
"""
|
1141
1249
|
cancel multiple orders
|
1142
|
-
|
1250
|
+
|
1251
|
+
https://docs.futures.kraken.com/#http-api-trading-v3-api-order-management-batch-order-management
|
1252
|
+
|
1143
1253
|
:param str[] ids: order ids
|
1144
1254
|
:param str [symbol]: unified market symbol
|
1145
1255
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1146
|
-
|
1147
|
-
|
1256
|
+
|
1257
|
+
EXCHANGE SPECIFIC PARAMETERS
|
1148
1258
|
:param str[] [params.clientOrderIds]: max length 10 e.g. ["my_id_1","my_id_2"]
|
1149
1259
|
:returns dict: an list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
1150
1260
|
"""
|
@@ -1158,7 +1268,7 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
1158
1268
|
else:
|
1159
1269
|
for i in range(0, len(ids)):
|
1160
1270
|
orders.append({'order': 'cancel', 'order_id': ids[i]})
|
1161
|
-
request = {
|
1271
|
+
request: dict = {
|
1162
1272
|
'batchOrder': orders,
|
1163
1273
|
}
|
1164
1274
|
response = self.privatePostBatchorder(self.extend(request, params))
|
@@ -1191,26 +1301,95 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
1191
1301
|
# }
|
1192
1302
|
# ]
|
1193
1303
|
# }
|
1194
|
-
batchStatus = self.
|
1304
|
+
batchStatus = self.safe_list(response, 'batchStatus', [])
|
1195
1305
|
return self.parse_orders(batchStatus)
|
1196
1306
|
|
1197
1307
|
def cancel_all_orders(self, symbol: Str = None, params={}):
|
1198
1308
|
"""
|
1199
|
-
|
1309
|
+
|
1310
|
+
https://docs.futures.kraken.com/#http-api-trading-v3-api-order-management-cancel-all-orders
|
1311
|
+
|
1200
1312
|
Cancels all orders on the exchange, including trigger orders
|
1201
1313
|
:param str symbol: Unified market symbol
|
1202
1314
|
:param dict [params]: Exchange specific params
|
1203
1315
|
:returns: Response from exchange api
|
1204
1316
|
"""
|
1205
|
-
request = {}
|
1317
|
+
request: dict = {}
|
1206
1318
|
if symbol is not None:
|
1207
1319
|
request['symbol'] = self.market_id(symbol)
|
1208
1320
|
response = self.privatePostCancelallorders(self.extend(request, params))
|
1321
|
+
#
|
1322
|
+
# {
|
1323
|
+
# result: 'success',
|
1324
|
+
# cancelStatus: {
|
1325
|
+
# receivedTime: '2024-06-06T01:12:44.814Z',
|
1326
|
+
# cancelOnly: 'PF_XRPUSD',
|
1327
|
+
# status: 'cancelled',
|
1328
|
+
# cancelledOrders: [{order_id: '272fd0ac-45c0-4003-b84d-d39b9e86bd36'}],
|
1329
|
+
# orderEvents: [
|
1330
|
+
# {
|
1331
|
+
# uid: '272fd0ac-45c0-4003-b84d-d39b9e86bd36',
|
1332
|
+
# order: {
|
1333
|
+
# orderId: '272fd0ac-45c0-4003-b84d-d39b9e86bd36',
|
1334
|
+
# cliOrdId: null,
|
1335
|
+
# type: 'lmt',
|
1336
|
+
# symbol: 'PF_XRPUSD',
|
1337
|
+
# side: 'buy',
|
1338
|
+
# quantity: '10',
|
1339
|
+
# filled: '0',
|
1340
|
+
# limitPrice: '0.4',
|
1341
|
+
# reduceOnly: False,
|
1342
|
+
# timestamp: '2024-06-06T01:11:16.045Z',
|
1343
|
+
# lastUpdateTimestamp: '2024-06-06T01:11:16.045Z'
|
1344
|
+
# },
|
1345
|
+
# type: 'CANCEL'
|
1346
|
+
# }
|
1347
|
+
# ]
|
1348
|
+
# },
|
1349
|
+
# serverTime: '2024-06-06T01:12:44.814Z'
|
1350
|
+
# }
|
1351
|
+
#
|
1352
|
+
cancelStatus = self.safe_dict(response, 'cancelStatus')
|
1353
|
+
orderEvents = self.safe_list(cancelStatus, 'orderEvents', [])
|
1354
|
+
orders = []
|
1355
|
+
for i in range(0, len(orderEvents)):
|
1356
|
+
orderEvent = self.safe_dict(orderEvents, 0)
|
1357
|
+
order = self.safe_dict(orderEvent, 'order', {})
|
1358
|
+
orders.append(order)
|
1359
|
+
return self.parse_orders(orders)
|
1360
|
+
|
1361
|
+
def cancel_all_orders_after(self, timeout: Int, params={}):
|
1362
|
+
"""
|
1363
|
+
dead man's switch, cancel all orders after the given timeout
|
1364
|
+
|
1365
|
+
https://docs.futures.kraken.com/#http-api-trading-v3-api-order-management-dead-man-39-s-switch
|
1366
|
+
|
1367
|
+
:param number timeout: time in milliseconds, 0 represents cancel the timer
|
1368
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1369
|
+
:returns dict: the api result
|
1370
|
+
"""
|
1371
|
+
self.load_markets()
|
1372
|
+
request: dict = {
|
1373
|
+
'timeout': (self.parse_to_int(timeout / 1000)) if (timeout > 0) else 0,
|
1374
|
+
}
|
1375
|
+
response = self.privatePostCancelallordersafter(self.extend(request, params))
|
1376
|
+
#
|
1377
|
+
# {
|
1378
|
+
# "result": "success",
|
1379
|
+
# "serverTime": "2018-06-19T16:51:23.839Z",
|
1380
|
+
# "status": {
|
1381
|
+
# "currentTime": "2018-06-19T16:51:23.839Z",
|
1382
|
+
# "triggerTime": "0"
|
1383
|
+
# }
|
1384
|
+
# }
|
1385
|
+
#
|
1209
1386
|
return response
|
1210
1387
|
|
1211
1388
|
def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
1212
1389
|
"""
|
1213
|
-
|
1390
|
+
|
1391
|
+
https://docs.futures.kraken.com/#http-api-trading-v3-api-order-management-get-open-orders
|
1392
|
+
|
1214
1393
|
Gets all open orders, including trigger orders, for an account from the exchange api
|
1215
1394
|
:param str symbol: Unified market symbol
|
1216
1395
|
:param int [since]: Timestamp(ms) of earliest order.(Not used by kraken api but filtered internally by CCXT)
|
@@ -1223,12 +1402,14 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
1223
1402
|
if symbol is not None:
|
1224
1403
|
market = self.market(symbol)
|
1225
1404
|
response = self.privateGetOpenorders(params)
|
1226
|
-
orders = self.
|
1405
|
+
orders = self.safe_list(response, 'openOrders', [])
|
1227
1406
|
return self.parse_orders(orders, market, since, limit)
|
1228
1407
|
|
1229
1408
|
def fetch_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
1230
1409
|
"""
|
1231
|
-
|
1410
|
+
|
1411
|
+
https://docs.futures.kraken.com/#http-api-history-account-history-get-order-events
|
1412
|
+
|
1232
1413
|
Gets all closed orders, including trigger orders, for an account from the exchange api
|
1233
1414
|
:param str symbol: Unified market symbol
|
1234
1415
|
:param int [since]: Timestamp(ms) of earliest order.
|
@@ -1240,7 +1421,7 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
1240
1421
|
market = None
|
1241
1422
|
if symbol is not None:
|
1242
1423
|
market = self.market(symbol)
|
1243
|
-
request = {}
|
1424
|
+
request: dict = {}
|
1244
1425
|
if limit is not None:
|
1245
1426
|
request['count'] = limit
|
1246
1427
|
if since is not None:
|
@@ -1262,7 +1443,9 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
1262
1443
|
|
1263
1444
|
def fetch_canceled_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
1264
1445
|
"""
|
1265
|
-
|
1446
|
+
|
1447
|
+
https://docs.futures.kraken.com/#http-api-history-account-history-get-order-events
|
1448
|
+
|
1266
1449
|
Gets all canceled orders, including trigger orders, for an account from the exchange api
|
1267
1450
|
:param str symbol: Unified market symbol
|
1268
1451
|
:param int [since]: Timestamp(ms) of earliest order.
|
@@ -1274,7 +1457,7 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
1274
1457
|
market = None
|
1275
1458
|
if symbol is not None:
|
1276
1459
|
market = self.market(symbol)
|
1277
|
-
request = {}
|
1460
|
+
request: dict = {}
|
1278
1461
|
if limit is not None:
|
1279
1462
|
request['count'] = limit
|
1280
1463
|
if since is not None:
|
@@ -1305,7 +1488,7 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
1305
1488
|
return self.parse_orders(canceledAndRejected, market, since, limit)
|
1306
1489
|
|
1307
1490
|
def parse_order_type(self, orderType):
|
1308
|
-
map = {
|
1491
|
+
map: dict = {
|
1309
1492
|
'lmt': 'limit',
|
1310
1493
|
'mkt': 'market',
|
1311
1494
|
'post': 'limit',
|
@@ -1314,7 +1497,7 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
1314
1497
|
return self.safe_string(map, orderType, orderType)
|
1315
1498
|
|
1316
1499
|
def verify_order_action_success(self, status, method, omit=[]):
|
1317
|
-
errors = {
|
1500
|
+
errors: dict = {
|
1318
1501
|
'invalidOrderType': InvalidOrder,
|
1319
1502
|
'invalidSide': InvalidOrder,
|
1320
1503
|
'invalidSize': InvalidOrder,
|
@@ -1339,8 +1522,8 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
1339
1522
|
if (status in errors) and not self.in_array(status, omit):
|
1340
1523
|
raise errors[status](self.id + ': ' + method + ' failed due to ' + status)
|
1341
1524
|
|
1342
|
-
def parse_order_status(self, status):
|
1343
|
-
statuses = {
|
1525
|
+
def parse_order_status(self, status: Str):
|
1526
|
+
statuses: dict = {
|
1344
1527
|
'placed': 'open', # the order was placed successfully
|
1345
1528
|
'cancelled': 'canceled', # the order was cancelled successfully
|
1346
1529
|
'invalidOrderType': 'rejected', # the order was not placed because orderType is invalid
|
@@ -1370,7 +1553,7 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
1370
1553
|
}
|
1371
1554
|
return self.safe_string(statuses, status, status)
|
1372
1555
|
|
1373
|
-
def parse_order(self, order, market: Market = None) -> Order:
|
1556
|
+
def parse_order(self, order: dict, market: Market = None) -> Order:
|
1374
1557
|
#
|
1375
1558
|
# LIMIT
|
1376
1559
|
#
|
@@ -1525,6 +1708,22 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
1525
1708
|
# ]
|
1526
1709
|
# }
|
1527
1710
|
#
|
1711
|
+
# cancelAllOrders
|
1712
|
+
#
|
1713
|
+
# {
|
1714
|
+
# "orderId": "85c40002-3f20-4e87-9302-262626c3531b",
|
1715
|
+
# "cliOrdId": null,
|
1716
|
+
# "type": "lmt",
|
1717
|
+
# "symbol": "pi_xbtusd",
|
1718
|
+
# "side": "buy",
|
1719
|
+
# "quantity": 1000,
|
1720
|
+
# "filled": 0,
|
1721
|
+
# "limitPrice": 10144,
|
1722
|
+
# "stopPrice": null,
|
1723
|
+
# "reduceOnly": False,
|
1724
|
+
# "timestamp": "2019-08-01T15:26:27.790Z"
|
1725
|
+
# }
|
1726
|
+
#
|
1528
1727
|
# FETCH OPEN ORDERS
|
1529
1728
|
#
|
1530
1729
|
# {
|
@@ -1593,16 +1792,17 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
1593
1792
|
executions.append(item)
|
1594
1793
|
# Final order(after placement / editing / execution / canceling)
|
1595
1794
|
orderTrigger = self.safe_value(item, 'orderTrigger')
|
1596
|
-
details
|
1597
|
-
|
1598
|
-
isPrior = False
|
1599
|
-
fixed = True
|
1600
|
-
elif not fixed:
|
1601
|
-
orderPriorExecution = self.safe_value(item, 'orderPriorExecution')
|
1602
|
-
details = self.safe_value_2(item, 'orderPriorExecution', 'orderPriorEdit')
|
1603
|
-
price = self.safe_string(orderPriorExecution, 'limitPrice')
|
1795
|
+
if details is None:
|
1796
|
+
details = self.safe_value_2(item, 'new', 'order', orderTrigger)
|
1604
1797
|
if details is not None:
|
1605
|
-
isPrior =
|
1798
|
+
isPrior = False
|
1799
|
+
fixed = True
|
1800
|
+
elif not fixed:
|
1801
|
+
orderPriorExecution = self.safe_value(item, 'orderPriorExecution')
|
1802
|
+
details = self.safe_value_2(item, 'orderPriorExecution', 'orderPriorEdit')
|
1803
|
+
price = self.safe_string(orderPriorExecution, 'limitPrice')
|
1804
|
+
if details is not None:
|
1805
|
+
isPrior = True
|
1606
1806
|
trades = self.parse_trades(executions)
|
1607
1807
|
statusId = self.safe_string(order, 'status')
|
1608
1808
|
if details is None:
|
@@ -1678,10 +1878,9 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
1678
1878
|
'type': self.parse_order_type(type),
|
1679
1879
|
'timeInForce': timeInForce,
|
1680
1880
|
'postOnly': type == 'post',
|
1681
|
-
'reduceOnly': self.
|
1881
|
+
'reduceOnly': self.safe_bool_2(details, 'reduceOnly', 'reduce_only'),
|
1682
1882
|
'side': self.safe_string(details, 'side'),
|
1683
1883
|
'price': price,
|
1684
|
-
'stopPrice': self.safe_string(details, 'triggerPrice'),
|
1685
1884
|
'triggerPrice': self.safe_string(details, 'triggerPrice'),
|
1686
1885
|
'amount': amount,
|
1687
1886
|
'cost': cost,
|
@@ -1697,7 +1896,9 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
1697
1896
|
def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
1698
1897
|
"""
|
1699
1898
|
fetch all trades made by the user
|
1700
|
-
|
1899
|
+
|
1900
|
+
https://docs.futures.kraken.com/#http-api-trading-v3-api-historical-data-get-your-fills
|
1901
|
+
|
1701
1902
|
:param str symbol: unified market symbol
|
1702
1903
|
:param int [since]: *not used by the api* the earliest time in ms to fetch trades for
|
1703
1904
|
:param int [limit]: the maximum number of trades structures to retrieve
|
@@ -1709,6 +1910,7 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
1709
1910
|
market = None
|
1710
1911
|
if symbol is not None:
|
1711
1912
|
market = self.market(symbol)
|
1913
|
+
# todo: lastFillTime: self.iso8601(end)
|
1712
1914
|
response = self.privateGetFills(params)
|
1713
1915
|
#
|
1714
1916
|
# {
|
@@ -1734,7 +1936,9 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
1734
1936
|
|
1735
1937
|
def fetch_balance(self, params={}) -> Balances:
|
1736
1938
|
"""
|
1737
|
-
|
1939
|
+
|
1940
|
+
https://docs.futures.kraken.com/#http-api-trading-v3-api-account-information-get-wallets
|
1941
|
+
|
1738
1942
|
Fetch the balance for a sub-account, all sub-account balances are inside 'info' in the response
|
1739
1943
|
:param dict [params]: Exchange specific parameters
|
1740
1944
|
:param str [params.type]: The sub-account type to query the balance of, possible values include 'flex', 'cash'/'main'/'funding', or a market symbol * defaults to 'flex' *
|
@@ -1920,7 +2124,7 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
1920
2124
|
isFlex = (accountType == 'multiCollateralMarginAccount')
|
1921
2125
|
isCash = (accountType == 'cashAccount')
|
1922
2126
|
balances = self.safe_value_2(response, 'balances', 'currencies', {})
|
1923
|
-
result = {}
|
2127
|
+
result: dict = {}
|
1924
2128
|
currencyIds = list(balances.keys())
|
1925
2129
|
for i in range(0, len(currencyIds)):
|
1926
2130
|
currencyId = currencyIds[i]
|
@@ -1944,10 +2148,12 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
1944
2148
|
result[code] = account
|
1945
2149
|
return self.safe_balance(result)
|
1946
2150
|
|
1947
|
-
def fetch_funding_rates(self, symbols: Strings = None, params={}):
|
2151
|
+
def fetch_funding_rates(self, symbols: Strings = None, params={}) -> FundingRates:
|
1948
2152
|
"""
|
1949
|
-
|
1950
|
-
|
2153
|
+
fetch the current funding rates for multiple markets
|
2154
|
+
|
2155
|
+
https://docs.futures.kraken.com/#http-api-trading-v3-api-market-data-get-tickers
|
2156
|
+
|
1951
2157
|
:param str[] symbols: unified market symbols
|
1952
2158
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1953
2159
|
:returns Order[]: an array of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rate-structure>`
|
@@ -1955,7 +2161,7 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
1955
2161
|
self.load_markets()
|
1956
2162
|
marketIds = self.market_ids(symbols)
|
1957
2163
|
response = self.publicGetTickers(params)
|
1958
|
-
tickers = self.
|
2164
|
+
tickers = self.safe_list(response, 'tickers', [])
|
1959
2165
|
fundingRates = []
|
1960
2166
|
for i in range(0, len(tickers)):
|
1961
2167
|
entry = tickers[i]
|
@@ -1968,7 +2174,7 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
1968
2174
|
fundingRates.append(parsed)
|
1969
2175
|
return self.index_by(fundingRates, 'symbol')
|
1970
2176
|
|
1971
|
-
def parse_funding_rate(self, ticker, market: Market = None):
|
2177
|
+
def parse_funding_rate(self, ticker, market: Market = None) -> FundingRate:
|
1972
2178
|
#
|
1973
2179
|
# {"ask": 26.283,
|
1974
2180
|
# "askSize": 4.6,
|
@@ -2022,12 +2228,15 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
2022
2228
|
'previousFundingRate': None,
|
2023
2229
|
'previousFundingTimestamp': None,
|
2024
2230
|
'previousFundingDatetime': None,
|
2231
|
+
'interval': None,
|
2025
2232
|
}
|
2026
2233
|
|
2027
2234
|
def fetch_funding_rate_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
2028
2235
|
"""
|
2029
2236
|
fetches historical funding rate prices
|
2030
|
-
|
2237
|
+
|
2238
|
+
https://docs.futures.kraken.com/#http-api-trading-v3-api-historical-funding-rates-historical-funding-rates
|
2239
|
+
|
2031
2240
|
:param str symbol: unified symbol of the market to fetch the funding rate history for
|
2032
2241
|
:param int [since]: timestamp in ms of the earliest funding rate to fetch
|
2033
2242
|
:param int [limit]: the maximum amount of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rate-history-structure>` to fetch
|
@@ -2040,7 +2249,7 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
2040
2249
|
market = self.market(symbol)
|
2041
2250
|
if not market['swap']:
|
2042
2251
|
raise BadRequest(self.id + ' fetchFundingRateHistory() supports swap contracts only')
|
2043
|
-
request = {
|
2252
|
+
request: dict = {
|
2044
2253
|
'symbol': market['id'].upper(),
|
2045
2254
|
}
|
2046
2255
|
response = self.publicGetHistoricalfundingrates(self.extend(request, params))
|
@@ -2073,14 +2282,16 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
2073
2282
|
|
2074
2283
|
def fetch_positions(self, symbols: Strings = None, params={}):
|
2075
2284
|
"""
|
2076
|
-
|
2285
|
+
|
2286
|
+
https://docs.futures.kraken.com/#http-api-trading-v3-api-account-information-get-open-positions
|
2287
|
+
|
2077
2288
|
Fetches current contract trading positions
|
2078
2289
|
:param str[] symbols: List of unified symbols
|
2079
2290
|
:param dict [params]: Not used by krakenfutures
|
2080
2291
|
:returns: Parsed exchange response for positions
|
2081
2292
|
"""
|
2082
2293
|
self.load_markets()
|
2083
|
-
request = {}
|
2294
|
+
request: dict = {}
|
2084
2295
|
response = self.privateGetOpenpositions(request)
|
2085
2296
|
#
|
2086
2297
|
# {
|
@@ -2109,7 +2320,7 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
2109
2320
|
result.append(position)
|
2110
2321
|
return result
|
2111
2322
|
|
2112
|
-
def parse_position(self, position, market: Market = None):
|
2323
|
+
def parse_position(self, position: dict, market: Market = None):
|
2113
2324
|
# cross
|
2114
2325
|
# {
|
2115
2326
|
# "side": "long",
|
@@ -2163,10 +2374,12 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
2163
2374
|
'percentage': None,
|
2164
2375
|
}
|
2165
2376
|
|
2166
|
-
def fetch_leverage_tiers(self, symbols: Strings = None, params={}):
|
2377
|
+
def fetch_leverage_tiers(self, symbols: Strings = None, params={}) -> LeverageTiers:
|
2167
2378
|
"""
|
2168
|
-
:see: https://docs.futures.kraken.com/#http-api-trading-v3-api-instrument-details-get-instruments
|
2169
2379
|
retrieve information on the maximum leverage, and maintenance margin for trades of varying trade sizes
|
2380
|
+
|
2381
|
+
https://docs.futures.kraken.com/#http-api-trading-v3-api-instrument-details-get-instruments
|
2382
|
+
|
2170
2383
|
:param str[]|None symbols: list of unified market symbols
|
2171
2384
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2172
2385
|
:returns dict: a dictionary of `leverage tiers structures <https://docs.ccxt.com/#/?id=leverage-tiers-structure>`, indexed by market symbols
|
@@ -2217,14 +2430,14 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
2217
2430
|
# "serverTime": "2018-07-19T11:32:39.433Z"
|
2218
2431
|
# }
|
2219
2432
|
#
|
2220
|
-
data = self.
|
2433
|
+
data = self.safe_list(response, 'instruments')
|
2221
2434
|
return self.parse_leverage_tiers(data, symbols, 'symbol')
|
2222
2435
|
|
2223
|
-
def parse_market_leverage_tiers(self, info, market: Market = None):
|
2436
|
+
def parse_market_leverage_tiers(self, info, market: Market = None) -> List[LeverageTier]:
|
2224
2437
|
"""
|
2225
|
-
|
2226
|
-
|
2227
|
-
|
2438
|
+
@ignore
|
2439
|
+
@param info Exchange market response for 1 market
|
2440
|
+
@param market CCXT market
|
2228
2441
|
"""
|
2229
2442
|
#
|
2230
2443
|
# {
|
@@ -2260,29 +2473,32 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
2260
2473
|
# }
|
2261
2474
|
#
|
2262
2475
|
marginLevels = self.safe_value(info, 'marginLevels')
|
2263
|
-
|
2264
|
-
market = self.safe_market(
|
2476
|
+
marketId = self.safe_string(info, 'symbol')
|
2477
|
+
market = self.safe_market(marketId, market)
|
2265
2478
|
tiers = []
|
2479
|
+
if marginLevels is None:
|
2480
|
+
return tiers
|
2266
2481
|
for i in range(0, len(marginLevels)):
|
2267
2482
|
tier = marginLevels[i]
|
2268
2483
|
initialMargin = self.safe_string(tier, 'initialMargin')
|
2269
|
-
|
2484
|
+
minNotional = self.safe_number(tier, 'numNonContractUnits')
|
2270
2485
|
if i != 0:
|
2271
2486
|
tiersLength = len(tiers)
|
2272
2487
|
previousTier = tiers[tiersLength - 1]
|
2273
|
-
previousTier['
|
2488
|
+
previousTier['maxNotional'] = minNotional
|
2274
2489
|
tiers.append({
|
2275
2490
|
'tier': self.sum(i, 1),
|
2491
|
+
'symbol': self.safe_symbol(marketId, market),
|
2276
2492
|
'currency': market['quote'],
|
2277
|
-
'
|
2278
|
-
'
|
2493
|
+
'minNotional': minNotional,
|
2494
|
+
'maxNotional': None,
|
2279
2495
|
'maintenanceMarginRate': self.safe_number(tier, 'maintenanceMargin'),
|
2280
2496
|
'maxLeverage': self.parse_number(Precise.string_div('1', initialMargin)),
|
2281
2497
|
'info': tier,
|
2282
2498
|
})
|
2283
2499
|
return tiers
|
2284
2500
|
|
2285
|
-
def parse_transfer(self, transfer, currency: Currency = None):
|
2501
|
+
def parse_transfer(self, transfer: dict, currency: Currency = None) -> TransferEntry:
|
2286
2502
|
#
|
2287
2503
|
# transfer
|
2288
2504
|
#
|
@@ -2305,7 +2521,7 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
2305
2521
|
}
|
2306
2522
|
|
2307
2523
|
def parse_account(self, account):
|
2308
|
-
accountByType = {
|
2524
|
+
accountByType: dict = {
|
2309
2525
|
'main': 'cash',
|
2310
2526
|
'funding': 'cash',
|
2311
2527
|
'future': 'cash',
|
@@ -2340,8 +2556,10 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
2340
2556
|
|
2341
2557
|
def transfer(self, code: str, amount: float, fromAccount: str, toAccount: str, params={}) -> TransferEntry:
|
2342
2558
|
"""
|
2343
|
-
|
2344
|
-
|
2559
|
+
|
2560
|
+
https://docs.futures.kraken.com/#http-api-trading-v3-api-transfers-initiate-wallet-transfer
|
2561
|
+
https://docs.futures.kraken.com/#http-api-trading-v3-api-transfers-initiate-withdrawal-to-spot-wallet
|
2562
|
+
|
2345
2563
|
transfers currencies between sub-accounts
|
2346
2564
|
:param str code: Unified currency code
|
2347
2565
|
:param float amount: Size of the transfer
|
@@ -2354,7 +2572,7 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
2354
2572
|
currency = self.currency(code)
|
2355
2573
|
if fromAccount == 'spot':
|
2356
2574
|
raise BadRequest(self.id + ' transfer does not yet support transfers from spot')
|
2357
|
-
request = {
|
2575
|
+
request: dict = {
|
2358
2576
|
'amount': amount,
|
2359
2577
|
}
|
2360
2578
|
response = None
|
@@ -2384,7 +2602,9 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
2384
2602
|
def set_leverage(self, leverage: Int, symbol: Str = None, params={}):
|
2385
2603
|
"""
|
2386
2604
|
set the level of leverage for a market
|
2387
|
-
|
2605
|
+
|
2606
|
+
https://docs.futures.kraken.com/#http-api-trading-v3-api-multi-collateral-set-the-leverage-setting-for-a-market
|
2607
|
+
|
2388
2608
|
:param float leverage: the rate of leverage
|
2389
2609
|
:param str symbol: unified market symbol
|
2390
2610
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -2393,7 +2613,7 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
2393
2613
|
if symbol is None:
|
2394
2614
|
raise ArgumentsRequired(self.id + ' setLeverage() requires a symbol argument')
|
2395
2615
|
self.load_markets()
|
2396
|
-
request = {
|
2616
|
+
request: dict = {
|
2397
2617
|
'maxLeverage': leverage,
|
2398
2618
|
'symbol': self.market_id(symbol).upper(),
|
2399
2619
|
}
|
@@ -2402,10 +2622,12 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
2402
2622
|
#
|
2403
2623
|
return self.privatePutLeveragepreferences(self.extend(request, params))
|
2404
2624
|
|
2405
|
-
def fetch_leverages(self, symbols:
|
2625
|
+
def fetch_leverages(self, symbols: Strings = None, params={}) -> Leverages:
|
2406
2626
|
"""
|
2407
2627
|
fetch the set leverage for all contract and margin markets
|
2408
|
-
|
2628
|
+
|
2629
|
+
https://docs.futures.kraken.com/#http-api-trading-v3-api-multi-collateral-get-the-leverage-setting-for-a-market
|
2630
|
+
|
2409
2631
|
:param str[] [symbols]: a list of unified market symbols
|
2410
2632
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2411
2633
|
:returns dict: a list of `leverage structures <https://docs.ccxt.com/#/?id=leverage-structure>`
|
@@ -2430,7 +2652,9 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
2430
2652
|
def fetch_leverage(self, symbol: str, params={}) -> Leverage:
|
2431
2653
|
"""
|
2432
2654
|
fetch the set leverage for a market
|
2433
|
-
|
2655
|
+
|
2656
|
+
https://docs.futures.kraken.com/#http-api-trading-v3-api-multi-collateral-get-the-leverage-setting-for-a-market
|
2657
|
+
|
2434
2658
|
:param str symbol: unified market symbol
|
2435
2659
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2436
2660
|
:returns dict: a `leverage structure <https://docs.ccxt.com/#/?id=leverage-structure>`
|
@@ -2439,7 +2663,7 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
2439
2663
|
raise ArgumentsRequired(self.id + ' fetchLeverage() requires a symbol argument')
|
2440
2664
|
self.load_markets()
|
2441
2665
|
market = self.market(symbol)
|
2442
|
-
request = {
|
2666
|
+
request: dict = {
|
2443
2667
|
'symbol': self.market_id(symbol).upper(),
|
2444
2668
|
}
|
2445
2669
|
response = self.privateGetLeveragepreferences(self.extend(request, params))
|
@@ -2454,7 +2678,7 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
2454
2678
|
data = self.safe_dict(leveragePreferences, 0, {})
|
2455
2679
|
return self.parse_leverage(data, market)
|
2456
2680
|
|
2457
|
-
def parse_leverage(self, leverage, market=None) -> Leverage:
|
2681
|
+
def parse_leverage(self, leverage: dict, market: Market = None) -> Leverage:
|
2458
2682
|
marketId = self.safe_string(leverage, 'symbol')
|
2459
2683
|
leverageValue = self.safe_integer(leverage, 'maxLeverage')
|
2460
2684
|
return {
|
@@ -2465,7 +2689,7 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
2465
2689
|
'shortLeverage': leverageValue,
|
2466
2690
|
}
|
2467
2691
|
|
2468
|
-
def handle_errors(self, code, reason, url, method, headers, body, response, requestHeaders, requestBody):
|
2692
|
+
def handle_errors(self, code: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
|
2469
2693
|
if response is None:
|
2470
2694
|
return None
|
2471
2695
|
if code == 429:
|