ccxt 4.2.80__py2.py3-none-any.whl → 4.2.82__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 +1 -1
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/base/exchange.py +1 -1
- ccxt/async_support/binance.py +89 -1
- ccxt/async_support/bitrue.py +1 -1
- ccxt/async_support/bybit.py +174 -1
- ccxt/async_support/delta.py +146 -1
- ccxt/async_support/deribit.py +1 -1
- ccxt/async_support/gate.py +183 -1
- ccxt/async_support/hyperliquid.py +4 -4
- ccxt/async_support/okx.py +153 -35
- ccxt/base/exchange.py +1 -1
- ccxt/binance.py +89 -1
- ccxt/bitrue.py +1 -1
- ccxt/bybit.py +174 -1
- ccxt/delta.py +146 -1
- ccxt/deribit.py +1 -1
- ccxt/gate.py +183 -1
- ccxt/hyperliquid.py +4 -4
- ccxt/okx.py +153 -35
- ccxt/pro/__init__.py +1 -1
- {ccxt-4.2.80.dist-info → ccxt-4.2.82.dist-info}/METADATA +4 -4
- {ccxt-4.2.80.dist-info → ccxt-4.2.82.dist-info}/RECORD +25 -25
- {ccxt-4.2.80.dist-info → ccxt-4.2.82.dist-info}/WHEEL +0 -0
- {ccxt-4.2.80.dist-info → ccxt-4.2.82.dist-info}/top_level.txt +0 -0
ccxt/__init__.py
CHANGED
ccxt/async_support/__init__.py
CHANGED
ccxt/async_support/binance.py
CHANGED
@@ -8,7 +8,7 @@ from ccxt.abstract.binance import ImplicitAPI
|
|
8
8
|
import asyncio
|
9
9
|
import hashlib
|
10
10
|
import json
|
11
|
-
from ccxt.base.types import Balances, Currency, Greeks, Int, Leverage, Leverages, MarginMode, MarginModes, Market, MarketInterface, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
|
11
|
+
from ccxt.base.types import Balances, Currency, Greeks, Int, Leverage, Leverages, MarginMode, MarginModes, Market, MarketInterface, Num, Option, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
|
12
12
|
from typing import List
|
13
13
|
from ccxt.base.errors import ExchangeError
|
14
14
|
from ccxt.base.errors import PermissionDenied
|
@@ -134,6 +134,8 @@ class binance(Exchange, ImplicitAPI):
|
|
134
134
|
'fetchOpenInterestHistory': True,
|
135
135
|
'fetchOpenOrder': True,
|
136
136
|
'fetchOpenOrders': True,
|
137
|
+
'fetchOption': True,
|
138
|
+
'fetchOptionChain': False,
|
137
139
|
'fetchOrder': True,
|
138
140
|
'fetchOrderBook': True,
|
139
141
|
'fetchOrderBooks': False,
|
@@ -11411,3 +11413,89 @@ class binance(Exchange, ImplicitAPI):
|
|
11411
11413
|
'symbol': market['symbol'],
|
11412
11414
|
'marginMode': 'isolated' if isIsolated else 'cross',
|
11413
11415
|
}
|
11416
|
+
|
11417
|
+
async def fetch_option(self, symbol: str, params={}) -> Option:
|
11418
|
+
"""
|
11419
|
+
fetches option data that is commonly found in an option chain
|
11420
|
+
:see: https://binance-docs.github.io/apidocs/voptions/en/#24hr-ticker-price-change-statistics
|
11421
|
+
:param str symbol: unified market symbol
|
11422
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
11423
|
+
:returns dict: an `option chain structure <https://docs.ccxt.com/#/?id=option-chain-structure>`
|
11424
|
+
"""
|
11425
|
+
await self.load_markets()
|
11426
|
+
market = self.market(symbol)
|
11427
|
+
request = {
|
11428
|
+
'symbol': market['id'],
|
11429
|
+
}
|
11430
|
+
response = await self.eapiPublicGetTicker(self.extend(request, params))
|
11431
|
+
#
|
11432
|
+
# [
|
11433
|
+
# {
|
11434
|
+
# "symbol": "BTC-241227-80000-C",
|
11435
|
+
# "priceChange": "0",
|
11436
|
+
# "priceChangePercent": "0",
|
11437
|
+
# "lastPrice": "2750",
|
11438
|
+
# "lastQty": "0",
|
11439
|
+
# "open": "2750",
|
11440
|
+
# "high": "2750",
|
11441
|
+
# "low": "2750",
|
11442
|
+
# "volume": "0",
|
11443
|
+
# "amount": "0",
|
11444
|
+
# "bidPrice": "4880",
|
11445
|
+
# "askPrice": "0",
|
11446
|
+
# "openTime": 0,
|
11447
|
+
# "closeTime": 0,
|
11448
|
+
# "firstTradeId": 0,
|
11449
|
+
# "tradeCount": 0,
|
11450
|
+
# "strikePrice": "80000",
|
11451
|
+
# "exercisePrice": "63944.09893617"
|
11452
|
+
# }
|
11453
|
+
# ]
|
11454
|
+
#
|
11455
|
+
chain = self.safe_dict(response, 0, {})
|
11456
|
+
return self.parse_option(chain, None, market)
|
11457
|
+
|
11458
|
+
def parse_option(self, chain, currency: Currency = None, market: Market = None):
|
11459
|
+
#
|
11460
|
+
# {
|
11461
|
+
# "symbol": "BTC-241227-80000-C",
|
11462
|
+
# "priceChange": "0",
|
11463
|
+
# "priceChangePercent": "0",
|
11464
|
+
# "lastPrice": "2750",
|
11465
|
+
# "lastQty": "0",
|
11466
|
+
# "open": "2750",
|
11467
|
+
# "high": "2750",
|
11468
|
+
# "low": "2750",
|
11469
|
+
# "volume": "0",
|
11470
|
+
# "amount": "0",
|
11471
|
+
# "bidPrice": "4880",
|
11472
|
+
# "askPrice": "0",
|
11473
|
+
# "openTime": 0,
|
11474
|
+
# "closeTime": 0,
|
11475
|
+
# "firstTradeId": 0,
|
11476
|
+
# "tradeCount": 0,
|
11477
|
+
# "strikePrice": "80000",
|
11478
|
+
# "exercisePrice": "63944.09893617"
|
11479
|
+
# }
|
11480
|
+
#
|
11481
|
+
marketId = self.safe_string(chain, 'symbol')
|
11482
|
+
market = self.safe_market(marketId, market)
|
11483
|
+
return {
|
11484
|
+
'info': chain,
|
11485
|
+
'currency': None,
|
11486
|
+
'symbol': market['symbol'],
|
11487
|
+
'timestamp': None,
|
11488
|
+
'datetime': None,
|
11489
|
+
'impliedVolatility': None,
|
11490
|
+
'openInterest': None,
|
11491
|
+
'bidPrice': self.safe_number(chain, 'bidPrice'),
|
11492
|
+
'askPrice': self.safe_number(chain, 'askPrice'),
|
11493
|
+
'midPrice': None,
|
11494
|
+
'markPrice': None,
|
11495
|
+
'lastPrice': self.safe_number(chain, 'lastPrice'),
|
11496
|
+
'underlyingPrice': self.safe_number(chain, 'exercisePrice'),
|
11497
|
+
'change': self.safe_number(chain, 'priceChange'),
|
11498
|
+
'percentage': self.safe_number(chain, 'priceChangePercent'),
|
11499
|
+
'baseVolume': self.safe_number(chain, 'volume'),
|
11500
|
+
'quoteVolume': None,
|
11501
|
+
}
|
ccxt/async_support/bitrue.py
CHANGED
@@ -422,7 +422,7 @@ class bitrue(Exchange, ImplicitAPI):
|
|
422
422
|
'-1022': AuthenticationError, # {"code":-1022,"msg":"Signature for self request is not valid."}
|
423
423
|
'-1100': BadRequest, # createOrder(symbol, 1, asdf) -> 'Illegal characters found in parameter 'price'
|
424
424
|
'-1101': BadRequest, # Too many parameters; expected %s and received %s.
|
425
|
-
'-1102': BadRequest, # Param %s or %s must be sent, but both were empty
|
425
|
+
'-1102': BadRequest, # Param %s or %s must be sent, but both were empty # {"code":-1102,"msg":"timestamp IllegalArgumentException.","data":null}
|
426
426
|
'-1103': BadRequest, # An unknown parameter was sent.
|
427
427
|
'-1104': BadRequest, # Not all sent parameters were read, read 8 parameters but was sent 9
|
428
428
|
'-1105': BadRequest, # Parameter %s was empty.
|
ccxt/async_support/bybit.py
CHANGED
@@ -7,7 +7,7 @@ from ccxt.async_support.base.exchange import Exchange
|
|
7
7
|
from ccxt.abstract.bybit import ImplicitAPI
|
8
8
|
import asyncio
|
9
9
|
import hashlib
|
10
|
-
from ccxt.base.types import Balances, Currency, Greeks, Int, Leverage, Market, MarketInterface, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
|
10
|
+
from ccxt.base.types import Balances, Currency, Greeks, Int, Leverage, Market, MarketInterface, Num, Option, OptionChain, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
|
11
11
|
from typing import List
|
12
12
|
from ccxt.base.errors import ExchangeError
|
13
13
|
from ccxt.base.errors import PermissionDenied
|
@@ -107,6 +107,8 @@ class bybit(Exchange, ImplicitAPI):
|
|
107
107
|
'fetchOpenInterestHistory': True,
|
108
108
|
'fetchOpenOrder': True,
|
109
109
|
'fetchOpenOrders': True,
|
110
|
+
'fetchOption': True,
|
111
|
+
'fetchOptionChain': True,
|
110
112
|
'fetchOrder': False,
|
111
113
|
'fetchOrderBook': True,
|
112
114
|
'fetchOrders': False,
|
@@ -7632,6 +7634,177 @@ class bybit(Exchange, ImplicitAPI):
|
|
7632
7634
|
'rate': self.safe_number(income, 'feeRate'),
|
7633
7635
|
}
|
7634
7636
|
|
7637
|
+
async def fetch_option(self, symbol: str, params={}) -> Option:
|
7638
|
+
"""
|
7639
|
+
fetches option data that is commonly found in an option chain
|
7640
|
+
:see: https://bybit-exchange.github.io/docs/v5/market/tickers
|
7641
|
+
:param str symbol: unified market symbol
|
7642
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
7643
|
+
:returns dict: an `option chain structure <https://docs.ccxt.com/#/?id=option-chain-structure>`
|
7644
|
+
"""
|
7645
|
+
await self.load_markets()
|
7646
|
+
market = self.market(symbol)
|
7647
|
+
request = {
|
7648
|
+
'category': 'option',
|
7649
|
+
'symbol': market['id'],
|
7650
|
+
}
|
7651
|
+
response = await self.publicGetV5MarketTickers(self.extend(request, params))
|
7652
|
+
#
|
7653
|
+
# {
|
7654
|
+
# "retCode": 0,
|
7655
|
+
# "retMsg": "SUCCESS",
|
7656
|
+
# "result": {
|
7657
|
+
# "category": "option",
|
7658
|
+
# "list": [
|
7659
|
+
# {
|
7660
|
+
# "symbol": "BTC-27DEC24-55000-P",
|
7661
|
+
# "bid1Price": "0",
|
7662
|
+
# "bid1Size": "0",
|
7663
|
+
# "bid1Iv": "0",
|
7664
|
+
# "ask1Price": "0",
|
7665
|
+
# "ask1Size": "0",
|
7666
|
+
# "ask1Iv": "0",
|
7667
|
+
# "lastPrice": "10980",
|
7668
|
+
# "highPrice24h": "0",
|
7669
|
+
# "lowPrice24h": "0",
|
7670
|
+
# "markPrice": "11814.66756236",
|
7671
|
+
# "indexPrice": "63838.92",
|
7672
|
+
# "markIv": "0.8866",
|
7673
|
+
# "underlyingPrice": "71690.55303594",
|
7674
|
+
# "openInterest": "0.01",
|
7675
|
+
# "turnover24h": "0",
|
7676
|
+
# "volume24h": "0",
|
7677
|
+
# "totalVolume": "2",
|
7678
|
+
# "totalTurnover": "78719",
|
7679
|
+
# "delta": "-0.23284954",
|
7680
|
+
# "gamma": "0.0000055",
|
7681
|
+
# "vega": "191.70757975",
|
7682
|
+
# "theta": "-30.43617927",
|
7683
|
+
# "predictedDeliveryPrice": "0",
|
7684
|
+
# "change24h": "0"
|
7685
|
+
# }
|
7686
|
+
# ]
|
7687
|
+
# },
|
7688
|
+
# "retExtInfo": {},
|
7689
|
+
# "time": 1711162003672
|
7690
|
+
# }
|
7691
|
+
#
|
7692
|
+
result = self.safe_dict(response, 'result', {})
|
7693
|
+
resultList = self.safe_list(result, 'list', [])
|
7694
|
+
chain = self.safe_dict(resultList, 0, {})
|
7695
|
+
return self.parse_option(chain, None, market)
|
7696
|
+
|
7697
|
+
async def fetch_option_chain(self, code: str, params={}) -> OptionChain:
|
7698
|
+
"""
|
7699
|
+
fetches data for an underlying asset that is commonly found in an option chain
|
7700
|
+
:see: https://bybit-exchange.github.io/docs/v5/market/tickers
|
7701
|
+
:param str currency: base currency to fetch an option chain for
|
7702
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
7703
|
+
:returns dict: a list of `option chain structures <https://docs.ccxt.com/#/?id=option-chain-structure>`
|
7704
|
+
"""
|
7705
|
+
await self.load_markets()
|
7706
|
+
currency = self.currency(code)
|
7707
|
+
request = {
|
7708
|
+
'category': 'option',
|
7709
|
+
'baseCoin': currency['id'],
|
7710
|
+
}
|
7711
|
+
response = await self.publicGetV5MarketTickers(self.extend(request, params))
|
7712
|
+
#
|
7713
|
+
# {
|
7714
|
+
# "retCode": 0,
|
7715
|
+
# "retMsg": "SUCCESS",
|
7716
|
+
# "result": {
|
7717
|
+
# "category": "option",
|
7718
|
+
# "list": [
|
7719
|
+
# {
|
7720
|
+
# "symbol": "BTC-27DEC24-55000-P",
|
7721
|
+
# "bid1Price": "0",
|
7722
|
+
# "bid1Size": "0",
|
7723
|
+
# "bid1Iv": "0",
|
7724
|
+
# "ask1Price": "0",
|
7725
|
+
# "ask1Size": "0",
|
7726
|
+
# "ask1Iv": "0",
|
7727
|
+
# "lastPrice": "10980",
|
7728
|
+
# "highPrice24h": "0",
|
7729
|
+
# "lowPrice24h": "0",
|
7730
|
+
# "markPrice": "11814.66756236",
|
7731
|
+
# "indexPrice": "63838.92",
|
7732
|
+
# "markIv": "0.8866",
|
7733
|
+
# "underlyingPrice": "71690.55303594",
|
7734
|
+
# "openInterest": "0.01",
|
7735
|
+
# "turnover24h": "0",
|
7736
|
+
# "volume24h": "0",
|
7737
|
+
# "totalVolume": "2",
|
7738
|
+
# "totalTurnover": "78719",
|
7739
|
+
# "delta": "-0.23284954",
|
7740
|
+
# "gamma": "0.0000055",
|
7741
|
+
# "vega": "191.70757975",
|
7742
|
+
# "theta": "-30.43617927",
|
7743
|
+
# "predictedDeliveryPrice": "0",
|
7744
|
+
# "change24h": "0"
|
7745
|
+
# },
|
7746
|
+
# ]
|
7747
|
+
# },
|
7748
|
+
# "retExtInfo": {},
|
7749
|
+
# "time": 1711162003672
|
7750
|
+
# }
|
7751
|
+
#
|
7752
|
+
result = self.safe_dict(response, 'result', {})
|
7753
|
+
resultList = self.safe_list(result, 'list', [])
|
7754
|
+
return self.parse_option_chain(resultList, None, 'symbol')
|
7755
|
+
|
7756
|
+
def parse_option(self, chain, currency: Currency = None, market: Market = None):
|
7757
|
+
#
|
7758
|
+
# {
|
7759
|
+
# "symbol": "BTC-27DEC24-55000-P",
|
7760
|
+
# "bid1Price": "0",
|
7761
|
+
# "bid1Size": "0",
|
7762
|
+
# "bid1Iv": "0",
|
7763
|
+
# "ask1Price": "0",
|
7764
|
+
# "ask1Size": "0",
|
7765
|
+
# "ask1Iv": "0",
|
7766
|
+
# "lastPrice": "10980",
|
7767
|
+
# "highPrice24h": "0",
|
7768
|
+
# "lowPrice24h": "0",
|
7769
|
+
# "markPrice": "11814.66756236",
|
7770
|
+
# "indexPrice": "63838.92",
|
7771
|
+
# "markIv": "0.8866",
|
7772
|
+
# "underlyingPrice": "71690.55303594",
|
7773
|
+
# "openInterest": "0.01",
|
7774
|
+
# "turnover24h": "0",
|
7775
|
+
# "volume24h": "0",
|
7776
|
+
# "totalVolume": "2",
|
7777
|
+
# "totalTurnover": "78719",
|
7778
|
+
# "delta": "-0.23284954",
|
7779
|
+
# "gamma": "0.0000055",
|
7780
|
+
# "vega": "191.70757975",
|
7781
|
+
# "theta": "-30.43617927",
|
7782
|
+
# "predictedDeliveryPrice": "0",
|
7783
|
+
# "change24h": "0"
|
7784
|
+
# }
|
7785
|
+
#
|
7786
|
+
marketId = self.safe_string(chain, 'symbol')
|
7787
|
+
market = self.safe_market(marketId, market)
|
7788
|
+
return {
|
7789
|
+
'info': chain,
|
7790
|
+
'currency': None,
|
7791
|
+
'symbol': market['symbol'],
|
7792
|
+
'timestamp': None,
|
7793
|
+
'datetime': None,
|
7794
|
+
'impliedVolatility': self.safe_number(chain, 'markIv'),
|
7795
|
+
'openInterest': self.safe_number(chain, 'openInterest'),
|
7796
|
+
'bidPrice': self.safe_number(chain, 'bid1Price'),
|
7797
|
+
'askPrice': self.safe_number(chain, 'ask1Price'),
|
7798
|
+
'midPrice': None,
|
7799
|
+
'markPrice': self.safe_number(chain, 'markPrice'),
|
7800
|
+
'lastPrice': self.safe_number(chain, 'lastPrice'),
|
7801
|
+
'underlyingPrice': self.safe_number(chain, 'underlyingPrice'),
|
7802
|
+
'change': self.safe_number(chain, 'change24h'),
|
7803
|
+
'percentage': None,
|
7804
|
+
'baseVolume': self.safe_number(chain, 'totalVolume'),
|
7805
|
+
'quoteVolume': None,
|
7806
|
+
}
|
7807
|
+
|
7635
7808
|
def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
|
7636
7809
|
url = self.implode_hostname(self.urls['api'][api]) + '/' + path
|
7637
7810
|
if api == 'public':
|
ccxt/async_support/delta.py
CHANGED
@@ -6,7 +6,7 @@
|
|
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, Currency, Greeks, Int, Leverage, MarginMode, Market, MarketInterface, Num, Option, Order, OrderBook, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import ArgumentsRequired
|
@@ -71,6 +71,8 @@ class delta(Exchange, ImplicitAPI):
|
|
71
71
|
'fetchOHLCV': True,
|
72
72
|
'fetchOpenInterest': True,
|
73
73
|
'fetchOpenOrders': True,
|
74
|
+
'fetchOption': True,
|
75
|
+
'fetchOptionChain': False,
|
74
76
|
'fetchOrderBook': True,
|
75
77
|
'fetchPosition': True,
|
76
78
|
'fetchPositionMode': False,
|
@@ -3192,6 +3194,149 @@ class delta(Exchange, ImplicitAPI):
|
|
3192
3194
|
'marginMode': self.safe_string(marginMode, 'margin_mode'),
|
3193
3195
|
}
|
3194
3196
|
|
3197
|
+
async def fetch_option(self, symbol: str, params={}) -> Option:
|
3198
|
+
"""
|
3199
|
+
fetches option data that is commonly found in an option chain
|
3200
|
+
:see: https://docs.delta.exchange/#get-ticker-for-a-product-by-symbol
|
3201
|
+
:param str symbol: unified market symbol
|
3202
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
3203
|
+
:returns dict: an `option chain structure <https://docs.ccxt.com/#/?id=option-chain-structure>`
|
3204
|
+
"""
|
3205
|
+
await self.load_markets()
|
3206
|
+
market = self.market(symbol)
|
3207
|
+
request = {
|
3208
|
+
'symbol': market['id'],
|
3209
|
+
}
|
3210
|
+
response = await self.publicGetTickersSymbol(self.extend(request, params))
|
3211
|
+
#
|
3212
|
+
# {
|
3213
|
+
# "result": {
|
3214
|
+
# "close": 6793.0,
|
3215
|
+
# "contract_type": "call_options",
|
3216
|
+
# "greeks": {
|
3217
|
+
# "delta": "0.94739174",
|
3218
|
+
# "gamma": "0.00002206",
|
3219
|
+
# "rho": "11.00890725",
|
3220
|
+
# "spot": "36839.58124652",
|
3221
|
+
# "theta": "-18.18365310",
|
3222
|
+
# "vega": "7.85209698"
|
3223
|
+
# },
|
3224
|
+
# "high": 7556.0,
|
3225
|
+
# "low": 6793.0,
|
3226
|
+
# "mark_price": "6955.70698909",
|
3227
|
+
# "mark_vol": "0.66916863",
|
3228
|
+
# "oi": "1.8980",
|
3229
|
+
# "oi_change_usd_6h": "110.4600",
|
3230
|
+
# "oi_contracts": "1898",
|
3231
|
+
# "oi_value": "1.8980",
|
3232
|
+
# "oi_value_symbol": "BTC",
|
3233
|
+
# "oi_value_usd": "69940.7319",
|
3234
|
+
# "open": 7.2e3,
|
3235
|
+
# "price_band": {
|
3236
|
+
# "lower_limit": "5533.89814767",
|
3237
|
+
# "upper_limit": "11691.37688371"
|
3238
|
+
# },
|
3239
|
+
# "product_id": 129508,
|
3240
|
+
# "quotes": {
|
3241
|
+
# "ask_iv": "0.90180438",
|
3242
|
+
# "ask_size": "1898",
|
3243
|
+
# "best_ask": "7210",
|
3244
|
+
# "best_bid": "6913",
|
3245
|
+
# "bid_iv": "0.60881706",
|
3246
|
+
# "bid_size": "3163",
|
3247
|
+
# "impact_mid_price": null,
|
3248
|
+
# "mark_iv": "0.66973549"
|
3249
|
+
# },
|
3250
|
+
# "size": 5,
|
3251
|
+
# "spot_price": "36839.58153868",
|
3252
|
+
# "strike_price": "30000",
|
3253
|
+
# "symbol": "C-BTC-30000-241123",
|
3254
|
+
# "timestamp": 1699584998504530,
|
3255
|
+
# "turnover": 184.41206804,
|
3256
|
+
# "turnover_symbol": "USDT",
|
3257
|
+
# "turnover_usd": 184.41206804,
|
3258
|
+
# "volume": 0.005
|
3259
|
+
# },
|
3260
|
+
# "success": True
|
3261
|
+
# }
|
3262
|
+
#
|
3263
|
+
result = self.safe_dict(response, 'result', {})
|
3264
|
+
return self.parse_option(result, None, market)
|
3265
|
+
|
3266
|
+
def parse_option(self, chain, currency: Currency = None, market: Market = None):
|
3267
|
+
#
|
3268
|
+
# {
|
3269
|
+
# "close": 6793.0,
|
3270
|
+
# "contract_type": "call_options",
|
3271
|
+
# "greeks": {
|
3272
|
+
# "delta": "0.94739174",
|
3273
|
+
# "gamma": "0.00002206",
|
3274
|
+
# "rho": "11.00890725",
|
3275
|
+
# "spot": "36839.58124652",
|
3276
|
+
# "theta": "-18.18365310",
|
3277
|
+
# "vega": "7.85209698"
|
3278
|
+
# },
|
3279
|
+
# "high": 7556.0,
|
3280
|
+
# "low": 6793.0,
|
3281
|
+
# "mark_price": "6955.70698909",
|
3282
|
+
# "mark_vol": "0.66916863",
|
3283
|
+
# "oi": "1.8980",
|
3284
|
+
# "oi_change_usd_6h": "110.4600",
|
3285
|
+
# "oi_contracts": "1898",
|
3286
|
+
# "oi_value": "1.8980",
|
3287
|
+
# "oi_value_symbol": "BTC",
|
3288
|
+
# "oi_value_usd": "69940.7319",
|
3289
|
+
# "open": 7.2e3,
|
3290
|
+
# "price_band": {
|
3291
|
+
# "lower_limit": "5533.89814767",
|
3292
|
+
# "upper_limit": "11691.37688371"
|
3293
|
+
# },
|
3294
|
+
# "product_id": 129508,
|
3295
|
+
# "quotes": {
|
3296
|
+
# "ask_iv": "0.90180438",
|
3297
|
+
# "ask_size": "1898",
|
3298
|
+
# "best_ask": "7210",
|
3299
|
+
# "best_bid": "6913",
|
3300
|
+
# "bid_iv": "0.60881706",
|
3301
|
+
# "bid_size": "3163",
|
3302
|
+
# "impact_mid_price": null,
|
3303
|
+
# "mark_iv": "0.66973549"
|
3304
|
+
# },
|
3305
|
+
# "size": 5,
|
3306
|
+
# "spot_price": "36839.58153868",
|
3307
|
+
# "strike_price": "30000",
|
3308
|
+
# "symbol": "C-BTC-30000-241123",
|
3309
|
+
# "timestamp": 1699584998504530,
|
3310
|
+
# "turnover": 184.41206804,
|
3311
|
+
# "turnover_symbol": "USDT",
|
3312
|
+
# "turnover_usd": 184.41206804,
|
3313
|
+
# "volume": 0.005
|
3314
|
+
# }
|
3315
|
+
#
|
3316
|
+
marketId = self.safe_string(chain, 'symbol')
|
3317
|
+
market = self.safe_market(marketId, market)
|
3318
|
+
quotes = self.safe_dict(chain, 'quotes', {})
|
3319
|
+
timestamp = self.safe_integer_product(chain, 'timestamp', 0.001)
|
3320
|
+
return {
|
3321
|
+
'info': chain,
|
3322
|
+
'currency': None,
|
3323
|
+
'symbol': market['symbol'],
|
3324
|
+
'timestamp': timestamp,
|
3325
|
+
'datetime': self.iso8601(timestamp),
|
3326
|
+
'impliedVolatility': self.safe_number(quotes, 'mark_iv'),
|
3327
|
+
'openInterest': self.safe_number(chain, 'oi'),
|
3328
|
+
'bidPrice': self.safe_number(quotes, 'best_bid'),
|
3329
|
+
'askPrice': self.safe_number(quotes, 'best_ask'),
|
3330
|
+
'midPrice': self.safe_number(quotes, 'impact_mid_price'),
|
3331
|
+
'markPrice': self.safe_number(chain, 'mark_price'),
|
3332
|
+
'lastPrice': None,
|
3333
|
+
'underlyingPrice': self.safe_number(chain, 'spot_price'),
|
3334
|
+
'change': None,
|
3335
|
+
'percentage': None,
|
3336
|
+
'baseVolume': self.safe_number(chain, 'volume'),
|
3337
|
+
'quoteVolume': None,
|
3338
|
+
}
|
3339
|
+
|
3195
3340
|
def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
|
3196
3341
|
requestPath = '/' + self.version + '/' + self.implode_params(path, params)
|
3197
3342
|
url = self.urls['api'][api] + requestPath
|
ccxt/async_support/deribit.py
CHANGED
@@ -3403,7 +3403,7 @@ class deribit(Exchange, ImplicitAPI):
|
|
3403
3403
|
timestamp = self.safe_integer(chain, 'timestamp')
|
3404
3404
|
return {
|
3405
3405
|
'info': chain,
|
3406
|
-
'currency': code
|
3406
|
+
'currency': code,
|
3407
3407
|
'symbol': market['symbol'],
|
3408
3408
|
'timestamp': timestamp,
|
3409
3409
|
'datetime': self.iso8601(timestamp),
|