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
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
# -----------------------------------------------------------------------------
|
4
4
|
|
5
|
-
__version__ = '4.
|
5
|
+
__version__ = '4.4.48'
|
6
6
|
|
7
7
|
# -----------------------------------------------------------------------------
|
8
8
|
|
@@ -16,7 +16,7 @@ import sys
|
|
16
16
|
import yarl
|
17
17
|
import math
|
18
18
|
from typing import Any, List
|
19
|
-
from ccxt.base.types import Int, Str, Num
|
19
|
+
from ccxt.base.types import Int, Str, Num, Strings
|
20
20
|
|
21
21
|
# -----------------------------------------------------------------------------
|
22
22
|
|
@@ -24,8 +24,8 @@ from ccxt.async_support.base.throttler import Throttler
|
|
24
24
|
|
25
25
|
# -----------------------------------------------------------------------------
|
26
26
|
|
27
|
-
from ccxt.base.errors import BaseError, BadSymbol, BadRequest, BadResponse, ExchangeError, ExchangeNotAvailable, RequestTimeout, NotSupported, NullResponse, InvalidAddress, RateLimitExceeded
|
28
|
-
from ccxt.base.types import OrderType, OrderSide, OrderRequest
|
27
|
+
from ccxt.base.errors import BaseError, NetworkError, BadSymbol, BadRequest, BadResponse, ExchangeError, ExchangeNotAvailable, RequestTimeout, NotSupported, NullResponse, InvalidAddress, RateLimitExceeded
|
28
|
+
from ccxt.base.types import OrderType, OrderSide, OrderRequest, CancellationRequest
|
29
29
|
|
30
30
|
# -----------------------------------------------------------------------------
|
31
31
|
|
@@ -65,6 +65,7 @@ class Exchange(BaseExchange):
|
|
65
65
|
ping = None
|
66
66
|
newUpdates = True
|
67
67
|
clients = {}
|
68
|
+
timeout_on_exit = 250 # needed for: https://github.com/ccxt/ccxt/pull/23470
|
68
69
|
|
69
70
|
def __init__(self, config={}):
|
70
71
|
if 'asyncio_loop' in config:
|
@@ -114,8 +115,8 @@ class Exchange(BaseExchange):
|
|
114
115
|
|
115
116
|
if self.own_session and self.session is None:
|
116
117
|
# Pass this SSL context to aiohttp and create a TCPConnector
|
117
|
-
|
118
|
-
self.session = aiohttp.ClientSession(loop=self.asyncio_loop, connector=
|
118
|
+
self.tcp_connector = aiohttp.TCPConnector(ssl=self.ssl_context, loop=self.asyncio_loop, enable_cleanup_closed=True)
|
119
|
+
self.session = aiohttp.ClientSession(loop=self.asyncio_loop, connector=self.tcp_connector, trust_env=self.aiohttp_trust_env)
|
119
120
|
|
120
121
|
async def close(self):
|
121
122
|
await self.ws_close()
|
@@ -123,7 +124,17 @@ class Exchange(BaseExchange):
|
|
123
124
|
if self.own_session:
|
124
125
|
await self.session.close()
|
125
126
|
self.session = None
|
127
|
+
await self.close_connector()
|
126
128
|
await self.close_proxy_sessions()
|
129
|
+
await self.sleep(self.timeout_on_exit)
|
130
|
+
|
131
|
+
async def close_connector(self):
|
132
|
+
if self.tcp_connector is not None:
|
133
|
+
await self.tcp_connector.close()
|
134
|
+
self.tcp_connector = None
|
135
|
+
if self.aiohttp_socks_connector is not None:
|
136
|
+
await self.aiohttp_socks_connector.close()
|
137
|
+
self.aiohttp_socks_connector = None
|
127
138
|
|
128
139
|
async def close_proxy_sessions(self):
|
129
140
|
if self.socks_proxy_sessions is not None:
|
@@ -153,20 +164,20 @@ class Exchange(BaseExchange):
|
|
153
164
|
elif socksProxy:
|
154
165
|
if ProxyConnector is None:
|
155
166
|
raise NotSupported(self.id + ' - to use SOCKS proxy with ccxt, you need "aiohttp_socks" module that can be installed by "pip install aiohttp_socks"')
|
156
|
-
# Create our SSL context object with our CA cert file
|
157
|
-
self.open() # ensure `asyncio_loop` is set
|
158
|
-
connector = ProxyConnector.from_url(
|
159
|
-
socksProxy,
|
160
|
-
# extra args copied from self.open()
|
161
|
-
ssl=self.ssl_context,
|
162
|
-
loop=self.asyncio_loop,
|
163
|
-
enable_cleanup_closed=True
|
164
|
-
)
|
165
167
|
# override session
|
166
168
|
if (self.socks_proxy_sessions is None):
|
167
169
|
self.socks_proxy_sessions = {}
|
168
170
|
if (socksProxy not in self.socks_proxy_sessions):
|
169
|
-
|
171
|
+
# Create our SSL context object with our CA cert file
|
172
|
+
self.open() # ensure `asyncio_loop` is set
|
173
|
+
self.aiohttp_socks_connector = ProxyConnector.from_url(
|
174
|
+
socksProxy,
|
175
|
+
# extra args copied from self.open()
|
176
|
+
ssl=self.ssl_context,
|
177
|
+
loop=self.asyncio_loop,
|
178
|
+
enable_cleanup_closed=True
|
179
|
+
)
|
180
|
+
self.socks_proxy_sessions[socksProxy] = aiohttp.ClientSession(loop=self.asyncio_loop, connector=self.aiohttp_socks_connector, trust_env=self.aiohttp_trust_env)
|
170
181
|
proxy_session = self.socks_proxy_sessions[socksProxy]
|
171
182
|
# add aiohttp_proxy for python as exclusion
|
172
183
|
elif self.aiohttp_proxy:
|
@@ -277,18 +288,6 @@ class Exchange(BaseExchange):
|
|
277
288
|
self.reloading_markets = False
|
278
289
|
return result
|
279
290
|
|
280
|
-
async def fetch_fees(self):
|
281
|
-
trading = {}
|
282
|
-
funding = {}
|
283
|
-
if self.has['fetchTradingFees']:
|
284
|
-
trading = await self.fetch_trading_fees()
|
285
|
-
if self.has['fetchFundingFees']:
|
286
|
-
funding = await self.fetch_funding_fees()
|
287
|
-
return {
|
288
|
-
'trading': trading,
|
289
|
-
'funding': funding,
|
290
|
-
}
|
291
|
-
|
292
291
|
async def load_fees(self, reload=False):
|
293
292
|
if not reload:
|
294
293
|
if self.loaded_fees != Exchange.loaded_fees:
|
@@ -580,12 +579,34 @@ class Exchange(BaseExchange):
|
|
580
579
|
async def fetch_trades_ws(self, symbol: str, since: Int = None, limit: Int = None, params={}):
|
581
580
|
raise NotSupported(self.id + ' fetchTradesWs() is not supported yet')
|
582
581
|
|
582
|
+
async def watch_liquidations(self, symbol: str, since: Int = None, limit: Int = None, params={}):
|
583
|
+
if self.has['watchLiquidationsForSymbols']:
|
584
|
+
return await self.watch_liquidations_for_symbols([symbol], since, limit, params)
|
585
|
+
raise NotSupported(self.id + ' watchLiquidations() is not supported yet')
|
586
|
+
|
587
|
+
async def watch_liquidations_for_symbols(self, symbols: List[str], since: Int = None, limit: Int = None, params={}):
|
588
|
+
raise NotSupported(self.id + ' watchLiquidationsForSymbols() is not supported yet')
|
589
|
+
|
590
|
+
async def watch_my_liquidations(self, symbol: str, since: Int = None, limit: Int = None, params={}):
|
591
|
+
if self.has['watchMyLiquidationsForSymbols']:
|
592
|
+
return self.watch_my_liquidations_for_symbols([symbol], since, limit, params)
|
593
|
+
raise NotSupported(self.id + ' watchMyLiquidations() is not supported yet')
|
594
|
+
|
595
|
+
async def watch_my_liquidations_for_symbols(self, symbols: List[str], since: Int = None, limit: Int = None, params={}):
|
596
|
+
raise NotSupported(self.id + ' watchMyLiquidationsForSymbols() is not supported yet')
|
597
|
+
|
583
598
|
async def watch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={}):
|
584
599
|
raise NotSupported(self.id + ' watchTrades() is not supported yet')
|
585
600
|
|
601
|
+
async def un_watch_trades(self, symbol: str, params={}):
|
602
|
+
raise NotSupported(self.id + ' unWatchTrades() is not supported yet')
|
603
|
+
|
586
604
|
async def watch_trades_for_symbols(self, symbols: List[str], since: Int = None, limit: Int = None, params={}):
|
587
605
|
raise NotSupported(self.id + ' watchTradesForSymbols() is not supported yet')
|
588
606
|
|
607
|
+
async def un_watch_trades_for_symbols(self, symbols: List[str], params={}):
|
608
|
+
raise NotSupported(self.id + ' unWatchTradesForSymbols() is not supported yet')
|
609
|
+
|
589
610
|
async def watch_my_trades_for_symbols(self, symbols: List[str], since: Int = None, limit: Int = None, params={}):
|
590
611
|
raise NotSupported(self.id + ' watchMyTradesForSymbols() is not supported yet')
|
591
612
|
|
@@ -595,27 +616,36 @@ class Exchange(BaseExchange):
|
|
595
616
|
async def watch_ohlcv_for_symbols(self, symbolsAndTimeframes: List[List[str]], since: Int = None, limit: Int = None, params={}):
|
596
617
|
raise NotSupported(self.id + ' watchOHLCVForSymbols() is not supported yet')
|
597
618
|
|
619
|
+
async def un_watch_ohlcv_for_symbols(self, symbolsAndTimeframes: List[List[str]], params={}):
|
620
|
+
raise NotSupported(self.id + ' unWatchOHLCVForSymbols() is not supported yet')
|
621
|
+
|
598
622
|
async def watch_order_book_for_symbols(self, symbols: List[str], limit: Int = None, params={}):
|
599
623
|
raise NotSupported(self.id + ' watchOrderBookForSymbols() is not supported yet')
|
600
624
|
|
601
|
-
async def
|
625
|
+
async def un_watch_order_book_for_symbols(self, symbols: List[str], params={}):
|
626
|
+
raise NotSupported(self.id + ' unWatchOrderBookForSymbols() is not supported yet')
|
627
|
+
|
628
|
+
async def fetch_deposit_addresses(self, codes: Strings = None, params={}):
|
602
629
|
raise NotSupported(self.id + ' fetchDepositAddresses() is not supported yet')
|
603
630
|
|
604
631
|
async def fetch_order_book(self, symbol: str, limit: Int = None, params={}):
|
605
632
|
raise NotSupported(self.id + ' fetchOrderBook() is not supported yet')
|
606
633
|
|
634
|
+
async def fetch_order_book_ws(self, symbol: str, limit: Int = None, params={}):
|
635
|
+
raise NotSupported(self.id + ' fetchOrderBookWs() is not supported yet')
|
636
|
+
|
607
637
|
async def fetch_margin_mode(self, symbol: str, params={}):
|
608
638
|
if self.has['fetchMarginModes']:
|
609
|
-
marginModes = await self.
|
639
|
+
marginModes = await self.fetch_margin_modes([symbol], params)
|
610
640
|
return self.safe_dict(marginModes, symbol)
|
611
641
|
else:
|
612
642
|
raise NotSupported(self.id + ' fetchMarginMode() is not supported yet')
|
613
643
|
|
614
|
-
async def fetch_margin_modes(self, symbols:
|
644
|
+
async def fetch_margin_modes(self, symbols: Strings = None, params={}):
|
615
645
|
raise NotSupported(self.id + ' fetchMarginModes() is not supported yet')
|
616
646
|
|
617
647
|
async def fetch_rest_order_book_safe(self, symbol, limit=None, params={}):
|
618
|
-
fetchSnapshotMaxRetries = self.
|
648
|
+
fetchSnapshotMaxRetries = self.handle_option('watchOrderBook', 'maxRetries', 3)
|
619
649
|
for i in range(0, fetchSnapshotMaxRetries):
|
620
650
|
try:
|
621
651
|
orderBook = await self.fetch_order_book(symbol, limit, params)
|
@@ -628,10 +658,13 @@ class Exchange(BaseExchange):
|
|
628
658
|
async def watch_order_book(self, symbol: str, limit: Int = None, params={}):
|
629
659
|
raise NotSupported(self.id + ' watchOrderBook() is not supported yet')
|
630
660
|
|
661
|
+
async def un_watch_order_book(self, symbol: str, params={}):
|
662
|
+
raise NotSupported(self.id + ' unWatchOrderBook() is not supported yet')
|
663
|
+
|
631
664
|
async def fetch_time(self, params={}):
|
632
665
|
raise NotSupported(self.id + ' fetchTime() is not supported yet')
|
633
666
|
|
634
|
-
async def fetch_trading_limits(self, symbols:
|
667
|
+
async def fetch_trading_limits(self, symbols: Strings = None, params={}):
|
635
668
|
raise NotSupported(self.id + ' fetchTradingLimits() is not supported yet')
|
636
669
|
|
637
670
|
async def fetch_cross_borrow_rates(self, params={}):
|
@@ -640,12 +673,15 @@ class Exchange(BaseExchange):
|
|
640
673
|
async def fetch_isolated_borrow_rates(self, params={}):
|
641
674
|
raise NotSupported(self.id + ' fetchIsolatedBorrowRates() is not supported yet')
|
642
675
|
|
643
|
-
async def fetch_leverage_tiers(self, symbols:
|
676
|
+
async def fetch_leverage_tiers(self, symbols: Strings = None, params={}):
|
644
677
|
raise NotSupported(self.id + ' fetchLeverageTiers() is not supported yet')
|
645
678
|
|
646
|
-
async def fetch_funding_rates(self, symbols:
|
679
|
+
async def fetch_funding_rates(self, symbols: Strings = None, params={}):
|
647
680
|
raise NotSupported(self.id + ' fetchFundingRates() is not supported yet')
|
648
681
|
|
682
|
+
async def fetch_funding_intervals(self, symbols: Strings = None, params={}):
|
683
|
+
raise NotSupported(self.id + ' fetchFundingIntervals() is not supported yet')
|
684
|
+
|
649
685
|
async def watch_funding_rate(self, symbol: str, params={}):
|
650
686
|
raise NotSupported(self.id + ' watchFundingRate() is not supported yet')
|
651
687
|
|
@@ -653,7 +689,7 @@ class Exchange(BaseExchange):
|
|
653
689
|
raise NotSupported(self.id + ' watchFundingRates() is not supported yet')
|
654
690
|
|
655
691
|
async def watch_funding_rates_for_symbols(self, symbols: List[str], params={}):
|
656
|
-
return await self.
|
692
|
+
return await self.watch_funding_rates(symbols, params)
|
657
693
|
|
658
694
|
async def transfer(self, code: str, amount: float, fromAccount: str, toAccount: str, params={}):
|
659
695
|
raise NotSupported(self.id + ' transfer() is not supported yet')
|
@@ -669,12 +705,12 @@ class Exchange(BaseExchange):
|
|
669
705
|
|
670
706
|
async def fetch_leverage(self, symbol: str, params={}):
|
671
707
|
if self.has['fetchLeverages']:
|
672
|
-
leverages = await self.
|
708
|
+
leverages = await self.fetch_leverages([symbol], params)
|
673
709
|
return self.safe_dict(leverages, symbol)
|
674
710
|
else:
|
675
711
|
raise NotSupported(self.id + ' fetchLeverage() is not supported yet')
|
676
712
|
|
677
|
-
async def fetch_leverages(self, symbols:
|
713
|
+
async def fetch_leverages(self, symbols: Strings = None, params={}):
|
678
714
|
raise NotSupported(self.id + ' fetchLeverages() is not supported yet')
|
679
715
|
|
680
716
|
async def set_position_mode(self, hedged: bool, symbol: Str = None, params={}):
|
@@ -689,6 +725,24 @@ class Exchange(BaseExchange):
|
|
689
725
|
async def set_margin(self, symbol: str, amount: float, params={}):
|
690
726
|
raise NotSupported(self.id + ' setMargin() is not supported yet')
|
691
727
|
|
728
|
+
async def fetch_long_short_ratio(self, symbol: str, timeframe: Str = None, params={}):
|
729
|
+
raise NotSupported(self.id + ' fetchLongShortRatio() is not supported yet')
|
730
|
+
|
731
|
+
async def fetch_long_short_ratio_history(self, symbol: Str = None, timeframe: Str = None, since: Int = None, limit: Int = None, params={}):
|
732
|
+
raise NotSupported(self.id + ' fetchLongShortRatioHistory() is not supported yet')
|
733
|
+
|
734
|
+
async def fetch_margin_adjustment_history(self, symbol: Str = None, type: Str = None, since: Num = None, limit: Num = None, params={}):
|
735
|
+
"""
|
736
|
+
fetches the history of margin added or reduced from contract isolated positions
|
737
|
+
:param str [symbol]: unified market symbol
|
738
|
+
:param str [type]: "add" or "reduce"
|
739
|
+
:param int [since]: timestamp in ms of the earliest change to fetch
|
740
|
+
:param int [limit]: the maximum amount of changes to fetch
|
741
|
+
:param dict params: extra parameters specific to the exchange api endpoint
|
742
|
+
:returns dict[]: a list of `margin structures <https://docs.ccxt.com/#/?id=margin-loan-structure>`
|
743
|
+
"""
|
744
|
+
raise NotSupported(self.id + ' fetchMarginAdjustmentHistory() is not supported yet')
|
745
|
+
|
692
746
|
async def set_margin_mode(self, marginMode: str, symbol: Str = None, params={}):
|
693
747
|
raise NotSupported(self.id + ' setMarginMode() is not supported yet')
|
694
748
|
|
@@ -701,19 +755,22 @@ class Exchange(BaseExchange):
|
|
701
755
|
async def fetch_open_interest(self, symbol: str, params={}):
|
702
756
|
raise NotSupported(self.id + ' fetchOpenInterest() is not supported yet')
|
703
757
|
|
758
|
+
async def fetch_open_interests(self, symbols: Strings = None, params={}):
|
759
|
+
raise NotSupported(self.id + ' fetchOpenInterests() is not supported yet')
|
760
|
+
|
704
761
|
async def sign_in(self, params={}):
|
705
762
|
raise NotSupported(self.id + ' signIn() is not supported yet')
|
706
763
|
|
707
764
|
async def fetch_payment_methods(self, params={}):
|
708
765
|
raise NotSupported(self.id + ' fetchPaymentMethods() is not supported yet')
|
709
766
|
|
710
|
-
async def fetch_borrow_rate(self, code: str, amount, params={}):
|
767
|
+
async def fetch_borrow_rate(self, code: str, amount: float, params={}):
|
711
768
|
raise NotSupported(self.id + ' fetchBorrowRate is deprecated, please use fetchCrossBorrowRate or fetchIsolatedBorrowRate instead')
|
712
769
|
|
713
|
-
async def repay_cross_margin(self, code: str, amount, params={}):
|
770
|
+
async def repay_cross_margin(self, code: str, amount: float, params={}):
|
714
771
|
raise NotSupported(self.id + ' repayCrossMargin is not support yet')
|
715
772
|
|
716
|
-
async def repay_isolated_margin(self, symbol: str, code: str, amount, params={}):
|
773
|
+
async def repay_isolated_margin(self, symbol: str, code: str, amount: float, params={}):
|
717
774
|
raise NotSupported(self.id + ' repayIsolatedMargin is not support yet')
|
718
775
|
|
719
776
|
async def borrow_cross_margin(self, code: str, amount: float, params={}):
|
@@ -722,10 +779,10 @@ class Exchange(BaseExchange):
|
|
722
779
|
async def borrow_isolated_margin(self, symbol: str, code: str, amount: float, params={}):
|
723
780
|
raise NotSupported(self.id + ' borrowIsolatedMargin is not support yet')
|
724
781
|
|
725
|
-
async def borrow_margin(self, code: str, amount, symbol: Str = None, params={}):
|
782
|
+
async def borrow_margin(self, code: str, amount: float, symbol: Str = None, params={}):
|
726
783
|
raise NotSupported(self.id + ' borrowMargin is deprecated, please use borrowCrossMargin or borrowIsolatedMargin instead')
|
727
784
|
|
728
|
-
async def repay_margin(self, code: str, amount, symbol: Str = None, params={}):
|
785
|
+
async def repay_margin(self, code: str, amount: float, symbol: Str = None, params={}):
|
729
786
|
raise NotSupported(self.id + ' repayMargin is deprecated, please use repayCrossMargin or repayIsolatedMargin instead')
|
730
787
|
|
731
788
|
async def fetch_ohlcv(self, symbol: str, timeframe='1m', since: Int = None, limit: Int = None, params={}):
|
@@ -791,7 +848,7 @@ class Exchange(BaseExchange):
|
|
791
848
|
'bids': self.sort_by(self.aggregate(orderbook['bids']), 0, True),
|
792
849
|
})
|
793
850
|
|
794
|
-
async def load_trading_limits(self, symbols:
|
851
|
+
async def load_trading_limits(self, symbols: Strings = None, reload=False, params={}):
|
795
852
|
if self.has['fetchTradingLimits']:
|
796
853
|
if reload or not ('limitsLoaded' in self.options):
|
797
854
|
response = await self.fetch_trading_limits(symbols)
|
@@ -810,7 +867,23 @@ class Exchange(BaseExchange):
|
|
810
867
|
self.last_request_headers = request['headers']
|
811
868
|
self.last_request_body = request['body']
|
812
869
|
self.last_request_url = request['url']
|
813
|
-
|
870
|
+
retries = None
|
871
|
+
retries, params = self.handle_option_and_params(params, path, 'maxRetriesOnFailure', 0)
|
872
|
+
retryDelay = None
|
873
|
+
retryDelay, params = self.handle_option_and_params(params, path, 'maxRetriesOnFailureDelay', 0)
|
874
|
+
for i in range(0, retries + 1):
|
875
|
+
try:
|
876
|
+
return await self.fetch(request['url'], request['method'], request['headers'], request['body'])
|
877
|
+
except Exception as e:
|
878
|
+
if isinstance(e, NetworkError):
|
879
|
+
if i < retries:
|
880
|
+
if self.verbose:
|
881
|
+
self.log('Request failed with the error: ' + str(e) + ', retrying ' + (i + str(1)) + ' of ' + str(retries) + '...')
|
882
|
+
if (retryDelay is not None) and (retryDelay != 0):
|
883
|
+
await self.sleep(retryDelay)
|
884
|
+
continue
|
885
|
+
raise e
|
886
|
+
return None # self line is never reached, but exists for c# value return requirement
|
814
887
|
|
815
888
|
async def request(self, path, api: Any = 'public', method='GET', params={}, headers: Any = None, body: Any = None, config={}):
|
816
889
|
return await self.fetch2(path, api, method, params, headers, body, config)
|
@@ -836,27 +909,27 @@ class Exchange(BaseExchange):
|
|
836
909
|
return await self.edit_order(id, symbol, 'limit', side, amount, price, params)
|
837
910
|
|
838
911
|
async def edit_order(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: Num = None, price: Num = None, params={}):
|
839
|
-
await self.
|
912
|
+
await self.cancel_order(id, symbol)
|
840
913
|
return await self.create_order(symbol, type, side, amount, price, params)
|
841
914
|
|
842
|
-
async def edit_order_ws(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount:
|
843
|
-
await self.
|
844
|
-
return await self.
|
845
|
-
|
846
|
-
async def fetch_permissions(self, params={}):
|
847
|
-
raise NotSupported(self.id + ' fetchPermissions() is not supported yet')
|
915
|
+
async def edit_order_ws(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: Num = None, price: Num = None, params={}):
|
916
|
+
await self.cancel_order_ws(id, symbol)
|
917
|
+
return await self.create_order_ws(symbol, type, side, amount, price, params)
|
848
918
|
|
849
919
|
async def fetch_position(self, symbol: str, params={}):
|
850
920
|
raise NotSupported(self.id + ' fetchPosition() is not supported yet')
|
851
921
|
|
922
|
+
async def fetch_position_ws(self, symbol: str, params={}):
|
923
|
+
raise NotSupported(self.id + ' fetchPositionWs() is not supported yet')
|
924
|
+
|
852
925
|
async def watch_position(self, symbol: Str = None, params={}):
|
853
926
|
raise NotSupported(self.id + ' watchPosition() is not supported yet')
|
854
927
|
|
855
|
-
async def watch_positions(self, symbols:
|
928
|
+
async def watch_positions(self, symbols: Strings = None, since: Int = None, limit: Int = None, params={}):
|
856
929
|
raise NotSupported(self.id + ' watchPositions() is not supported yet')
|
857
930
|
|
858
|
-
async def watch_position_for_symbols(self, symbols:
|
859
|
-
return await self.
|
931
|
+
async def watch_position_for_symbols(self, symbols: Strings = None, since: Int = None, limit: Int = None, params={}):
|
932
|
+
return await self.watch_positions(symbols, since, limit, params)
|
860
933
|
|
861
934
|
async def fetch_positions_for_symbol(self, symbol: str, params={}):
|
862
935
|
"""
|
@@ -867,13 +940,25 @@ class Exchange(BaseExchange):
|
|
867
940
|
"""
|
868
941
|
raise NotSupported(self.id + ' fetchPositionsForSymbol() is not supported yet')
|
869
942
|
|
870
|
-
async def
|
943
|
+
async def fetch_positions_for_symbol_ws(self, symbol: str, params={}):
|
944
|
+
"""
|
945
|
+
fetches all open positions for specific symbol, unlike fetchPositions(which is designed to work with multiple symbols) so self method might be preffered for one-market position, because of less rate-limit consumption and speed
|
946
|
+
:param str symbol: unified market symbol
|
947
|
+
:param dict params: extra parameters specific to the endpoint
|
948
|
+
:returns dict[]: a list of `position structure <https://docs.ccxt.com/#/?id=position-structure>` with maximum 3 items - possible one position for "one-way" mode, and possible two positions(long & short) for "two-way"(a.k.a. hedge) mode
|
949
|
+
"""
|
950
|
+
raise NotSupported(self.id + ' fetchPositionsForSymbol() is not supported yet')
|
951
|
+
|
952
|
+
async def fetch_positions(self, symbols: Strings = None, params={}):
|
871
953
|
raise NotSupported(self.id + ' fetchPositions() is not supported yet')
|
872
954
|
|
873
|
-
async def
|
955
|
+
async def fetch_positions_ws(self, symbols: Strings = None, params={}):
|
956
|
+
raise NotSupported(self.id + ' fetchPositions() is not supported yet')
|
957
|
+
|
958
|
+
async def fetch_positions_risk(self, symbols: Strings = None, params={}):
|
874
959
|
raise NotSupported(self.id + ' fetchPositionsRisk() is not supported yet')
|
875
960
|
|
876
|
-
async def fetch_bids_asks(self, symbols:
|
961
|
+
async def fetch_bids_asks(self, symbols: Strings = None, params={}):
|
877
962
|
raise NotSupported(self.id + ' fetchBidsAsks() is not supported yet')
|
878
963
|
|
879
964
|
async def fetch_borrow_interest(self, code: Str = None, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
@@ -910,40 +995,28 @@ class Exchange(BaseExchange):
|
|
910
995
|
async def fetch_status(self, params={}):
|
911
996
|
raise NotSupported(self.id + ' fetchStatus() is not supported yet')
|
912
997
|
|
913
|
-
async def fetch_funding_fee(self, code: str, params={}):
|
914
|
-
warnOnFetchFundingFee = self.safe_bool(self.options, 'warnOnFetchFundingFee', True)
|
915
|
-
if warnOnFetchFundingFee:
|
916
|
-
raise NotSupported(self.id + ' fetchFundingFee() method is deprecated, it will be removed in July 2022, please, use fetchTransactionFee() or set exchange.options["warnOnFetchFundingFee"] = False to suppress self warning')
|
917
|
-
return await self.fetch_transaction_fee(code, params)
|
918
|
-
|
919
|
-
async def fetch_funding_fees(self, codes: List[str] = None, params={}):
|
920
|
-
warnOnFetchFundingFees = self.safe_bool(self.options, 'warnOnFetchFundingFees', True)
|
921
|
-
if warnOnFetchFundingFees:
|
922
|
-
raise NotSupported(self.id + ' fetchFundingFees() method is deprecated, it will be removed in July 2022. Please, use fetchTransactionFees() or set exchange.options["warnOnFetchFundingFees"] = False to suppress self warning')
|
923
|
-
return await self.fetch_transaction_fees(codes, params)
|
924
|
-
|
925
998
|
async def fetch_transaction_fee(self, code: str, params={}):
|
926
999
|
if not self.has['fetchTransactionFees']:
|
927
1000
|
raise NotSupported(self.id + ' fetchTransactionFee() is not supported yet')
|
928
1001
|
return await self.fetch_transaction_fees([code], params)
|
929
1002
|
|
930
|
-
async def fetch_transaction_fees(self, codes:
|
1003
|
+
async def fetch_transaction_fees(self, codes: Strings = None, params={}):
|
931
1004
|
raise NotSupported(self.id + ' fetchTransactionFees() is not supported yet')
|
932
1005
|
|
933
|
-
async def fetch_deposit_withdraw_fees(self, codes:
|
1006
|
+
async def fetch_deposit_withdraw_fees(self, codes: Strings = None, params={}):
|
934
1007
|
raise NotSupported(self.id + ' fetchDepositWithdrawFees() is not supported yet')
|
935
1008
|
|
936
1009
|
async def fetch_deposit_withdraw_fee(self, code: str, params={}):
|
937
1010
|
if not self.has['fetchDepositWithdrawFees']:
|
938
1011
|
raise NotSupported(self.id + ' fetchDepositWithdrawFee() is not supported yet')
|
939
|
-
fees = await self.
|
1012
|
+
fees = await self.fetch_deposit_withdraw_fees([code], params)
|
940
1013
|
return self.safe_value(fees, code)
|
941
1014
|
|
942
1015
|
async def fetch_cross_borrow_rate(self, code: str, params={}):
|
943
1016
|
await self.load_markets()
|
944
1017
|
if not self.has['fetchBorrowRates']:
|
945
1018
|
raise NotSupported(self.id + ' fetchCrossBorrowRate() is not supported yet')
|
946
|
-
borrowRates = await self.
|
1019
|
+
borrowRates = await self.fetch_cross_borrow_rates(params)
|
947
1020
|
rate = self.safe_value(borrowRates, code)
|
948
1021
|
if rate is None:
|
949
1022
|
raise ExchangeError(self.id + ' fetchCrossBorrowRate() could not find the borrow rate for currency code ' + code)
|
@@ -973,18 +1046,58 @@ class Exchange(BaseExchange):
|
|
973
1046
|
else:
|
974
1047
|
raise NotSupported(self.id + ' fetchTicker() is not supported yet')
|
975
1048
|
|
1049
|
+
async def fetch_mark_price(self, symbol: str, params={}):
|
1050
|
+
if self.has['fetchMarkPrices']:
|
1051
|
+
await self.load_markets()
|
1052
|
+
market = self.market(symbol)
|
1053
|
+
symbol = market['symbol']
|
1054
|
+
tickers = await self.fetch_mark_prices([symbol], params)
|
1055
|
+
ticker = self.safe_dict(tickers, symbol)
|
1056
|
+
if ticker is None:
|
1057
|
+
raise NullResponse(self.id + ' fetchMarkPrices() could not find a ticker for ' + symbol)
|
1058
|
+
else:
|
1059
|
+
return ticker
|
1060
|
+
else:
|
1061
|
+
raise NotSupported(self.id + ' fetchMarkPrices() is not supported yet')
|
1062
|
+
|
1063
|
+
async def fetch_ticker_ws(self, symbol: str, params={}):
|
1064
|
+
if self.has['fetchTickersWs']:
|
1065
|
+
await self.load_markets()
|
1066
|
+
market = self.market(symbol)
|
1067
|
+
symbol = market['symbol']
|
1068
|
+
tickers = await self.fetch_tickers_ws([symbol], params)
|
1069
|
+
ticker = self.safe_dict(tickers, symbol)
|
1070
|
+
if ticker is None:
|
1071
|
+
raise NullResponse(self.id + ' fetchTickerWs() could not find a ticker for ' + symbol)
|
1072
|
+
else:
|
1073
|
+
return ticker
|
1074
|
+
else:
|
1075
|
+
raise NotSupported(self.id + ' fetchTickerWs() is not supported yet')
|
1076
|
+
|
976
1077
|
async def watch_ticker(self, symbol: str, params={}):
|
977
1078
|
raise NotSupported(self.id + ' watchTicker() is not supported yet')
|
978
1079
|
|
979
|
-
async def fetch_tickers(self, symbols:
|
1080
|
+
async def fetch_tickers(self, symbols: Strings = None, params={}):
|
1081
|
+
raise NotSupported(self.id + ' fetchTickers() is not supported yet')
|
1082
|
+
|
1083
|
+
async def fetch_mark_prices(self, symbols: Strings = None, params={}):
|
1084
|
+
raise NotSupported(self.id + ' fetchMarkPrices() is not supported yet')
|
1085
|
+
|
1086
|
+
async def fetch_tickers_ws(self, symbols: Strings = None, params={}):
|
980
1087
|
raise NotSupported(self.id + ' fetchTickers() is not supported yet')
|
981
1088
|
|
982
|
-
async def fetch_order_books(self, symbols:
|
1089
|
+
async def fetch_order_books(self, symbols: Strings = None, limit: Int = None, params={}):
|
983
1090
|
raise NotSupported(self.id + ' fetchOrderBooks() is not supported yet')
|
984
1091
|
|
985
|
-
async def
|
1092
|
+
async def watch_bids_asks(self, symbols: Strings = None, params={}):
|
1093
|
+
raise NotSupported(self.id + ' watchBidsAsks() is not supported yet')
|
1094
|
+
|
1095
|
+
async def watch_tickers(self, symbols: Strings = None, params={}):
|
986
1096
|
raise NotSupported(self.id + ' watchTickers() is not supported yet')
|
987
1097
|
|
1098
|
+
async def un_watch_tickers(self, symbols: Strings = None, params={}):
|
1099
|
+
raise NotSupported(self.id + ' unWatchTickers() is not supported yet')
|
1100
|
+
|
988
1101
|
async def fetch_order(self, id: str, symbol: Str = None, params={}):
|
989
1102
|
raise NotSupported(self.id + ' fetchOrder() is not supported yet')
|
990
1103
|
|
@@ -1025,6 +1138,28 @@ class Exchange(BaseExchange):
|
|
1025
1138
|
return await self.create_order(symbol, type, side, amount, price, params)
|
1026
1139
|
raise NotSupported(self.id + ' createTrailingAmountOrder() is not supported yet')
|
1027
1140
|
|
1141
|
+
async def create_trailing_amount_order_ws(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, trailingAmount=None, trailingTriggerPrice=None, params={}):
|
1142
|
+
"""
|
1143
|
+
create a trailing order by providing the symbol, type, side, amount, price and trailingAmount
|
1144
|
+
:param str symbol: unified symbol of the market to create an order in
|
1145
|
+
:param str type: 'market' or 'limit'
|
1146
|
+
:param str side: 'buy' or 'sell'
|
1147
|
+
:param float amount: how much you want to trade in units of the base currency, or number of contracts
|
1148
|
+
:param float [price]: the price for the order to be filled at, in units of the quote currency, ignored in market orders
|
1149
|
+
:param float trailingAmount: the quote amount to trail away from the current market price
|
1150
|
+
:param float [trailingTriggerPrice]: the price to activate a trailing order, default uses the price argument
|
1151
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1152
|
+
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
1153
|
+
"""
|
1154
|
+
if trailingAmount is None:
|
1155
|
+
raise ArgumentsRequired(self.id + ' createTrailingAmountOrderWs() requires a trailingAmount argument')
|
1156
|
+
params['trailingAmount'] = trailingAmount
|
1157
|
+
if trailingTriggerPrice is not None:
|
1158
|
+
params['trailingTriggerPrice'] = trailingTriggerPrice
|
1159
|
+
if self.has['createTrailingAmountOrderWs']:
|
1160
|
+
return await self.create_order_ws(symbol, type, side, amount, price, params)
|
1161
|
+
raise NotSupported(self.id + ' createTrailingAmountOrderWs() is not supported yet')
|
1162
|
+
|
1028
1163
|
async def create_trailing_percent_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, trailingPercent=None, trailingTriggerPrice=None, params={}):
|
1029
1164
|
"""
|
1030
1165
|
create a trailing order by providing the symbol, type, side, amount, price and trailingPercent
|
@@ -1047,6 +1182,28 @@ class Exchange(BaseExchange):
|
|
1047
1182
|
return await self.create_order(symbol, type, side, amount, price, params)
|
1048
1183
|
raise NotSupported(self.id + ' createTrailingPercentOrder() is not supported yet')
|
1049
1184
|
|
1185
|
+
async def create_trailing_percent_order_ws(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, trailingPercent=None, trailingTriggerPrice=None, params={}):
|
1186
|
+
"""
|
1187
|
+
create a trailing order by providing the symbol, type, side, amount, price and trailingPercent
|
1188
|
+
:param str symbol: unified symbol of the market to create an order in
|
1189
|
+
:param str type: 'market' or 'limit'
|
1190
|
+
:param str side: 'buy' or 'sell'
|
1191
|
+
:param float amount: how much you want to trade in units of the base currency, or number of contracts
|
1192
|
+
:param float [price]: the price for the order to be filled at, in units of the quote currency, ignored in market orders
|
1193
|
+
:param float trailingPercent: the percent to trail away from the current market price
|
1194
|
+
:param float [trailingTriggerPrice]: the price to activate a trailing order, default uses the price argument
|
1195
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1196
|
+
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
1197
|
+
"""
|
1198
|
+
if trailingPercent is None:
|
1199
|
+
raise ArgumentsRequired(self.id + ' createTrailingPercentOrderWs() requires a trailingPercent argument')
|
1200
|
+
params['trailingPercent'] = trailingPercent
|
1201
|
+
if trailingTriggerPrice is not None:
|
1202
|
+
params['trailingTriggerPrice'] = trailingTriggerPrice
|
1203
|
+
if self.has['createTrailingPercentOrderWs']:
|
1204
|
+
return await self.create_order_ws(symbol, type, side, amount, price, params)
|
1205
|
+
raise NotSupported(self.id + ' createTrailingPercentOrderWs() is not supported yet')
|
1206
|
+
|
1050
1207
|
async def create_market_order_with_cost(self, symbol: str, side: OrderSide, cost: float, params={}):
|
1051
1208
|
"""
|
1052
1209
|
create a market order by providing the symbol, side and cost
|
@@ -1084,6 +1241,19 @@ class Exchange(BaseExchange):
|
|
1084
1241
|
return await self.create_order(symbol, 'market', 'sell', cost, 1, params)
|
1085
1242
|
raise NotSupported(self.id + ' createMarketSellOrderWithCost() is not supported yet')
|
1086
1243
|
|
1244
|
+
async def create_market_order_with_cost_ws(self, symbol: str, side: OrderSide, cost: float, params={}):
|
1245
|
+
"""
|
1246
|
+
create a market order by providing the symbol, side and cost
|
1247
|
+
:param str symbol: unified symbol of the market to create an order in
|
1248
|
+
:param str side: 'buy' or 'sell'
|
1249
|
+
:param float cost: how much you want to trade in units of the quote currency
|
1250
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1251
|
+
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
1252
|
+
"""
|
1253
|
+
if self.has['createMarketOrderWithCostWs'] or (self.has['createMarketBuyOrderWithCostWs'] and self.has['createMarketSellOrderWithCostWs']):
|
1254
|
+
return await self.create_order_ws(symbol, 'market', side, cost, 1, params)
|
1255
|
+
raise NotSupported(self.id + ' createMarketOrderWithCostWs() is not supported yet')
|
1256
|
+
|
1087
1257
|
async def create_trigger_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, triggerPrice: Num = None, params={}):
|
1088
1258
|
"""
|
1089
1259
|
create a trigger stop order(type 1)
|
@@ -1103,6 +1273,25 @@ class Exchange(BaseExchange):
|
|
1103
1273
|
return await self.create_order(symbol, type, side, amount, price, params)
|
1104
1274
|
raise NotSupported(self.id + ' createTriggerOrder() is not supported yet')
|
1105
1275
|
|
1276
|
+
async def create_trigger_order_ws(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, triggerPrice: Num = None, params={}):
|
1277
|
+
"""
|
1278
|
+
create a trigger stop order(type 1)
|
1279
|
+
:param str symbol: unified symbol of the market to create an order in
|
1280
|
+
:param str type: 'market' or 'limit'
|
1281
|
+
:param str side: 'buy' or 'sell'
|
1282
|
+
:param float amount: how much you want to trade in units of the base currency or the number of contracts
|
1283
|
+
:param float [price]: the price to fulfill the order, in units of the quote currency, ignored in market orders
|
1284
|
+
:param float triggerPrice: the price to trigger the stop order, in units of the quote currency
|
1285
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1286
|
+
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
1287
|
+
"""
|
1288
|
+
if triggerPrice is None:
|
1289
|
+
raise ArgumentsRequired(self.id + ' createTriggerOrderWs() requires a triggerPrice argument')
|
1290
|
+
params['triggerPrice'] = triggerPrice
|
1291
|
+
if self.has['createTriggerOrderWs']:
|
1292
|
+
return await self.create_order_ws(symbol, type, side, amount, price, params)
|
1293
|
+
raise NotSupported(self.id + ' createTriggerOrderWs() is not supported yet')
|
1294
|
+
|
1106
1295
|
async def create_stop_loss_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, stopLossPrice: Num = None, params={}):
|
1107
1296
|
"""
|
1108
1297
|
create a trigger stop loss order(type 2)
|
@@ -1122,6 +1311,25 @@ class Exchange(BaseExchange):
|
|
1122
1311
|
return await self.create_order(symbol, type, side, amount, price, params)
|
1123
1312
|
raise NotSupported(self.id + ' createStopLossOrder() is not supported yet')
|
1124
1313
|
|
1314
|
+
async def create_stop_loss_order_ws(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, stopLossPrice: Num = None, params={}):
|
1315
|
+
"""
|
1316
|
+
create a trigger stop loss order(type 2)
|
1317
|
+
:param str symbol: unified symbol of the market to create an order in
|
1318
|
+
:param str type: 'market' or 'limit'
|
1319
|
+
:param str side: 'buy' or 'sell'
|
1320
|
+
:param float amount: how much you want to trade in units of the base currency or the number of contracts
|
1321
|
+
:param float [price]: the price to fulfill the order, in units of the quote currency, ignored in market orders
|
1322
|
+
:param float stopLossPrice: the price to trigger the stop loss order, in units of the quote currency
|
1323
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1324
|
+
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
1325
|
+
"""
|
1326
|
+
if stopLossPrice is None:
|
1327
|
+
raise ArgumentsRequired(self.id + ' createStopLossOrderWs() requires a stopLossPrice argument')
|
1328
|
+
params['stopLossPrice'] = stopLossPrice
|
1329
|
+
if self.has['createStopLossOrderWs']:
|
1330
|
+
return await self.create_order_ws(symbol, type, side, amount, price, params)
|
1331
|
+
raise NotSupported(self.id + ' createStopLossOrderWs() is not supported yet')
|
1332
|
+
|
1125
1333
|
async def create_take_profit_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, takeProfitPrice: Num = None, params={}):
|
1126
1334
|
"""
|
1127
1335
|
create a trigger take profit order(type 2)
|
@@ -1141,6 +1349,25 @@ class Exchange(BaseExchange):
|
|
1141
1349
|
return await self.create_order(symbol, type, side, amount, price, params)
|
1142
1350
|
raise NotSupported(self.id + ' createTakeProfitOrder() is not supported yet')
|
1143
1351
|
|
1352
|
+
async def create_take_profit_order_ws(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, takeProfitPrice: Num = None, params={}):
|
1353
|
+
"""
|
1354
|
+
create a trigger take profit order(type 2)
|
1355
|
+
:param str symbol: unified symbol of the market to create an order in
|
1356
|
+
:param str type: 'market' or 'limit'
|
1357
|
+
:param str side: 'buy' or 'sell'
|
1358
|
+
:param float amount: how much you want to trade in units of the base currency or the number of contracts
|
1359
|
+
:param float [price]: the price to fulfill the order, in units of the quote currency, ignored in market orders
|
1360
|
+
:param float takeProfitPrice: the price to trigger the take profit order, in units of the quote currency
|
1361
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1362
|
+
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
1363
|
+
"""
|
1364
|
+
if takeProfitPrice is None:
|
1365
|
+
raise ArgumentsRequired(self.id + ' createTakeProfitOrderWs() requires a takeProfitPrice argument')
|
1366
|
+
params['takeProfitPrice'] = takeProfitPrice
|
1367
|
+
if self.has['createTakeProfitOrderWs']:
|
1368
|
+
return await self.create_order_ws(symbol, type, side, amount, price, params)
|
1369
|
+
raise NotSupported(self.id + ' createTakeProfitOrderWs() is not supported yet')
|
1370
|
+
|
1144
1371
|
async def create_order_with_take_profit_and_stop_loss(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, takeProfit: Num = None, stopLoss: Num = None, params={}):
|
1145
1372
|
"""
|
1146
1373
|
create an order with a stop loss or take profit attached(type 3)
|
@@ -1162,45 +1389,37 @@ class Exchange(BaseExchange):
|
|
1162
1389
|
:param float [params.stopLossAmount]: *not available on all exchanges* the amount for a stop loss
|
1163
1390
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
1164
1391
|
"""
|
1165
|
-
|
1166
|
-
raise ArgumentsRequired(self.id + ' createOrderWithTakeProfitAndStopLoss() requires either a takeProfit or stopLoss argument')
|
1167
|
-
if takeProfit is not None:
|
1168
|
-
params['takeProfit'] = {
|
1169
|
-
'triggerPrice': takeProfit,
|
1170
|
-
}
|
1171
|
-
if stopLoss is not None:
|
1172
|
-
params['stopLoss'] = {
|
1173
|
-
'triggerPrice': stopLoss,
|
1174
|
-
}
|
1175
|
-
takeProfitType = self.safe_string(params, 'takeProfitType')
|
1176
|
-
takeProfitPriceType = self.safe_string(params, 'takeProfitPriceType')
|
1177
|
-
takeProfitLimitPrice = self.safe_string(params, 'takeProfitLimitPrice')
|
1178
|
-
takeProfitAmount = self.safe_string(params, 'takeProfitAmount')
|
1179
|
-
stopLossType = self.safe_string(params, 'stopLossType')
|
1180
|
-
stopLossPriceType = self.safe_string(params, 'stopLossPriceType')
|
1181
|
-
stopLossLimitPrice = self.safe_string(params, 'stopLossLimitPrice')
|
1182
|
-
stopLossAmount = self.safe_string(params, 'stopLossAmount')
|
1183
|
-
if takeProfitType is not None:
|
1184
|
-
params['takeProfit']['type'] = takeProfitType
|
1185
|
-
if takeProfitPriceType is not None:
|
1186
|
-
params['takeProfit']['priceType'] = takeProfitPriceType
|
1187
|
-
if takeProfitLimitPrice is not None:
|
1188
|
-
params['takeProfit']['price'] = self.parse_to_numeric(takeProfitLimitPrice)
|
1189
|
-
if takeProfitAmount is not None:
|
1190
|
-
params['takeProfit']['amount'] = self.parse_to_numeric(takeProfitAmount)
|
1191
|
-
if stopLossType is not None:
|
1192
|
-
params['stopLoss']['type'] = stopLossType
|
1193
|
-
if stopLossPriceType is not None:
|
1194
|
-
params['stopLoss']['priceType'] = stopLossPriceType
|
1195
|
-
if stopLossLimitPrice is not None:
|
1196
|
-
params['stopLoss']['price'] = self.parse_to_numeric(stopLossLimitPrice)
|
1197
|
-
if stopLossAmount is not None:
|
1198
|
-
params['stopLoss']['amount'] = self.parse_to_numeric(stopLossAmount)
|
1199
|
-
params = self.omit(params, ['takeProfitType', 'takeProfitPriceType', 'takeProfitLimitPrice', 'takeProfitAmount', 'stopLossType', 'stopLossPriceType', 'stopLossLimitPrice', 'stopLossAmount'])
|
1392
|
+
params = self.set_take_profit_and_stop_loss_params(symbol, type, side, amount, price, takeProfit, stopLoss, params)
|
1200
1393
|
if self.has['createOrderWithTakeProfitAndStopLoss']:
|
1201
1394
|
return await self.create_order(symbol, type, side, amount, price, params)
|
1202
1395
|
raise NotSupported(self.id + ' createOrderWithTakeProfitAndStopLoss() is not supported yet')
|
1203
1396
|
|
1397
|
+
async def create_order_with_take_profit_and_stop_loss_ws(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, takeProfit: Num = None, stopLoss: Num = None, params={}):
|
1398
|
+
"""
|
1399
|
+
create an order with a stop loss or take profit attached(type 3)
|
1400
|
+
:param str symbol: unified symbol of the market to create an order in
|
1401
|
+
:param str type: 'market' or 'limit'
|
1402
|
+
:param str side: 'buy' or 'sell'
|
1403
|
+
:param float amount: how much you want to trade in units of the base currency or the number of contracts
|
1404
|
+
:param float [price]: the price to fulfill the order, in units of the quote currency, ignored in market orders
|
1405
|
+
:param float [takeProfit]: the take profit price, in units of the quote currency
|
1406
|
+
:param float [stopLoss]: the stop loss price, in units of the quote currency
|
1407
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1408
|
+
:param str [params.takeProfitType]: *not available on all exchanges* 'limit' or 'market'
|
1409
|
+
:param str [params.stopLossType]: *not available on all exchanges* 'limit' or 'market'
|
1410
|
+
:param str [params.takeProfitPriceType]: *not available on all exchanges* 'last', 'mark' or 'index'
|
1411
|
+
:param str [params.stopLossPriceType]: *not available on all exchanges* 'last', 'mark' or 'index'
|
1412
|
+
:param float [params.takeProfitLimitPrice]: *not available on all exchanges* limit price for a limit take profit order
|
1413
|
+
:param float [params.stopLossLimitPrice]: *not available on all exchanges* stop loss for a limit stop loss order
|
1414
|
+
:param float [params.takeProfitAmount]: *not available on all exchanges* the amount for a take profit
|
1415
|
+
:param float [params.stopLossAmount]: *not available on all exchanges* the amount for a stop loss
|
1416
|
+
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
1417
|
+
"""
|
1418
|
+
params = self.set_take_profit_and_stop_loss_params(symbol, type, side, amount, price, takeProfit, stopLoss, params)
|
1419
|
+
if self.has['createOrderWithTakeProfitAndStopLossWs']:
|
1420
|
+
return await self.create_order_ws(symbol, type, side, amount, price, params)
|
1421
|
+
raise NotSupported(self.id + ' createOrderWithTakeProfitAndStopLossWs() is not supported yet')
|
1422
|
+
|
1204
1423
|
async def create_orders(self, orders: List[OrderRequest], params={}):
|
1205
1424
|
raise NotSupported(self.id + ' createOrders() is not supported yet')
|
1206
1425
|
|
@@ -1219,11 +1438,17 @@ class Exchange(BaseExchange):
|
|
1219
1438
|
async def cancel_all_orders(self, symbol: Str = None, params={}):
|
1220
1439
|
raise NotSupported(self.id + ' cancelAllOrders() is not supported yet')
|
1221
1440
|
|
1441
|
+
async def cancel_all_orders_after(self, timeout: Int, params={}):
|
1442
|
+
raise NotSupported(self.id + ' cancelAllOrdersAfter() is not supported yet')
|
1443
|
+
|
1444
|
+
async def cancel_orders_for_symbols(self, orders: List[CancellationRequest], params={}):
|
1445
|
+
raise NotSupported(self.id + ' cancelOrdersForSymbols() is not supported yet')
|
1446
|
+
|
1222
1447
|
async def cancel_all_orders_ws(self, symbol: Str = None, params={}):
|
1223
1448
|
raise NotSupported(self.id + ' cancelAllOrdersWs() is not supported yet')
|
1224
1449
|
|
1225
1450
|
async def cancel_unified_order(self, order, params={}):
|
1226
|
-
return self.
|
1451
|
+
return self.cancel_order(self.safe_string(order, 'id'), self.safe_string(order, 'symbol'), params)
|
1227
1452
|
|
1228
1453
|
async def fetch_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
1229
1454
|
if self.has['fetchOpenOrders'] and self.has['fetchClosedOrders']:
|
@@ -1247,7 +1472,7 @@ class Exchange(BaseExchange):
|
|
1247
1472
|
|
1248
1473
|
async def fetch_open_orders_ws(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
1249
1474
|
if self.has['fetchOrdersWs']:
|
1250
|
-
orders = await self.
|
1475
|
+
orders = await self.fetch_orders_ws(symbol, since, limit, params)
|
1251
1476
|
return self.filter_by(orders, 'status', 'open')
|
1252
1477
|
raise NotSupported(self.id + ' fetchOpenOrdersWs() is not supported yet')
|
1253
1478
|
|
@@ -1262,7 +1487,7 @@ class Exchange(BaseExchange):
|
|
1262
1487
|
|
1263
1488
|
async def fetch_closed_orders_ws(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
1264
1489
|
if self.has['fetchOrdersWs']:
|
1265
|
-
orders = await self.
|
1490
|
+
orders = await self.fetch_orders_ws(symbol, since, limit, params)
|
1266
1491
|
return self.filter_by(orders, 'status', 'closed')
|
1267
1492
|
raise NotSupported(self.id + ' fetchClosedOrdersWs() is not supported yet')
|
1268
1493
|
|
@@ -1284,6 +1509,15 @@ class Exchange(BaseExchange):
|
|
1284
1509
|
async def fetch_greeks(self, symbol: str, params={}):
|
1285
1510
|
raise NotSupported(self.id + ' fetchGreeks() is not supported yet')
|
1286
1511
|
|
1512
|
+
async def fetch_option_chain(self, code: str, params={}):
|
1513
|
+
raise NotSupported(self.id + ' fetchOptionChain() is not supported yet')
|
1514
|
+
|
1515
|
+
async def fetch_option(self, symbol: str, params={}):
|
1516
|
+
raise NotSupported(self.id + ' fetchOption() is not supported yet')
|
1517
|
+
|
1518
|
+
async def fetch_convert_quote(self, fromCode: str, toCode: str, amount: Num = None, params={}):
|
1519
|
+
raise NotSupported(self.id + ' fetchConvertQuote() is not supported yet')
|
1520
|
+
|
1287
1521
|
async def fetch_deposits_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
|
1288
1522
|
"""
|
1289
1523
|
fetch history of deposits and withdrawals
|
@@ -1324,7 +1558,7 @@ class Exchange(BaseExchange):
|
|
1324
1558
|
|
1325
1559
|
async def fetch_deposit_address(self, code: str, params={}):
|
1326
1560
|
if self.has['fetchDepositAddresses']:
|
1327
|
-
depositAddresses = await self.
|
1561
|
+
depositAddresses = await self.fetch_deposit_addresses([code], params)
|
1328
1562
|
depositAddress = self.safe_value(depositAddresses, code)
|
1329
1563
|
if depositAddress is None:
|
1330
1564
|
raise InvalidAddress(self.id + ' fetchDepositAddress() could not find a deposit address for ' + code + ', make sure you have created a corresponding deposit address in your wallet on the exchange website')
|
@@ -1333,7 +1567,7 @@ class Exchange(BaseExchange):
|
|
1333
1567
|
elif self.has['fetchDepositAddressesByNetwork']:
|
1334
1568
|
network = self.safe_string(params, 'network')
|
1335
1569
|
params = self.omit(params, 'network')
|
1336
|
-
addressStructures = await self.
|
1570
|
+
addressStructures = await self.fetch_deposit_addresses_by_network(code, params)
|
1337
1571
|
if network is not None:
|
1338
1572
|
return self.safe_dict(addressStructures, network)
|
1339
1573
|
else:
|
@@ -1346,21 +1580,39 @@ class Exchange(BaseExchange):
|
|
1346
1580
|
async def create_limit_order(self, symbol: str, side: OrderSide, amount: float, price: float, params={}):
|
1347
1581
|
return await self.create_order(symbol, 'limit', side, amount, price, params)
|
1348
1582
|
|
1583
|
+
async def create_limit_order_ws(self, symbol: str, side: OrderSide, amount: float, price: float, params={}):
|
1584
|
+
return await self.create_order_ws(symbol, 'limit', side, amount, price, params)
|
1585
|
+
|
1349
1586
|
async def create_market_order(self, symbol: str, side: OrderSide, amount: float, price: Num = None, params={}):
|
1350
1587
|
return await self.create_order(symbol, 'market', side, amount, price, params)
|
1351
1588
|
|
1589
|
+
async def create_market_order_ws(self, symbol: str, side: OrderSide, amount: float, price: Num = None, params={}):
|
1590
|
+
return await self.create_order_ws(symbol, 'market', side, amount, price, params)
|
1591
|
+
|
1352
1592
|
async def create_limit_buy_order(self, symbol: str, amount: float, price: float, params={}):
|
1353
1593
|
return await self.create_order(symbol, 'limit', 'buy', amount, price, params)
|
1354
1594
|
|
1595
|
+
async def create_limit_buy_order_ws(self, symbol: str, amount: float, price: float, params={}):
|
1596
|
+
return await self.create_order_ws(symbol, 'limit', 'buy', amount, price, params)
|
1597
|
+
|
1355
1598
|
async def create_limit_sell_order(self, symbol: str, amount: float, price: float, params={}):
|
1356
1599
|
return await self.create_order(symbol, 'limit', 'sell', amount, price, params)
|
1357
1600
|
|
1601
|
+
async def create_limit_sell_order_ws(self, symbol: str, amount: float, price: float, params={}):
|
1602
|
+
return await self.create_order_ws(symbol, 'limit', 'sell', amount, price, params)
|
1603
|
+
|
1358
1604
|
async def create_market_buy_order(self, symbol: str, amount: float, params={}):
|
1359
1605
|
return await self.create_order(symbol, 'market', 'buy', amount, None, params)
|
1360
1606
|
|
1607
|
+
async def create_market_buy_order_ws(self, symbol: str, amount: float, params={}):
|
1608
|
+
return await self.create_order_ws(symbol, 'market', 'buy', amount, None, params)
|
1609
|
+
|
1361
1610
|
async def create_market_sell_order(self, symbol: str, amount: float, params={}):
|
1362
1611
|
return await self.create_order(symbol, 'market', 'sell', amount, None, params)
|
1363
1612
|
|
1613
|
+
async def create_market_sell_order_ws(self, symbol: str, amount: float, params={}):
|
1614
|
+
return await self.create_order_ws(symbol, 'market', 'sell', amount, None, params)
|
1615
|
+
|
1364
1616
|
async def load_time_difference(self, params={}):
|
1365
1617
|
serverTime = await self.fetch_time(params)
|
1366
1618
|
after = self.milliseconds()
|
@@ -1383,33 +1635,65 @@ class Exchange(BaseExchange):
|
|
1383
1635
|
query = self.extend(params, {'postOnly': True})
|
1384
1636
|
return await self.create_order(symbol, type, side, amount, price, query)
|
1385
1637
|
|
1638
|
+
async def create_post_only_order_ws(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
|
1639
|
+
if not self.has['createPostOnlyOrderWs']:
|
1640
|
+
raise NotSupported(self.id + 'createPostOnlyOrderWs() is not supported yet')
|
1641
|
+
query = self.extend(params, {'postOnly': True})
|
1642
|
+
return await self.create_order_ws(symbol, type, side, amount, price, query)
|
1643
|
+
|
1386
1644
|
async def create_reduce_only_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
|
1387
1645
|
if not self.has['createReduceOnlyOrder']:
|
1388
1646
|
raise NotSupported(self.id + 'createReduceOnlyOrder() is not supported yet')
|
1389
1647
|
query = self.extend(params, {'reduceOnly': True})
|
1390
1648
|
return await self.create_order(symbol, type, side, amount, price, query)
|
1391
1649
|
|
1392
|
-
async def
|
1650
|
+
async def create_reduce_only_order_ws(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
|
1651
|
+
if not self.has['createReduceOnlyOrderWs']:
|
1652
|
+
raise NotSupported(self.id + 'createReduceOnlyOrderWs() is not supported yet')
|
1653
|
+
query = self.extend(params, {'reduceOnly': True})
|
1654
|
+
return await self.create_order_ws(symbol, type, side, amount, price, query)
|
1655
|
+
|
1656
|
+
async def create_stop_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, triggerPrice: Num = None, params={}):
|
1393
1657
|
if not self.has['createStopOrder']:
|
1394
1658
|
raise NotSupported(self.id + ' createStopOrder() is not supported yet')
|
1395
|
-
if
|
1659
|
+
if triggerPrice is None:
|
1396
1660
|
raise ArgumentsRequired(self.id + ' create_stop_order() requires a stopPrice argument')
|
1397
|
-
query = self.extend(params, {'stopPrice':
|
1661
|
+
query = self.extend(params, {'stopPrice': triggerPrice})
|
1398
1662
|
return await self.create_order(symbol, type, side, amount, price, query)
|
1399
1663
|
|
1400
|
-
async def
|
1664
|
+
async def create_stop_order_ws(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, triggerPrice: Num = None, params={}):
|
1665
|
+
if not self.has['createStopOrderWs']:
|
1666
|
+
raise NotSupported(self.id + ' createStopOrderWs() is not supported yet')
|
1667
|
+
if triggerPrice is None:
|
1668
|
+
raise ArgumentsRequired(self.id + ' createStopOrderWs() requires a stopPrice argument')
|
1669
|
+
query = self.extend(params, {'stopPrice': triggerPrice})
|
1670
|
+
return await self.create_order_ws(symbol, type, side, amount, price, query)
|
1671
|
+
|
1672
|
+
async def create_stop_limit_order(self, symbol: str, side: OrderSide, amount: float, price: float, triggerPrice: float, params={}):
|
1401
1673
|
if not self.has['createStopLimitOrder']:
|
1402
1674
|
raise NotSupported(self.id + ' createStopLimitOrder() is not supported yet')
|
1403
|
-
query = self.extend(params, {'stopPrice':
|
1675
|
+
query = self.extend(params, {'stopPrice': triggerPrice})
|
1404
1676
|
return await self.create_order(symbol, 'limit', side, amount, price, query)
|
1405
1677
|
|
1406
|
-
async def
|
1678
|
+
async def create_stop_limit_order_ws(self, symbol: str, side: OrderSide, amount: float, price: float, triggerPrice: float, params={}):
|
1679
|
+
if not self.has['createStopLimitOrderWs']:
|
1680
|
+
raise NotSupported(self.id + ' createStopLimitOrderWs() is not supported yet')
|
1681
|
+
query = self.extend(params, {'stopPrice': triggerPrice})
|
1682
|
+
return await self.create_order_ws(symbol, 'limit', side, amount, price, query)
|
1683
|
+
|
1684
|
+
async def create_stop_market_order(self, symbol: str, side: OrderSide, amount: float, triggerPrice: float, params={}):
|
1407
1685
|
if not self.has['createStopMarketOrder']:
|
1408
1686
|
raise NotSupported(self.id + ' createStopMarketOrder() is not supported yet')
|
1409
|
-
query = self.extend(params, {'stopPrice':
|
1687
|
+
query = self.extend(params, {'stopPrice': triggerPrice})
|
1410
1688
|
return await self.create_order(symbol, 'market', side, amount, None, query)
|
1411
1689
|
|
1412
|
-
async def
|
1690
|
+
async def create_stop_market_order_ws(self, symbol: str, side: OrderSide, amount: float, triggerPrice: float, params={}):
|
1691
|
+
if not self.has['createStopMarketOrderWs']:
|
1692
|
+
raise NotSupported(self.id + ' createStopMarketOrderWs() is not supported yet')
|
1693
|
+
query = self.extend(params, {'stopPrice': triggerPrice})
|
1694
|
+
return await self.create_order_ws(symbol, 'market', side, amount, None, query)
|
1695
|
+
|
1696
|
+
async def fetch_last_prices(self, symbols: Strings = None, params={}):
|
1413
1697
|
raise NotSupported(self.id + ' fetchLastPrices() is not supported yet')
|
1414
1698
|
|
1415
1699
|
async def fetch_trading_fees(self, params={}):
|
@@ -1421,7 +1705,11 @@ class Exchange(BaseExchange):
|
|
1421
1705
|
async def fetch_trading_fee(self, symbol: str, params={}):
|
1422
1706
|
if not self.has['fetchTradingFees']:
|
1423
1707
|
raise NotSupported(self.id + ' fetchTradingFee() is not supported yet')
|
1424
|
-
|
1708
|
+
fees = await self.fetch_trading_fees(params)
|
1709
|
+
return self.safe_dict(fees, symbol)
|
1710
|
+
|
1711
|
+
async def fetch_convert_currencies(self, params={}):
|
1712
|
+
raise NotSupported(self.id + ' fetchConvertCurrencies() is not supported yet')
|
1425
1713
|
|
1426
1714
|
async def fetch_funding_rate(self, symbol: str, params={}):
|
1427
1715
|
if self.has['fetchFundingRates']:
|
@@ -1430,7 +1718,7 @@ class Exchange(BaseExchange):
|
|
1430
1718
|
symbol = market['symbol']
|
1431
1719
|
if not market['contract']:
|
1432
1720
|
raise BadSymbol(self.id + ' fetchFundingRate() supports contract markets only')
|
1433
|
-
rates = await self.
|
1721
|
+
rates = await self.fetch_funding_rates([symbol], params)
|
1434
1722
|
rate = self.safe_value(rates, symbol)
|
1435
1723
|
if rate is None:
|
1436
1724
|
raise NullResponse(self.id + ' fetchFundingRate() returned no data for ' + symbol)
|
@@ -1439,6 +1727,22 @@ class Exchange(BaseExchange):
|
|
1439
1727
|
else:
|
1440
1728
|
raise NotSupported(self.id + ' fetchFundingRate() is not supported yet')
|
1441
1729
|
|
1730
|
+
async def fetch_funding_interval(self, symbol: str, params={}):
|
1731
|
+
if self.has['fetchFundingIntervals']:
|
1732
|
+
await self.load_markets()
|
1733
|
+
market = self.market(symbol)
|
1734
|
+
symbol = market['symbol']
|
1735
|
+
if not market['contract']:
|
1736
|
+
raise BadSymbol(self.id + ' fetchFundingInterval() supports contract markets only')
|
1737
|
+
rates = await self.fetch_funding_intervals([symbol], params)
|
1738
|
+
rate = self.safe_value(rates, symbol)
|
1739
|
+
if rate is None:
|
1740
|
+
raise NullResponse(self.id + ' fetchFundingInterval() returned no data for ' + symbol)
|
1741
|
+
else:
|
1742
|
+
return rate
|
1743
|
+
else:
|
1744
|
+
raise NotSupported(self.id + ' fetchFundingInterval() is not supported yet')
|
1745
|
+
|
1442
1746
|
async def fetch_mark_ohlcv(self, symbol, timeframe='1m', since: Int = None, limit: Int = None, params={}):
|
1443
1747
|
"""
|
1444
1748
|
fetches historical mark price candlestick data containing the open, high, low, and close price of a market
|
@@ -1450,7 +1754,7 @@ class Exchange(BaseExchange):
|
|
1450
1754
|
:returns float[][]: A list of candles ordered, open, high, low, close, None
|
1451
1755
|
"""
|
1452
1756
|
if self.has['fetchMarkOHLCV']:
|
1453
|
-
request = {
|
1757
|
+
request: dict = {
|
1454
1758
|
'price': 'mark',
|
1455
1759
|
}
|
1456
1760
|
return await self.fetch_ohlcv(symbol, timeframe, since, limit, self.extend(request, params))
|
@@ -1465,10 +1769,10 @@ class Exchange(BaseExchange):
|
|
1465
1769
|
:param int [since]: timestamp in ms of the earliest candle to fetch
|
1466
1770
|
:param int [limit]: the maximum amount of candles to fetch
|
1467
1771
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1468
|
-
|
1772
|
+
@returns {} A list of candles ordered, open, high, low, close, None
|
1469
1773
|
"""
|
1470
1774
|
if self.has['fetchIndexOHLCV']:
|
1471
|
-
request = {
|
1775
|
+
request: dict = {
|
1472
1776
|
'price': 'index',
|
1473
1777
|
}
|
1474
1778
|
return await self.fetch_ohlcv(symbol, timeframe, since, limit, self.extend(request, params))
|
@@ -1486,7 +1790,7 @@ class Exchange(BaseExchange):
|
|
1486
1790
|
:returns float[][]: A list of candles ordered, open, high, low, close, None
|
1487
1791
|
"""
|
1488
1792
|
if self.has['fetchPremiumIndexOHLCV']:
|
1489
|
-
request = {
|
1793
|
+
request: dict = {
|
1490
1794
|
'price': 'premiumIndex',
|
1491
1795
|
}
|
1492
1796
|
return await self.fetch_ohlcv(symbol, timeframe, since, limit, self.extend(request, params))
|
@@ -1495,7 +1799,7 @@ class Exchange(BaseExchange):
|
|
1495
1799
|
|
1496
1800
|
async def fetch_transactions(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
|
1497
1801
|
"""
|
1498
|
-
|
1802
|
+
@deprecated
|
1499
1803
|
*DEPRECATED* use fetchDepositsWithdrawals instead
|
1500
1804
|
:param str code: unified currency code for the currency of the deposit/withdrawals, default is None
|
1501
1805
|
:param int [since]: timestamp in ms of the earliest deposit/withdrawal, default is None
|
@@ -1504,11 +1808,11 @@ class Exchange(BaseExchange):
|
|
1504
1808
|
:returns dict: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
|
1505
1809
|
"""
|
1506
1810
|
if self.has['fetchDepositsWithdrawals']:
|
1507
|
-
return await self.
|
1811
|
+
return await self.fetch_deposits_withdrawals(code, since, limit, params)
|
1508
1812
|
else:
|
1509
1813
|
raise NotSupported(self.id + ' fetchTransactions() is not supported yet')
|
1510
1814
|
|
1511
|
-
async def fetch_paginated_call_dynamic(self, method: str, symbol: Str = None, since: Int = None, limit: Int = None, params={}, maxEntriesPerRequest: Int = None):
|
1815
|
+
async def fetch_paginated_call_dynamic(self, method: str, symbol: Str = None, since: Int = None, limit: Int = None, params={}, maxEntriesPerRequest: Int = None, removeRepeated=True):
|
1512
1816
|
maxCalls = None
|
1513
1817
|
maxCalls, params = self.handle_option_and_params(params, method, 'paginationCalls', 10)
|
1514
1818
|
maxRetries = None
|
@@ -1516,6 +1820,8 @@ class Exchange(BaseExchange):
|
|
1516
1820
|
paginationDirection = None
|
1517
1821
|
paginationDirection, params = self.handle_option_and_params(params, method, 'paginationDirection', 'backward')
|
1518
1822
|
paginationTimestamp = None
|
1823
|
+
removeRepeatedOption = removeRepeated
|
1824
|
+
removeRepeatedOption, params = self.handle_option_and_params(params, method, 'removeRepeated', removeRepeated)
|
1519
1825
|
calls = 0
|
1520
1826
|
result = []
|
1521
1827
|
errors = 0
|
@@ -1562,14 +1868,16 @@ class Exchange(BaseExchange):
|
|
1562
1868
|
errors = 0
|
1563
1869
|
result = self.array_concat(result, response)
|
1564
1870
|
last = self.safe_value(response, responseLength - 1)
|
1565
|
-
paginationTimestamp = self.safe_integer(last, 'timestamp')
|
1871
|
+
paginationTimestamp = self.safe_integer(last, 'timestamp') + 1
|
1566
1872
|
if (until is not None) and (paginationTimestamp >= until):
|
1567
1873
|
break
|
1568
1874
|
except Exception as e:
|
1569
1875
|
errors += 1
|
1570
1876
|
if errors > maxRetries:
|
1571
1877
|
raise e
|
1572
|
-
uniqueResults =
|
1878
|
+
uniqueResults = result
|
1879
|
+
if removeRepeatedOption:
|
1880
|
+
uniqueResults = self.remove_repeated_elements_from_array(result)
|
1573
1881
|
key = 0 if (method == 'fetchOHLCV') else 'timestamp'
|
1574
1882
|
return self.filter_by_since_limit(uniqueResults, since, limit, key)
|
1575
1883
|
|
@@ -1577,18 +1885,19 @@ class Exchange(BaseExchange):
|
|
1577
1885
|
maxRetries = None
|
1578
1886
|
maxRetries, params = self.handle_option_and_params(params, method, 'maxRetries', 3)
|
1579
1887
|
errors = 0
|
1580
|
-
|
1581
|
-
|
1582
|
-
|
1583
|
-
|
1584
|
-
|
1585
|
-
|
1586
|
-
|
1587
|
-
|
1588
|
-
|
1589
|
-
|
1590
|
-
|
1591
|
-
|
1888
|
+
while(errors <= maxRetries):
|
1889
|
+
try:
|
1890
|
+
if timeframe and method != 'fetchFundingRateHistory':
|
1891
|
+
return await getattr(self, method)(symbol, timeframe, since, limit, params)
|
1892
|
+
else:
|
1893
|
+
return await getattr(self, method)(symbol, since, limit, params)
|
1894
|
+
except Exception as e:
|
1895
|
+
if isinstance(e, RateLimitExceeded):
|
1896
|
+
raise e # if we are rate limited, we should not retry and fail fast
|
1897
|
+
errors += 1
|
1898
|
+
if errors > maxRetries:
|
1899
|
+
raise e
|
1900
|
+
return []
|
1592
1901
|
|
1593
1902
|
async def fetch_paginated_call_deterministic(self, method: str, symbol: Str = None, since: Int = None, limit: Int = None, timeframe: Str = None, params={}, maxEntriesPerRequest=None):
|
1594
1903
|
maxCalls = None
|
@@ -1601,6 +1910,8 @@ class Exchange(BaseExchange):
|
|
1601
1910
|
currentSince = current - (maxCalls * step) - 1
|
1602
1911
|
if since is not None:
|
1603
1912
|
currentSince = max(currentSince, since)
|
1913
|
+
else:
|
1914
|
+
currentSince = max(currentSince, 1241440531000) # avoid timestamps older than 2009
|
1604
1915
|
until = self.safe_integer_2(params, 'until', 'till') # do not omit it here
|
1605
1916
|
if until is not None:
|
1606
1917
|
requiredCalls = int(math.ceil((until - since)) / step)
|
@@ -1609,6 +1920,8 @@ class Exchange(BaseExchange):
|
|
1609
1920
|
for i in range(0, maxCalls):
|
1610
1921
|
if (until is not None) and (currentSince >= until):
|
1611
1922
|
break
|
1923
|
+
if currentSince >= current:
|
1924
|
+
break
|
1612
1925
|
tasks.append(self.safe_deterministic_call(method, symbol, currentSince, maxEntriesPerRequest, timeframe, params))
|
1613
1926
|
currentSince = self.sum(currentSince, step) - 1
|
1614
1927
|
results = await asyncio.gather(*tasks)
|
@@ -1629,28 +1942,44 @@ class Exchange(BaseExchange):
|
|
1629
1942
|
i = 0
|
1630
1943
|
errors = 0
|
1631
1944
|
result = []
|
1945
|
+
timeframe = self.safe_string(params, 'timeframe')
|
1946
|
+
params = self.omit(params, 'timeframe') # reading the timeframe from the method arguments to avoid changing the signature
|
1632
1947
|
while(i < maxCalls):
|
1633
1948
|
try:
|
1634
1949
|
if cursorValue is not None:
|
1635
1950
|
if cursorIncrement is not None:
|
1636
|
-
cursorValue = self.
|
1951
|
+
cursorValue = self.parse_to_int(cursorValue) + cursorIncrement
|
1637
1952
|
params[cursorSent] = cursorValue
|
1638
1953
|
response = None
|
1639
1954
|
if method == 'fetchAccounts':
|
1640
1955
|
response = await getattr(self, method)(params)
|
1956
|
+
elif method == 'getLeverageTiersPaginated' or method == 'fetchPositions':
|
1957
|
+
response = await getattr(self, method)(symbol, params)
|
1958
|
+
elif method == 'fetchOpenInterestHistory':
|
1959
|
+
response = await getattr(self, method)(symbol, timeframe, since, maxEntriesPerRequest, params)
|
1641
1960
|
else:
|
1642
1961
|
response = await getattr(self, method)(symbol, since, maxEntriesPerRequest, params)
|
1643
1962
|
errors = 0
|
1644
1963
|
responseLength = len(response)
|
1645
1964
|
if self.verbose:
|
1646
|
-
|
1647
|
-
|
1965
|
+
cursorString = '' if (cursorValue is None) else cursorValue
|
1966
|
+
iteration = (i + 1)
|
1967
|
+
cursorMessage = 'Cursor pagination call ' + str(iteration) + ' method ' + method + ' response length ' + str(responseLength) + ' cursor ' + cursorString
|
1648
1968
|
self.log(cursorMessage)
|
1649
1969
|
if responseLength == 0:
|
1650
1970
|
break
|
1651
1971
|
result = self.array_concat(result, response)
|
1652
|
-
last = self.
|
1653
|
-
cursorValue = self.safe_value(last['info'], cursorReceived)
|
1972
|
+
last = self.safe_dict(response, responseLength - 1)
|
1973
|
+
# cursorValue = self.safe_value(last['info'], cursorReceived)
|
1974
|
+
cursorValue = None # search for the cursor
|
1975
|
+
for j in range(0, responseLength):
|
1976
|
+
index = responseLength - j - 1
|
1977
|
+
entry = self.safe_dict(response, index)
|
1978
|
+
info = self.safe_dict(entry, 'info')
|
1979
|
+
cursor = self.safe_value(info, cursorReceived)
|
1980
|
+
if cursor is not None:
|
1981
|
+
cursorValue = cursor
|
1982
|
+
break
|
1654
1983
|
if cursorValue is None:
|
1655
1984
|
break
|
1656
1985
|
lastTimestamp = self.safe_integer(last, 'timestamp')
|
@@ -1661,7 +1990,7 @@ class Exchange(BaseExchange):
|
|
1661
1990
|
if errors > maxRetries:
|
1662
1991
|
raise e
|
1663
1992
|
i += 1
|
1664
|
-
sorted = self.
|
1993
|
+
sorted = self.sort_cursor_paginated_result(result)
|
1665
1994
|
key = 0 if (method == 'fetchOHLCV') else 'timestamp'
|
1666
1995
|
return self.filter_by_since_limit(sorted, since, limit, key)
|
1667
1996
|
|
@@ -1692,6 +2021,53 @@ class Exchange(BaseExchange):
|
|
1692
2021
|
if errors > maxRetries:
|
1693
2022
|
raise e
|
1694
2023
|
i += 1
|
1695
|
-
sorted = self.
|
2024
|
+
sorted = self.sort_cursor_paginated_result(result)
|
1696
2025
|
key = 0 if (method == 'fetchOHLCV') else 'timestamp'
|
1697
2026
|
return self.filter_by_since_limit(sorted, since, limit, key)
|
2027
|
+
|
2028
|
+
async def fetch_position_history(self, symbol: str, since: Int = None, limit: Int = None, params={}):
|
2029
|
+
"""
|
2030
|
+
fetches the history of margin added or reduced from contract isolated positions
|
2031
|
+
:param str [symbol]: unified market symbol
|
2032
|
+
:param int [since]: timestamp in ms of the position
|
2033
|
+
:param int [limit]: the maximum amount of candles to fetch, default=1000
|
2034
|
+
:param dict params: extra parameters specific to the exchange api endpoint
|
2035
|
+
:returns dict[]: a list of `position structures <https://docs.ccxt.com/#/?id=position-structure>`
|
2036
|
+
"""
|
2037
|
+
if self.has['fetchPositionsHistory']:
|
2038
|
+
positions = await self.fetch_positions_history([symbol], since, limit, params)
|
2039
|
+
return positions
|
2040
|
+
else:
|
2041
|
+
raise NotSupported(self.id + ' fetchPositionHistory() is not supported yet')
|
2042
|
+
|
2043
|
+
async def fetch_positions_history(self, symbols: Strings = None, since: Int = None, limit: Int = None, params={}):
|
2044
|
+
"""
|
2045
|
+
fetches the history of margin added or reduced from contract isolated positions
|
2046
|
+
:param str [symbol]: unified market symbol
|
2047
|
+
:param int [since]: timestamp in ms of the position
|
2048
|
+
:param int [limit]: the maximum amount of candles to fetch, default=1000
|
2049
|
+
:param dict params: extra parameters specific to the exchange api endpoint
|
2050
|
+
:returns dict[]: a list of `position structures <https://docs.ccxt.com/#/?id=position-structure>`
|
2051
|
+
"""
|
2052
|
+
raise NotSupported(self.id + ' fetchPositionsHistory() is not supported yet')
|
2053
|
+
|
2054
|
+
async def fetch_transfer(self, id: str, code: Str = None, params={}):
|
2055
|
+
"""
|
2056
|
+
fetches a transfer
|
2057
|
+
:param str id: transfer id
|
2058
|
+
:param [str] code: unified currency code
|
2059
|
+
:param dict params: extra parameters specific to the exchange api endpoint
|
2060
|
+
:returns dict: a `transfer structure <https://docs.ccxt.com/#/?id=transfer-structure>`
|
2061
|
+
"""
|
2062
|
+
raise NotSupported(self.id + ' fetchTransfer() is not supported yet')
|
2063
|
+
|
2064
|
+
async def fetch_transfers(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
|
2065
|
+
"""
|
2066
|
+
fetches a transfer
|
2067
|
+
:param str id: transfer id
|
2068
|
+
:param int [since]: timestamp in ms of the earliest transfer to fetch
|
2069
|
+
:param int [limit]: the maximum amount of transfers to fetch
|
2070
|
+
:param dict params: extra parameters specific to the exchange api endpoint
|
2071
|
+
:returns dict: a `transfer structure <https://docs.ccxt.com/#/?id=transfer-structure>`
|
2072
|
+
"""
|
2073
|
+
raise NotSupported(self.id + ' fetchTransfers() is not supported yet')
|