ccxt 4.2.79__py2.py3-none-any.whl → 4.2.81__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.

Potentially problematic release.


This version of ccxt might be problematic. Click here for more details.

ccxt/__init__.py CHANGED
@@ -22,7 +22,7 @@
22
22
 
23
23
  # ----------------------------------------------------------------------------
24
24
 
25
- __version__ = '4.2.79'
25
+ __version__ = '4.2.81'
26
26
 
27
27
  # ----------------------------------------------------------------------------
28
28
 
ccxt/abstract/upbit.py CHANGED
@@ -9,6 +9,7 @@ class ImplicitAPI:
9
9
  public_get_candles_minutes_1 = publicGetCandlesMinutes1 = Entry('candles/minutes/1', 'public', 'GET', {})
10
10
  public_get_candles_minutes_3 = publicGetCandlesMinutes3 = Entry('candles/minutes/3', 'public', 'GET', {})
11
11
  public_get_candles_minutes_5 = publicGetCandlesMinutes5 = Entry('candles/minutes/5', 'public', 'GET', {})
12
+ public_get_candles_minutes_10 = publicGetCandlesMinutes10 = Entry('candles/minutes/10', 'public', 'GET', {})
12
13
  public_get_candles_minutes_15 = publicGetCandlesMinutes15 = Entry('candles/minutes/15', 'public', 'GET', {})
13
14
  public_get_candles_minutes_30 = publicGetCandlesMinutes30 = Entry('candles/minutes/30', 'public', 'GET', {})
14
15
  public_get_candles_minutes_60 = publicGetCandlesMinutes60 = Entry('candles/minutes/60', 'public', 'GET', {})
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.2.79'
7
+ __version__ = '4.2.81'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  # -----------------------------------------------------------------------------
4
4
 
5
- __version__ = '4.2.79'
5
+ __version__ = '4.2.81'
6
6
 
7
7
  # -----------------------------------------------------------------------------
8
8
 
@@ -982,6 +982,9 @@ class Exchange(BaseExchange):
982
982
  async def fetch_order_books(self, symbols: List[str] = None, limit: Int = None, params={}):
983
983
  raise NotSupported(self.id + ' fetchOrderBooks() is not supported yet')
984
984
 
985
+ async def watch_bids_asks(self, symbols: List[str] = None, params={}):
986
+ raise NotSupported(self.id + ' watchBidsAsks() is not supported yet')
987
+
985
988
  async def watch_tickers(self, symbols: List[str] = None, params={}):
986
989
  raise NotSupported(self.id + ' watchTickers() is not supported yet')
987
990
 
@@ -1284,6 +1287,12 @@ class Exchange(BaseExchange):
1284
1287
  async def fetch_greeks(self, symbol: str, params={}):
1285
1288
  raise NotSupported(self.id + ' fetchGreeks() is not supported yet')
1286
1289
 
1290
+ async def fetch_option_chain(self, code: str, params={}):
1291
+ raise NotSupported(self.id + ' fetchOptionChain() is not supported yet')
1292
+
1293
+ async def fetch_option(self, symbol: str, params={}):
1294
+ raise NotSupported(self.id + ' fetchOption() is not supported yet')
1295
+
1287
1296
  async def fetch_deposits_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
