ccxt 4.2.77__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 +24 -0
- ccxt/abstract/kucoinfutures.py +34 -0
- ccxt/abstract/luno.py +2 -0
- ccxt/abstract/mexc.py +4 -0
- ccxt/abstract/myokx.py +340 -0
- ccxt/abstract/oceanex.py +5 -0
- ccxt/abstract/okx.py +30 -0
- ccxt/abstract/onetrading.py +0 -12
- ccxt/abstract/oxfun.py +34 -0
- ccxt/abstract/paradex.py +40 -0
- ccxt/abstract/phemex.py +1 -0
- ccxt/abstract/upbit.py +4 -0
- ccxt/abstract/vertex.py +19 -0
- ccxt/abstract/whitebit.py +31 -1
- ccxt/abstract/woo.py +6 -2
- ccxt/abstract/woofipro.py +119 -0
- ccxt/abstract/xt.py +153 -0
- ccxt/abstract/zonda.py +6 -0
- ccxt/ace.py +164 -60
- ccxt/alpaca.py +727 -63
- ccxt/ascendex.py +395 -249
- ccxt/async_support/__init__.py +36 -14
- ccxt/async_support/ace.py +164 -60
- ccxt/async_support/alpaca.py +727 -63
- ccxt/async_support/ascendex.py +396 -249
- ccxt/async_support/base/exchange.py +531 -155
- ccxt/async_support/base/ws/aiohttp_client.py +28 -5
- ccxt/async_support/base/ws/cache.py +3 -2
- ccxt/async_support/base/ws/client.py +26 -5
- ccxt/async_support/base/ws/fast_client.py +4 -3
- ccxt/async_support/base/ws/functions.py +1 -1
- ccxt/async_support/base/ws/future.py +40 -31
- ccxt/async_support/base/ws/order_book_side.py +3 -0
- ccxt/async_support/bequant.py +1 -1
- ccxt/async_support/bigone.py +329 -202
- ccxt/async_support/binance.py +3030 -1087
- ccxt/async_support/binancecoinm.py +2 -1
- ccxt/async_support/binanceus.py +12 -1
- ccxt/async_support/binanceusdm.py +3 -1
- ccxt/async_support/bingx.py +3104 -880
- ccxt/async_support/bit2c.py +119 -38
- ccxt/async_support/bitbank.py +215 -76
- ccxt/async_support/bitbns.py +124 -53
- ccxt/async_support/bitfinex.py +3236 -1078
- ccxt/async_support/bitfinex1.py +1711 -0
- ccxt/async_support/bitflyer.py +238 -49
- ccxt/async_support/bitget.py +1513 -563
- ccxt/async_support/bithumb.py +199 -65
- ccxt/async_support/bitmart.py +1320 -435
- ccxt/async_support/bitmex.py +308 -111
- ccxt/async_support/bitopro.py +256 -96
- ccxt/async_support/bitrue.py +365 -233
- ccxt/async_support/bitso.py +201 -89
- ccxt/async_support/bitstamp.py +438 -269
- ccxt/async_support/bitteam.py +179 -73
- ccxt/async_support/bitvavo.py +180 -70
- ccxt/async_support/bl3p.py +92 -25
- ccxt/async_support/blockchaincom.py +193 -79
- ccxt/async_support/blofin.py +392 -148
- ccxt/async_support/btcalpha.py +161 -55
- ccxt/async_support/btcbox.py +250 -34
- ccxt/async_support/btcmarkets.py +232 -85
- ccxt/async_support/btcturk.py +159 -60
- ccxt/async_support/bybit.py +2231 -1193
- ccxt/async_support/cex.py +1409 -1329
- ccxt/async_support/coinbase.py +1454 -287
- ccxt/async_support/coinbaseadvanced.py +17 -0
- ccxt/async_support/{coinbasepro.py → coinbaseexchange.py} +233 -99
- ccxt/async_support/coinbaseinternational.py +428 -88
- ccxt/async_support/coincatch.py +5152 -0
- ccxt/async_support/coincheck.py +121 -38
- ccxt/async_support/coinex.py +4020 -3339
- ccxt/async_support/coinlist.py +273 -116
- ccxt/async_support/coinmate.py +204 -97
- ccxt/async_support/coinmetro.py +203 -110
- ccxt/async_support/coinone.py +142 -68
- ccxt/async_support/coinsph.py +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 +404 -109
- ccxt/async_support/deribit.py +557 -323
- 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 +1472 -463
- 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 +1633 -268
- 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 +917 -357
- 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 +1776 -454
- 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 +1137 -296
- ccxt/async_support/woofipro.py +2716 -0
- ccxt/async_support/xt.py +4628 -0
- ccxt/async_support/yobit.py +160 -92
- ccxt/async_support/zaif.py +80 -33
- ccxt/async_support/zonda.py +140 -69
- ccxt/base/errors.py +51 -20
- ccxt/base/exchange.py +1722 -480
- ccxt/base/precise.py +10 -0
- ccxt/base/types.py +223 -4
- ccxt/bequant.py +1 -1
- ccxt/bigone.py +329 -202
- ccxt/binance.py +3030 -1087
- ccxt/binancecoinm.py +2 -1
- ccxt/binanceus.py +12 -1
- ccxt/binanceusdm.py +3 -1
- ccxt/bingx.py +3104 -880
- ccxt/bit2c.py +119 -38
- ccxt/bitbank.py +215 -76
- ccxt/bitbns.py +124 -53
- ccxt/bitfinex.py +3235 -1078
- ccxt/bitfinex1.py +1710 -0
- ccxt/bitflyer.py +238 -49
- ccxt/bitget.py +1513 -563
- ccxt/bithumb.py +198 -65
- ccxt/bitmart.py +1320 -435
- ccxt/bitmex.py +308 -111
- ccxt/bitopro.py +256 -96
- ccxt/bitrue.py +365 -233
- ccxt/bitso.py +201 -89
- ccxt/bitstamp.py +438 -269
- ccxt/bitteam.py +179 -73
- ccxt/bitvavo.py +180 -70
- ccxt/bl3p.py +92 -25
- ccxt/blockchaincom.py +193 -79
- ccxt/blofin.py +392 -148
- ccxt/btcalpha.py +161 -55
- ccxt/btcbox.py +250 -34
- ccxt/btcmarkets.py +232 -85
- ccxt/btcturk.py +159 -60
- ccxt/bybit.py +2231 -1193
- ccxt/cex.py +1408 -1329
- ccxt/coinbase.py +1454 -287
- ccxt/coinbaseadvanced.py +17 -0
- ccxt/{coinbasepro.py → coinbaseexchange.py} +233 -99
- ccxt/coinbaseinternational.py +428 -88
- ccxt/coincatch.py +5152 -0
- ccxt/coincheck.py +121 -38
- ccxt/coinex.py +4020 -3339
- ccxt/coinlist.py +273 -116
- ccxt/coinmate.py +204 -97
- ccxt/coinmetro.py +203 -110
- ccxt/coinone.py +142 -68
- ccxt/coinsph.py +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 +404 -109
- ccxt/deribit.py +557 -323
- ccxt/digifinex.py +340 -223
- ccxt/ellipx.py +1826 -0
- ccxt/exmo.py +259 -128
- ccxt/gate.py +1472 -463
- 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 +1632 -268
- 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 +917 -357
- 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 +1776 -454
- 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 +62 -14
- ccxt/pro/bequant.py +4 -0
- ccxt/pro/binance.py +1596 -329
- ccxt/pro/binancecoinm.py +1 -0
- ccxt/pro/binanceus.py +2 -9
- ccxt/pro/binanceusdm.py +2 -0
- ccxt/pro/bingx.py +527 -134
- ccxt/pro/bitcoincom.py +4 -1
- ccxt/pro/bitfinex.py +731 -266
- ccxt/pro/bitfinex1.py +635 -0
- ccxt/pro/bitget.py +726 -357
- ccxt/pro/bithumb.py +380 -0
- ccxt/pro/bitmart.py +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 +203 -81
- ccxt/pro/blockchaincom.py +30 -17
- ccxt/pro/blofin.py +692 -0
- ccxt/pro/bybit.py +791 -82
- ccxt/pro/cex.py +99 -51
- ccxt/pro/coinbase.py +220 -30
- ccxt/{async_support/hitbtc3.py → pro/coinbaseadvanced.py} +5 -5
- ccxt/pro/{coinbasepro.py → coinbaseexchange.py} +19 -19
- ccxt/pro/coinbaseinternational.py +193 -30
- ccxt/pro/coincatch.py +1464 -0
- ccxt/pro/coincheck.py +11 -6
- ccxt/pro/coinex.py +965 -665
- ccxt/pro/coinone.py +17 -10
- ccxt/pro/cryptocom.py +446 -66
- ccxt/pro/currencycom.py +11 -10
- ccxt/pro/defx.py +832 -0
- ccxt/pro/deribit.py +167 -31
- ccxt/pro/exmo.py +252 -20
- ccxt/pro/gate.py +729 -64
- ccxt/pro/gemini.py +44 -26
- ccxt/pro/hashkey.py +802 -0
- ccxt/pro/hitbtc.py +208 -103
- ccxt/pro/hollaex.py +25 -9
- ccxt/pro/htx.py +83 -39
- ccxt/pro/huobijp.py +17 -16
- ccxt/pro/hyperliquid.py +502 -31
- ccxt/pro/idex.py +28 -13
- ccxt/pro/independentreserve.py +21 -16
- ccxt/pro/kraken.py +298 -51
- ccxt/pro/krakenfutures.py +166 -75
- ccxt/pro/kucoin.py +395 -77
- ccxt/pro/kucoinfutures.py +400 -99
- ccxt/pro/lbank.py +52 -31
- ccxt/pro/luno.py +12 -10
- ccxt/pro/mexc.py +400 -50
- ccxt/pro/myokx.py +28 -0
- ccxt/pro/ndax.py +25 -12
- ccxt/pro/okcoin.py +28 -9
- ccxt/pro/okx.py +935 -124
- ccxt/pro/onetrading.py +41 -24
- ccxt/pro/oxfun.py +1054 -0
- ccxt/pro/p2b.py +100 -24
- ccxt/pro/paradex.py +352 -0
- ccxt/pro/phemex.py +92 -33
- ccxt/pro/poloniex.py +128 -49
- ccxt/pro/poloniexfutures.py +53 -32
- ccxt/pro/probit.py +92 -85
- ccxt/pro/upbit.py +401 -8
- ccxt/pro/vertex.py +943 -0
- ccxt/pro/wazirx.py +46 -28
- ccxt/pro/whitebit.py +65 -12
- ccxt/pro/woo.py +437 -65
- ccxt/pro/woofipro.py +1271 -0
- ccxt/pro/xt.py +1067 -0
- ccxt/probit.py +143 -110
- ccxt/static_dependencies/__init__.py +1 -1
- ccxt/static_dependencies/lark/__init__.py +38 -0
- ccxt/static_dependencies/lark/__pyinstaller/__init__.py +6 -0
- ccxt/static_dependencies/lark/__pyinstaller/hook-lark.py +14 -0
- ccxt/static_dependencies/lark/ast_utils.py +59 -0
- ccxt/static_dependencies/lark/common.py +86 -0
- ccxt/static_dependencies/lark/exceptions.py +292 -0
- ccxt/static_dependencies/lark/grammar.py +130 -0
- ccxt/static_dependencies/lark/grammars/__init__.py +0 -0
- ccxt/static_dependencies/lark/indenter.py +143 -0
- ccxt/static_dependencies/lark/lark.py +658 -0
- ccxt/static_dependencies/lark/lexer.py +678 -0
- ccxt/static_dependencies/lark/load_grammar.py +1428 -0
- ccxt/static_dependencies/lark/parse_tree_builder.py +391 -0
- ccxt/static_dependencies/lark/parser_frontends.py +257 -0
- ccxt/static_dependencies/lark/parsers/__init__.py +0 -0
- ccxt/static_dependencies/lark/parsers/cyk.py +340 -0
- ccxt/static_dependencies/lark/parsers/earley.py +314 -0
- ccxt/static_dependencies/lark/parsers/earley_common.py +42 -0
- ccxt/static_dependencies/lark/parsers/earley_forest.py +801 -0
- ccxt/static_dependencies/lark/parsers/grammar_analysis.py +203 -0
- ccxt/static_dependencies/lark/parsers/lalr_analysis.py +332 -0
- ccxt/static_dependencies/lark/parsers/lalr_interactive_parser.py +158 -0
- ccxt/static_dependencies/lark/parsers/lalr_parser.py +122 -0
- ccxt/static_dependencies/lark/parsers/lalr_parser_state.py +110 -0
- ccxt/static_dependencies/lark/parsers/xearley.py +165 -0
- ccxt/static_dependencies/lark/py.typed +0 -0
- ccxt/static_dependencies/lark/reconstruct.py +107 -0
- ccxt/static_dependencies/lark/tools/__init__.py +70 -0
- ccxt/static_dependencies/lark/tools/nearley.py +202 -0
- ccxt/static_dependencies/lark/tools/serialize.py +32 -0
- ccxt/static_dependencies/lark/tools/standalone.py +196 -0
- ccxt/static_dependencies/lark/tree.py +267 -0
- ccxt/static_dependencies/lark/tree_matcher.py +186 -0
- ccxt/static_dependencies/lark/tree_templates.py +180 -0
- ccxt/static_dependencies/lark/utils.py +343 -0
- ccxt/static_dependencies/lark/visitors.py +596 -0
- ccxt/static_dependencies/marshmallow/__init__.py +81 -0
- ccxt/static_dependencies/marshmallow/base.py +65 -0
- ccxt/static_dependencies/marshmallow/class_registry.py +94 -0
- ccxt/static_dependencies/marshmallow/decorators.py +231 -0
- ccxt/static_dependencies/marshmallow/error_store.py +60 -0
- ccxt/static_dependencies/marshmallow/exceptions.py +71 -0
- ccxt/static_dependencies/marshmallow/fields.py +2114 -0
- ccxt/static_dependencies/marshmallow/orderedset.py +89 -0
- ccxt/static_dependencies/marshmallow/py.typed +0 -0
- ccxt/static_dependencies/marshmallow/schema.py +1228 -0
- ccxt/static_dependencies/marshmallow/types.py +12 -0
- ccxt/static_dependencies/marshmallow/utils.py +378 -0
- ccxt/static_dependencies/marshmallow/validate.py +678 -0
- ccxt/static_dependencies/marshmallow/warnings.py +2 -0
- ccxt/static_dependencies/marshmallow_dataclass/__init__.py +1047 -0
- ccxt/static_dependencies/marshmallow_dataclass/collection_field.py +51 -0
- ccxt/static_dependencies/marshmallow_dataclass/lazy_class_attribute.py +45 -0
- ccxt/static_dependencies/marshmallow_dataclass/mypy.py +71 -0
- ccxt/static_dependencies/marshmallow_dataclass/py.typed +0 -0
- ccxt/static_dependencies/marshmallow_dataclass/typing.py +14 -0
- ccxt/static_dependencies/marshmallow_dataclass/union_field.py +82 -0
- ccxt/static_dependencies/marshmallow_oneofschema/__init__.py +1 -0
- ccxt/static_dependencies/marshmallow_oneofschema/one_of_schema.py +193 -0
- ccxt/static_dependencies/marshmallow_oneofschema/py.typed +0 -0
- ccxt/static_dependencies/starknet/__init__.py +0 -0
- ccxt/static_dependencies/starknet/cairo/__init__.py +0 -0
- ccxt/static_dependencies/starknet/cairo/data_types.py +123 -0
- ccxt/static_dependencies/starknet/cairo/deprecated_parse/__init__.py +0 -0
- ccxt/static_dependencies/starknet/cairo/deprecated_parse/cairo_types.py +77 -0
- ccxt/static_dependencies/starknet/cairo/deprecated_parse/parser.py +46 -0
- ccxt/static_dependencies/starknet/cairo/deprecated_parse/parser_transformer.py +138 -0
- ccxt/static_dependencies/starknet/cairo/felt.py +64 -0
- ccxt/static_dependencies/starknet/cairo/type_parser.py +121 -0
- ccxt/static_dependencies/starknet/cairo/v1/__init__.py +0 -0
- ccxt/static_dependencies/starknet/cairo/v1/type_parser.py +59 -0
- ccxt/static_dependencies/starknet/cairo/v2/__init__.py +0 -0
- ccxt/static_dependencies/starknet/cairo/v2/type_parser.py +77 -0
- ccxt/static_dependencies/starknet/ccxt_utils.py +7 -0
- ccxt/static_dependencies/starknet/common.py +15 -0
- ccxt/static_dependencies/starknet/constants.py +39 -0
- ccxt/static_dependencies/starknet/hash/__init__.py +0 -0
- ccxt/static_dependencies/starknet/hash/address.py +79 -0
- ccxt/static_dependencies/starknet/hash/compiled_class_hash_objects.py +111 -0
- ccxt/static_dependencies/starknet/hash/selector.py +16 -0
- ccxt/static_dependencies/starknet/hash/storage.py +12 -0
- ccxt/static_dependencies/starknet/hash/utils.py +78 -0
- ccxt/static_dependencies/starknet/models/__init__.py +0 -0
- ccxt/static_dependencies/starknet/models/typed_data.py +45 -0
- ccxt/static_dependencies/starknet/serialization/__init__.py +24 -0
- ccxt/static_dependencies/starknet/serialization/_calldata_reader.py +40 -0
- ccxt/static_dependencies/starknet/serialization/_context.py +142 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/__init__.py +10 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/_common.py +82 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/array_serializer.py +43 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/bool_serializer.py +37 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/byte_array_serializer.py +66 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/cairo_data_serializer.py +71 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/enum_serializer.py +71 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/felt_serializer.py +50 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/named_tuple_serializer.py +58 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/option_serializer.py +43 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/output_serializer.py +40 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/payload_serializer.py +72 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/struct_serializer.py +36 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/tuple_serializer.py +36 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/uint256_serializer.py +76 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/uint_serializer.py +100 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/unit_serializer.py +32 -0
- ccxt/static_dependencies/starknet/serialization/errors.py +10 -0
- ccxt/static_dependencies/starknet/serialization/factory.py +229 -0
- ccxt/static_dependencies/starknet/serialization/function_serialization_adapter.py +110 -0
- ccxt/static_dependencies/starknet/serialization/tuple_dataclass.py +59 -0
- ccxt/static_dependencies/starknet/utils/__init__.py +0 -0
- ccxt/static_dependencies/starknet/utils/constructor_args_translator.py +86 -0
- ccxt/static_dependencies/starknet/utils/iterable.py +13 -0
- ccxt/static_dependencies/starknet/utils/schema.py +13 -0
- ccxt/static_dependencies/starknet/utils/typed_data.py +182 -0
- ccxt/static_dependencies/starkware/__init__.py +0 -0
- ccxt/static_dependencies/starkware/crypto/__init__.py +0 -0
- ccxt/static_dependencies/starkware/crypto/fast_pedersen_hash.py +50 -0
- ccxt/static_dependencies/starkware/crypto/math_utils.py +78 -0
- ccxt/static_dependencies/starkware/crypto/signature.py +2344 -0
- ccxt/static_dependencies/starkware/crypto/utils.py +63 -0
- ccxt/static_dependencies/sympy/__init__.py +0 -0
- ccxt/static_dependencies/sympy/core/__init__.py +0 -0
- ccxt/static_dependencies/sympy/core/intfunc.py +35 -0
- ccxt/static_dependencies/sympy/external/__init__.py +0 -0
- ccxt/static_dependencies/sympy/external/gmpy.py +345 -0
- ccxt/static_dependencies/sympy/external/importtools.py +187 -0
- ccxt/static_dependencies/sympy/external/ntheory.py +637 -0
- ccxt/static_dependencies/sympy/external/pythonmpq.py +341 -0
- ccxt/static_dependencies/typing_inspect/__init__.py +0 -0
- ccxt/static_dependencies/typing_inspect/typing_inspect.py +851 -0
- ccxt/test/{test_async.py → tests_async.py} +456 -391
- ccxt/test/tests_helpers.py +285 -0
- ccxt/test/tests_init.py +39 -0
- ccxt/test/{test_sync.py → tests_sync.py} +456 -393
- ccxt/timex.py +123 -70
- ccxt/tokocrypto.py +129 -93
- ccxt/tradeogre.py +39 -25
- ccxt/upbit.py +322 -113
- ccxt/vertex.py +2983 -0
- ccxt/wavesexchange.py +227 -173
- ccxt/wazirx.py +145 -65
- ccxt/whitebit.py +533 -138
- ccxt/woo.py +1137 -296
- ccxt/woofipro.py +2716 -0
- ccxt/xt.py +4627 -0
- ccxt/yobit.py +159 -92
- ccxt/zaif.py +80 -33
- ccxt/zonda.py +140 -69
- ccxt-4.4.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.77.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.77.dist-info/METADATA +0 -626
- ccxt-4.2.77.dist-info/RECORD +0 -534
- {ccxt-4.2.77.dist-info → ccxt-4.4.48.dist-info}/top_level.txt +0 -0
ccxt/async_support/delta.py
CHANGED
@@ -6,9 +6,10 @@
|
|
6
6
|
from ccxt.async_support.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.delta import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Balances, Currency, Greeks, Int, Leverage, MarginMode, Market, MarketInterface, Num, Order, OrderBook, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade
|
9
|
+
from ccxt.base.types import Balances, Currencies, Currency, DepositAddress, Greeks, Int, LedgerEntry, Leverage, MarginMode, MarginModification, Market, MarketInterface, Num, Option, Order, OrderBook, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, Trade
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
|
+
from ccxt.base.errors import AuthenticationError
|
12
13
|
from ccxt.base.errors import ArgumentsRequired
|
13
14
|
from ccxt.base.errors import BadRequest
|
14
15
|
from ccxt.base.errors import BadSymbol
|
@@ -16,7 +17,6 @@ from ccxt.base.errors import InsufficientFunds
|
|
16
17
|
from ccxt.base.errors import InvalidOrder
|
17
18
|
from ccxt.base.errors import OrderNotFound
|
18
19
|
from ccxt.base.errors import ExchangeNotAvailable
|
19
|
-
from ccxt.base.errors import AuthenticationError
|
20
20
|
from ccxt.base.decimal_to_precision import TICK_SIZE
|
21
21
|
from ccxt.base.precise import Precise
|
22
22
|
|
@@ -51,6 +51,8 @@ class delta(Exchange, ImplicitAPI):
|
|
51
51
|
'fetchCurrencies': True,
|
52
52
|
'fetchDeposit': None,
|
53
53
|
'fetchDepositAddress': True,
|
54
|
+
'fetchDepositAddresses': False,
|
55
|
+
'fetchDepositAddressesByNetwork': False,
|
54
56
|
'fetchDeposits': None,
|
55
57
|
'fetchFundingHistory': False,
|
56
58
|
'fetchFundingRate': True,
|
@@ -71,6 +73,8 @@ class delta(Exchange, ImplicitAPI):
|
|
71
73
|
'fetchOHLCV': True,
|
72
74
|
'fetchOpenInterest': True,
|
73
75
|
'fetchOpenOrders': True,
|
76
|
+
'fetchOption': True,
|
77
|
+
'fetchOptionChain': False,
|
74
78
|
'fetchOrderBook': True,
|
75
79
|
'fetchPosition': True,
|
76
80
|
'fetchPositionMode': False,
|
@@ -225,6 +229,88 @@ class delta(Exchange, ImplicitAPI):
|
|
225
229
|
'BEP20': 'BEP20(BSC)',
|
226
230
|
},
|
227
231
|
},
|
232
|
+
'features': {
|
233
|
+
'default': {
|
234
|
+
'sandbox': True,
|
235
|
+
'createOrder': {
|
236
|
+
'marginMode': False,
|
237
|
+
'triggerPrice': True, # todo implement
|
238
|
+
# todo implement
|
239
|
+
'triggerPriceType': {
|
240
|
+
'last': True,
|
241
|
+
'mark': True,
|
242
|
+
'index': True,
|
243
|
+
},
|
244
|
+
'triggerDirection': False,
|
245
|
+
'stopLossPrice': False, # todo
|
246
|
+
'takeProfitPrice': False, # todo
|
247
|
+
'attachedStopLossTakeProfit': {
|
248
|
+
'triggerPriceType': None,
|
249
|
+
'price': True,
|
250
|
+
},
|
251
|
+
# todo implementation
|
252
|
+
'timeInForce': {
|
253
|
+
'IOC': True,
|
254
|
+
'FOK': True,
|
255
|
+
'PO': True,
|
256
|
+
'GTD': False,
|
257
|
+
},
|
258
|
+
'hedged': False,
|
259
|
+
'selfTradePrevention': False,
|
260
|
+
'trailing': False, # todo: implement
|
261
|
+
'iceberg': False,
|
262
|
+
'leverage': False,
|
263
|
+
'marketBuyByCost': False,
|
264
|
+
'marketBuyRequiresPrice': False,
|
265
|
+
},
|
266
|
+
'createOrders': None, # todo: implement
|
267
|
+
'fetchMyTrades': {
|
268
|
+
'marginMode': False,
|
269
|
+
'limit': 100, # todo: revise
|
270
|
+
'daysBack': 100000,
|
271
|
+
'untilDays': 100000,
|
272
|
+
},
|
273
|
+
'fetchOrder': None,
|
274
|
+
'fetchOpenOrders': {
|
275
|
+
'marginMode': False,
|
276
|
+
'limit': 100, # todo: revise
|
277
|
+
'trigger': False,
|
278
|
+
'trailing': False,
|
279
|
+
},
|
280
|
+
'fetchOrders': None,
|
281
|
+
'fetchClosedOrders': {
|
282
|
+
'marginMode': False,
|
283
|
+
'limit': 500,
|
284
|
+
'daysBack': 100000,
|
285
|
+
'daysBackCanceled': 1,
|
286
|
+
'untilDays': 100000,
|
287
|
+
'trigger': False,
|
288
|
+
'trailing': False,
|
289
|
+
},
|
290
|
+
'fetchOHLCV': {
|
291
|
+
'limit': 2000, # todo: recheck
|
292
|
+
},
|
293
|
+
},
|
294
|
+
'spot': {
|
295
|
+
'extends': 'default',
|
296
|
+
},
|
297
|
+
'swap': {
|
298
|
+
'linear': {
|
299
|
+
'extends': 'default',
|
300
|
+
},
|
301
|
+
'inverse': {
|
302
|
+
'extends': 'default',
|
303
|
+
},
|
304
|
+
},
|
305
|
+
'future': {
|
306
|
+
'linear': {
|
307
|
+
'extends': 'default',
|
308
|
+
},
|
309
|
+
'inverse': {
|
310
|
+
'extends': 'default',
|
311
|
+
},
|
312
|
+
},
|
313
|
+
},
|
228
314
|
'precisionMode': TICK_SIZE,
|
229
315
|
'requiredCredentials': {
|
230
316
|
'apiKey': True,
|
@@ -252,14 +338,6 @@ class delta(Exchange, ImplicitAPI):
|
|
252
338
|
},
|
253
339
|
})
|
254
340
|
|
255
|
-
def convert_expire_date(self, date):
|
256
|
-
# parse YYMMDD to timestamp
|
257
|
-
year = date[0:2]
|
258
|
-
month = date[2:4]
|
259
|
-
day = date[4:6]
|
260
|
-
reconstructedDate = '20' + year + '-' + month + '-' + day + 'T00:00:00Z'
|
261
|
-
return reconstructedDate
|
262
|
-
|
263
341
|
def create_expired_option_market(self, symbol: str):
|
264
342
|
# support expired option contracts
|
265
343
|
quote = 'USDT'
|
@@ -415,10 +493,12 @@ class delta(Exchange, ImplicitAPI):
|
|
415
493
|
'info': response,
|
416
494
|
}
|
417
495
|
|
418
|
-
async def fetch_currencies(self, params={}):
|
496
|
+
async def fetch_currencies(self, params={}) -> Currencies:
|
419
497
|
"""
|
420
498
|
fetches all available currencies on an exchange
|
421
|
-
|
499
|
+
|
500
|
+
https://docs.delta.exchange/#get-list-of-all-assets
|
501
|
+
|
422
502
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
423
503
|
:returns dict: an associative dictionary of currencies
|
424
504
|
"""
|
@@ -454,7 +534,7 @@ class delta(Exchange, ImplicitAPI):
|
|
454
534
|
# }
|
455
535
|
#
|
456
536
|
currencies = self.safe_list(response, 'result', [])
|
457
|
-
result = {}
|
537
|
+
result: dict = {}
|
458
538
|
for i in range(0, len(currencies)):
|
459
539
|
currency = currencies[i]
|
460
540
|
id = self.safe_string(currency, 'symbol')
|
@@ -498,7 +578,7 @@ class delta(Exchange, ImplicitAPI):
|
|
498
578
|
return markets
|
499
579
|
|
500
580
|
def index_by_stringified_numeric_id(self, input):
|
501
|
-
result = {}
|
581
|
+
result: dict = {}
|
502
582
|
if input is None:
|
503
583
|
return None
|
504
584
|
keys = list(input.keys())
|
@@ -511,10 +591,12 @@ class delta(Exchange, ImplicitAPI):
|
|
511
591
|
result[numericIdString] = item
|
512
592
|
return result
|
513
593
|
|
514
|
-
async def fetch_markets(self, params={}):
|
594
|
+
async def fetch_markets(self, params={}) -> List[Market]:
|
515
595
|
"""
|
516
596
|
retrieves data on all markets for delta
|
517
|
-
|
597
|
+
|
598
|
+
https://docs.delta.exchange/#get-list-of-products
|
599
|
+
|
518
600
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
519
601
|
:returns dict[]: an array of objects representing market data
|
520
602
|
"""
|
@@ -734,7 +816,7 @@ class delta(Exchange, ImplicitAPI):
|
|
734
816
|
else:
|
735
817
|
# other markets(swap, futures, move, spread, irs) seem to use the step of '1' contract
|
736
818
|
amountPrecision = self.parse_number('1')
|
737
|
-
linear = (settle ==
|
819
|
+
linear = (settle == quote)
|
738
820
|
optionType = None
|
739
821
|
symbol = base + '/' + quote
|
740
822
|
if swap or future or option:
|
@@ -811,7 +893,7 @@ class delta(Exchange, ImplicitAPI):
|
|
811
893
|
})
|
812
894
|
return result
|
813
895
|
|
814
|
-
def parse_ticker(self, ticker, market: Market = None) -> Ticker:
|
896
|
+
def parse_ticker(self, ticker: dict, market: Market = None) -> Ticker:
|
815
897
|
#
|
816
898
|
# spot: fetchTicker, fetchTickers
|
817
899
|
#
|
@@ -952,20 +1034,24 @@ class delta(Exchange, ImplicitAPI):
|
|
952
1034
|
'average': None,
|
953
1035
|
'baseVolume': self.safe_number(ticker, 'volume'),
|
954
1036
|
'quoteVolume': self.safe_number(ticker, 'turnover'),
|
1037
|
+
'markPrice': self.safe_number(ticker, 'mark_price'),
|
1038
|
+
'indexPrice': self.safe_number(ticker, 'spot_price'),
|
955
1039
|
'info': ticker,
|
956
1040
|
}, market)
|
957
1041
|
|
958
1042
|
async def fetch_ticker(self, symbol: str, params={}) -> Ticker:
|
959
1043
|
"""
|
960
1044
|
fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
961
|
-
|
1045
|
+
|
1046
|
+
https://docs.delta.exchange/#get-ticker-for-a-product-by-symbol
|
1047
|
+
|
962
1048
|
:param str symbol: unified symbol of the market to fetch the ticker for
|
963
1049
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
964
1050
|
:returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
|
965
1051
|
"""
|
966
1052
|
await self.load_markets()
|
967
1053
|
market = self.market(symbol)
|
968
|
-
request = {
|
1054
|
+
request: dict = {
|
969
1055
|
'symbol': market['id'],
|
970
1056
|
}
|
971
1057
|
response = await self.publicGetTickersSymbol(self.extend(request, params))
|
@@ -1099,7 +1185,9 @@ class delta(Exchange, ImplicitAPI):
|
|
1099
1185
|
async def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
|
1100
1186
|
"""
|
1101
1187
|
fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
1102
|
-
|
1188
|
+
|
1189
|
+
https://docs.delta.exchange/#get-tickers-for-products
|
1190
|
+
|
1103
1191
|
:param str[]|None symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
1104
1192
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1105
1193
|
:returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
|
@@ -1238,7 +1326,7 @@ class delta(Exchange, ImplicitAPI):
|
|
1238
1326
|
# }
|
1239
1327
|
#
|
1240
1328
|
tickers = self.safe_list(response, 'result', [])
|
1241
|
-
result = {}
|
1329
|
+
result: dict = {}
|
1242
1330
|
for i in range(0, len(tickers)):
|
1243
1331
|
ticker = self.parse_ticker(tickers[i])
|
1244
1332
|
symbol = ticker['symbol']
|
@@ -1248,7 +1336,9 @@ class delta(Exchange, ImplicitAPI):
|
|
1248
1336
|
async def fetch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook:
|
1249
1337
|
"""
|
1250
1338
|
fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
|
1251
|
-
|
1339
|
+
|
1340
|
+
https://docs.delta.exchange/#get-l2-orderbook
|
1341
|
+
|
1252
1342
|
:param str symbol: unified symbol of the market to fetch the order book for
|
1253
1343
|
:param int [limit]: the maximum amount of order book entries to return
|
1254
1344
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -1256,7 +1346,7 @@ class delta(Exchange, ImplicitAPI):
|
|
1256
1346
|
"""
|
1257
1347
|
await self.load_markets()
|
1258
1348
|
market = self.market(symbol)
|
1259
|
-
request = {
|
1349
|
+
request: dict = {
|
1260
1350
|
'symbol': market['id'],
|
1261
1351
|
}
|
1262
1352
|
if limit is not None:
|
@@ -1283,7 +1373,7 @@ class delta(Exchange, ImplicitAPI):
|
|
1283
1373
|
result = self.safe_dict(response, 'result', {})
|
1284
1374
|
return self.parse_order_book(result, market['symbol'], None, 'buy', 'sell', 'price', 'size')
|
1285
1375
|
|
1286
|
-
def parse_trade(self, trade, market: Market = None) -> Trade:
|
1376
|
+
def parse_trade(self, trade: dict, market: Market = None) -> Trade:
|
1287
1377
|
#
|
1288
1378
|
# public fetchTrades
|
1289
1379
|
#
|
@@ -1381,7 +1471,9 @@ class delta(Exchange, ImplicitAPI):
|
|
1381
1471
|
async def fetch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
|
1382
1472
|
"""
|
1383
1473
|
get the list of most recent trades for a particular symbol
|
1384
|
-
|
1474
|
+
|
1475
|
+
https://docs.delta.exchange/#get-public-trades
|
1476
|
+
|
1385
1477
|
:param str symbol: unified symbol of the market to fetch trades for
|
1386
1478
|
:param int [since]: timestamp in ms of the earliest trade to fetch
|
1387
1479
|
:param int [limit]: the maximum amount of trades to fetch
|
@@ -1390,7 +1482,7 @@ class delta(Exchange, ImplicitAPI):
|
|
1390
1482
|
"""
|
1391
1483
|
await self.load_markets()
|
1392
1484
|
market = self.market(symbol)
|
1393
|
-
request = {
|
1485
|
+
request: dict = {
|
1394
1486
|
'symbol': market['id'],
|
1395
1487
|
}
|
1396
1488
|
response = await self.publicGetTradesSymbol(self.extend(request, params))
|
@@ -1435,29 +1527,36 @@ class delta(Exchange, ImplicitAPI):
|
|
1435
1527
|
async def fetch_ohlcv(self, symbol: str, timeframe='1m', since: Int = None, limit: Int = None, params={}) -> List[list]:
|
1436
1528
|
"""
|
1437
1529
|
fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
1438
|
-
|
1530
|
+
|
1531
|
+
https://docs.delta.exchange/#delta-exchange-api-v2-historical-ohlc-candles-sparklines
|
1532
|
+
|
1439
1533
|
:param str symbol: unified symbol of the market to fetch OHLCV data for
|
1440
1534
|
:param str timeframe: the length of time each candle represents
|
1441
1535
|
:param int [since]: timestamp in ms of the earliest candle to fetch
|
1442
1536
|
:param int [limit]: the maximum amount of candles to fetch
|
1443
1537
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1538
|
+
:param str [params.until]: timestamp in ms of the latest candle to fetch
|
1444
1539
|
:returns int[][]: A list of candles ordered, open, high, low, close, volume
|
1445
1540
|
"""
|
1446
1541
|
await self.load_markets()
|
1447
1542
|
market = self.market(symbol)
|
1448
|
-
request = {
|
1543
|
+
request: dict = {
|
1449
1544
|
'resolution': self.safe_string(self.timeframes, timeframe, timeframe),
|
1450
1545
|
}
|
1451
1546
|
duration = self.parse_timeframe(timeframe)
|
1452
1547
|
limit = limit if limit else 2000 # max 2000
|
1548
|
+
until = self.safe_integer_product(params, 'until', 0.001)
|
1549
|
+
untilIsDefined = (until is not None)
|
1550
|
+
if untilIsDefined:
|
1551
|
+
until = self.parse_to_int(until)
|
1453
1552
|
if since is None:
|
1454
|
-
end = self.seconds()
|
1553
|
+
end = until if untilIsDefined else self.seconds()
|
1455
1554
|
request['end'] = end
|
1456
1555
|
request['start'] = end - limit * duration
|
1457
1556
|
else:
|
1458
1557
|
start = self.parse_to_int(since / 1000)
|
1459
1558
|
request['start'] = start
|
1460
|
-
request['end'] = self.sum(start, limit * duration)
|
1559
|
+
request['end'] = until if untilIsDefined else self.sum(start, limit * duration)
|
1461
1560
|
price = self.safe_string(params, 'price')
|
1462
1561
|
if price == 'mark':
|
1463
1562
|
request['symbol'] = 'MARK:' + market['id']
|
@@ -1465,7 +1564,7 @@ class delta(Exchange, ImplicitAPI):
|
|
1465
1564
|
request['symbol'] = market['info']['spot_index']['symbol']
|
1466
1565
|
else:
|
1467
1566
|
request['symbol'] = market['id']
|
1468
|
-
params = self.omit(params, 'price')
|
1567
|
+
params = self.omit(params, ['price', 'until'])
|
1469
1568
|
response = await self.publicGetHistoryCandles(self.extend(request, params))
|
1470
1569
|
#
|
1471
1570
|
# {
|
@@ -1482,7 +1581,7 @@ class delta(Exchange, ImplicitAPI):
|
|
1482
1581
|
|
1483
1582
|
def parse_balance(self, response) -> Balances:
|
1484
1583
|
balances = self.safe_list(response, 'result', [])
|
1485
|
-
result = {'info': response}
|
1584
|
+
result: dict = {'info': response}
|
1486
1585
|
currenciesByNumericId = self.safe_dict(self.options, 'currenciesByNumericId', {})
|
1487
1586
|
for i in range(0, len(balances)):
|
1488
1587
|
balance = balances[i]
|
@@ -1498,7 +1597,9 @@ class delta(Exchange, ImplicitAPI):
|
|
1498
1597
|
async def fetch_balance(self, params={}) -> Balances:
|
1499
1598
|
"""
|
1500
1599
|
query for balance and get the amount of funds available for trading or funds locked in orders
|
1501
|
-
|
1600
|
+
|
1601
|
+
https://docs.delta.exchange/#get-wallet-balances
|
1602
|
+
|
1502
1603
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1503
1604
|
:returns dict: a `balance structure <https://docs.ccxt.com/#/?id=balance-structure>`
|
1504
1605
|
"""
|
@@ -1530,14 +1631,16 @@ class delta(Exchange, ImplicitAPI):
|
|
1530
1631
|
async def fetch_position(self, symbol: str, params={}):
|
1531
1632
|
"""
|
1532
1633
|
fetch data on a single open contract trade position
|
1533
|
-
|
1634
|
+
|
1635
|
+
https://docs.delta.exchange/#get-position
|
1636
|
+
|
1534
1637
|
:param str symbol: unified market symbol of the market the position is held in, default is None
|
1535
1638
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1536
1639
|
:returns dict: a `position structure <https://docs.ccxt.com/#/?id=position-structure>`
|
1537
1640
|
"""
|
1538
1641
|
await self.load_markets()
|
1539
1642
|
market = self.market(symbol)
|
1540
|
-
request = {
|
1643
|
+
request: dict = {
|
1541
1644
|
'product_id': market['numericId'],
|
1542
1645
|
}
|
1543
1646
|
response = await self.privateGetPositions(self.extend(request, params))
|
@@ -1557,7 +1660,9 @@ class delta(Exchange, ImplicitAPI):
|
|
1557
1660
|
async def fetch_positions(self, symbols: Strings = None, params={}):
|
1558
1661
|
"""
|
1559
1662
|
fetch all open positions
|
1560
|
-
|
1663
|
+
|
1664
|
+
https://docs.delta.exchange/#get-margined-positions
|
1665
|
+
|
1561
1666
|
:param str[]|None symbols: list of unified market symbols
|
1562
1667
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1563
1668
|
:returns dict[]: a list of `position structure <https://docs.ccxt.com/#/?id=position-structure>`
|
@@ -1588,7 +1693,7 @@ class delta(Exchange, ImplicitAPI):
|
|
1588
1693
|
result = self.safe_list(response, 'result', [])
|
1589
1694
|
return self.parse_positions(result, symbols)
|
1590
1695
|
|
1591
|
-
def parse_position(self, position, market: Market = None):
|
1696
|
+
def parse_position(self, position: dict, market: Market = None):
|
1592
1697
|
#
|
1593
1698
|
# fetchPosition
|
1594
1699
|
#
|
@@ -1655,8 +1760,8 @@ class delta(Exchange, ImplicitAPI):
|
|
1655
1760
|
'takeProfitPrice': None,
|
1656
1761
|
})
|
1657
1762
|
|
1658
|
-
def parse_order_status(self, status):
|
1659
|
-
statuses = {
|
1763
|
+
def parse_order_status(self, status: Str):
|
1764
|
+
statuses: dict = {
|
1660
1765
|
'open': 'open',
|
1661
1766
|
'pending': 'open',
|
1662
1767
|
'closed': 'closed',
|
@@ -1664,7 +1769,7 @@ class delta(Exchange, ImplicitAPI):
|
|
1664
1769
|
}
|
1665
1770
|
return self.safe_string(statuses, status, status)
|
1666
1771
|
|
1667
|
-
def parse_order(self, order, market: Market = None) -> Order:
|
1772
|
+
def parse_order(self, order: dict, market: Market = None) -> Order:
|
1668
1773
|
#
|
1669
1774
|
# createOrder, cancelOrder, editOrder, fetchOpenOrders, fetchClosedOrders
|
1670
1775
|
#
|
@@ -1751,12 +1856,14 @@ class delta(Exchange, ImplicitAPI):
|
|
1751
1856
|
async def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
|
1752
1857
|
"""
|
1753
1858
|
create a trade order
|
1754
|
-
|
1859
|
+
|
1860
|
+
https://docs.delta.exchange/#place-order
|
1861
|
+
|
1755
1862
|
:param str symbol: unified symbol of the market to create an order in
|
1756
1863
|
:param str type: 'market' or 'limit'
|
1757
1864
|
:param str side: 'buy' or 'sell'
|
1758
1865
|
:param float amount: how much of currency you want to trade in units of base currency
|
1759
|
-
:param float [price]: the price at which the order is to be
|
1866
|
+
:param float [price]: the price at which the order is to be fulfilled, in units of the quote currency, ignored in market orders
|
1760
1867
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1761
1868
|
:param bool [params.reduceOnly]: *contract only* indicates if self order is to reduce the size of a position
|
1762
1869
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
@@ -1764,7 +1871,7 @@ class delta(Exchange, ImplicitAPI):
|
|
1764
1871
|
await self.load_markets()
|
1765
1872
|
orderType = type + '_order'
|
1766
1873
|
market = self.market(symbol)
|
1767
|
-
request = {
|
1874
|
+
request: dict = {
|
1768
1875
|
'product_id': market['numericId'],
|
1769
1876
|
# 'limit_price': self.price_to_precision(market['symbol'], price),
|
1770
1877
|
'size': self.amount_to_precision(market['symbol'], amount),
|
@@ -1828,19 +1935,21 @@ class delta(Exchange, ImplicitAPI):
|
|
1828
1935
|
async def edit_order(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: Num = None, price: Num = None, params={}):
|
1829
1936
|
"""
|
1830
1937
|
edit a trade order
|
1831
|
-
|
1938
|
+
|
1939
|
+
https://docs.delta.exchange/#edit-order
|
1940
|
+
|
1832
1941
|
:param str id: order id
|
1833
1942
|
:param str symbol: unified symbol of the market to create an order in
|
1834
1943
|
:param str type: 'market' or 'limit'
|
1835
1944
|
:param str side: 'buy' or 'sell'
|
1836
1945
|
:param float amount: how much of the currency you want to trade in units of the base currency
|
1837
|
-
:param float [price]: the price at which the order is to be
|
1946
|
+
:param float [price]: the price at which the order is to be fulfilled, in units of the quote currency
|
1838
1947
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1839
1948
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
1840
1949
|
"""
|
1841
1950
|
await self.load_markets()
|
1842
1951
|
market = self.market(symbol)
|
1843
|
-
request = {
|
1952
|
+
request: dict = {
|
1844
1953
|
'id': int(id),
|
1845
1954
|
'product_id': market['numericId'],
|
1846
1955
|
# "limit_price": self.price_to_precision(symbol, price),
|
@@ -1874,7 +1983,9 @@ class delta(Exchange, ImplicitAPI):
|
|
1874
1983
|
async def cancel_order(self, id: str, symbol: Str = None, params={}):
|
1875
1984
|
"""
|
1876
1985
|
cancels an open order
|
1877
|
-
|
1986
|
+
|
1987
|
+
https://docs.delta.exchange/#cancel-order
|
1988
|
+
|
1878
1989
|
:param str id: order id
|
1879
1990
|
:param str symbol: unified symbol of the market the order was made in
|
1880
1991
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -1884,7 +1995,7 @@ class delta(Exchange, ImplicitAPI):
|
|
1884
1995
|
raise ArgumentsRequired(self.id + ' cancelOrder() requires a symbol argument')
|
1885
1996
|
await self.load_markets()
|
1886
1997
|
market = self.market(symbol)
|
1887
|
-
request = {
|
1998
|
+
request: dict = {
|
1888
1999
|
'id': int(id),
|
1889
2000
|
'product_id': market['numericId'],
|
1890
2001
|
}
|
@@ -1931,7 +2042,9 @@ class delta(Exchange, ImplicitAPI):
|
|
1931
2042
|
async def cancel_all_orders(self, symbol: Str = None, params={}):
|
1932
2043
|
"""
|
1933
2044
|
cancel all open orders in a market
|
1934
|
-
|
2045
|
+
|
2046
|
+
https://docs.delta.exchange/#cancel-all-open-orders
|
2047
|
+
|
1935
2048
|
:param str symbol: unified market symbol of the market to cancel orders in
|
1936
2049
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1937
2050
|
:returns dict[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
@@ -1940,7 +2053,7 @@ class delta(Exchange, ImplicitAPI):
|
|
1940
2053
|
raise ArgumentsRequired(self.id + ' cancelAllOrders() requires a symbol argument')
|
1941
2054
|
await self.load_markets()
|
1942
2055
|
market = self.market(symbol)
|
1943
|
-
request = {
|
2056
|
+
request: dict = {
|
1944
2057
|
'product_id': market['numericId'],
|
1945
2058
|
# 'cancel_limit_orders': 'true',
|
1946
2059
|
# 'cancel_stop_orders': 'true',
|
@@ -1952,12 +2065,18 @@ class delta(Exchange, ImplicitAPI):
|
|
1952
2065
|
# "success":true
|
1953
2066
|
# }
|
1954
2067
|
#
|
1955
|
-
return
|
2068
|
+
return [
|
2069
|
+
self.safe_order({
|
2070
|
+
'info': response,
|
2071
|
+
}),
|
2072
|
+
]
|
1956
2073
|
|
1957
2074
|
async def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
1958
2075
|
"""
|
1959
2076
|
fetch all unfilled currently open orders
|
1960
|
-
|
2077
|
+
|
2078
|
+
https://docs.delta.exchange/#get-active-orders
|
2079
|
+
|
1961
2080
|
:param str symbol: unified market symbol
|
1962
2081
|
:param int [since]: the earliest time in ms to fetch open orders for
|
1963
2082
|
:param int [limit]: the maximum number of open order structures to retrieve
|
@@ -1969,7 +2088,9 @@ class delta(Exchange, ImplicitAPI):
|
|
1969
2088
|
async def fetch_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
1970
2089
|
"""
|
1971
2090
|
fetches information on multiple closed orders made by the user
|
1972
|
-
|
2091
|
+
|
2092
|
+
https://docs.delta.exchange/#get-order-history-cancelled-and-closed
|
2093
|
+
|
1973
2094
|
:param str symbol: unified market symbol of the market orders were made in
|
1974
2095
|
:param int [since]: the earliest time in ms to fetch orders for
|
1975
2096
|
:param int [limit]: the maximum number of order structures to retrieve
|
@@ -1980,7 +2101,7 @@ class delta(Exchange, ImplicitAPI):
|
|
1980
2101
|
|
1981
2102
|
async def fetch_orders_with_method(self, method, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
1982
2103
|
await self.load_markets()
|
1983
|
-
request = {
|
2104
|
+
request: dict = {
|
1984
2105
|
# 'product_ids': market['id'], # comma-separated
|
1985
2106
|
# 'contract_types': types, # comma-separated, futures, perpetual_futures, call_options, put_options, interest_rate_swaps, move_options, spreads
|
1986
2107
|
# 'order_types': types, # comma-separated, market, limit, stop_market, stop_limit, all_stop
|
@@ -2032,7 +2153,9 @@ class delta(Exchange, ImplicitAPI):
|
|
2032
2153
|
async def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
2033
2154
|
"""
|
2034
2155
|
fetch all trades made by the user
|
2035
|
-
|
2156
|
+
|
2157
|
+
https://docs.delta.exchange/#get-user-fills-by-filters
|
2158
|
+
|
2036
2159
|
:param str symbol: unified market symbol
|
2037
2160
|
:param int [since]: the earliest time in ms to fetch trades for
|
2038
2161
|
:param int [limit]: the maximum number of trades structures to retrieve
|
@@ -2040,7 +2163,7 @@ class delta(Exchange, ImplicitAPI):
|
|
2040
2163
|
:returns Trade[]: a list of `trade structures <https://docs.ccxt.com/#/?id=trade-structure>`
|
2041
2164
|
"""
|
2042
2165
|
await self.load_markets()
|
2043
|
-
request = {
|
2166
|
+
request: dict = {
|
2044
2167
|
# 'product_ids': market['id'], # comma-separated
|
2045
2168
|
# 'contract_types': types, # comma-separated, futures, perpetual_futures, call_options, put_options, interest_rate_swaps, move_options, spreads
|
2046
2169
|
# 'start_time': since * 1000,
|
@@ -2106,18 +2229,20 @@ class delta(Exchange, ImplicitAPI):
|
|
2106
2229
|
result = self.safe_list(response, 'result', [])
|
2107
2230
|
return self.parse_trades(result, market, since, limit)
|
2108
2231
|
|
2109
|
-
async def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
|
2232
|
+
async def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[LedgerEntry]:
|
2110
2233
|
"""
|
2111
|
-
fetch the history of changes, actions done by the user or operations that altered balance of the user
|
2112
|
-
|
2113
|
-
|
2234
|
+
fetch the history of changes, actions done by the user or operations that altered the balance of the user
|
2235
|
+
|
2236
|
+
https://docs.delta.exchange/#get-wallet-transactions
|
2237
|
+
|
2238
|
+
:param str [code]: unified currency code, default is None
|
2114
2239
|
:param int [since]: timestamp in ms of the earliest ledger entry, default is None
|
2115
|
-
:param int [limit]: max number of ledger
|
2240
|
+
:param int [limit]: max number of ledger entries to return, default is None
|
2116
2241
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2117
|
-
:returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger
|
2242
|
+
:returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger>`
|
2118
2243
|
"""
|
2119
2244
|
await self.load_markets()
|
2120
|
-
request = {
|
2245
|
+
request: dict = {
|
2121
2246
|
# 'asset_id': currency['numericId'],
|
2122
2247
|
# 'end_time': self.seconds(),
|
2123
2248
|
# 'after': 'string', # after cursor for pagination
|
@@ -2156,7 +2281,7 @@ class delta(Exchange, ImplicitAPI):
|
|
2156
2281
|
return self.parse_ledger(result, currency, since, limit)
|
2157
2282
|
|
2158
2283
|
def parse_ledger_entry_type(self, type):
|
2159
|
-
types = {
|
2284
|
+
types: dict = {
|
2160
2285
|
'pnl': 'pnl',
|
2161
2286
|
'deposit': 'transaction',
|
2162
2287
|
'withdrawal': 'transaction',
|
@@ -2170,7 +2295,7 @@ class delta(Exchange, ImplicitAPI):
|
|
2170
2295
|
}
|
2171
2296
|
return self.safe_string(types, type, type)
|
2172
2297
|
|
2173
|
-
def parse_ledger_entry(self, item, currency: Currency = None):
|
2298
|
+
def parse_ledger_entry(self, item: dict, currency: Currency = None) -> LedgerEntry:
|
2174
2299
|
#
|
2175
2300
|
# {
|
2176
2301
|
# "amount":"29.889184",
|
@@ -2207,7 +2332,7 @@ class delta(Exchange, ImplicitAPI):
|
|
2207
2332
|
after = self.safe_string(item, 'balance')
|
2208
2333
|
before = Precise.string_max('0', Precise.string_sub(after, amount))
|
2209
2334
|
status = 'ok'
|
2210
|
-
return {
|
2335
|
+
return self.safe_ledger_entry({
|
2211
2336
|
'info': item,
|
2212
2337
|
'id': id,
|
2213
2338
|
'direction': direction,
|
@@ -2223,9 +2348,9 @@ class delta(Exchange, ImplicitAPI):
|
|
2223
2348
|
'timestamp': timestamp,
|
2224
2349
|
'datetime': self.iso8601(timestamp),
|
2225
2350
|
'fee': None,
|
2226
|
-
}
|
2351
|
+
}, currency)
|
2227
2352
|
|
2228
|
-
async def fetch_deposit_address(self, code: str, params={}):
|
2353
|
+
async def fetch_deposit_address(self, code: str, params={}) -> DepositAddress:
|
2229
2354
|
"""
|
2230
2355
|
fetch the deposit address for a currency associated with self account
|
2231
2356
|
:param str code: unified currency code
|
@@ -2235,7 +2360,7 @@ class delta(Exchange, ImplicitAPI):
|
|
2235
2360
|
"""
|
2236
2361
|
await self.load_markets()
|
2237
2362
|
currency = self.currency(code)
|
2238
|
-
request = {
|
2363
|
+
request: dict = {
|
2239
2364
|
'asset_symbol': currency['id'],
|
2240
2365
|
}
|
2241
2366
|
networkCode = self.safe_string_upper(params, 'network')
|
@@ -2263,7 +2388,7 @@ class delta(Exchange, ImplicitAPI):
|
|
2263
2388
|
result = self.safe_dict(response, 'result', {})
|
2264
2389
|
return self.parse_deposit_address(result, currency)
|
2265
2390
|
|
2266
|
-
def parse_deposit_address(self, depositAddress, currency: Currency = None):
|
2391
|
+
def parse_deposit_address(self, depositAddress, currency: Currency = None) -> DepositAddress:
|
2267
2392
|
#
|
2268
2393
|
# {
|
2269
2394
|
# "id": 1915615,
|
@@ -2283,17 +2408,19 @@ class delta(Exchange, ImplicitAPI):
|
|
2283
2408
|
networkId = self.safe_string(depositAddress, 'network')
|
2284
2409
|
self.check_address(address)
|
2285
2410
|
return {
|
2411
|
+
'info': depositAddress,
|
2286
2412
|
'currency': self.safe_currency_code(marketId, currency),
|
2413
|
+
'network': self.network_id_to_code(networkId),
|
2287
2414
|
'address': address,
|
2288
2415
|
'tag': self.safe_string(depositAddress, 'memo'),
|
2289
|
-
'network': self.network_id_to_code(networkId),
|
2290
|
-
'info': depositAddress,
|
2291
2416
|
}
|
2292
2417
|
|
2293
|
-
async def fetch_funding_rate(self, symbol: str, params={}):
|
2418
|
+
async def fetch_funding_rate(self, symbol: str, params={}) -> FundingRate:
|
2294
2419
|
"""
|
2295
2420
|
fetch the current funding rate
|
2296
|
-
|
2421
|
+
|
2422
|
+
https://docs.delta.exchange/#get-ticker-for-a-product-by-symbol
|
2423
|
+
|
2297
2424
|
:param str symbol: unified market symbol
|
2298
2425
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2299
2426
|
:returns dict: a `funding rate structure <https://docs.ccxt.com/#/?id=funding-rate-structure>`
|
@@ -2302,7 +2429,7 @@ class delta(Exchange, ImplicitAPI):
|
|
2302
2429
|
market = self.market(symbol)
|
2303
2430
|
if not market['swap']:
|
2304
2431
|
raise BadSymbol(self.id + ' fetchFundingRate() supports swap contracts only')
|
2305
|
-
request = {
|
2432
|
+
request: dict = {
|
2306
2433
|
'symbol': market['id'],
|
2307
2434
|
}
|
2308
2435
|
response = await self.publicGetTickersSymbol(self.extend(request, params))
|
@@ -2354,17 +2481,19 @@ class delta(Exchange, ImplicitAPI):
|
|
2354
2481
|
result = self.safe_dict(response, 'result', {})
|
2355
2482
|
return self.parse_funding_rate(result, market)
|
2356
2483
|
|
2357
|
-
async def fetch_funding_rates(self, symbols: Strings = None, params={}):
|
2484
|
+
async def fetch_funding_rates(self, symbols: Strings = None, params={}) -> FundingRates:
|
2358
2485
|
"""
|
2359
2486
|
fetch the funding rate for multiple markets
|
2360
|
-
|
2487
|
+
|
2488
|
+
https://docs.delta.exchange/#get-tickers-for-products
|
2489
|
+
|
2361
2490
|
:param str[]|None symbols: list of unified market symbols
|
2362
2491
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2363
|
-
:returns dict: a
|
2492
|
+
:returns dict[]: a list of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rates-structure>`, indexed by market symbols
|
2364
2493
|
"""
|
2365
2494
|
await self.load_markets()
|
2366
2495
|
symbols = self.market_symbols(symbols)
|
2367
|
-
request = {
|
2496
|
+
request: dict = {
|
2368
2497
|
'contract_types': 'perpetual_futures',
|
2369
2498
|
}
|
2370
2499
|
response = await self.publicGetTickers(self.extend(request, params))
|
@@ -2416,10 +2545,9 @@ class delta(Exchange, ImplicitAPI):
|
|
2416
2545
|
# }
|
2417
2546
|
#
|
2418
2547
|
rates = self.safe_list(response, 'result', [])
|
2419
|
-
|
2420
|
-
return self.filter_by_array(result, 'symbol', symbols)
|
2548
|
+
return self.parse_funding_rates(rates, symbols)
|
2421
2549
|
|
2422
|
-
def parse_funding_rate(self, contract, market: Market = None):
|
2550
|
+
def parse_funding_rate(self, contract, market: Market = None) -> FundingRate:
|
2423
2551
|
#
|
2424
2552
|
# {
|
2425
2553
|
# "close": 30600.5,
|
@@ -2484,12 +2612,15 @@ class delta(Exchange, ImplicitAPI):
|
|
2484
2612
|
'previousFundingRate': None,
|
2485
2613
|
'previousFundingTimestamp': None,
|
2486
2614
|
'previousFundingDatetime': None,
|
2615
|
+
'interval': None,
|
2487
2616
|
}
|
2488
2617
|
|
2489
|
-
async def add_margin(self, symbol: str, amount, params={}):
|
2618
|
+
async def add_margin(self, symbol: str, amount: float, params={}) -> MarginModification:
|
2490
2619
|
"""
|
2491
2620
|
add margin
|
2492
|
-
|
2621
|
+
|
2622
|
+
https://docs.delta.exchange/#add-remove-position-margin
|
2623
|
+
|
2493
2624
|
:param str symbol: unified market symbol
|
2494
2625
|
:param float amount: amount of margin to add
|
2495
2626
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -2497,10 +2628,12 @@ class delta(Exchange, ImplicitAPI):
|
|
2497
2628
|
"""
|
2498
2629
|
return await self.modify_margin_helper(symbol, amount, 'add', params)
|
2499
2630
|
|
2500
|
-
async def reduce_margin(self, symbol: str, amount, params={}):
|
2631
|
+
async def reduce_margin(self, symbol: str, amount: float, params={}) -> MarginModification:
|
2501
2632
|
"""
|
2502
2633
|
remove margin from a position
|
2503
|
-
|
2634
|
+
|
2635
|
+
https://docs.delta.exchange/#add-remove-position-margin
|
2636
|
+
|
2504
2637
|
:param str symbol: unified market symbol
|
2505
2638
|
:param float amount: the amount of margin to remove
|
2506
2639
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -2508,13 +2641,13 @@ class delta(Exchange, ImplicitAPI):
|
|
2508
2641
|
"""
|
2509
2642
|
return await self.modify_margin_helper(symbol, amount, 'reduce', params)
|
2510
2643
|
|
2511
|
-
async def modify_margin_helper(self, symbol: str, amount, type, params={}):
|
2644
|
+
async def modify_margin_helper(self, symbol: str, amount, type, params={}) -> MarginModification:
|
2512
2645
|
await self.load_markets()
|
2513
2646
|
market = self.market(symbol)
|
2514
2647
|
amount = str(amount)
|
2515
2648
|
if type == 'reduce':
|
2516
2649
|
amount = Precise.string_mul(amount, '-1')
|
2517
|
-
request = {
|
2650
|
+
request: dict = {
|
2518
2651
|
'product_id': market['numericId'],
|
2519
2652
|
'delta_margin': amount,
|
2520
2653
|
}
|
@@ -2545,7 +2678,7 @@ class delta(Exchange, ImplicitAPI):
|
|
2545
2678
|
result = self.safe_dict(response, 'result', {})
|
2546
2679
|
return self.parse_margin_modification(result, market)
|
2547
2680
|
|
2548
|
-
def parse_margin_modification(self, data, market: Market = None):
|
2681
|
+
def parse_margin_modification(self, data: dict, market: Market = None) -> MarginModification:
|
2549
2682
|
#
|
2550
2683
|
# {
|
2551
2684
|
# "auto_topup": False,
|
@@ -2570,18 +2703,23 @@ class delta(Exchange, ImplicitAPI):
|
|
2570
2703
|
market = self.safe_market(marketId, market)
|
2571
2704
|
return {
|
2572
2705
|
'info': data,
|
2706
|
+
'symbol': market['symbol'],
|
2573
2707
|
'type': None,
|
2708
|
+
'marginMode': 'isolated',
|
2574
2709
|
'amount': None,
|
2575
2710
|
'total': self.safe_number(data, 'margin'),
|
2576
2711
|
'code': None,
|
2577
|
-
'symbol': market['symbol'],
|
2578
2712
|
'status': None,
|
2713
|
+
'timestamp': None,
|
2714
|
+
'datetime': None,
|
2579
2715
|
}
|
2580
2716
|
|
2581
2717
|
async def fetch_open_interest(self, symbol: str, params={}):
|
2582
2718
|
"""
|
2583
2719
|
retrieves the open interest of a derivative market
|
2584
|
-
|
2720
|
+
|
2721
|
+
https://docs.delta.exchange/#get-ticker-for-a-product-by-symbol
|
2722
|
+
|
2585
2723
|
:param str symbol: unified market symbol
|
2586
2724
|
:param dict [params]: exchange specific parameters
|
2587
2725
|
:returns dict} an open interest structure{@link https://docs.ccxt.com/#/?id=open-interest-structure:
|
@@ -2590,7 +2728,7 @@ class delta(Exchange, ImplicitAPI):
|
|
2590
2728
|
market = self.market(symbol)
|
2591
2729
|
if not market['contract']:
|
2592
2730
|
raise BadRequest(self.id + ' fetchOpenInterest() supports contract markets only')
|
2593
|
-
request = {
|
2731
|
+
request: dict = {
|
2594
2732
|
'symbol': market['id'],
|
2595
2733
|
}
|
2596
2734
|
response = await self.publicGetTickersSymbol(self.extend(request, params))
|
@@ -2715,14 +2853,16 @@ class delta(Exchange, ImplicitAPI):
|
|
2715
2853
|
async def fetch_leverage(self, symbol: str, params={}) -> Leverage:
|
2716
2854
|
"""
|
2717
2855
|
fetch the set leverage for a market
|
2718
|
-
|
2856
|
+
|
2857
|
+
https://docs.delta.exchange/#get-order-leverage
|
2858
|
+
|
2719
2859
|
:param str symbol: unified market symbol
|
2720
2860
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2721
2861
|
:returns dict: a `leverage structure <https://docs.ccxt.com/#/?id=leverage-structure>`
|
2722
2862
|
"""
|
2723
2863
|
await self.load_markets()
|
2724
2864
|
market = self.market(symbol)
|
2725
|
-
request = {
|
2865
|
+
request: dict = {
|
2726
2866
|
'product_id': market['numericId'],
|
2727
2867
|
}
|
2728
2868
|
response = await self.privateGetProductsProductIdOrdersLeverage(self.extend(request, params))
|
@@ -2742,7 +2882,7 @@ class delta(Exchange, ImplicitAPI):
|
|
2742
2882
|
result = self.safe_dict(response, 'result', {})
|
2743
2883
|
return self.parse_leverage(result, market)
|
2744
2884
|
|
2745
|
-
def parse_leverage(self, leverage, market=None) -> Leverage:
|
2885
|
+
def parse_leverage(self, leverage: dict, market: Market = None) -> Leverage:
|
2746
2886
|
marketId = self.safe_string(leverage, 'index_symbol')
|
2747
2887
|
leverageValue = self.safe_integer(leverage, 'leverage')
|
2748
2888
|
return {
|
@@ -2756,7 +2896,9 @@ class delta(Exchange, ImplicitAPI):
|
|
2756
2896
|
async def set_leverage(self, leverage: Int, symbol: Str = None, params={}):
|
2757
2897
|
"""
|
2758
2898
|
set the level of leverage for a market
|
2759
|
-
|
2899
|
+
|
2900
|
+
https://docs.delta.exchange/#change-order-leverage
|
2901
|
+
|
2760
2902
|
:param float leverage: the rate of leverage
|
2761
2903
|
:param str symbol: unified market symbol
|
2762
2904
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -2766,7 +2908,7 @@ class delta(Exchange, ImplicitAPI):
|
|
2766
2908
|
raise ArgumentsRequired(self.id + ' setLeverage() requires a symbol argument')
|
2767
2909
|
await self.load_markets()
|
2768
2910
|
market = self.market(symbol)
|
2769
|
-
request = {
|
2911
|
+
request: dict = {
|
2770
2912
|
'product_id': market['numericId'],
|
2771
2913
|
'leverage': leverage,
|
2772
2914
|
}
|
@@ -2786,7 +2928,9 @@ class delta(Exchange, ImplicitAPI):
|
|
2786
2928
|
async def fetch_settlement_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
2787
2929
|
"""
|
2788
2930
|
fetches historical settlement records
|
2789
|
-
|
2931
|
+
|
2932
|
+
https://docs.delta.exchange/#get-product-settlement-prices
|
2933
|
+
|
2790
2934
|
:param str symbol: unified market symbol of the settlement history
|
2791
2935
|
:param int [since]: timestamp in ms
|
2792
2936
|
:param int [limit]: number of records
|
@@ -2797,7 +2941,7 @@ class delta(Exchange, ImplicitAPI):
|
|
2797
2941
|
market = None
|
2798
2942
|
if symbol is not None:
|
2799
2943
|
market = self.market(symbol)
|
2800
|
-
request = {
|
2944
|
+
request: dict = {
|
2801
2945
|
'states': 'expired',
|
2802
2946
|
}
|
2803
2947
|
if limit is not None:
|
@@ -2939,14 +3083,16 @@ class delta(Exchange, ImplicitAPI):
|
|
2939
3083
|
async def fetch_greeks(self, symbol: str, params={}) -> Greeks:
|
2940
3084
|
"""
|
2941
3085
|
fetches an option contracts greeks, financial metrics used to measure the factors that affect the price of an options contract
|
2942
|
-
|
3086
|
+
|
3087
|
+
https://docs.delta.exchange/#get-ticker-for-a-product-by-symbol
|
3088
|
+
|
2943
3089
|
:param str symbol: unified symbol of the market to fetch greeks for
|
2944
3090
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2945
3091
|
:returns dict: a `greeks structure <https://docs.ccxt.com/#/?id=greeks-structure>`
|
2946
3092
|
"""
|
2947
3093
|
await self.load_markets()
|
2948
3094
|
market = self.market(symbol)
|
2949
|
-
request = {
|
3095
|
+
request: dict = {
|
2950
3096
|
'symbol': market['id'],
|
2951
3097
|
}
|
2952
3098
|
response = await self.publicGetTickersSymbol(self.extend(request, params))
|
@@ -3005,7 +3151,7 @@ class delta(Exchange, ImplicitAPI):
|
|
3005
3151
|
result = self.safe_dict(response, 'result', {})
|
3006
3152
|
return self.parse_greeks(result, market)
|
3007
3153
|
|
3008
|
-
def parse_greeks(self, greeks, market: Market = None):
|
3154
|
+
def parse_greeks(self, greeks: dict, market: Market = None) -> Greeks:
|
3009
3155
|
#
|
3010
3156
|
# {
|
3011
3157
|
# "close": 6793.0,
|
@@ -3085,13 +3231,15 @@ class delta(Exchange, ImplicitAPI):
|
|
3085
3231
|
async def close_all_positions(self, params={}) -> List[Position]:
|
3086
3232
|
"""
|
3087
3233
|
closes all open positions for a market type
|
3088
|
-
|
3234
|
+
|
3235
|
+
https://docs.delta.exchange/#close-all-positions
|
3236
|
+
|
3089
3237
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
3090
3238
|
:param int [params.user_id]: the users id
|
3091
3239
|
:returns dict[]: A list of `position structures <https://docs.ccxt.com/#/?id=position-structure>`
|
3092
3240
|
"""
|
3093
3241
|
await self.load_markets()
|
3094
|
-
request = {
|
3242
|
+
request: dict = {
|
3095
3243
|
'close_all_portfolio': True,
|
3096
3244
|
'close_all_isolated': True,
|
3097
3245
|
# 'user_id': 12345,
|
@@ -3106,7 +3254,9 @@ class delta(Exchange, ImplicitAPI):
|
|
3106
3254
|
async def fetch_margin_mode(self, symbol: str, params={}) -> MarginMode:
|
3107
3255
|
"""
|
3108
3256
|
fetches the margin mode of a trading pair
|
3109
|
-
|
3257
|
+
|
3258
|
+
https://docs.delta.exchange/#get-user
|
3259
|
+
|
3110
3260
|
:param str symbol: unified symbol of the market to fetch the margin mode for
|
3111
3261
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
3112
3262
|
:returns dict: a `margin mode structure <https://docs.ccxt.com/#/?id=margin-mode-structure>`
|
@@ -3182,7 +3332,7 @@ class delta(Exchange, ImplicitAPI):
|
|
3182
3332
|
result = self.safe_dict(response, 'result', {})
|
3183
3333
|
return self.parse_margin_mode(result, market)
|
3184
3334
|
|
3185
|
-
def parse_margin_mode(self, marginMode, market=None) -> MarginMode:
|
3335
|
+
def parse_margin_mode(self, marginMode: dict, market=None) -> MarginMode:
|
3186
3336
|
symbol = None
|
3187
3337
|
if market is not None:
|
3188
3338
|
symbol = market['symbol']
|
@@ -3192,6 +3342,151 @@ class delta(Exchange, ImplicitAPI):
|
|
3192
3342
|
'marginMode': self.safe_string(marginMode, 'margin_mode'),
|
3193
3343
|
}
|
3194
3344
|
|
3345
|
+
async def fetch_option(self, symbol: str, params={}) -> Option:
|
3346
|
+
"""
|
3347
|
+
fetches option data that is commonly found in an option chain
|
3348
|
+
|
3349
|
+
https://docs.delta.exchange/#get-ticker-for-a-product-by-symbol
|
3350
|
+
|
3351
|
+
:param str symbol: unified market symbol
|
3352
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
3353
|
+
:returns dict: an `option chain structure <https://docs.ccxt.com/#/?id=option-chain-structure>`
|
3354
|
+
"""
|
3355
|
+
await self.load_markets()
|
3356
|
+
market = self.market(symbol)
|
3357
|
+
request: dict = {
|
3358
|
+
'symbol': market['id'],
|
3359
|
+
}
|
3360
|
+
response = await self.publicGetTickersSymbol(self.extend(request, params))
|
3361
|
+
#
|
3362
|
+
# {
|
3363
|
+
# "result": {
|
3364
|
+
# "close": 6793.0,
|
3365
|
+
# "contract_type": "call_options",
|
3366
|
+
# "greeks": {
|
3367
|
+
# "delta": "0.94739174",
|
3368
|
+
# "gamma": "0.00002206",
|
3369
|
+
# "rho": "11.00890725",
|
3370
|
+
# "spot": "36839.58124652",
|
3371
|
+
# "theta": "-18.18365310",
|
3372
|
+
# "vega": "7.85209698"
|
3373
|
+
# },
|
3374
|
+
# "high": 7556.0,
|
3375
|
+
# "low": 6793.0,
|
3376
|
+
# "mark_price": "6955.70698909",
|
3377
|
+
# "mark_vol": "0.66916863",
|
3378
|
+
# "oi": "1.8980",
|
3379
|
+
# "oi_change_usd_6h": "110.4600",
|
3380
|
+
# "oi_contracts": "1898",
|
3381
|
+
# "oi_value": "1.8980",
|
3382
|
+
# "oi_value_symbol": "BTC",
|
3383
|
+
# "oi_value_usd": "69940.7319",
|
3384
|
+
# "open": 7.2e3,
|
3385
|
+
# "price_band": {
|
3386
|
+
# "lower_limit": "5533.89814767",
|
3387
|
+
# "upper_limit": "11691.37688371"
|
3388
|
+
# },
|
3389
|
+
# "product_id": 129508,
|
3390
|
+
# "quotes": {
|
3391
|
+
# "ask_iv": "0.90180438",
|
3392
|
+
# "ask_size": "1898",
|
3393
|
+
# "best_ask": "7210",
|
3394
|
+
# "best_bid": "6913",
|
3395
|
+
# "bid_iv": "0.60881706",
|
3396
|
+
# "bid_size": "3163",
|
3397
|
+
# "impact_mid_price": null,
|
3398
|
+
# "mark_iv": "0.66973549"
|
3399
|
+
# },
|
3400
|
+
# "size": 5,
|
3401
|
+
# "spot_price": "36839.58153868",
|
3402
|
+
# "strike_price": "30000",
|
3403
|
+
# "symbol": "C-BTC-30000-241123",
|
3404
|
+
# "timestamp": 1699584998504530,
|
3405
|
+
# "turnover": 184.41206804,
|
3406
|
+
# "turnover_symbol": "USDT",
|
3407
|
+
# "turnover_usd": 184.41206804,
|
3408
|
+
# "volume": 0.005
|
3409
|
+
# },
|
3410
|
+
# "success": True
|
3411
|
+
# }
|
3412
|
+
#
|
3413
|
+
result = self.safe_dict(response, 'result', {})
|
3414
|
+
return self.parse_option(result, None, market)
|
3415
|
+
|
3416
|
+
def parse_option(self, chain: dict, currency: Currency = None, market: Market = None) -> Option:
|
3417
|
+
#
|
3418
|
+
# {
|
3419
|
+
# "close": 6793.0,
|
3420
|
+
# "contract_type": "call_options",
|
3421
|
+
# "greeks": {
|
3422
|
+
# "delta": "0.94739174",
|
3423
|
+
# "gamma": "0.00002206",
|
3424
|
+
# "rho": "11.00890725",
|
3425
|
+
# "spot": "36839.58124652",
|
3426
|
+
# "theta": "-18.18365310",
|
3427
|
+
# "vega": "7.85209698"
|
3428
|
+
# },
|
3429
|
+
# "high": 7556.0,
|
3430
|
+
# "low": 6793.0,
|
3431
|
+
# "mark_price": "6955.70698909",
|
3432
|
+
# "mark_vol": "0.66916863",
|
3433
|
+
# "oi": "1.8980",
|
3434
|
+
# "oi_change_usd_6h": "110.4600",
|
3435
|
+
# "oi_contracts": "1898",
|
3436
|
+
# "oi_value": "1.8980",
|
3437
|
+
# "oi_value_symbol": "BTC",
|
3438
|
+
# "oi_value_usd": "69940.7319",
|
3439
|
+
# "open": 7.2e3,
|
3440
|
+
# "price_band": {
|
3441
|
+
# "lower_limit": "5533.89814767",
|
3442
|
+
# "upper_limit": "11691.37688371"
|
3443
|
+
# },
|
3444
|
+
# "product_id": 129508,
|
3445
|
+
# "quotes": {
|
3446
|
+
# "ask_iv": "0.90180438",
|
3447
|
+
# "ask_size": "1898",
|
3448
|
+
# "best_ask": "7210",
|
3449
|
+
# "best_bid": "6913",
|
3450
|
+
# "bid_iv": "0.60881706",
|
3451
|
+
# "bid_size": "3163",
|
3452
|
+
# "impact_mid_price": null,
|
3453
|
+
# "mark_iv": "0.66973549"
|
3454
|
+
# },
|
3455
|
+
# "size": 5,
|
3456
|
+
# "spot_price": "36839.58153868",
|
3457
|
+
# "strike_price": "30000",
|
3458
|
+
# "symbol": "C-BTC-30000-241123",
|
3459
|
+
# "timestamp": 1699584998504530,
|
3460
|
+
# "turnover": 184.41206804,
|
3461
|
+
# "turnover_symbol": "USDT",
|
3462
|
+
# "turnover_usd": 184.41206804,
|
3463
|
+
# "volume": 0.005
|
3464
|
+
# }
|
3465
|
+
#
|
3466
|
+
marketId = self.safe_string(chain, 'symbol')
|
3467
|
+
market = self.safe_market(marketId, market)
|
3468
|
+
quotes = self.safe_dict(chain, 'quotes', {})
|
3469
|
+
timestamp = self.safe_integer_product(chain, 'timestamp', 0.001)
|
3470
|
+
return {
|
3471
|
+
'info': chain,
|
3472
|
+
'currency': None,
|
3473
|
+
'symbol': market['symbol'],
|
3474
|
+
'timestamp': timestamp,
|
3475
|
+
'datetime': self.iso8601(timestamp),
|
3476
|
+
'impliedVolatility': self.safe_number(quotes, 'mark_iv'),
|
3477
|
+
'openInterest': self.safe_number(chain, 'oi'),
|
3478
|
+
'bidPrice': self.safe_number(quotes, 'best_bid'),
|
3479
|
+
'askPrice': self.safe_number(quotes, 'best_ask'),
|
3480
|
+
'midPrice': self.safe_number(quotes, 'impact_mid_price'),
|
3481
|
+
'markPrice': self.safe_number(chain, 'mark_price'),
|
3482
|
+
'lastPrice': None,
|
3483
|
+
'underlyingPrice': self.safe_number(chain, 'spot_price'),
|
3484
|
+
'change': None,
|
3485
|
+
'percentage': None,
|
3486
|
+
'baseVolume': self.safe_number(chain, 'volume'),
|
3487
|
+
'quoteVolume': None,
|
3488
|
+
}
|
3489
|
+
|
3195
3490
|
def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
|
3196
3491
|
requestPath = '/' + self.version + '/' + self.implode_params(path, params)
|
3197
3492
|
url = self.urls['api'][api] + requestPath
|
@@ -3207,7 +3502,7 @@ class delta(Exchange, ImplicitAPI):
|
|
3207
3502
|
'timestamp': timestamp,
|
3208
3503
|
}
|
3209
3504
|
auth = method + timestamp + requestPath
|
3210
|
-
if
|
3505
|
+
if method == 'GET':
|
3211
3506
|
if query:
|
3212
3507
|
queryString = '?' + self.urlencode(query)
|
3213
3508
|
auth += queryString
|
@@ -3220,7 +3515,7 @@ class delta(Exchange, ImplicitAPI):
|
|
3220
3515
|
headers['signature'] = signature
|
3221
3516
|
return {'url': url, 'method': method, 'body': body, 'headers': headers}
|
3222
3517
|
|
3223
|
-
def handle_errors(self, code, reason, url, method, headers, body, response, requestHeaders, requestBody):
|
3518
|
+
def handle_errors(self, code: int, reason: str, url: str, method: str, headers: dict, body: str, response, requestHeaders, requestBody):
|
3224
3519
|
if response is None:
|
3225
3520
|
return None
|
3226
3521
|
#
|