ccxt 4.2.76__py2.py3-none-any.whl → 4.4.48__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ccxt/__init__.py +36 -14
- ccxt/abstract/alpaca.py +4 -0
- ccxt/abstract/bigone.py +1 -1
- ccxt/abstract/binance.py +112 -48
- ccxt/abstract/binancecoinm.py +112 -48
- ccxt/abstract/binanceus.py +147 -83
- ccxt/abstract/binanceusdm.py +112 -48
- ccxt/abstract/bingx.py +133 -78
- ccxt/abstract/bitbank.py +5 -0
- ccxt/abstract/bitfinex.py +136 -65
- ccxt/abstract/bitfinex1.py +69 -0
- ccxt/abstract/bitflyer.py +1 -0
- ccxt/abstract/bitget.py +8 -1
- ccxt/abstract/bitmart.py +13 -1
- ccxt/abstract/bitopro.py +1 -0
- ccxt/abstract/bitpanda.py +0 -12
- ccxt/abstract/bitrue.py +3 -3
- ccxt/abstract/bitstamp.py +26 -3
- ccxt/abstract/blofin.py +24 -0
- ccxt/abstract/btcbox.py +1 -0
- ccxt/abstract/bybit.py +29 -14
- ccxt/abstract/cex.py +28 -29
- ccxt/abstract/coinbase.py +6 -0
- ccxt/abstract/coinbaseadvanced.py +94 -0
- ccxt/abstract/{coinbasepro.py → coinbaseexchange.py} +1 -0
- ccxt/abstract/coinbaseinternational.py +1 -1
- ccxt/abstract/coincatch.py +94 -0
- ccxt/abstract/coinex.py +233 -123
- ccxt/abstract/coinmetro.py +1 -0
- ccxt/abstract/cryptocom.py +14 -0
- ccxt/abstract/defx.py +69 -0
- ccxt/abstract/deribit.py +1 -0
- ccxt/abstract/digifinex.py +1 -0
- ccxt/abstract/ellipx.py +25 -0
- ccxt/abstract/gate.py +20 -0
- ccxt/abstract/gateio.py +20 -0
- ccxt/abstract/gemini.py +1 -0
- ccxt/abstract/hashkey.py +67 -0
- ccxt/abstract/hyperliquid.py +1 -1
- ccxt/abstract/independentreserve.py +6 -0
- ccxt/abstract/kraken.py +4 -3
- ccxt/abstract/krakenfutures.py +4 -0
- ccxt/abstract/kucoin.py +25 -0
- ccxt/abstract/kucoinfutures.py +35 -0
- ccxt/abstract/luno.py +2 -0
- ccxt/abstract/mexc.py +4 -0
- ccxt/abstract/myokx.py +340 -0
- ccxt/abstract/oceanex.py +5 -0
- ccxt/abstract/okx.py +30 -0
- ccxt/abstract/onetrading.py +0 -12
- ccxt/abstract/oxfun.py +34 -0
- ccxt/abstract/paradex.py +40 -0
- ccxt/abstract/phemex.py +1 -0
- ccxt/abstract/upbit.py +4 -0
- ccxt/abstract/vertex.py +19 -0
- ccxt/abstract/whitebit.py +31 -1
- ccxt/abstract/woo.py +6 -2
- ccxt/abstract/woofipro.py +119 -0
- ccxt/abstract/xt.py +153 -0
- ccxt/abstract/zonda.py +6 -0
- ccxt/ace.py +164 -60
- ccxt/alpaca.py +727 -63
- ccxt/ascendex.py +395 -249
- ccxt/async_support/__init__.py +36 -14
- ccxt/async_support/ace.py +164 -60
- ccxt/async_support/alpaca.py +727 -63
- ccxt/async_support/ascendex.py +396 -249
- ccxt/async_support/base/exchange.py +531 -155
- ccxt/async_support/base/ws/aiohttp_client.py +28 -5
- ccxt/async_support/base/ws/cache.py +3 -2
- ccxt/async_support/base/ws/client.py +26 -5
- ccxt/async_support/base/ws/fast_client.py +4 -3
- ccxt/async_support/base/ws/functions.py +1 -1
- ccxt/async_support/base/ws/future.py +40 -31
- ccxt/async_support/base/ws/order_book_side.py +3 -0
- ccxt/async_support/bequant.py +1 -1
- ccxt/async_support/bigone.py +329 -202
- ccxt/async_support/binance.py +3513 -1511
- ccxt/async_support/binancecoinm.py +2 -1
- ccxt/async_support/binanceus.py +12 -1
- ccxt/async_support/binanceusdm.py +3 -1
- ccxt/async_support/bingx.py +3105 -881
- ccxt/async_support/bit2c.py +119 -38
- ccxt/async_support/bitbank.py +215 -76
- ccxt/async_support/bitbns.py +124 -53
- ccxt/async_support/bitfinex.py +3236 -1078
- ccxt/async_support/bitfinex1.py +1711 -0
- ccxt/async_support/bitflyer.py +239 -50
- ccxt/async_support/bitget.py +1513 -563
- ccxt/async_support/bithumb.py +201 -67
- ccxt/async_support/bitmart.py +1320 -435
- ccxt/async_support/bitmex.py +308 -111
- ccxt/async_support/bitopro.py +256 -96
- ccxt/async_support/bitrue.py +365 -233
- ccxt/async_support/bitso.py +201 -89
- ccxt/async_support/bitstamp.py +438 -269
- ccxt/async_support/bitteam.py +179 -73
- ccxt/async_support/bitvavo.py +180 -70
- ccxt/async_support/bl3p.py +92 -25
- ccxt/async_support/blockchaincom.py +193 -79
- ccxt/async_support/blofin.py +403 -150
- ccxt/async_support/btcalpha.py +161 -55
- ccxt/async_support/btcbox.py +250 -34
- ccxt/async_support/btcmarkets.py +232 -85
- ccxt/async_support/btcturk.py +159 -60
- ccxt/async_support/bybit.py +2326 -1255
- ccxt/async_support/cex.py +1409 -1329
- ccxt/async_support/coinbase.py +1455 -288
- ccxt/async_support/coinbaseadvanced.py +17 -0
- ccxt/async_support/{coinbasepro.py → coinbaseexchange.py} +233 -99
- ccxt/async_support/coinbaseinternational.py +428 -88
- ccxt/async_support/coincatch.py +5152 -0
- ccxt/async_support/coincheck.py +121 -38
- ccxt/async_support/coinex.py +4020 -3339
- ccxt/async_support/coinlist.py +273 -116
- ccxt/async_support/coinmate.py +204 -97
- ccxt/async_support/coinmetro.py +203 -110
- ccxt/async_support/coinone.py +142 -68
- ccxt/async_support/coinsph.py +206 -89
- ccxt/async_support/coinspot.py +137 -62
- ccxt/async_support/cryptocom.py +515 -185
- ccxt/async_support/currencycom.py +203 -85
- ccxt/async_support/defx.py +2066 -0
- ccxt/async_support/delta.py +467 -158
- ccxt/async_support/deribit.py +558 -324
- ccxt/async_support/digifinex.py +340 -223
- ccxt/async_support/ellipx.py +1826 -0
- ccxt/async_support/exmo.py +259 -128
- ccxt/async_support/gate.py +1473 -464
- ccxt/async_support/gemini.py +206 -84
- ccxt/async_support/hashkey.py +4164 -0
- ccxt/async_support/hitbtc.py +334 -178
- ccxt/async_support/hollaex.py +134 -83
- ccxt/async_support/htx.py +1095 -563
- ccxt/async_support/huobijp.py +105 -56
- ccxt/async_support/hyperliquid.py +1634 -269
- ccxt/async_support/idex.py +148 -95
- ccxt/async_support/independentreserve.py +236 -31
- ccxt/async_support/indodax.py +165 -62
- ccxt/async_support/kraken.py +871 -354
- ccxt/async_support/krakenfutures.py +324 -100
- ccxt/async_support/kucoin.py +1050 -355
- ccxt/async_support/kucoinfutures.py +1004 -149
- ccxt/async_support/kuna.py +138 -106
- ccxt/async_support/latoken.py +135 -79
- ccxt/async_support/lbank.py +290 -113
- ccxt/async_support/luno.py +112 -62
- ccxt/async_support/lykke.py +104 -55
- ccxt/async_support/mercado.py +36 -29
- ccxt/async_support/mexc.py +995 -429
- ccxt/async_support/myokx.py +43 -0
- ccxt/async_support/ndax.py +163 -82
- ccxt/async_support/novadax.py +121 -75
- ccxt/async_support/oceanex.py +175 -59
- ccxt/async_support/okcoin.py +222 -163
- ccxt/async_support/okx.py +1777 -455
- ccxt/async_support/onetrading.py +132 -414
- ccxt/async_support/oxfun.py +2832 -0
- ccxt/async_support/p2b.py +79 -51
- ccxt/async_support/paradex.py +2017 -0
- ccxt/async_support/paymium.py +56 -32
- ccxt/async_support/phemex.py +572 -196
- ccxt/async_support/poloniex.py +218 -95
- ccxt/async_support/poloniexfutures.py +260 -92
- ccxt/async_support/probit.py +143 -110
- ccxt/async_support/timex.py +123 -70
- ccxt/async_support/tokocrypto.py +129 -93
- ccxt/async_support/tradeogre.py +39 -25
- ccxt/async_support/upbit.py +322 -113
- ccxt/async_support/vertex.py +2983 -0
- ccxt/async_support/wavesexchange.py +227 -173
- ccxt/async_support/wazirx.py +145 -65
- ccxt/async_support/whitebit.py +533 -138
- ccxt/async_support/woo.py +1155 -295
- ccxt/async_support/woofipro.py +2716 -0
- ccxt/async_support/xt.py +4628 -0
- ccxt/async_support/yobit.py +160 -92
- ccxt/async_support/zaif.py +80 -33
- ccxt/async_support/zonda.py +140 -69
- ccxt/base/errors.py +51 -20
- ccxt/base/exchange.py +1729 -482
- ccxt/base/precise.py +10 -0
- ccxt/base/types.py +223 -4
- ccxt/bequant.py +1 -1
- ccxt/bigone.py +329 -202
- ccxt/binance.py +3513 -1511
- ccxt/binancecoinm.py +2 -1
- ccxt/binanceus.py +12 -1
- ccxt/binanceusdm.py +3 -1
- ccxt/bingx.py +3105 -881
- ccxt/bit2c.py +119 -38
- ccxt/bitbank.py +215 -76
- ccxt/bitbns.py +124 -53
- ccxt/bitfinex.py +3235 -1078
- ccxt/bitfinex1.py +1710 -0
- ccxt/bitflyer.py +239 -50
- ccxt/bitget.py +1513 -563
- ccxt/bithumb.py +200 -67
- ccxt/bitmart.py +1320 -435
- ccxt/bitmex.py +308 -111
- ccxt/bitopro.py +256 -96
- ccxt/bitrue.py +365 -233
- ccxt/bitso.py +201 -89
- ccxt/bitstamp.py +438 -269
- ccxt/bitteam.py +179 -73
- ccxt/bitvavo.py +180 -70
- ccxt/bl3p.py +92 -25
- ccxt/blockchaincom.py +193 -79
- ccxt/blofin.py +403 -150
- ccxt/btcalpha.py +161 -55
- ccxt/btcbox.py +250 -34
- ccxt/btcmarkets.py +232 -85
- ccxt/btcturk.py +159 -60
- ccxt/bybit.py +2326 -1255
- ccxt/cex.py +1408 -1329
- ccxt/coinbase.py +1455 -288
- ccxt/coinbaseadvanced.py +17 -0
- ccxt/{coinbasepro.py → coinbaseexchange.py} +233 -99
- ccxt/coinbaseinternational.py +428 -88
- ccxt/coincatch.py +5152 -0
- ccxt/coincheck.py +121 -38
- ccxt/coinex.py +4020 -3339
- ccxt/coinlist.py +273 -116
- ccxt/coinmate.py +204 -97
- ccxt/coinmetro.py +203 -110
- ccxt/coinone.py +142 -68
- ccxt/coinsph.py +206 -89
- ccxt/coinspot.py +137 -62
- ccxt/cryptocom.py +515 -185
- ccxt/currencycom.py +203 -85
- ccxt/defx.py +2065 -0
- ccxt/delta.py +467 -158
- ccxt/deribit.py +558 -324
- ccxt/digifinex.py +340 -223
- ccxt/ellipx.py +1826 -0
- ccxt/exmo.py +259 -128
- ccxt/gate.py +1473 -464
- ccxt/gemini.py +206 -84
- ccxt/hashkey.py +4164 -0
- ccxt/hitbtc.py +334 -178
- ccxt/hollaex.py +134 -83
- ccxt/htx.py +1095 -563
- ccxt/huobijp.py +105 -56
- ccxt/hyperliquid.py +1633 -269
- ccxt/idex.py +148 -95
- ccxt/independentreserve.py +235 -31
- ccxt/indodax.py +165 -62
- ccxt/kraken.py +871 -354
- ccxt/krakenfutures.py +324 -100
- ccxt/kucoin.py +1050 -355
- ccxt/kucoinfutures.py +1004 -149
- ccxt/kuna.py +138 -106
- ccxt/latoken.py +135 -79
- ccxt/lbank.py +290 -113
- ccxt/luno.py +112 -62
- ccxt/lykke.py +104 -55
- ccxt/mercado.py +36 -29
- ccxt/mexc.py +994 -429
- ccxt/myokx.py +43 -0
- ccxt/ndax.py +163 -82
- ccxt/novadax.py +121 -75
- ccxt/oceanex.py +175 -59
- ccxt/okcoin.py +222 -163
- ccxt/okx.py +1777 -455
- ccxt/onetrading.py +132 -414
- ccxt/oxfun.py +2831 -0
- ccxt/p2b.py +79 -51
- ccxt/paradex.py +2017 -0
- ccxt/paymium.py +56 -32
- ccxt/phemex.py +572 -196
- ccxt/poloniex.py +218 -95
- ccxt/poloniexfutures.py +260 -92
- ccxt/pro/__init__.py +29 -5
- ccxt/pro/alpaca.py +32 -17
- ccxt/pro/ascendex.py +63 -15
- ccxt/pro/bequant.py +4 -0
- ccxt/pro/binance.py +1596 -329
- ccxt/pro/binancecoinm.py +1 -0
- ccxt/pro/binanceus.py +2 -9
- ccxt/pro/binanceusdm.py +2 -0
- ccxt/pro/bingx.py +527 -134
- ccxt/pro/bitcoincom.py +4 -1
- ccxt/pro/bitfinex.py +731 -266
- ccxt/pro/bitfinex1.py +635 -0
- ccxt/pro/bitget.py +726 -357
- ccxt/pro/bithumb.py +380 -0
- ccxt/pro/bitmart.py +138 -39
- ccxt/pro/bitmex.py +199 -40
- ccxt/pro/bitopro.py +25 -13
- ccxt/pro/bitrue.py +31 -32
- ccxt/pro/bitstamp.py +7 -6
- ccxt/pro/bitvavo.py +204 -82
- ccxt/pro/blockchaincom.py +30 -17
- ccxt/pro/blofin.py +692 -0
- ccxt/pro/bybit.py +791 -82
- ccxt/pro/cex.py +99 -51
- ccxt/pro/coinbase.py +220 -30
- ccxt/{async_support/hitbtc3.py → pro/coinbaseadvanced.py} +5 -5
- ccxt/pro/{coinbasepro.py → coinbaseexchange.py} +19 -19
- ccxt/pro/coinbaseinternational.py +193 -30
- ccxt/pro/coincatch.py +1464 -0
- ccxt/pro/coincheck.py +11 -6
- ccxt/pro/coinex.py +967 -661
- ccxt/pro/coinone.py +17 -10
- ccxt/pro/cryptocom.py +446 -66
- ccxt/pro/currencycom.py +11 -10
- ccxt/pro/defx.py +832 -0
- ccxt/pro/deribit.py +168 -32
- ccxt/pro/exmo.py +253 -21
- ccxt/pro/gate.py +729 -64
- ccxt/pro/gemini.py +44 -26
- ccxt/pro/hashkey.py +802 -0
- ccxt/pro/hitbtc.py +208 -103
- ccxt/pro/hollaex.py +25 -9
- ccxt/pro/htx.py +83 -39
- ccxt/pro/huobijp.py +17 -16
- ccxt/pro/hyperliquid.py +502 -31
- ccxt/pro/idex.py +28 -13
- ccxt/pro/independentreserve.py +21 -16
- ccxt/pro/kraken.py +298 -51
- ccxt/pro/krakenfutures.py +166 -75
- ccxt/pro/kucoin.py +395 -77
- ccxt/pro/kucoinfutures.py +400 -99
- ccxt/pro/lbank.py +52 -31
- ccxt/pro/luno.py +12 -10
- ccxt/pro/mexc.py +400 -50
- ccxt/pro/myokx.py +28 -0
- ccxt/pro/ndax.py +25 -12
- ccxt/pro/okcoin.py +28 -9
- ccxt/pro/okx.py +935 -124
- ccxt/pro/onetrading.py +41 -24
- ccxt/pro/oxfun.py +1054 -0
- ccxt/pro/p2b.py +100 -24
- ccxt/pro/paradex.py +352 -0
- ccxt/pro/phemex.py +93 -34
- ccxt/pro/poloniex.py +129 -50
- ccxt/pro/poloniexfutures.py +53 -32
- ccxt/pro/probit.py +93 -86
- ccxt/pro/upbit.py +401 -8
- ccxt/pro/vertex.py +943 -0
- ccxt/pro/wazirx.py +46 -28
- ccxt/pro/whitebit.py +65 -12
- ccxt/pro/woo.py +486 -70
- ccxt/pro/woofipro.py +1271 -0
- ccxt/pro/xt.py +1067 -0
- ccxt/probit.py +143 -110
- ccxt/static_dependencies/__init__.py +1 -1
- ccxt/static_dependencies/lark/__init__.py +38 -0
- ccxt/static_dependencies/lark/__pyinstaller/__init__.py +6 -0
- ccxt/static_dependencies/lark/__pyinstaller/hook-lark.py +14 -0
- ccxt/static_dependencies/lark/ast_utils.py +59 -0
- ccxt/static_dependencies/lark/common.py +86 -0
- ccxt/static_dependencies/lark/exceptions.py +292 -0
- ccxt/static_dependencies/lark/grammar.py +130 -0
- ccxt/static_dependencies/lark/grammars/__init__.py +0 -0
- ccxt/static_dependencies/lark/indenter.py +143 -0
- ccxt/static_dependencies/lark/lark.py +658 -0
- ccxt/static_dependencies/lark/lexer.py +678 -0
- ccxt/static_dependencies/lark/load_grammar.py +1428 -0
- ccxt/static_dependencies/lark/parse_tree_builder.py +391 -0
- ccxt/static_dependencies/lark/parser_frontends.py +257 -0
- ccxt/static_dependencies/lark/parsers/__init__.py +0 -0
- ccxt/static_dependencies/lark/parsers/cyk.py +340 -0
- ccxt/static_dependencies/lark/parsers/earley.py +314 -0
- ccxt/static_dependencies/lark/parsers/earley_common.py +42 -0
- ccxt/static_dependencies/lark/parsers/earley_forest.py +801 -0
- ccxt/static_dependencies/lark/parsers/grammar_analysis.py +203 -0
- ccxt/static_dependencies/lark/parsers/lalr_analysis.py +332 -0
- ccxt/static_dependencies/lark/parsers/lalr_interactive_parser.py +158 -0
- ccxt/static_dependencies/lark/parsers/lalr_parser.py +122 -0
- ccxt/static_dependencies/lark/parsers/lalr_parser_state.py +110 -0
- ccxt/static_dependencies/lark/parsers/xearley.py +165 -0
- ccxt/static_dependencies/lark/py.typed +0 -0
- ccxt/static_dependencies/lark/reconstruct.py +107 -0
- ccxt/static_dependencies/lark/tools/__init__.py +70 -0
- ccxt/static_dependencies/lark/tools/nearley.py +202 -0
- ccxt/static_dependencies/lark/tools/serialize.py +32 -0
- ccxt/static_dependencies/lark/tools/standalone.py +196 -0
- ccxt/static_dependencies/lark/tree.py +267 -0
- ccxt/static_dependencies/lark/tree_matcher.py +186 -0
- ccxt/static_dependencies/lark/tree_templates.py +180 -0
- ccxt/static_dependencies/lark/utils.py +343 -0
- ccxt/static_dependencies/lark/visitors.py +596 -0
- ccxt/static_dependencies/marshmallow/__init__.py +81 -0
- ccxt/static_dependencies/marshmallow/base.py +65 -0
- ccxt/static_dependencies/marshmallow/class_registry.py +94 -0
- ccxt/static_dependencies/marshmallow/decorators.py +231 -0
- ccxt/static_dependencies/marshmallow/error_store.py +60 -0
- ccxt/static_dependencies/marshmallow/exceptions.py +71 -0
- ccxt/static_dependencies/marshmallow/fields.py +2114 -0
- ccxt/static_dependencies/marshmallow/orderedset.py +89 -0
- ccxt/static_dependencies/marshmallow/py.typed +0 -0
- ccxt/static_dependencies/marshmallow/schema.py +1228 -0
- ccxt/static_dependencies/marshmallow/types.py +12 -0
- ccxt/static_dependencies/marshmallow/utils.py +378 -0
- ccxt/static_dependencies/marshmallow/validate.py +678 -0
- ccxt/static_dependencies/marshmallow/warnings.py +2 -0
- ccxt/static_dependencies/marshmallow_dataclass/__init__.py +1047 -0
- ccxt/static_dependencies/marshmallow_dataclass/collection_field.py +51 -0
- ccxt/static_dependencies/marshmallow_dataclass/lazy_class_attribute.py +45 -0
- ccxt/static_dependencies/marshmallow_dataclass/mypy.py +71 -0
- ccxt/static_dependencies/marshmallow_dataclass/py.typed +0 -0
- ccxt/static_dependencies/marshmallow_dataclass/typing.py +14 -0
- ccxt/static_dependencies/marshmallow_dataclass/union_field.py +82 -0
- ccxt/static_dependencies/marshmallow_oneofschema/__init__.py +1 -0
- ccxt/static_dependencies/marshmallow_oneofschema/one_of_schema.py +193 -0
- ccxt/static_dependencies/marshmallow_oneofschema/py.typed +0 -0
- ccxt/static_dependencies/starknet/__init__.py +0 -0
- ccxt/static_dependencies/starknet/cairo/__init__.py +0 -0
- ccxt/static_dependencies/starknet/cairo/data_types.py +123 -0
- ccxt/static_dependencies/starknet/cairo/deprecated_parse/__init__.py +0 -0
- ccxt/static_dependencies/starknet/cairo/deprecated_parse/cairo_types.py +77 -0
- ccxt/static_dependencies/starknet/cairo/deprecated_parse/parser.py +46 -0
- ccxt/static_dependencies/starknet/cairo/deprecated_parse/parser_transformer.py +138 -0
- ccxt/static_dependencies/starknet/cairo/felt.py +64 -0
- ccxt/static_dependencies/starknet/cairo/type_parser.py +121 -0
- ccxt/static_dependencies/starknet/cairo/v1/__init__.py +0 -0
- ccxt/static_dependencies/starknet/cairo/v1/type_parser.py +59 -0
- ccxt/static_dependencies/starknet/cairo/v2/__init__.py +0 -0
- ccxt/static_dependencies/starknet/cairo/v2/type_parser.py +77 -0
- ccxt/static_dependencies/starknet/ccxt_utils.py +7 -0
- ccxt/static_dependencies/starknet/common.py +15 -0
- ccxt/static_dependencies/starknet/constants.py +39 -0
- ccxt/static_dependencies/starknet/hash/__init__.py +0 -0
- ccxt/static_dependencies/starknet/hash/address.py +79 -0
- ccxt/static_dependencies/starknet/hash/compiled_class_hash_objects.py +111 -0
- ccxt/static_dependencies/starknet/hash/selector.py +16 -0
- ccxt/static_dependencies/starknet/hash/storage.py +12 -0
- ccxt/static_dependencies/starknet/hash/utils.py +78 -0
- ccxt/static_dependencies/starknet/models/__init__.py +0 -0
- ccxt/static_dependencies/starknet/models/typed_data.py +45 -0
- ccxt/static_dependencies/starknet/serialization/__init__.py +24 -0
- ccxt/static_dependencies/starknet/serialization/_calldata_reader.py +40 -0
- ccxt/static_dependencies/starknet/serialization/_context.py +142 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/__init__.py +10 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/_common.py +82 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/array_serializer.py +43 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/bool_serializer.py +37 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/byte_array_serializer.py +66 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/cairo_data_serializer.py +71 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/enum_serializer.py +71 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/felt_serializer.py +50 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/named_tuple_serializer.py +58 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/option_serializer.py +43 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/output_serializer.py +40 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/payload_serializer.py +72 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/struct_serializer.py +36 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/tuple_serializer.py +36 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/uint256_serializer.py +76 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/uint_serializer.py +100 -0
- ccxt/static_dependencies/starknet/serialization/data_serializers/unit_serializer.py +32 -0
- ccxt/static_dependencies/starknet/serialization/errors.py +10 -0
- ccxt/static_dependencies/starknet/serialization/factory.py +229 -0
- ccxt/static_dependencies/starknet/serialization/function_serialization_adapter.py +110 -0
- ccxt/static_dependencies/starknet/serialization/tuple_dataclass.py +59 -0
- ccxt/static_dependencies/starknet/utils/__init__.py +0 -0
- ccxt/static_dependencies/starknet/utils/constructor_args_translator.py +86 -0
- ccxt/static_dependencies/starknet/utils/iterable.py +13 -0
- ccxt/static_dependencies/starknet/utils/schema.py +13 -0
- ccxt/static_dependencies/starknet/utils/typed_data.py +182 -0
- ccxt/static_dependencies/starkware/__init__.py +0 -0
- ccxt/static_dependencies/starkware/crypto/__init__.py +0 -0
- ccxt/static_dependencies/starkware/crypto/fast_pedersen_hash.py +50 -0
- ccxt/static_dependencies/starkware/crypto/math_utils.py +78 -0
- ccxt/static_dependencies/starkware/crypto/signature.py +2344 -0
- ccxt/static_dependencies/starkware/crypto/utils.py +63 -0
- ccxt/static_dependencies/sympy/__init__.py +0 -0
- ccxt/static_dependencies/sympy/core/__init__.py +0 -0
- ccxt/static_dependencies/sympy/core/intfunc.py +35 -0
- ccxt/static_dependencies/sympy/external/__init__.py +0 -0
- ccxt/static_dependencies/sympy/external/gmpy.py +345 -0
- ccxt/static_dependencies/sympy/external/importtools.py +187 -0
- ccxt/static_dependencies/sympy/external/ntheory.py +637 -0
- ccxt/static_dependencies/sympy/external/pythonmpq.py +341 -0
- ccxt/static_dependencies/typing_inspect/__init__.py +0 -0
- ccxt/static_dependencies/typing_inspect/typing_inspect.py +851 -0
- ccxt/test/{test_async.py → tests_async.py} +465 -407
- ccxt/test/tests_helpers.py +285 -0
- ccxt/test/tests_init.py +39 -0
- ccxt/test/{test_sync.py → tests_sync.py} +465 -409
- ccxt/timex.py +123 -70
- ccxt/tokocrypto.py +129 -93
- ccxt/tradeogre.py +39 -25
- ccxt/upbit.py +322 -113
- ccxt/vertex.py +2983 -0
- ccxt/wavesexchange.py +227 -173
- ccxt/wazirx.py +145 -65
- ccxt/whitebit.py +533 -138
- ccxt/woo.py +1155 -295
- ccxt/woofipro.py +2716 -0
- ccxt/xt.py +4627 -0
- ccxt/yobit.py +159 -92
- ccxt/zaif.py +80 -33
- ccxt/zonda.py +140 -69
- ccxt-4.4.48.dist-info/LICENSE.txt +21 -0
- ccxt-4.4.48.dist-info/METADATA +646 -0
- ccxt-4.4.48.dist-info/RECORD +669 -0
- {ccxt-4.2.76.dist-info → ccxt-4.4.48.dist-info}/WHEEL +1 -1
- ccxt/abstract/bitbay.py +0 -47
- ccxt/abstract/bitfinex2.py +0 -139
- ccxt/abstract/hitbtc3.py +0 -115
- ccxt/async_support/bitbay.py +0 -17
- ccxt/async_support/bitfinex2.py +0 -3496
- ccxt/async_support/flowbtc.py +0 -34
- ccxt/bitbay.py +0 -17
- ccxt/bitfinex2.py +0 -3496
- ccxt/flowbtc.py +0 -34
- ccxt/hitbtc3.py +0 -16
- ccxt/pro/bitfinex2.py +0 -1081
- ccxt/test/base/__init__.py +0 -28
- ccxt/test/base/test_account.py +0 -26
- ccxt/test/base/test_balance.py +0 -56
- ccxt/test/base/test_borrow_interest.py +0 -35
- ccxt/test/base/test_borrow_rate.py +0 -32
- ccxt/test/base/test_calculate_fee.py +0 -51
- ccxt/test/base/test_crypto.py +0 -127
- ccxt/test/base/test_currency.py +0 -76
- ccxt/test/base/test_datetime.py +0 -103
- ccxt/test/base/test_decimal_to_precision.py +0 -392
- ccxt/test/base/test_deep_extend.py +0 -68
- ccxt/test/base/test_deposit_withdrawal.py +0 -50
- ccxt/test/base/test_exchange_datetime_functions.py +0 -76
- ccxt/test/base/test_funding_rate_history.py +0 -29
- ccxt/test/base/test_last_price.py +0 -32
- ccxt/test/base/test_ledger_entry.py +0 -45
- ccxt/test/base/test_ledger_item.py +0 -48
- ccxt/test/base/test_leverage_tier.py +0 -33
- ccxt/test/base/test_margin_mode.py +0 -24
- ccxt/test/base/test_margin_modification.py +0 -35
- ccxt/test/base/test_market.py +0 -190
- ccxt/test/base/test_number.py +0 -411
- ccxt/test/base/test_ohlcv.py +0 -32
- ccxt/test/base/test_open_interest.py +0 -32
- ccxt/test/base/test_order.py +0 -64
- ccxt/test/base/test_order_book.py +0 -63
- ccxt/test/base/test_position.py +0 -60
- ccxt/test/base/test_shared_methods.py +0 -345
- ccxt/test/base/test_status.py +0 -24
- ccxt/test/base/test_throttle.py +0 -126
- ccxt/test/base/test_ticker.py +0 -86
- ccxt/test/base/test_trade.py +0 -47
- ccxt/test/base/test_trading_fee.py +0 -26
- ccxt/test/base/test_transaction.py +0 -39
- ccxt-4.2.76.dist-info/METADATA +0 -626
- ccxt-4.2.76.dist-info/RECORD +0 -534
- {ccxt-4.2.76.dist-info → ccxt-4.4.48.dist-info}/top_level.txt +0 -0
ccxt/delta.py
CHANGED
@@ -6,9 +6,10 @@
|
|
6
6
|
from ccxt.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, 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'
|
@@ -325,7 +403,7 @@ class delta(Exchange, ImplicitAPI):
|
|
325
403
|
'info': None,
|
326
404
|
}
|
327
405
|
|
328
|
-
def safe_market(self, marketId=None, market=None, delimiter=None, marketType=None):
|
406
|
+
def safe_market(self, marketId: Str = None, market: Market = None, delimiter: Str = None, marketType: Str = None) -> MarketInterface:
|
329
407
|
isOption = (marketId is not None) and ((marketId.endswith('-C')) or (marketId.endswith('-P')) or (marketId.startswith('C-')) or (marketId.startswith('P-')))
|
330
408
|
if isOption and not (marketId in self.markets_by_id):
|
331
409
|
# handle expired option contracts
|
@@ -340,7 +418,7 @@ class delta(Exchange, ImplicitAPI):
|
|
340
418
|
"""
|
341
419
|
response = self.publicGetSettings(params)
|
342
420
|
# full response sample under `fetchStatus`
|
343
|
-
result = self.
|
421
|
+
result = self.safe_dict(response, 'result', {})
|
344
422
|
return self.safe_integer_product(result, 'server_time', 0.001)
|
345
423
|
|
346
424
|
def fetch_status(self, params={}):
|
@@ -403,7 +481,7 @@ class delta(Exchange, ImplicitAPI):
|
|
403
481
|
# "success": True
|
404
482
|
# }
|
405
483
|
#
|
406
|
-
result = self.
|
484
|
+
result = self.safe_dict(response, 'result', {})
|
407
485
|
underMaintenance = self.safe_string(result, 'under_maintenance')
|
408
486
|
status = 'maintenance' if (underMaintenance == 'true') else 'ok'
|
409
487
|
updated = self.safe_integer_product(result, 'server_time', 0.001, self.milliseconds())
|
@@ -415,10 +493,12 @@ class delta(Exchange, ImplicitAPI):
|
|
415
493
|
'info': response,
|
416
494
|
}
|
417
495
|
|
418
|
-
def fetch_currencies(self, params={}):
|
496
|
+
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
|
"""
|
@@ -453,8 +533,8 @@ class delta(Exchange, ImplicitAPI):
|
|
453
533
|
# "success":true
|
454
534
|
# }
|
455
535
|
#
|
456
|
-
currencies = self.
|
457
|
-
result = {}
|
536
|
+
currencies = self.safe_list(response, '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')
|
@@ -489,18 +569,34 @@ class delta(Exchange, ImplicitAPI):
|
|
489
569
|
|
490
570
|
def load_markets(self, reload=False, params={}):
|
491
571
|
markets = super(delta, self).load_markets(reload, params)
|
492
|
-
currenciesByNumericId = self.
|
572
|
+
currenciesByNumericId = self.safe_dict(self.options, 'currenciesByNumericId')
|
493
573
|
if (currenciesByNumericId is None) or reload:
|
494
|
-
self.options['currenciesByNumericId'] = self.
|
495
|
-
marketsByNumericId = self.
|
574
|
+
self.options['currenciesByNumericId'] = self.index_by_stringified_numeric_id(self.currencies)
|
575
|
+
marketsByNumericId = self.safe_dict(self.options, 'marketsByNumericId')
|
496
576
|
if (marketsByNumericId is None) or reload:
|
497
|
-
self.options['marketsByNumericId'] = self.
|
577
|
+
self.options['marketsByNumericId'] = self.index_by_stringified_numeric_id(self.markets)
|
498
578
|
return markets
|
499
579
|
|
500
|
-
def
|
580
|
+
def index_by_stringified_numeric_id(self, input):
|
581
|
+
result: dict = {}
|
582
|
+
if input is None:
|
583
|
+
return None
|
584
|
+
keys = list(input.keys())
|
585
|
+
for i in range(0, len(keys)):
|
586
|
+
key = keys[i]
|
587
|
+
item = input[key]
|
588
|
+
numericIdString = self.safe_string(item, 'numericId')
|
589
|
+
if numericIdString is None:
|
590
|
+
continue
|
591
|
+
result[numericIdString] = item
|
592
|
+
return result
|
593
|
+
|
594
|
+
def fetch_markets(self, params={}) -> List[Market]:
|
501
595
|
"""
|
502
596
|
retrieves data on all markets for delta
|
503
|
-
|
597
|
+
|
598
|
+
https://docs.delta.exchange/#get-list-of-products
|
599
|
+
|
504
600
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
505
601
|
:returns dict[]: an array of objects representing market data
|
506
602
|
"""
|
@@ -683,7 +779,7 @@ class delta(Exchange, ImplicitAPI):
|
|
683
779
|
# "success":true
|
684
780
|
# }
|
685
781
|
#
|
686
|
-
markets = self.
|
782
|
+
markets = self.safe_list(response, 'result', [])
|
687
783
|
result = []
|
688
784
|
for i in range(0, len(markets)):
|
689
785
|
market = markets[i]
|
@@ -691,10 +787,10 @@ class delta(Exchange, ImplicitAPI):
|
|
691
787
|
if type == 'options_combos':
|
692
788
|
continue
|
693
789
|
# settlingAsset = self.safe_value(market, 'settling_asset', {})
|
694
|
-
quotingAsset = self.
|
695
|
-
underlyingAsset = self.
|
696
|
-
settlingAsset = self.
|
697
|
-
productSpecs = self.
|
790
|
+
quotingAsset = self.safe_dict(market, 'quoting_asset', {})
|
791
|
+
underlyingAsset = self.safe_dict(market, 'underlying_asset', {})
|
792
|
+
settlingAsset = self.safe_dict(market, 'settling_asset')
|
793
|
+
productSpecs = self.safe_dict(market, 'product_specs', {})
|
698
794
|
baseId = self.safe_string(underlyingAsset, 'symbol')
|
699
795
|
quoteId = self.safe_string(quotingAsset, 'symbol')
|
700
796
|
settleId = self.safe_string(settlingAsset, 'symbol')
|
@@ -720,7 +816,7 @@ class delta(Exchange, ImplicitAPI):
|
|
720
816
|
else:
|
721
817
|
# other markets(swap, futures, move, spread, irs) seem to use the step of '1' contract
|
722
818
|
amountPrecision = self.parse_number('1')
|
723
|
-
linear = (settle ==
|
819
|
+
linear = (settle == quote)
|
724
820
|
optionType = None
|
725
821
|
symbol = base + '/' + quote
|
726
822
|
if swap or future or option:
|
@@ -797,7 +893,7 @@ class delta(Exchange, ImplicitAPI):
|
|
797
893
|
})
|
798
894
|
return result
|
799
895
|
|
800
|
-
def parse_ticker(self, ticker, market: Market = None) -> Ticker:
|
896
|
+
def parse_ticker(self, ticker: dict, market: Market = None) -> Ticker:
|
801
897
|
#
|
802
898
|
# spot: fetchTicker, fetchTickers
|
803
899
|
#
|
@@ -917,7 +1013,7 @@ class delta(Exchange, ImplicitAPI):
|
|
917
1013
|
marketId = self.safe_string(ticker, 'symbol')
|
918
1014
|
symbol = self.safe_symbol(marketId, market)
|
919
1015
|
last = self.safe_string(ticker, 'close')
|
920
|
-
quotes = self.
|
1016
|
+
quotes = self.safe_dict(ticker, 'quotes', {})
|
921
1017
|
return self.safe_ticker({
|
922
1018
|
'symbol': symbol,
|
923
1019
|
'timestamp': timestamp,
|
@@ -938,20 +1034,24 @@ class delta(Exchange, ImplicitAPI):
|
|
938
1034
|
'average': None,
|
939
1035
|
'baseVolume': self.safe_number(ticker, 'volume'),
|
940
1036
|
'quoteVolume': self.safe_number(ticker, 'turnover'),
|
1037
|
+
'markPrice': self.safe_number(ticker, 'mark_price'),
|
1038
|
+
'indexPrice': self.safe_number(ticker, 'spot_price'),
|
941
1039
|
'info': ticker,
|
942
1040
|
}, market)
|
943
1041
|
|
944
1042
|
def fetch_ticker(self, symbol: str, params={}) -> Ticker:
|
945
1043
|
"""
|
946
1044
|
fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
947
|
-
|
1045
|
+
|
1046
|
+
https://docs.delta.exchange/#get-ticker-for-a-product-by-symbol
|
1047
|
+
|
948
1048
|
:param str symbol: unified symbol of the market to fetch the ticker for
|
949
1049
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
950
1050
|
:returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
|
951
1051
|
"""
|
952
1052
|
self.load_markets()
|
953
1053
|
market = self.market(symbol)
|
954
|
-
request = {
|
1054
|
+
request: dict = {
|
955
1055
|
'symbol': market['id'],
|
956
1056
|
}
|
957
1057
|
response = self.publicGetTickersSymbol(self.extend(request, params))
|
@@ -1079,13 +1179,15 @@ class delta(Exchange, ImplicitAPI):
|
|
1079
1179
|
# "success": True
|
1080
1180
|
# }
|
1081
1181
|
#
|
1082
|
-
result = self.
|
1182
|
+
result = self.safe_dict(response, 'result', {})
|
1083
1183
|
return self.parse_ticker(result, market)
|
1084
1184
|
|
1085
1185
|
def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
|
1086
1186
|
"""
|
1087
1187
|
fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
1088
|
-
|
1188
|
+
|
1189
|
+
https://docs.delta.exchange/#get-tickers-for-products
|
1190
|
+
|
1089
1191
|
:param str[]|None symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
1090
1192
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1091
1193
|
:returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
|
@@ -1223,8 +1325,8 @@ class delta(Exchange, ImplicitAPI):
|
|
1223
1325
|
# "success":true
|
1224
1326
|
# }
|
1225
1327
|
#
|
1226
|
-
tickers = self.
|
1227
|
-
result = {}
|
1328
|
+
tickers = self.safe_list(response, 'result', [])
|
1329
|
+
result: dict = {}
|
1228
1330
|
for i in range(0, len(tickers)):
|
1229
1331
|
ticker = self.parse_ticker(tickers[i])
|
1230
1332
|
symbol = ticker['symbol']
|
@@ -1234,7 +1336,9 @@ class delta(Exchange, ImplicitAPI):
|
|
1234
1336
|
def fetch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook:
|
1235
1337
|
"""
|
1236
1338
|
fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
|
1237
|
-
|
1339
|
+
|
1340
|
+
https://docs.delta.exchange/#get-l2-orderbook
|
1341
|
+
|
1238
1342
|
:param str symbol: unified symbol of the market to fetch the order book for
|
1239
1343
|
:param int [limit]: the maximum amount of order book entries to return
|
1240
1344
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -1242,7 +1346,7 @@ class delta(Exchange, ImplicitAPI):
|
|
1242
1346
|
"""
|
1243
1347
|
self.load_markets()
|
1244
1348
|
market = self.market(symbol)
|
1245
|
-
request = {
|
1349
|
+
request: dict = {
|
1246
1350
|
'symbol': market['id'],
|
1247
1351
|
}
|
1248
1352
|
if limit is not None:
|
@@ -1266,10 +1370,10 @@ class delta(Exchange, ImplicitAPI):
|
|
1266
1370
|
# "success":true
|
1267
1371
|
# }
|
1268
1372
|
#
|
1269
|
-
result = self.
|
1373
|
+
result = self.safe_dict(response, 'result', {})
|
1270
1374
|
return self.parse_order_book(result, market['symbol'], None, 'buy', 'sell', 'price', 'size')
|
1271
1375
|
|
1272
|
-
def parse_trade(self, trade, market: Market = None) -> Trade:
|
1376
|
+
def parse_trade(self, trade: dict, market: Market = None) -> Trade:
|
1273
1377
|
#
|
1274
1378
|
# public fetchTrades
|
1275
1379
|
#
|
@@ -1323,7 +1427,7 @@ class delta(Exchange, ImplicitAPI):
|
|
1323
1427
|
timestamp = self.safe_integer_product(trade, 'timestamp', 0.001, timestamp)
|
1324
1428
|
priceString = self.safe_string(trade, 'price')
|
1325
1429
|
amountString = self.safe_string(trade, 'size')
|
1326
|
-
product = self.
|
1430
|
+
product = self.safe_dict(trade, 'product', {})
|
1327
1431
|
marketId = self.safe_string(product, 'symbol')
|
1328
1432
|
symbol = self.safe_symbol(marketId, market)
|
1329
1433
|
sellerRole = self.safe_string(trade, 'seller_role')
|
@@ -1334,14 +1438,14 @@ class delta(Exchange, ImplicitAPI):
|
|
1334
1438
|
elif sellerRole == 'maker':
|
1335
1439
|
side = 'buy'
|
1336
1440
|
takerOrMaker = self.safe_string(trade, 'role')
|
1337
|
-
metaData = self.
|
1441
|
+
metaData = self.safe_dict(trade, 'meta_data', {})
|
1338
1442
|
type = self.safe_string(metaData, 'order_type')
|
1339
1443
|
if type is not None:
|
1340
1444
|
type = type.replace('_order', '')
|
1341
1445
|
feeCostString = self.safe_string(trade, 'commission')
|
1342
1446
|
fee = None
|
1343
1447
|
if feeCostString is not None:
|
1344
|
-
settlingAsset = self.
|
1448
|
+
settlingAsset = self.safe_dict(product, 'settling_asset', {})
|
1345
1449
|
feeCurrencyId = self.safe_string(settlingAsset, 'symbol')
|
1346
1450
|
feeCurrencyCode = self.safe_currency_code(feeCurrencyId)
|
1347
1451
|
fee = {
|
@@ -1367,7 +1471,9 @@ class delta(Exchange, ImplicitAPI):
|
|
1367
1471
|
def fetch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
|
1368
1472
|
"""
|
1369
1473
|
get the list of most recent trades for a particular symbol
|
1370
|
-
|
1474
|
+
|
1475
|
+
https://docs.delta.exchange/#get-public-trades
|
1476
|
+
|
1371
1477
|
:param str symbol: unified symbol of the market to fetch trades for
|
1372
1478
|
:param int [since]: timestamp in ms of the earliest trade to fetch
|
1373
1479
|
:param int [limit]: the maximum amount of trades to fetch
|
@@ -1376,7 +1482,7 @@ class delta(Exchange, ImplicitAPI):
|
|
1376
1482
|
"""
|
1377
1483
|
self.load_markets()
|
1378
1484
|
market = self.market(symbol)
|
1379
|
-
request = {
|
1485
|
+
request: dict = {
|
1380
1486
|
'symbol': market['id'],
|
1381
1487
|
}
|
1382
1488
|
response = self.publicGetTradesSymbol(self.extend(request, params))
|
@@ -1395,7 +1501,7 @@ class delta(Exchange, ImplicitAPI):
|
|
1395
1501
|
# "success":true
|
1396
1502
|
# }
|
1397
1503
|
#
|
1398
|
-
result = self.
|
1504
|
+
result = self.safe_list(response, 'result', [])
|
1399
1505
|
return self.parse_trades(result, market, since, limit)
|
1400
1506
|
|
1401
1507
|
def parse_ohlcv(self, ohlcv, market: Market = None) -> list:
|
@@ -1421,29 +1527,36 @@ class delta(Exchange, ImplicitAPI):
|
|
1421
1527
|
def fetch_ohlcv(self, symbol: str, timeframe='1m', since: Int = None, limit: Int = None, params={}) -> List[list]:
|
1422
1528
|
"""
|
1423
1529
|
fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
1424
|
-
|
1530
|
+
|
1531
|
+
https://docs.delta.exchange/#delta-exchange-api-v2-historical-ohlc-candles-sparklines
|
1532
|
+
|
1425
1533
|
:param str symbol: unified symbol of the market to fetch OHLCV data for
|
1426
1534
|
:param str timeframe: the length of time each candle represents
|
1427
1535
|
:param int [since]: timestamp in ms of the earliest candle to fetch
|
1428
1536
|
:param int [limit]: the maximum amount of candles to fetch
|
1429
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
|
1430
1539
|
:returns int[][]: A list of candles ordered, open, high, low, close, volume
|
1431
1540
|
"""
|
1432
1541
|
self.load_markets()
|
1433
1542
|
market = self.market(symbol)
|
1434
|
-
request = {
|
1543
|
+
request: dict = {
|
1435
1544
|
'resolution': self.safe_string(self.timeframes, timeframe, timeframe),
|
1436
1545
|
}
|
1437
1546
|
duration = self.parse_timeframe(timeframe)
|
1438
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)
|
1439
1552
|
if since is None:
|
1440
|
-
end = self.seconds()
|
1553
|
+
end = until if untilIsDefined else self.seconds()
|
1441
1554
|
request['end'] = end
|
1442
1555
|
request['start'] = end - limit * duration
|
1443
1556
|
else:
|
1444
1557
|
start = self.parse_to_int(since / 1000)
|
1445
1558
|
request['start'] = start
|
1446
|
-
request['end'] = self.sum(start, limit * duration)
|
1559
|
+
request['end'] = until if untilIsDefined else self.sum(start, limit * duration)
|
1447
1560
|
price = self.safe_string(params, 'price')
|
1448
1561
|
if price == 'mark':
|
1449
1562
|
request['symbol'] = 'MARK:' + market['id']
|
@@ -1451,7 +1564,7 @@ class delta(Exchange, ImplicitAPI):
|
|
1451
1564
|
request['symbol'] = market['info']['spot_index']['symbol']
|
1452
1565
|
else:
|
1453
1566
|
request['symbol'] = market['id']
|
1454
|
-
params = self.omit(params, 'price')
|
1567
|
+
params = self.omit(params, ['price', 'until'])
|
1455
1568
|
response = self.publicGetHistoryCandles(self.extend(request, params))
|
1456
1569
|
#
|
1457
1570
|
# {
|
@@ -1463,17 +1576,17 @@ class delta(Exchange, ImplicitAPI):
|
|
1463
1576
|
# ]
|
1464
1577
|
# }
|
1465
1578
|
#
|
1466
|
-
result = self.
|
1579
|
+
result = self.safe_list(response, 'result', [])
|
1467
1580
|
return self.parse_ohlcvs(result, market, timeframe, since, limit)
|
1468
1581
|
|
1469
1582
|
def parse_balance(self, response) -> Balances:
|
1470
|
-
balances = self.
|
1471
|
-
result = {'info': response}
|
1472
|
-
currenciesByNumericId = self.
|
1583
|
+
balances = self.safe_list(response, 'result', [])
|
1584
|
+
result: dict = {'info': response}
|
1585
|
+
currenciesByNumericId = self.safe_dict(self.options, 'currenciesByNumericId', {})
|
1473
1586
|
for i in range(0, len(balances)):
|
1474
1587
|
balance = balances[i]
|
1475
1588
|
currencyId = self.safe_string(balance, 'asset_id')
|
1476
|
-
currency = self.
|
1589
|
+
currency = self.safe_dict(currenciesByNumericId, currencyId)
|
1477
1590
|
code = currencyId if (currency is None) else currency['code']
|
1478
1591
|
account = self.account()
|
1479
1592
|
account['total'] = self.safe_string(balance, 'balance')
|
@@ -1484,7 +1597,9 @@ class delta(Exchange, ImplicitAPI):
|
|
1484
1597
|
def fetch_balance(self, params={}) -> Balances:
|
1485
1598
|
"""
|
1486
1599
|
query for balance and get the amount of funds available for trading or funds locked in orders
|
1487
|
-
|
1600
|
+
|
1601
|
+
https://docs.delta.exchange/#get-wallet-balances
|
1602
|
+
|
1488
1603
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1489
1604
|
:returns dict: a `balance structure <https://docs.ccxt.com/#/?id=balance-structure>`
|
1490
1605
|
"""
|
@@ -1516,14 +1631,16 @@ class delta(Exchange, ImplicitAPI):
|
|
1516
1631
|
def fetch_position(self, symbol: str, params={}):
|
1517
1632
|
"""
|
1518
1633
|
fetch data on a single open contract trade position
|
1519
|
-
|
1634
|
+
|
1635
|
+
https://docs.delta.exchange/#get-position
|
1636
|
+
|
1520
1637
|
:param str symbol: unified market symbol of the market the position is held in, default is None
|
1521
1638
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1522
1639
|
:returns dict: a `position structure <https://docs.ccxt.com/#/?id=position-structure>`
|
1523
1640
|
"""
|
1524
1641
|
self.load_markets()
|
1525
1642
|
market = self.market(symbol)
|
1526
|
-
request = {
|
1643
|
+
request: dict = {
|
1527
1644
|
'product_id': market['numericId'],
|
1528
1645
|
}
|
1529
1646
|
response = self.privateGetPositions(self.extend(request, params))
|
@@ -1537,13 +1654,15 @@ class delta(Exchange, ImplicitAPI):
|
|
1537
1654
|
# "success":true
|
1538
1655
|
# }
|
1539
1656
|
#
|
1540
|
-
result = self.
|
1657
|
+
result = self.safe_dict(response, 'result', {})
|
1541
1658
|
return self.parse_position(result, market)
|
1542
1659
|
|
1543
1660
|
def fetch_positions(self, symbols: Strings = None, params={}):
|
1544
1661
|
"""
|
1545
1662
|
fetch all open positions
|
1546
|
-
|
1663
|
+
|
1664
|
+
https://docs.delta.exchange/#get-margined-positions
|
1665
|
+
|
1547
1666
|
:param str[]|None symbols: list of unified market symbols
|
1548
1667
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1549
1668
|
:returns dict[]: a list of `position structure <https://docs.ccxt.com/#/?id=position-structure>`
|
@@ -1571,10 +1690,10 @@ class delta(Exchange, ImplicitAPI):
|
|
1571
1690
|
# ]
|
1572
1691
|
# }
|
1573
1692
|
#
|
1574
|
-
result = self.
|
1693
|
+
result = self.safe_list(response, 'result', [])
|
1575
1694
|
return self.parse_positions(result, symbols)
|
1576
1695
|
|
1577
|
-
def parse_position(self, position, market: Market = None):
|
1696
|
+
def parse_position(self, position: dict, market: Market = None):
|
1578
1697
|
#
|
1579
1698
|
# fetchPosition
|
1580
1699
|
#
|
@@ -1641,8 +1760,8 @@ class delta(Exchange, ImplicitAPI):
|
|
1641
1760
|
'takeProfitPrice': None,
|
1642
1761
|
})
|
1643
1762
|
|
1644
|
-
def parse_order_status(self, status):
|
1645
|
-
statuses = {
|
1763
|
+
def parse_order_status(self, status: Str):
|
1764
|
+
statuses: dict = {
|
1646
1765
|
'open': 'open',
|
1647
1766
|
'pending': 'open',
|
1648
1767
|
'closed': 'closed',
|
@@ -1650,7 +1769,7 @@ class delta(Exchange, ImplicitAPI):
|
|
1650
1769
|
}
|
1651
1770
|
return self.safe_string(statuses, status, status)
|
1652
1771
|
|
1653
|
-
def parse_order(self, order, market: Market = None) -> Order:
|
1772
|
+
def parse_order(self, order: dict, market: Market = None) -> Order:
|
1654
1773
|
#
|
1655
1774
|
# createOrder, cancelOrder, editOrder, fetchOpenOrders, fetchClosedOrders
|
1656
1775
|
#
|
@@ -1690,7 +1809,7 @@ class delta(Exchange, ImplicitAPI):
|
|
1690
1809
|
clientOrderId = self.safe_string(order, 'client_order_id')
|
1691
1810
|
timestamp = self.parse8601(self.safe_string(order, 'created_at'))
|
1692
1811
|
marketId = self.safe_string(order, 'product_id')
|
1693
|
-
marketsByNumericId = self.
|
1812
|
+
marketsByNumericId = self.safe_dict(self.options, 'marketsByNumericId', {})
|
1694
1813
|
market = self.safe_value(marketsByNumericId, marketId, market)
|
1695
1814
|
symbol = marketId if (market is None) else market['symbol']
|
1696
1815
|
status = self.parse_order_status(self.safe_string(order, 'state'))
|
@@ -1706,7 +1825,7 @@ class delta(Exchange, ImplicitAPI):
|
|
1706
1825
|
if feeCostString is not None:
|
1707
1826
|
feeCurrencyCode = None
|
1708
1827
|
if market is not None:
|
1709
|
-
settlingAsset = self.
|
1828
|
+
settlingAsset = self.safe_dict(market['info'], 'settling_asset', {})
|
1710
1829
|
feeCurrencyId = self.safe_string(settlingAsset, 'symbol')
|
1711
1830
|
feeCurrencyCode = self.safe_currency_code(feeCurrencyId)
|
1712
1831
|
fee = {
|
@@ -1737,12 +1856,14 @@ class delta(Exchange, ImplicitAPI):
|
|
1737
1856
|
def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
|
1738
1857
|
"""
|
1739
1858
|
create a trade order
|
1740
|
-
|
1859
|
+
|
1860
|
+
https://docs.delta.exchange/#place-order
|
1861
|
+
|
1741
1862
|
:param str symbol: unified symbol of the market to create an order in
|
1742
1863
|
:param str type: 'market' or 'limit'
|
1743
1864
|
:param str side: 'buy' or 'sell'
|
1744
1865
|
:param float amount: how much of currency you want to trade in units of base currency
|
1745
|
-
: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
|
1746
1867
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1747
1868
|
:param bool [params.reduceOnly]: *contract only* indicates if self order is to reduce the size of a position
|
1748
1869
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
@@ -1750,7 +1871,7 @@ class delta(Exchange, ImplicitAPI):
|
|
1750
1871
|
self.load_markets()
|
1751
1872
|
orderType = type + '_order'
|
1752
1873
|
market = self.market(symbol)
|
1753
|
-
request = {
|
1874
|
+
request: dict = {
|
1754
1875
|
'product_id': market['numericId'],
|
1755
1876
|
# 'limit_price': self.price_to_precision(market['symbol'], price),
|
1756
1877
|
'size': self.amount_to_precision(market['symbol'], amount),
|
@@ -1767,7 +1888,7 @@ class delta(Exchange, ImplicitAPI):
|
|
1767
1888
|
params = self.omit(params, ['clientOrderId', 'client_order_id'])
|
1768
1889
|
if clientOrderId is not None:
|
1769
1890
|
request['client_order_id'] = clientOrderId
|
1770
|
-
reduceOnly = self.
|
1891
|
+
reduceOnly = self.safe_bool(params, 'reduceOnly')
|
1771
1892
|
if reduceOnly:
|
1772
1893
|
request['reduce_only'] = reduceOnly
|
1773
1894
|
params = self.omit(params, 'reduceOnly')
|
@@ -1808,25 +1929,27 @@ class delta(Exchange, ImplicitAPI):
|
|
1808
1929
|
# "success":true
|
1809
1930
|
# }
|
1810
1931
|
#
|
1811
|
-
result = self.
|
1932
|
+
result = self.safe_dict(response, 'result', {})
|
1812
1933
|
return self.parse_order(result, market)
|
1813
1934
|
|
1814
1935
|
def edit_order(self, id: str, symbol: str, type: OrderType, side: OrderSide, amount: Num = None, price: Num = None, params={}):
|
1815
1936
|
"""
|
1816
1937
|
edit a trade order
|
1817
|
-
|
1938
|
+
|
1939
|
+
https://docs.delta.exchange/#edit-order
|
1940
|
+
|
1818
1941
|
:param str id: order id
|
1819
1942
|
:param str symbol: unified symbol of the market to create an order in
|
1820
1943
|
:param str type: 'market' or 'limit'
|
1821
1944
|
:param str side: 'buy' or 'sell'
|
1822
1945
|
:param float amount: how much of the currency you want to trade in units of the base currency
|
1823
|
-
: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
|
1824
1947
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1825
1948
|
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`
|
1826
1949
|
"""
|
1827
1950
|
self.load_markets()
|
1828
1951
|
market = self.market(symbol)
|
1829
|
-
request = {
|
1952
|
+
request: dict = {
|
1830
1953
|
'id': int(id),
|
1831
1954
|
'product_id': market['numericId'],
|
1832
1955
|
# "limit_price": self.price_to_precision(symbol, price),
|
@@ -1854,13 +1977,15 @@ class delta(Exchange, ImplicitAPI):
|
|
1854
1977
|
# }
|
1855
1978
|
# }
|
1856
1979
|
#
|
1857
|
-
result = self.
|
1980
|
+
result = self.safe_dict(response, 'result')
|
1858
1981
|
return self.parse_order(result, market)
|
1859
1982
|
|
1860
1983
|
def cancel_order(self, id: str, symbol: Str = None, params={}):
|
1861
1984
|
"""
|
1862
1985
|
cancels an open order
|
1863
|
-
|
1986
|
+
|
1987
|
+
https://docs.delta.exchange/#cancel-order
|
1988
|
+
|
1864
1989
|
:param str id: order id
|
1865
1990
|
:param str symbol: unified symbol of the market the order was made in
|
1866
1991
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -1870,7 +1995,7 @@ class delta(Exchange, ImplicitAPI):
|
|
1870
1995
|
raise ArgumentsRequired(self.id + ' cancelOrder() requires a symbol argument')
|
1871
1996
|
self.load_markets()
|
1872
1997
|
market = self.market(symbol)
|
1873
|
-
request = {
|
1998
|
+
request: dict = {
|
1874
1999
|
'id': int(id),
|
1875
2000
|
'product_id': market['numericId'],
|
1876
2001
|
}
|
@@ -1911,13 +2036,15 @@ class delta(Exchange, ImplicitAPI):
|
|
1911
2036
|
# "success":true
|
1912
2037
|
# }
|
1913
2038
|
#
|
1914
|
-
result = self.
|
2039
|
+
result = self.safe_dict(response, 'result')
|
1915
2040
|
return self.parse_order(result, market)
|
1916
2041
|
|
1917
2042
|
def cancel_all_orders(self, symbol: Str = None, params={}):
|
1918
2043
|
"""
|
1919
2044
|
cancel all open orders in a market
|
1920
|
-
|
2045
|
+
|
2046
|
+
https://docs.delta.exchange/#cancel-all-open-orders
|
2047
|
+
|
1921
2048
|
:param str symbol: unified market symbol of the market to cancel orders in
|
1922
2049
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1923
2050
|
:returns dict[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
@@ -1926,7 +2053,7 @@ class delta(Exchange, ImplicitAPI):
|
|
1926
2053
|
raise ArgumentsRequired(self.id + ' cancelAllOrders() requires a symbol argument')
|
1927
2054
|
self.load_markets()
|
1928
2055
|
market = self.market(symbol)
|
1929
|
-
request = {
|
2056
|
+
request: dict = {
|
1930
2057
|
'product_id': market['numericId'],
|
1931
2058
|
# 'cancel_limit_orders': 'true',
|
1932
2059
|
# 'cancel_stop_orders': 'true',
|
@@ -1938,12 +2065,18 @@ class delta(Exchange, ImplicitAPI):
|
|
1938
2065
|
# "success":true
|
1939
2066
|
# }
|
1940
2067
|
#
|
1941
|
-
return
|
2068
|
+
return [
|
2069
|
+
self.safe_order({
|
2070
|
+
'info': response,
|
2071
|
+
}),
|
2072
|
+
]
|
1942
2073
|
|
1943
2074
|
def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
1944
2075
|
"""
|
1945
2076
|
fetch all unfilled currently open orders
|
1946
|
-
|
2077
|
+
|
2078
|
+
https://docs.delta.exchange/#get-active-orders
|
2079
|
+
|
1947
2080
|
:param str symbol: unified market symbol
|
1948
2081
|
:param int [since]: the earliest time in ms to fetch open orders for
|
1949
2082
|
:param int [limit]: the maximum number of open order structures to retrieve
|
@@ -1955,7 +2088,9 @@ class delta(Exchange, ImplicitAPI):
|
|
1955
2088
|
def fetch_closed_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
1956
2089
|
"""
|
1957
2090
|
fetches information on multiple closed orders made by the user
|
1958
|
-
|
2091
|
+
|
2092
|
+
https://docs.delta.exchange/#get-order-history-cancelled-and-closed
|
2093
|
+
|
1959
2094
|
:param str symbol: unified market symbol of the market orders were made in
|
1960
2095
|
:param int [since]: the earliest time in ms to fetch orders for
|
1961
2096
|
:param int [limit]: the maximum number of order structures to retrieve
|
@@ -1966,7 +2101,7 @@ class delta(Exchange, ImplicitAPI):
|
|
1966
2101
|
|
1967
2102
|
def fetch_orders_with_method(self, method, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
1968
2103
|
self.load_markets()
|
1969
|
-
request = {
|
2104
|
+
request: dict = {
|
1970
2105
|
# 'product_ids': market['id'], # comma-separated
|
1971
2106
|
# 'contract_types': types, # comma-separated, futures, perpetual_futures, call_options, put_options, interest_rate_swaps, move_options, spreads
|
1972
2107
|
# 'order_types': types, # comma-separated, market, limit, stop_market, stop_limit, all_stop
|
@@ -2012,13 +2147,15 @@ class delta(Exchange, ImplicitAPI):
|
|
2012
2147
|
# }
|
2013
2148
|
# }
|
2014
2149
|
#
|
2015
|
-
result = self.
|
2150
|
+
result = self.safe_list(response, 'result', [])
|
2016
2151
|
return self.parse_orders(result, market, since, limit)
|
2017
2152
|
|
2018
2153
|
def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
2019
2154
|
"""
|
2020
2155
|
fetch all trades made by the user
|
2021
|
-
|
2156
|
+
|
2157
|
+
https://docs.delta.exchange/#get-user-fills-by-filters
|
2158
|
+
|
2022
2159
|
:param str symbol: unified market symbol
|
2023
2160
|
:param int [since]: the earliest time in ms to fetch trades for
|
2024
2161
|
:param int [limit]: the maximum number of trades structures to retrieve
|
@@ -2026,7 +2163,7 @@ class delta(Exchange, ImplicitAPI):
|
|
2026
2163
|
:returns Trade[]: a list of `trade structures <https://docs.ccxt.com/#/?id=trade-structure>`
|
2027
2164
|
"""
|
2028
2165
|
self.load_markets()
|
2029
|
-
request = {
|
2166
|
+
request: dict = {
|
2030
2167
|
# 'product_ids': market['id'], # comma-separated
|
2031
2168
|
# 'contract_types': types, # comma-separated, futures, perpetual_futures, call_options, put_options, interest_rate_swaps, move_options, spreads
|
2032
2169
|
# 'start_time': since * 1000,
|
@@ -2089,21 +2226,23 @@ class delta(Exchange, ImplicitAPI):
|
|
2089
2226
|
# "success":true
|
2090
2227
|
# }
|
2091
2228
|
#
|
2092
|
-
result = self.
|
2229
|
+
result = self.safe_list(response, 'result', [])
|
2093
2230
|
return self.parse_trades(result, market, since, limit)
|
2094
2231
|
|
2095
|
-
def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
|
2232
|
+
def fetch_ledger(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[LedgerEntry]:
|
2096
2233
|
"""
|
2097
|
-
fetch the history of changes, actions done by the user or operations that altered balance of the user
|
2098
|
-
|
2099
|
-
|
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
|
2100
2239
|
:param int [since]: timestamp in ms of the earliest ledger entry, default is None
|
2101
|
-
:param int [limit]: max number of ledger
|
2240
|
+
:param int [limit]: max number of ledger entries to return, default is None
|
2102
2241
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2103
|
-
:returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger
|
2242
|
+
:returns dict: a `ledger structure <https://docs.ccxt.com/#/?id=ledger>`
|
2104
2243
|
"""
|
2105
2244
|
self.load_markets()
|
2106
|
-
request = {
|
2245
|
+
request: dict = {
|
2107
2246
|
# 'asset_id': currency['numericId'],
|
2108
2247
|
# 'end_time': self.seconds(),
|
2109
2248
|
# 'after': 'string', # after cursor for pagination
|
@@ -2138,11 +2277,11 @@ class delta(Exchange, ImplicitAPI):
|
|
2138
2277
|
# "success":true
|
2139
2278
|
# }
|
2140
2279
|
#
|
2141
|
-
result = self.
|
2280
|
+
result = self.safe_list(response, 'result', [])
|
2142
2281
|
return self.parse_ledger(result, currency, since, limit)
|
2143
2282
|
|
2144
2283
|
def parse_ledger_entry_type(self, type):
|
2145
|
-
types = {
|
2284
|
+
types: dict = {
|
2146
2285
|
'pnl': 'pnl',
|
2147
2286
|
'deposit': 'transaction',
|
2148
2287
|
'withdrawal': 'transaction',
|
@@ -2156,7 +2295,7 @@ class delta(Exchange, ImplicitAPI):
|
|
2156
2295
|
}
|
2157
2296
|
return self.safe_string(types, type, type)
|
2158
2297
|
|
2159
|
-
def parse_ledger_entry(self, item, currency: Currency = None):
|
2298
|
+
def parse_ledger_entry(self, item: dict, currency: Currency = None) -> LedgerEntry:
|
2160
2299
|
#
|
2161
2300
|
# {
|
2162
2301
|
# "amount":"29.889184",
|
@@ -2175,7 +2314,7 @@ class delta(Exchange, ImplicitAPI):
|
|
2175
2314
|
id = self.safe_string(item, 'uuid')
|
2176
2315
|
direction = None
|
2177
2316
|
account = None
|
2178
|
-
metaData = self.
|
2317
|
+
metaData = self.safe_dict(item, 'meta_data', {})
|
2179
2318
|
referenceId = self.safe_string(metaData, 'transaction_id')
|
2180
2319
|
referenceAccount = None
|
2181
2320
|
type = self.safe_string(item, 'transaction_type')
|
@@ -2184,8 +2323,8 @@ class delta(Exchange, ImplicitAPI):
|
|
2184
2323
|
elif (type == 'withdrawal') or (type == 'commission') or (type == 'conversion') or (type == 'perpetual_futures_funding'):
|
2185
2324
|
direction = 'out'
|
2186
2325
|
type = self.parse_ledger_entry_type(type)
|
2187
|
-
currencyId = self.
|
2188
|
-
currenciesByNumericId = self.
|
2326
|
+
currencyId = self.safe_string(item, 'asset_id')
|
2327
|
+
currenciesByNumericId = self.safe_dict(self.options, 'currenciesByNumericId')
|
2189
2328
|
currency = self.safe_value(currenciesByNumericId, currencyId, currency)
|
2190
2329
|
code = None if (currency is None) else currency['code']
|
2191
2330
|
amount = self.safe_string(item, 'amount')
|
@@ -2193,7 +2332,7 @@ class delta(Exchange, ImplicitAPI):
|
|
2193
2332
|
after = self.safe_string(item, 'balance')
|
2194
2333
|
before = Precise.string_max('0', Precise.string_sub(after, amount))
|
2195
2334
|
status = 'ok'
|
2196
|
-
return {
|
2335
|
+
return self.safe_ledger_entry({
|
2197
2336
|
'info': item,
|
2198
2337
|
'id': id,
|
2199
2338
|
'direction': direction,
|
@@ -2209,9 +2348,9 @@ class delta(Exchange, ImplicitAPI):
|
|
2209
2348
|
'timestamp': timestamp,
|
2210
2349
|
'datetime': self.iso8601(timestamp),
|
2211
2350
|
'fee': None,
|
2212
|
-
}
|
2351
|
+
}, currency)
|
2213
2352
|
|
2214
|
-
def fetch_deposit_address(self, code: str, params={}):
|
2353
|
+
def fetch_deposit_address(self, code: str, params={}) -> DepositAddress:
|
2215
2354
|
"""
|
2216
2355
|
fetch the deposit address for a currency associated with self account
|
2217
2356
|
:param str code: unified currency code
|
@@ -2221,7 +2360,7 @@ class delta(Exchange, ImplicitAPI):
|
|
2221
2360
|
"""
|
2222
2361
|
self.load_markets()
|
2223
2362
|
currency = self.currency(code)
|
2224
|
-
request = {
|
2363
|
+
request: dict = {
|
2225
2364
|
'asset_symbol': currency['id'],
|
2226
2365
|
}
|
2227
2366
|
networkCode = self.safe_string_upper(params, 'network')
|
@@ -2246,10 +2385,10 @@ class delta(Exchange, ImplicitAPI):
|
|
2246
2385
|
# }
|
2247
2386
|
# }
|
2248
2387
|
#
|
2249
|
-
result = self.
|
2388
|
+
result = self.safe_dict(response, 'result', {})
|
2250
2389
|
return self.parse_deposit_address(result, currency)
|
2251
2390
|
|
2252
|
-
def parse_deposit_address(self, depositAddress, currency: Currency = None):
|
2391
|
+
def parse_deposit_address(self, depositAddress, currency: Currency = None) -> DepositAddress:
|
2253
2392
|
#
|
2254
2393
|
# {
|
2255
2394
|
# "id": 1915615,
|
@@ -2269,17 +2408,19 @@ class delta(Exchange, ImplicitAPI):
|
|
2269
2408
|
networkId = self.safe_string(depositAddress, 'network')
|
2270
2409
|
self.check_address(address)
|
2271
2410
|
return {
|
2411
|
+
'info': depositAddress,
|
2272
2412
|
'currency': self.safe_currency_code(marketId, currency),
|
2413
|
+
'network': self.network_id_to_code(networkId),
|
2273
2414
|
'address': address,
|
2274
2415
|
'tag': self.safe_string(depositAddress, 'memo'),
|
2275
|
-
'network': self.network_id_to_code(networkId),
|
2276
|
-
'info': depositAddress,
|
2277
2416
|
}
|
2278
2417
|
|
2279
|
-
def fetch_funding_rate(self, symbol: str, params={}):
|
2418
|
+
def fetch_funding_rate(self, symbol: str, params={}) -> FundingRate:
|
2280
2419
|
"""
|
2281
2420
|
fetch the current funding rate
|
2282
|
-
|
2421
|
+
|
2422
|
+
https://docs.delta.exchange/#get-ticker-for-a-product-by-symbol
|
2423
|
+
|
2283
2424
|
:param str symbol: unified market symbol
|
2284
2425
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2285
2426
|
:returns dict: a `funding rate structure <https://docs.ccxt.com/#/?id=funding-rate-structure>`
|
@@ -2288,7 +2429,7 @@ class delta(Exchange, ImplicitAPI):
|
|
2288
2429
|
market = self.market(symbol)
|
2289
2430
|
if not market['swap']:
|
2290
2431
|
raise BadSymbol(self.id + ' fetchFundingRate() supports swap contracts only')
|
2291
|
-
request = {
|
2432
|
+
request: dict = {
|
2292
2433
|
'symbol': market['id'],
|
2293
2434
|
}
|
2294
2435
|
response = self.publicGetTickersSymbol(self.extend(request, params))
|
@@ -2337,20 +2478,22 @@ class delta(Exchange, ImplicitAPI):
|
|
2337
2478
|
# "success": True
|
2338
2479
|
# }
|
2339
2480
|
#
|
2340
|
-
result = self.
|
2481
|
+
result = self.safe_dict(response, 'result', {})
|
2341
2482
|
return self.parse_funding_rate(result, market)
|
2342
2483
|
|
2343
|
-
def fetch_funding_rates(self, symbols: Strings = None, params={}):
|
2484
|
+
def fetch_funding_rates(self, symbols: Strings = None, params={}) -> FundingRates:
|
2344
2485
|
"""
|
2345
2486
|
fetch the funding rate for multiple markets
|
2346
|
-
|
2487
|
+
|
2488
|
+
https://docs.delta.exchange/#get-tickers-for-products
|
2489
|
+
|
2347
2490
|
:param str[]|None symbols: list of unified market symbols
|
2348
2491
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2349
|
-
:returns dict: a
|
2492
|
+
:returns dict[]: a list of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rates-structure>`, indexed by market symbols
|
2350
2493
|
"""
|
2351
2494
|
self.load_markets()
|
2352
2495
|
symbols = self.market_symbols(symbols)
|
2353
|
-
request = {
|
2496
|
+
request: dict = {
|
2354
2497
|
'contract_types': 'perpetual_futures',
|
2355
2498
|
}
|
2356
2499
|
response = self.publicGetTickers(self.extend(request, params))
|
@@ -2401,11 +2544,10 @@ class delta(Exchange, ImplicitAPI):
|
|
2401
2544
|
# "success":true
|
2402
2545
|
# }
|
2403
2546
|
#
|
2404
|
-
rates = self.
|
2405
|
-
|
2406
|
-
return self.filter_by_array(result, 'symbol', symbols)
|
2547
|
+
rates = self.safe_list(response, 'result', [])
|
2548
|
+
return self.parse_funding_rates(rates, symbols)
|
2407
2549
|
|
2408
|
-
def parse_funding_rate(self, contract, market: Market = None):
|
2550
|
+
def parse_funding_rate(self, contract, market: Market = None) -> FundingRate:
|
2409
2551
|
#
|
2410
2552
|
# {
|
2411
2553
|
# "close": 30600.5,
|
@@ -2470,12 +2612,15 @@ class delta(Exchange, ImplicitAPI):
|
|
2470
2612
|
'previousFundingRate': None,
|
2471
2613
|
'previousFundingTimestamp': None,
|
2472
2614
|
'previousFundingDatetime': None,
|
2615
|
+
'interval': None,
|
2473
2616
|
}
|
2474
2617
|
|
2475
|
-
def add_margin(self, symbol: str, amount, params={}):
|
2618
|
+
def add_margin(self, symbol: str, amount: float, params={}) -> MarginModification:
|
2476
2619
|
"""
|
2477
2620
|
add margin
|
2478
|
-
|
2621
|
+
|
2622
|
+
https://docs.delta.exchange/#add-remove-position-margin
|
2623
|
+
|
2479
2624
|
:param str symbol: unified market symbol
|
2480
2625
|
:param float amount: amount of margin to add
|
2481
2626
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -2483,10 +2628,12 @@ class delta(Exchange, ImplicitAPI):
|
|
2483
2628
|
"""
|
2484
2629
|
return self.modify_margin_helper(symbol, amount, 'add', params)
|
2485
2630
|
|
2486
|
-
def reduce_margin(self, symbol: str, amount, params={}):
|
2631
|
+
def reduce_margin(self, symbol: str, amount: float, params={}) -> MarginModification:
|
2487
2632
|
"""
|
2488
2633
|
remove margin from a position
|
2489
|
-
|
2634
|
+
|
2635
|
+
https://docs.delta.exchange/#add-remove-position-margin
|
2636
|
+
|
2490
2637
|
:param str symbol: unified market symbol
|
2491
2638
|
:param float amount: the amount of margin to remove
|
2492
2639
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -2494,13 +2641,13 @@ class delta(Exchange, ImplicitAPI):
|
|
2494
2641
|
"""
|
2495
2642
|
return self.modify_margin_helper(symbol, amount, 'reduce', params)
|
2496
2643
|
|
2497
|
-
def modify_margin_helper(self, symbol: str, amount, type, params={}):
|
2644
|
+
def modify_margin_helper(self, symbol: str, amount, type, params={}) -> MarginModification:
|
2498
2645
|
self.load_markets()
|
2499
2646
|
market = self.market(symbol)
|
2500
2647
|
amount = str(amount)
|
2501
2648
|
if type == 'reduce':
|
2502
2649
|
amount = Precise.string_mul(amount, '-1')
|
2503
|
-
request = {
|
2650
|
+
request: dict = {
|
2504
2651
|
'product_id': market['numericId'],
|
2505
2652
|
'delta_margin': amount,
|
2506
2653
|
}
|
@@ -2528,10 +2675,10 @@ class delta(Exchange, ImplicitAPI):
|
|
2528
2675
|
# "success": True
|
2529
2676
|
# }
|
2530
2677
|
#
|
2531
|
-
result = self.
|
2678
|
+
result = self.safe_dict(response, 'result', {})
|
2532
2679
|
return self.parse_margin_modification(result, market)
|
2533
2680
|
|
2534
|
-
def parse_margin_modification(self, data, market: Market = None):
|
2681
|
+
def parse_margin_modification(self, data: dict, market: Market = None) -> MarginModification:
|
2535
2682
|
#
|
2536
2683
|
# {
|
2537
2684
|
# "auto_topup": False,
|
@@ -2556,18 +2703,23 @@ class delta(Exchange, ImplicitAPI):
|
|
2556
2703
|
market = self.safe_market(marketId, market)
|
2557
2704
|
return {
|
2558
2705
|
'info': data,
|
2706
|
+
'symbol': market['symbol'],
|
2559
2707
|
'type': None,
|
2708
|
+
'marginMode': 'isolated',
|
2560
2709
|
'amount': None,
|
2561
2710
|
'total': self.safe_number(data, 'margin'),
|
2562
2711
|
'code': None,
|
2563
|
-
'symbol': market['symbol'],
|
2564
2712
|
'status': None,
|
2713
|
+
'timestamp': None,
|
2714
|
+
'datetime': None,
|
2565
2715
|
}
|
2566
2716
|
|
2567
2717
|
def fetch_open_interest(self, symbol: str, params={}):
|
2568
2718
|
"""
|
2569
2719
|
retrieves the open interest of a derivative market
|
2570
|
-
|
2720
|
+
|
2721
|
+
https://docs.delta.exchange/#get-ticker-for-a-product-by-symbol
|
2722
|
+
|
2571
2723
|
:param str symbol: unified market symbol
|
2572
2724
|
:param dict [params]: exchange specific parameters
|
2573
2725
|
:returns dict} an open interest structure{@link https://docs.ccxt.com/#/?id=open-interest-structure:
|
@@ -2576,7 +2728,7 @@ class delta(Exchange, ImplicitAPI):
|
|
2576
2728
|
market = self.market(symbol)
|
2577
2729
|
if not market['contract']:
|
2578
2730
|
raise BadRequest(self.id + ' fetchOpenInterest() supports contract markets only')
|
2579
|
-
request = {
|
2731
|
+
request: dict = {
|
2580
2732
|
'symbol': market['id'],
|
2581
2733
|
}
|
2582
2734
|
response = self.publicGetTickersSymbol(self.extend(request, params))
|
@@ -2632,7 +2784,7 @@ class delta(Exchange, ImplicitAPI):
|
|
2632
2784
|
# "success": True
|
2633
2785
|
# }
|
2634
2786
|
#
|
2635
|
-
result = self.
|
2787
|
+
result = self.safe_dict(response, 'result', {})
|
2636
2788
|
return self.parse_open_interest(result, market)
|
2637
2789
|
|
2638
2790
|
def parse_open_interest(self, interest, market: Market = None):
|
@@ -2701,14 +2853,16 @@ class delta(Exchange, ImplicitAPI):
|
|
2701
2853
|
def fetch_leverage(self, symbol: str, params={}) -> Leverage:
|
2702
2854
|
"""
|
2703
2855
|
fetch the set leverage for a market
|
2704
|
-
|
2856
|
+
|
2857
|
+
https://docs.delta.exchange/#get-order-leverage
|
2858
|
+
|
2705
2859
|
:param str symbol: unified market symbol
|
2706
2860
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2707
2861
|
:returns dict: a `leverage structure <https://docs.ccxt.com/#/?id=leverage-structure>`
|
2708
2862
|
"""
|
2709
2863
|
self.load_markets()
|
2710
2864
|
market = self.market(symbol)
|
2711
|
-
request = {
|
2865
|
+
request: dict = {
|
2712
2866
|
'product_id': market['numericId'],
|
2713
2867
|
}
|
2714
2868
|
response = self.privateGetProductsProductIdOrdersLeverage(self.extend(request, params))
|
@@ -2728,7 +2882,7 @@ class delta(Exchange, ImplicitAPI):
|
|
2728
2882
|
result = self.safe_dict(response, 'result', {})
|
2729
2883
|
return self.parse_leverage(result, market)
|
2730
2884
|
|
2731
|
-
def parse_leverage(self, leverage, market=None) -> Leverage:
|
2885
|
+
def parse_leverage(self, leverage: dict, market: Market = None) -> Leverage:
|
2732
2886
|
marketId = self.safe_string(leverage, 'index_symbol')
|
2733
2887
|
leverageValue = self.safe_integer(leverage, 'leverage')
|
2734
2888
|
return {
|
@@ -2742,7 +2896,9 @@ class delta(Exchange, ImplicitAPI):
|
|
2742
2896
|
def set_leverage(self, leverage: Int, symbol: Str = None, params={}):
|
2743
2897
|
"""
|
2744
2898
|
set the level of leverage for a market
|
2745
|
-
|
2899
|
+
|
2900
|
+
https://docs.delta.exchange/#change-order-leverage
|
2901
|
+
|
2746
2902
|
:param float leverage: the rate of leverage
|
2747
2903
|
:param str symbol: unified market symbol
|
2748
2904
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -2752,7 +2908,7 @@ class delta(Exchange, ImplicitAPI):
|
|
2752
2908
|
raise ArgumentsRequired(self.id + ' setLeverage() requires a symbol argument')
|
2753
2909
|
self.load_markets()
|
2754
2910
|
market = self.market(symbol)
|
2755
|
-
request = {
|
2911
|
+
request: dict = {
|
2756
2912
|
'product_id': market['numericId'],
|
2757
2913
|
'leverage': leverage,
|
2758
2914
|
}
|
@@ -2772,7 +2928,9 @@ class delta(Exchange, ImplicitAPI):
|
|
2772
2928
|
def fetch_settlement_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
2773
2929
|
"""
|
2774
2930
|
fetches historical settlement records
|
2775
|
-
|
2931
|
+
|
2932
|
+
https://docs.delta.exchange/#get-product-settlement-prices
|
2933
|
+
|
2776
2934
|
:param str symbol: unified market symbol of the settlement history
|
2777
2935
|
:param int [since]: timestamp in ms
|
2778
2936
|
:param int [limit]: number of records
|
@@ -2783,7 +2941,7 @@ class delta(Exchange, ImplicitAPI):
|
|
2783
2941
|
market = None
|
2784
2942
|
if symbol is not None:
|
2785
2943
|
market = self.market(symbol)
|
2786
|
-
request = {
|
2944
|
+
request: dict = {
|
2787
2945
|
'states': 'expired',
|
2788
2946
|
}
|
2789
2947
|
if limit is not None:
|
@@ -2847,7 +3005,7 @@ class delta(Exchange, ImplicitAPI):
|
|
2847
3005
|
# "success": True
|
2848
3006
|
# }
|
2849
3007
|
#
|
2850
|
-
result = self.
|
3008
|
+
result = self.safe_list(response, 'result', [])
|
2851
3009
|
settlements = self.parse_settlements(result, market)
|
2852
3010
|
sorted = self.sort_by(settlements, 'timestamp')
|
2853
3011
|
return self.filter_by_symbol_since_limit(sorted, market['symbol'], since, limit)
|
@@ -2925,14 +3083,16 @@ class delta(Exchange, ImplicitAPI):
|
|
2925
3083
|
def fetch_greeks(self, symbol: str, params={}) -> Greeks:
|
2926
3084
|
"""
|
2927
3085
|
fetches an option contracts greeks, financial metrics used to measure the factors that affect the price of an options contract
|
2928
|
-
|
3086
|
+
|
3087
|
+
https://docs.delta.exchange/#get-ticker-for-a-product-by-symbol
|
3088
|
+
|
2929
3089
|
:param str symbol: unified symbol of the market to fetch greeks for
|
2930
3090
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2931
3091
|
:returns dict: a `greeks structure <https://docs.ccxt.com/#/?id=greeks-structure>`
|
2932
3092
|
"""
|
2933
3093
|
self.load_markets()
|
2934
3094
|
market = self.market(symbol)
|
2935
|
-
request = {
|
3095
|
+
request: dict = {
|
2936
3096
|
'symbol': market['id'],
|
2937
3097
|
}
|
2938
3098
|
response = self.publicGetTickersSymbol(self.extend(request, params))
|
@@ -2988,10 +3148,10 @@ class delta(Exchange, ImplicitAPI):
|
|
2988
3148
|
# "success": True
|
2989
3149
|
# }
|
2990
3150
|
#
|
2991
|
-
result = self.
|
3151
|
+
result = self.safe_dict(response, 'result', {})
|
2992
3152
|
return self.parse_greeks(result, market)
|
2993
3153
|
|
2994
|
-
def parse_greeks(self, greeks, market: Market = None):
|
3154
|
+
def parse_greeks(self, greeks: dict, market: Market = None) -> Greeks:
|
2995
3155
|
#
|
2996
3156
|
# {
|
2997
3157
|
# "close": 6793.0,
|
@@ -3044,8 +3204,8 @@ class delta(Exchange, ImplicitAPI):
|
|
3044
3204
|
timestamp = self.safe_integer_product(greeks, 'timestamp', 0.001)
|
3045
3205
|
marketId = self.safe_string(greeks, 'symbol')
|
3046
3206
|
symbol = self.safe_symbol(marketId, market)
|
3047
|
-
stats = self.
|
3048
|
-
quotes = self.
|
3207
|
+
stats = self.safe_dict(greeks, 'greeks', {})
|
3208
|
+
quotes = self.safe_dict(greeks, 'quotes', {})
|
3049
3209
|
return {
|
3050
3210
|
'symbol': symbol,
|
3051
3211
|
'timestamp': timestamp,
|
@@ -3071,13 +3231,15 @@ class delta(Exchange, ImplicitAPI):
|
|
3071
3231
|
def close_all_positions(self, params={}) -> List[Position]:
|
3072
3232
|
"""
|
3073
3233
|
closes all open positions for a market type
|
3074
|
-
|
3234
|
+
|
3235
|
+
https://docs.delta.exchange/#close-all-positions
|
3236
|
+
|
3075
3237
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
3076
3238
|
:param int [params.user_id]: the users id
|
3077
3239
|
:returns dict[]: A list of `position structures <https://docs.ccxt.com/#/?id=position-structure>`
|
3078
3240
|
"""
|
3079
3241
|
self.load_markets()
|
3080
|
-
request = {
|
3242
|
+
request: dict = {
|
3081
3243
|
'close_all_portfolio': True,
|
3082
3244
|
'close_all_isolated': True,
|
3083
3245
|
# 'user_id': 12345,
|
@@ -3086,13 +3248,15 @@ class delta(Exchange, ImplicitAPI):
|
|
3086
3248
|
#
|
3087
3249
|
# {"result":{},"success":true}
|
3088
3250
|
#
|
3089
|
-
position = self.parse_position(self.
|
3251
|
+
position = self.parse_position(self.safe_dict(response, 'result', {}))
|
3090
3252
|
return [position]
|
3091
3253
|
|
3092
3254
|
def fetch_margin_mode(self, symbol: str, params={}) -> MarginMode:
|
3093
3255
|
"""
|
3094
3256
|
fetches the margin mode of a trading pair
|
3095
|
-
|
3257
|
+
|
3258
|
+
https://docs.delta.exchange/#get-user
|
3259
|
+
|
3096
3260
|
:param str symbol: unified symbol of the market to fetch the margin mode for
|
3097
3261
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
3098
3262
|
:returns dict: a `margin mode structure <https://docs.ccxt.com/#/?id=margin-mode-structure>`
|
@@ -3168,7 +3332,7 @@ class delta(Exchange, ImplicitAPI):
|
|
3168
3332
|
result = self.safe_dict(response, 'result', {})
|
3169
3333
|
return self.parse_margin_mode(result, market)
|
3170
3334
|
|
3171
|
-
def parse_margin_mode(self, marginMode, market=None) -> MarginMode:
|
3335
|
+
def parse_margin_mode(self, marginMode: dict, market=None) -> MarginMode:
|
3172
3336
|
symbol = None
|
3173
3337
|
if market is not None:
|
3174
3338
|
symbol = market['symbol']
|
@@ -3178,6 +3342,151 @@ class delta(Exchange, ImplicitAPI):
|
|
3178
3342
|
'marginMode': self.safe_string(marginMode, 'margin_mode'),
|
3179
3343
|
}
|
3180
3344
|
|
3345
|
+
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
|
+
self.load_markets()
|
3356
|
+
market = self.market(symbol)
|
3357
|
+
request: dict = {
|
3358
|
+
'symbol': market['id'],
|
3359
|
+
}
|
3360
|
+
response = 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
|
+
|
3181
3490
|
def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
|
3182
3491
|
requestPath = '/' + self.version + '/' + self.implode_params(path, params)
|
3183
3492
|
url = self.urls['api'][api] + requestPath
|
@@ -3193,7 +3502,7 @@ class delta(Exchange, ImplicitAPI):
|
|
3193
3502
|
'timestamp': timestamp,
|
3194
3503
|
}
|
3195
3504
|
auth = method + timestamp + requestPath
|
3196
|
-
if
|
3505
|
+
if method == 'GET':
|
3197
3506
|
if query:
|
3198
3507
|
queryString = '?' + self.urlencode(query)
|
3199
3508
|
auth += queryString
|
@@ -3206,13 +3515,13 @@ class delta(Exchange, ImplicitAPI):
|
|
3206
3515
|
headers['signature'] = signature
|
3207
3516
|
return {'url': url, 'method': method, 'body': body, 'headers': headers}
|
3208
3517
|
|
3209
|
-
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):
|
3210
3519
|
if response is None:
|
3211
3520
|
return None
|
3212
3521
|
#
|
3213
3522
|
# {"error":{"code":"insufficient_margin","context":{"available_balance":"0.000000000000000000","required_additional_balance":"1.618626000000000000000000000"}},"success":false}
|
3214
3523
|
#
|
3215
|
-
error = self.
|
3524
|
+
error = self.safe_dict(response, 'error', {})
|
3216
3525
|
errorCode = self.safe_string(error, 'code')
|
3217
3526
|
if errorCode is not None:
|
3218
3527
|
feedback = self.id + ' ' + body
|