1288
1297
  """
1289
1298
  fetch history of deposits and withdrawals
@@ -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,
@@ -2423,13 +2425,13 @@ class binance(Exchange, ImplicitAPI):
2423
2425
  },
2424
2426
  })
2425
2427
 
2426
- def is_inverse(self, type, subType=None) -> bool:
2428
+ def is_inverse(self, type: str, subType: Str = None) -> bool:
2427
2429
  if subType is None:
2428
- return type == 'delivery'
2430
+ return(type == 'delivery')
2429
2431
  else:
2430
2432
  return subType == 'inverse'
2431
2433
 
2432
- def is_linear(self, type, subType=None) -> bool:
2434
+ def is_linear(self, type: str, subType: Str = None) -> bool:
2433
2435
  if subType is None:
2434
2436
  return(type == 'future') or (type == 'swap')
2435
2437
  else:
@@ -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
+ }
@@ -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':
@@ -6,7 +6,7 @@
6
6
  from ccxt.async_support.base.exchange import Exchange
7
7
  from ccxt.abstract.deribit import ImplicitAPI
8
8
  import hashlib
9
- from ccxt.base.types import Account, Balances, Currency, Greeks, Int, Market, MarketInterface, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
9
+ from ccxt.base.types import Account, Balances, Currency, Greeks, Int, Market, MarketInterface, Num, Option, OptionChain, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry
10
10
  from typing import List
11
11
  from ccxt.base.errors import ExchangeError
12
12
  from ccxt.base.errors import PermissionDenied
@@ -83,6 +83,8 @@ class deribit(Exchange, ImplicitAPI):
83
83
  'fetchMyTrades': True,
84
84
  'fetchOHLCV': True,
85
85
  'fetchOpenOrders': True,
86
+ 'fetchOption': True,
87
+ 'fetchOptionChain': True,
86
88
  'fetchOrder': True,
87
89
  'fetchOrderBook': True,
88
90
  'fetchOrders': False,
@@ -3270,6 +3272,155 @@ class deribit(Exchange, ImplicitAPI):
3270
3272
  'info': greeks,
3271
3273
  }
3272
3274
 
3275
+ async def fetch_option(self, symbol: str, params={}) -> Option:
3276
+ """
3277
+ fetches option data that is commonly found in an option chain
3278
+ :see: https://docs.deribit.com/#public-get_book_summary_by_instrument
3279
+ :param str symbol: unified market symbol
3280
+ :param dict [params]: extra parameters specific to the exchange API endpoint
3281
+ :returns dict: an `option chain structure <https://docs.ccxt.com/#/?id=option-chain-structure>`
3282
+ """
3283
+ await self.load_markets()
3284
+ market = self.market(symbol)
3285
+ request = {
3286
+ 'instrument_name': market['id'],
3287
+ }
3288
+ response = await self.publicGetGetBookSummaryByInstrument(self.extend(request, params))
3289
+ #
3290
+ # {
3291
+ # "jsonrpc": "2.0",
3292
+ # "result": [
3293
+ # {
3294
+ # "mid_price": 0.04025,
3295
+ # "volume_usd": 11045.12,
3296
+ # "quote_currency": "BTC",
3297
+ # "estimated_delivery_price": 65444.72,
3298
+ # "creation_timestamp": 1711100949273,
3299
+ # "base_currency": "BTC",
3300
+ # "underlying_index": "BTC-27DEC24",
3301
+ # "underlying_price": 73742.14,
3302
+ # "volume": 4.0,
3303
+ # "interest_rate": 0.0,
3304
+ # "price_change": -6.9767,
3305
+ # "open_interest": 274.2,
3306
+ # "ask_price": 0.042,
3307
+ # "bid_price": 0.0385,
3308
+ # "instrument_name": "BTC-27DEC24-240000-C",
3309
+ # "mark_price": 0.04007735,
3310
+ # "last": 0.04,
3311
+ # "low": 0.04,
3312
+ # "high": 0.043
3313
+ # }
3314
+ # ],
3315
+ # "usIn": 1711100949273223,
3316
+ # "usOut": 1711100949273580,
3317
+ # "usDiff": 357,
3318
+ # "testnet": False
3319
+ # }
3320
+ #
3321
+ result = self.safe_list(response, 'result', [])
3322
+ chain = self.safe_dict(result, 0, {})
3323
+ return self.parse_option(chain, None, market)
3324
+
3325
+ async def fetch_option_chain(self, code: str, params={}) -> OptionChain:
3326
+ """
3327
+ fetches data for an underlying asset that is commonly found in an option chain
3328
+ :see: https://docs.deribit.com/#public-get_book_summary_by_currency
3329
+ :param str currency: base currency to fetch an option chain for
3330
+ :param dict [params]: extra parameters specific to the exchange API endpoint
3331
+ :returns dict: a list of `option chain structures <https://docs.ccxt.com/#/?id=option-chain-structure>`
3332
+ """
3333
+ await self.load_markets()
3334
+ currency = self.currency(code)
3335
+ request = {
3336
+ 'currency': currency['id'],
3337
+ 'kind': 'option',
3338
+ }
3339
+ response = await self.publicGetGetBookSummaryByCurrency(self.extend(request, params))
3340
+ #
3341
+ # {
3342
+ # "jsonrpc": "2.0",
3343
+ # "result": [
3344
+ # {
3345
+ # "mid_price": 0.4075,
3346
+ # "volume_usd": 2836.83,
3347
+ # "quote_currency": "BTC",
3348
+ # "estimated_delivery_price": 65479.26,
3349
+ # "creation_timestamp": 1711101594477,
3350
+ # "base_currency": "BTC",
3351
+ # "underlying_index": "BTC-28JUN24",
3352
+ # "underlying_price": 68827.27,
3353
+ # "volume": 0.1,
3354
+ # "interest_rate": 0.0,
3355
+ # "price_change": 0.0,
3356
+ # "open_interest": 364.1,
3357
+ # "ask_price": 0.411,
3358
+ # "bid_price": 0.404,
3359
+ # "instrument_name": "BTC-28JUN24-42000-C",
3360
+ # "mark_price": 0.40752052,
3361
+ # "last": 0.423,
3362
+ # "low": 0.423,
3363
+ # "high": 0.423
3364
+ # }
3365
+ # ],
3366
+ # "usIn": 1711101594456388,
3367
+ # "usOut": 1711101594484065,
3368
+ # "usDiff": 27677,
3369
+ # "testnet": False
3370
+ # }
3371
+ #
3372
+ result = self.safe_list(response, 'result', [])
3373
+ return self.parse_option_chain(result, 'base_currency', 'instrument_name')
3374
+
3375
+ def parse_option(self, chain, currency: Currency = None, market: Market = None):
3376
+ #
3377
+ # {
3378
+ # "mid_price": 0.04025,
3379
+ # "volume_usd": 11045.12,
3380
+ # "quote_currency": "BTC",
3381
+ # "estimated_delivery_price": 65444.72,
3382
+ # "creation_timestamp": 1711100949273,
3383
+ # "base_currency": "BTC",
3384
+ # "underlying_index": "BTC-27DEC24",
3385
+ # "underlying_price": 73742.14,
3386
+ # "volume": 4.0,
3387
+ # "interest_rate": 0.0,
3388
+ # "price_change": -6.9767,
3389
+ # "open_interest": 274.2,
3390
+ # "ask_price": 0.042,
3391
+ # "bid_price": 0.0385,
3392
+ # "instrument_name": "BTC-27DEC24-240000-C",
3393
+ # "mark_price": 0.04007735,
3394
+ # "last": 0.04,
3395
+ # "low": 0.04,
3396
+ # "high": 0.043
3397
+ # }
3398
+ #
3399
+ marketId = self.safe_string(chain, 'instrument_name')
3400
+ market = self.safe_market(marketId, market)
3401
+ currencyId = self.safe_string(chain, 'base_currency')
3402
+ code = self.safe_currency_code(currencyId, currency)
3403
+ timestamp = self.safe_integer(chain, 'timestamp')
3404
+ return {
3405
+ 'info': chain,
3406
+ 'currency': code['code'],
3407
+ 'symbol': market['symbol'],
3408
+ 'timestamp': timestamp,
3409
+ 'datetime': self.iso8601(timestamp),
3410
+ 'impliedVolatility': None,
3411
+ 'openInterest': self.safe_number(chain, 'open_interest'),
3412
+ 'bidPrice': self.safe_number(chain, 'bid_price'),
3413
+ 'askPrice': self.safe_number(chain, 'ask_price'),
3414
+ 'midPrice': self.safe_number(chain, 'mid_price'),
3415
+ 'markPrice': self.safe_number(chain, 'mark_price'),
3416
+ 'lastPrice': self.safe_number(chain, 'last'),
3417
+ 'underlyingPrice': self.safe_number(chain, 'underlying_price'),
3418
+ 'change': None,
3419
+ 'percentage': self.safe_number(chain, 'price_change'),
3420
+ 'baseVolume': self.safe_number(chain, 'volume'),
3421
+ 'quoteVolume': self.safe_number(chain, 'volume_usd'),
3422
+ }
3423
+
3273
3424
  def nonce(self):
3274
3425
  return self.milliseconds()
3275
3426