ccxt 4.0.72__py2.py3-none-any.whl → 4.0.73__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 CHANGED
@@ -22,7 +22,7 @@
22
22
 
23
23
  # ----------------------------------------------------------------------------
24
24
 
25
- __version__ = '4.0.72'
25
+ __version__ = '4.0.73'
26
26
 
27
27
  # ----------------------------------------------------------------------------
28
28
 
ccxt/abstract/lbank2.py CHANGED
@@ -2,56 +2,60 @@ from ccxt.base.types import Entry
2
2
 
3
3
 
4
4
  class ImplicitAPI:
5
- public_get_currencypairs = publicGetCurrencyPairs = Entry('currencyPairs', 'public', 'GET', {'cost': 2.5})
6
- public_get_accuracy = publicGetAccuracy = Entry('accuracy', 'public', 'GET', {'cost': 2.5})
7
- public_get_usdtocny = publicGetUsdToCny = Entry('usdToCny', 'public', 'GET', {'cost': 2.5})
8
- public_get_withdrawconfigs = publicGetWithdrawConfigs = Entry('withdrawConfigs', 'public', 'GET', {'cost': 2.5})
9
- public_get_timestamp = publicGetTimestamp = Entry('timestamp', 'public', 'GET', {'cost': 2.5})
10
- public_get_ticker_24hr = publicGetTicker24hr = Entry('ticker/24hr', 'public', 'GET', {'cost': 2.5})
11
- public_get_ticker = publicGetTicker = Entry('ticker', 'public', 'GET', {'cost': 2.5})
12
- public_get_depth = publicGetDepth = Entry('depth', 'public', 'GET', {'cost': 2.5})
13
- public_get_incrdepth = publicGetIncrDepth = Entry('incrDepth', 'public', 'GET', {'cost': 2.5})
14
- public_get_trades = publicGetTrades = Entry('trades', 'public', 'GET', {'cost': 2.5})
15
- public_get_kline = publicGetKline = Entry('kline', 'public', 'GET', {'cost': 2.5})
16
- public_get_supplement_system_ping = publicGetSupplementSystemPing = Entry('supplement/system_ping', 'public', 'GET', {'cost': 2.5})
17
- public_get_supplement_incrdepth = publicGetSupplementIncrDepth = Entry('supplement/incrDepth', 'public', 'GET', {'cost': 2.5})
18
- public_get_supplement_trades = publicGetSupplementTrades = Entry('supplement/trades', 'public', 'GET', {'cost': 2.5})
19
- public_get_supplement_ticker_price = publicGetSupplementTickerPrice = Entry('supplement/ticker/price', 'public', 'GET', {'cost': 2.5})
20
- public_get_supplement_ticker_bookticker = publicGetSupplementTickerBookTicker = Entry('supplement/ticker/bookTicker', 'public', 'GET', {'cost': 2.5})
21
- public_post_supplement_system_status = publicPostSupplementSystemStatus = Entry('supplement/system_status', 'public', 'POST', {'cost': 2.5})
22
- private_post_user_info = privatePostUserInfo = Entry('user_info', 'private', 'POST', {'cost': 2.5})
23
- private_post_subscribe_get_key = privatePostSubscribeGetKey = Entry('subscribe/get_key', 'private', 'POST', {'cost': 2.5})
24
- private_post_subscribe_refresh_key = privatePostSubscribeRefreshKey = Entry('subscribe/refresh_key', 'private', 'POST', {'cost': 2.5})
25
- private_post_subscribe_destroy_key = privatePostSubscribeDestroyKey = Entry('subscribe/destroy_key', 'private', 'POST', {'cost': 2.5})
26
- private_post_get_deposit_address = privatePostGetDepositAddress = Entry('get_deposit_address', 'private', 'POST', {'cost': 2.5})
27
- private_post_deposit_history = privatePostDepositHistory = Entry('deposit_history', 'private', 'POST', {'cost': 2.5})
28
- private_post_create_order = privatePostCreateOrder = Entry('create_order', 'private', 'POST', {'cost': 1})
29
- private_post_batch_create_order = privatePostBatchCreateOrder = Entry('batch_create_order', 'private', 'POST', {'cost': 1})
30
- private_post_cancel_order = privatePostCancelOrder = Entry('cancel_order', 'private', 'POST', {'cost': 1})
31
- private_post_cancel_clientorders = privatePostCancelClientOrders = Entry('cancel_clientOrders', 'private', 'POST', {'cost': 1})
32
- private_post_orders_info = privatePostOrdersInfo = Entry('orders_info', 'private', 'POST', {'cost': 2.5})
33
- private_post_orders_info_history = privatePostOrdersInfoHistory = Entry('orders_info_history', 'private', 'POST', {'cost': 2.5})
34
- private_post_order_transaction_detail = privatePostOrderTransactionDetail = Entry('order_transaction_detail', 'private', 'POST', {'cost': 2.5})
35
- private_post_transaction_history = privatePostTransactionHistory = Entry('transaction_history', 'private', 'POST', {'cost': 2.5})
36
- private_post_orders_info_no_deal = privatePostOrdersInfoNoDeal = Entry('orders_info_no_deal', 'private', 'POST', {'cost': 2.5})
37
- private_post_withdraw = privatePostWithdraw = Entry('withdraw', 'private', 'POST', {'cost': 2.5})
38
- private_post_withdrawcancel = privatePostWithdrawCancel = Entry('withdrawCancel', 'private', 'POST', {'cost': 2.5})
39
- private_post_withdraws = privatePostWithdraws = Entry('withdraws', 'private', 'POST', {'cost': 2.5})
40
- private_post_supplement_user_info = privatePostSupplementUserInfo = Entry('supplement/user_info', 'private', 'POST', {'cost': 2.5})
41
- private_post_supplement_withdraw = privatePostSupplementWithdraw = Entry('supplement/withdraw', 'private', 'POST', {'cost': 2.5})
42
- private_post_supplement_deposit_history = privatePostSupplementDepositHistory = Entry('supplement/deposit_history', 'private', 'POST', {'cost': 2.5})
43
- private_post_supplement_withdraws = privatePostSupplementWithdraws = Entry('supplement/withdraws', 'private', 'POST', {'cost': 2.5})
44
- private_post_supplement_get_deposit_address = privatePostSupplementGetDepositAddress = Entry('supplement/get_deposit_address', 'private', 'POST', {'cost': 2.5})
45
- private_post_supplement_asset_detail = privatePostSupplementAssetDetail = Entry('supplement/asset_detail', 'private', 'POST', {'cost': 2.5})
46
- private_post_supplement_customer_trade_fee = privatePostSupplementCustomerTradeFee = Entry('supplement/customer_trade_fee', 'private', 'POST', {'cost': 2.5})
47
- private_post_supplement_api_restrictions = privatePostSupplementApiRestrictions = Entry('supplement/api_Restrictions', 'private', 'POST', {'cost': 2.5})
48
- private_post_supplement_system_ping = privatePostSupplementSystemPing = Entry('supplement/system_ping', 'private', 'POST', {'cost': 2.5})
49
- private_post_supplement_create_order_test = privatePostSupplementCreateOrderTest = Entry('supplement/create_order_test', 'private', 'POST', {'cost': 1})
50
- private_post_supplement_create_order = privatePostSupplementCreateOrder = Entry('supplement/create_order', 'private', 'POST', {'cost': 1})
51
- private_post_supplement_cancel_order = privatePostSupplementCancelOrder = Entry('supplement/cancel_order', 'private', 'POST', {'cost': 1})
52
- private_post_supplement_cancel_order_by_symbol = privatePostSupplementCancelOrderBySymbol = Entry('supplement/cancel_order_by_symbol', 'private', 'POST', {'cost': 1})
53
- private_post_supplement_orders_info = privatePostSupplementOrdersInfo = Entry('supplement/orders_info', 'private', 'POST', {'cost': 2.5})
54
- private_post_supplement_orders_info_no_deal = privatePostSupplementOrdersInfoNoDeal = Entry('supplement/orders_info_no_deal', 'private', 'POST', {'cost': 2.5})
55
- private_post_supplement_orders_info_history = privatePostSupplementOrdersInfoHistory = Entry('supplement/orders_info_history', 'private', 'POST', {'cost': 2.5})
56
- private_post_supplement_user_info_account = privatePostSupplementUserInfoAccount = Entry('supplement/user_info_account', 'private', 'POST', {'cost': 2.5})
57
- private_post_supplement_transaction_history = privatePostSupplementTransactionHistory = Entry('supplement/transaction_history', 'private', 'POST', {'cost': 2.5})
5
+ spot_public_get_currencypairs = spotPublicGetCurrencyPairs = Entry('currencyPairs', ['spot', 'public'], 'GET', {'cost': 2.5})
6
+ spot_public_get_accuracy = spotPublicGetAccuracy = Entry('accuracy', ['spot', 'public'], 'GET', {'cost': 2.5})
7
+ spot_public_get_usdtocny = spotPublicGetUsdToCny = Entry('usdToCny', ['spot', 'public'], 'GET', {'cost': 2.5})
8
+ spot_public_get_withdrawconfigs = spotPublicGetWithdrawConfigs = Entry('withdrawConfigs', ['spot', 'public'], 'GET', {'cost': 2.5})
9
+ spot_public_get_timestamp = spotPublicGetTimestamp = Entry('timestamp', ['spot', 'public'], 'GET', {'cost': 2.5})
10
+ spot_public_get_ticker_24hr = spotPublicGetTicker24hr = Entry('ticker/24hr', ['spot', 'public'], 'GET', {'cost': 2.5})
11
+ spot_public_get_ticker = spotPublicGetTicker = Entry('ticker', ['spot', 'public'], 'GET', {'cost': 2.5})
12
+ spot_public_get_depth = spotPublicGetDepth = Entry('depth', ['spot', 'public'], 'GET', {'cost': 2.5})
13
+ spot_public_get_incrdepth = spotPublicGetIncrDepth = Entry('incrDepth', ['spot', 'public'], 'GET', {'cost': 2.5})
14
+ spot_public_get_trades = spotPublicGetTrades = Entry('trades', ['spot', 'public'], 'GET', {'cost': 2.5})
15
+ spot_public_get_kline = spotPublicGetKline = Entry('kline', ['spot', 'public'], 'GET', {'cost': 2.5})
16
+ spot_public_get_supplement_system_ping = spotPublicGetSupplementSystemPing = Entry('supplement/system_ping', ['spot', 'public'], 'GET', {'cost': 2.5})
17
+ spot_public_get_supplement_incrdepth = spotPublicGetSupplementIncrDepth = Entry('supplement/incrDepth', ['spot', 'public'], 'GET', {'cost': 2.5})
18
+ spot_public_get_supplement_trades = spotPublicGetSupplementTrades = Entry('supplement/trades', ['spot', 'public'], 'GET', {'cost': 2.5})
19
+ spot_public_get_supplement_ticker_price = spotPublicGetSupplementTickerPrice = Entry('supplement/ticker/price', ['spot', 'public'], 'GET', {'cost': 2.5})
20
+ spot_public_get_supplement_ticker_bookticker = spotPublicGetSupplementTickerBookTicker = Entry('supplement/ticker/bookTicker', ['spot', 'public'], 'GET', {'cost': 2.5})
21
+ spot_public_post_supplement_system_status = spotPublicPostSupplementSystemStatus = Entry('supplement/system_status', ['spot', 'public'], 'POST', {'cost': 2.5})
22
+ spot_private_post_user_info = spotPrivatePostUserInfo = Entry('user_info', ['spot', 'private'], 'POST', {'cost': 2.5})
23
+ spot_private_post_subscribe_get_key = spotPrivatePostSubscribeGetKey = Entry('subscribe/get_key', ['spot', 'private'], 'POST', {'cost': 2.5})
24
+ spot_private_post_subscribe_refresh_key = spotPrivatePostSubscribeRefreshKey = Entry('subscribe/refresh_key', ['spot', 'private'], 'POST', {'cost': 2.5})
25
+ spot_private_post_subscribe_destroy_key = spotPrivatePostSubscribeDestroyKey = Entry('subscribe/destroy_key', ['spot', 'private'], 'POST', {'cost': 2.5})
26
+ spot_private_post_get_deposit_address = spotPrivatePostGetDepositAddress = Entry('get_deposit_address', ['spot', 'private'], 'POST', {'cost': 2.5})
27
+ spot_private_post_deposit_history = spotPrivatePostDepositHistory = Entry('deposit_history', ['spot', 'private'], 'POST', {'cost': 2.5})
28
+ spot_private_post_create_order = spotPrivatePostCreateOrder = Entry('create_order', ['spot', 'private'], 'POST', {'cost': 1})
29
+ spot_private_post_batch_create_order = spotPrivatePostBatchCreateOrder = Entry('batch_create_order', ['spot', 'private'], 'POST', {'cost': 1})
30
+ spot_private_post_cancel_order = spotPrivatePostCancelOrder = Entry('cancel_order', ['spot', 'private'], 'POST', {'cost': 1})
31
+ spot_private_post_cancel_clientorders = spotPrivatePostCancelClientOrders = Entry('cancel_clientOrders', ['spot', 'private'], 'POST', {'cost': 1})
32
+ spot_private_post_orders_info = spotPrivatePostOrdersInfo = Entry('orders_info', ['spot', 'private'], 'POST', {'cost': 2.5})
33
+ spot_private_post_orders_info_history = spotPrivatePostOrdersInfoHistory = Entry('orders_info_history', ['spot', 'private'], 'POST', {'cost': 2.5})
34
+ spot_private_post_order_transaction_detail = spotPrivatePostOrderTransactionDetail = Entry('order_transaction_detail', ['spot', 'private'], 'POST', {'cost': 2.5})
35
+ spot_private_post_transaction_history = spotPrivatePostTransactionHistory = Entry('transaction_history', ['spot', 'private'], 'POST', {'cost': 2.5})
36
+ spot_private_post_orders_info_no_deal = spotPrivatePostOrdersInfoNoDeal = Entry('orders_info_no_deal', ['spot', 'private'], 'POST', {'cost': 2.5})
37
+ spot_private_post_withdraw = spotPrivatePostWithdraw = Entry('withdraw', ['spot', 'private'], 'POST', {'cost': 2.5})
38
+ spot_private_post_withdrawcancel = spotPrivatePostWithdrawCancel = Entry('withdrawCancel', ['spot', 'private'], 'POST', {'cost': 2.5})
39
+ spot_private_post_withdraws = spotPrivatePostWithdraws = Entry('withdraws', ['spot', 'private'], 'POST', {'cost': 2.5})
40
+ spot_private_post_supplement_user_info = spotPrivatePostSupplementUserInfo = Entry('supplement/user_info', ['spot', 'private'], 'POST', {'cost': 2.5})
41
+ spot_private_post_supplement_withdraw = spotPrivatePostSupplementWithdraw = Entry('supplement/withdraw', ['spot', 'private'], 'POST', {'cost': 2.5})
42
+ spot_private_post_supplement_deposit_history = spotPrivatePostSupplementDepositHistory = Entry('supplement/deposit_history', ['spot', 'private'], 'POST', {'cost': 2.5})
43
+ spot_private_post_supplement_withdraws = spotPrivatePostSupplementWithdraws = Entry('supplement/withdraws', ['spot', 'private'], 'POST', {'cost': 2.5})
44
+ spot_private_post_supplement_get_deposit_address = spotPrivatePostSupplementGetDepositAddress = Entry('supplement/get_deposit_address', ['spot', 'private'], 'POST', {'cost': 2.5})
45
+ spot_private_post_supplement_asset_detail = spotPrivatePostSupplementAssetDetail = Entry('supplement/asset_detail', ['spot', 'private'], 'POST', {'cost': 2.5})
46
+ spot_private_post_supplement_customer_trade_fee = spotPrivatePostSupplementCustomerTradeFee = Entry('supplement/customer_trade_fee', ['spot', 'private'], 'POST', {'cost': 2.5})
47
+ spot_private_post_supplement_api_restrictions = spotPrivatePostSupplementApiRestrictions = Entry('supplement/api_Restrictions', ['spot', 'private'], 'POST', {'cost': 2.5})
48
+ spot_private_post_supplement_system_ping = spotPrivatePostSupplementSystemPing = Entry('supplement/system_ping', ['spot', 'private'], 'POST', {'cost': 2.5})
49
+ spot_private_post_supplement_create_order_test = spotPrivatePostSupplementCreateOrderTest = Entry('supplement/create_order_test', ['spot', 'private'], 'POST', {'cost': 1})
50
+ spot_private_post_supplement_create_order = spotPrivatePostSupplementCreateOrder = Entry('supplement/create_order', ['spot', 'private'], 'POST', {'cost': 1})
51
+ spot_private_post_supplement_cancel_order = spotPrivatePostSupplementCancelOrder = Entry('supplement/cancel_order', ['spot', 'private'], 'POST', {'cost': 1})
52
+ spot_private_post_supplement_cancel_order_by_symbol = spotPrivatePostSupplementCancelOrderBySymbol = Entry('supplement/cancel_order_by_symbol', ['spot', 'private'], 'POST', {'cost': 1})
53
+ spot_private_post_supplement_orders_info = spotPrivatePostSupplementOrdersInfo = Entry('supplement/orders_info', ['spot', 'private'], 'POST', {'cost': 2.5})
54
+ spot_private_post_supplement_orders_info_no_deal = spotPrivatePostSupplementOrdersInfoNoDeal = Entry('supplement/orders_info_no_deal', ['spot', 'private'], 'POST', {'cost': 2.5})
55
+ spot_private_post_supplement_orders_info_history = spotPrivatePostSupplementOrdersInfoHistory = Entry('supplement/orders_info_history', ['spot', 'private'], 'POST', {'cost': 2.5})
56
+ spot_private_post_supplement_user_info_account = spotPrivatePostSupplementUserInfoAccount = Entry('supplement/user_info_account', ['spot', 'private'], 'POST', {'cost': 2.5})
57
+ spot_private_post_supplement_transaction_history = spotPrivatePostSupplementTransactionHistory = Entry('supplement/transaction_history', ['spot', 'private'], 'POST', {'cost': 2.5})
58
+ contract_public_get_cfd_openapi_v1_pub_gettime = contractPublicGetCfdOpenApiV1PubGetTime = Entry('cfd/openApi/v1/pub/getTime', ['contract', 'public'], 'GET', {'cost': 2.5})
59
+ contract_public_get_cfd_openapi_v1_pub_instrument = contractPublicGetCfdOpenApiV1PubInstrument = Entry('cfd/openApi/v1/pub/instrument', ['contract', 'public'], 'GET', {'cost': 2.5})
60
+ contract_public_get_cfd_openapi_v1_pub_marketdata = contractPublicGetCfdOpenApiV1PubMarketData = Entry('cfd/openApi/v1/pub/marketData', ['contract', 'public'], 'GET', {'cost': 2.5})
61
+ contract_public_get_cfd_openapi_v1_pub_marketorder = contractPublicGetCfdOpenApiV1PubMarketOrder = Entry('cfd/openApi/v1/pub/marketOrder', ['contract', 'public'], 'GET', {'cost': 2.5})
@@ -4,7 +4,7 @@
4
4
 
5
5
  # -----------------------------------------------------------------------------
6
6
 
7
- __version__ = '4.0.72'
7
+ __version__ = '4.0.73'
8
8
 
9
9
  # -----------------------------------------------------------------------------
10
10
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  # -----------------------------------------------------------------------------
4
4
 
5
- __version__ = '4.0.72'
5
+ __version__ = '4.0.73'
6
6
 
7
7
  # -----------------------------------------------------------------------------
8
8
 
@@ -743,7 +743,7 @@ class Exchange(BaseExchange):
743
743
  raise NotSupported(self.id + ' parseWsOrderTrade() is not supported yet')
744
744
 
745
745
  def parse_ws_ohlcv(self, ohlcv, market=None):
746
- raise NotSupported(self.id + ' parseWsOHLCV() is not supported yet')
746
+ return self.parse_ohlcv(ohlcv, market)
747
747
 
748
748
  async def fetch_funding_rates(self, symbols: Optional[List[str]] = None, params={}):
749
749
  raise NotSupported(self.id + ' fetchFundingRates() is not supported yet')
@@ -2967,6 +2967,12 @@ class Exchange(BaseExchange):
2967
2967
  market = self.market(firstMarket)
2968
2968
  return market
2969
2969
 
2970
+ def parse_ws_ohlcvs(self, ohlcvs: List[object], market: Optional[Any] = None, timeframe: str = '1m', since: Optional[int] = None, limit: Optional[int] = None):
2971
+ results = []
2972
+ for i in range(0, len(ohlcvs)):
2973
+ results.append(self.parse_ws_ohlcv(ohlcvs[i], market))
2974
+ return results
2975
+
2970
2976
  async def fetch_transactions(self, code: Optional[str] = None, since: Optional[int] = None, limit: Optional[int] = None, params={}):
2971
2977
  """
2972
2978
  * @deprecated
@@ -103,6 +103,7 @@ class binance(Exchange, ImplicitAPI):
103
103
  'fetchMarketLeverageTiers': 'emulated',
104
104
  'fetchMarkets': True,
105
105
  'fetchMarkOHLCV': True,
106
+ 'fetchMySettlementHistory': True,
106
107
  'fetchMyTrades': True,
107
108
  'fetchOHLCV': True,
108
109
  'fetchOpenInterest': True,
@@ -7176,7 +7177,57 @@ class binance(Exchange, ImplicitAPI):
7176
7177
  sorted = self.sort_by(settlements, 'timestamp')
7177
7178
  return self.filter_by_symbol_since_limit(sorted, symbol, since, limit)
7178
7179
 
7180
+ async def fetch_my_settlement_history(self, symbol: Optional[str] = None, since: Optional[int] = None, limit: Optional[int] = None, params={}):
7181
+ """
7182
+ fetches historical settlement records of the user
7183
+ see https://binance-docs.github.io/apidocs/voptions/en/#user-exercise-record-user_data
7184
+ :param str symbol: unified market symbol of the settlement history
7185
+ :param int [since]: timestamp in ms
7186
+ :param int [limit]: number of records
7187
+ :param dict [params]: exchange specific params
7188
+ :returns dict[]: a list of [settlement history objects]
7189
+ """
7190
+ await self.load_markets()
7191
+ market = None if (symbol is None) else self.market(symbol)
7192
+ type = None
7193
+ type, params = self.handle_market_type_and_params('fetchMySettlementHistory', market, params)
7194
+ if type != 'option':
7195
+ raise NotSupported(self.id + ' fetchMySettlementHistory() supports option markets only')
7196
+ request = {}
7197
+ if symbol is not None:
7198
+ request['symbol'] = market['id']
7199
+ if since is not None:
7200
+ request['startTime'] = since
7201
+ if limit is not None:
7202
+ request['limit'] = limit
7203
+ response = await self.eapiPrivateGetExerciseRecord(self.extend(request, params))
7204
+ #
7205
+ # [
7206
+ # {
7207
+ # "id": "1125899906842897036",
7208
+ # "currency": "USDT",
7209
+ # "symbol": "BTC-230728-30000-C",
7210
+ # "exercisePrice": "30000.00000000",
7211
+ # "markPrice": "29160.71284993",
7212
+ # "quantity": "1.00000000",
7213
+ # "amount": "0.00000000",
7214
+ # "fee": "0.00000000",
7215
+ # "createDate": 1690531200000,
7216
+ # "priceScale": 0,
7217
+ # "quantityScale": 2,
7218
+ # "optionSide": "CALL",
7219
+ # "positionSide": "LONG",
7220
+ # "quoteAsset": "USDT"
7221
+ # }
7222
+ # ]
7223
+ #
7224
+ settlements = self.parse_settlements(response, market)
7225
+ sorted = self.sort_by(settlements, 'timestamp')
7226
+ return self.filter_by_symbol_since_limit(sorted, market['symbol'], since, limit)
7227
+
7179
7228
  def parse_settlement(self, settlement, market):
7229
+ #
7230
+ # fetchSettlementHistory
7180
7231
  #
7181
7232
  # {
7182
7233
  # "symbol": "ETH-230223-1900-P",
@@ -7186,17 +7237,38 @@ class binance(Exchange, ImplicitAPI):
7186
7237
  # "strikeResult": "REALISTIC_VALUE_STRICKEN"
7187
7238
  # }
7188
7239
  #
7189
- timestamp = self.safe_integer(settlement, 'expiryDate')
7240
+ # fetchMySettlementHistory
7241
+ #
7242
+ # {
7243
+ # "id": "1125899906842897036",
7244
+ # "currency": "USDT",
7245
+ # "symbol": "BTC-230728-30000-C",
7246
+ # "exercisePrice": "30000.00000000",
7247
+ # "markPrice": "29160.71284993",
7248
+ # "quantity": "1.00000000",
7249
+ # "amount": "0.00000000",
7250
+ # "fee": "0.00000000",
7251
+ # "createDate": 1690531200000,
7252
+ # "priceScale": 0,
7253
+ # "quantityScale": 2,
7254
+ # "optionSide": "CALL",
7255
+ # "positionSide": "LONG",
7256
+ # "quoteAsset": "USDT"
7257
+ # }
7258
+ #
7259
+ timestamp = self.safe_integer_2(settlement, 'expiryDate', 'createDate')
7190
7260
  marketId = self.safe_string(settlement, 'symbol')
7191
7261
  return {
7192
7262
  'info': settlement,
7193
7263
  'symbol': self.safe_symbol(marketId, market),
7194
- 'price': self.safe_number(settlement, 'realStrikePrice'),
7264
+ 'price': self.safe_number_2(settlement, 'realStrikePrice', 'exercisePrice'),
7195
7265
  'timestamp': timestamp,
7196
7266
  'datetime': self.iso8601(timestamp),
7197
7267
  }
7198
7268
 
7199
7269
  def parse_settlements(self, settlements, market):
7270
+ #
7271
+ # fetchSettlementHistory
7200
7272
  #
7201
7273
  # [
7202
7274
  # {
@@ -7208,6 +7280,27 @@ class binance(Exchange, ImplicitAPI):
7208
7280
  # }
7209
7281
  # ]
7210
7282
  #
7283
+ # fetchMySettlementHistory
7284
+ #
7285
+ # [
7286
+ # {
7287
+ # "id": "1125899906842897036",
7288
+ # "currency": "USDT",
7289
+ # "symbol": "BTC-230728-30000-C",
7290
+ # "exercisePrice": "30000.00000000",
7291
+ # "markPrice": "29160.71284993",
7292
+ # "quantity": "1.00000000",
7293
+ # "amount": "0.00000000",
7294
+ # "fee": "0.00000000",
7295
+ # "createDate": 1690531200000,
7296
+ # "priceScale": 0,
7297
+ # "quantityScale": 2,
7298
+ # "optionSide": "CALL",
7299
+ # "positionSide": "LONG",
7300
+ # "quoteAsset": "USDT"
7301
+ # }
7302
+ # ]
7303
+ #
7211
7304
  result = []
7212
7305
  for i in range(0, len(settlements)):
7213
7306
  result.append(self.parse_settlement(settlements[i], market))
@@ -81,6 +81,7 @@ class bybit(Exchange, ImplicitAPI):
81
81
  'fetchMarketLeverageTiers': True,
82
82
  'fetchMarkets': True,
83
83
  'fetchMarkOHLCV': True,
84
+ 'fetchMySettlementHistory': True,
84
85
  'fetchMyTrades': True,
85
86
  'fetchOHLCV': True,
86
87
  'fetchOpenInterest': True,
@@ -8309,7 +8310,68 @@ class bybit(Exchange, ImplicitAPI):
8309
8310
  sorted = self.sort_by(settlements, 'timestamp')
8310
8311
  return self.filter_by_symbol_since_limit(sorted, market['symbol'], since, limit)
8311
8312
 
8313
+ async def fetch_my_settlement_history(self, symbol: Optional[str] = None, since: Optional[int] = None, limit: Optional[int] = None, params={}):
8314
+ """
8315
+ fetches historical settlement records of the user
8316
+ see https://bybit-exchange.github.io/docs/v5/asset/delivery
8317
+ :param str symbol: unified market symbol of the settlement history
8318
+ :param int [since]: timestamp in ms
8319
+ :param int [limit]: number of records
8320
+ :param dict [params]: exchange specific params
8321
+ :returns dict[]: a list of [settlement history objects]
8322
+ """
8323
+ await self.load_markets()
8324
+ request = {}
8325
+ market = None
8326
+ if symbol is not None:
8327
+ market = self.market(symbol)
8328
+ request['symbol'] = market['id']
8329
+ type = None
8330
+ type, params = self.handle_market_type_and_params('fetchMySettlementHistory', market, params)
8331
+ if type == 'option':
8332
+ request['category'] = 'option'
8333
+ else:
8334
+ subType = None
8335
+ subType, params = self.handle_sub_type_and_params('fetchMySettlementHistory', market, params, 'linear')
8336
+ if subType == 'inverse':
8337
+ raise NotSupported(self.id + ' fetchMySettlementHistory() doesn\'t support inverse markets')
8338
+ request['category'] = 'linear'
8339
+ if limit is not None:
8340
+ request['limit'] = limit
8341
+ response = await self.privateGetV5AssetDeliveryRecord(self.extend(request, params))
8342
+ #
8343
+ # {
8344
+ # "retCode": 0,
8345
+ # "retMsg": "success",
8346
+ # "result": {
8347
+ # "category": "option",
8348
+ # "nextPageCursor": "0%2C3",
8349
+ # "list": [
8350
+ # {
8351
+ # "symbol": "SOL-27JUN23-20-C",
8352
+ # "deliveryPrice": "16.62258889",
8353
+ # "deliveryTime": "1687852800000",
8354
+ # "side": "Buy",
8355
+ # "strike": "20",
8356
+ # "fee": "0.00000000",
8357
+ # "position": "0.01",
8358
+ # "deliveryRpl": "3.5"
8359
+ # },
8360
+ # ]
8361
+ # },
8362
+ # "retExtInfo": {},
8363
+ # "time": 1689043527231
8364
+ # }
8365
+ #
8366
+ result = self.safe_value(response, 'result', {})
8367
+ data = self.safe_value(result, 'list', [])
8368
+ settlements = self.parse_settlements(data, market)
8369
+ sorted = self.sort_by(settlements, 'timestamp')
8370
+ return self.filter_by_symbol_since_limit(sorted, market['symbol'], since, limit)
8371
+
8312
8372
  def parse_settlement(self, settlement, market):
8373
+ #
8374
+ # fetchSettlementHistory
8313
8375
  #
8314
8376
  # {
8315
8377
  # "symbol": "SOL-27JUN23-20-C",
@@ -8317,6 +8379,19 @@ class bybit(Exchange, ImplicitAPI):
8317
8379
  # "deliveryTime": "1687852800000"
8318
8380
  # }
8319
8381
  #
8382
+ # fetchMySettlementHistory
8383
+ #
8384
+ # {
8385
+ # "symbol": "SOL-27JUN23-20-C",
8386
+ # "deliveryPrice": "16.62258889",
8387
+ # "deliveryTime": "1687852800000",
8388
+ # "side": "Buy",
8389
+ # "strike": "20",
8390
+ # "fee": "0.00000000",
8391
+ # "position": "0.01",
8392
+ # "deliveryRpl": "3.5"
8393
+ # }
8394
+ #
8320
8395
  timestamp = self.safe_integer(settlement, 'deliveryTime')
8321
8396
  marketId = self.safe_string(settlement, 'symbol')
8322
8397
  return {
@@ -8328,6 +8403,8 @@ class bybit(Exchange, ImplicitAPI):
8328
8403
  }
8329
8404
 
8330
8405
  def parse_settlements(self, settlements, market):
8406
+ #
8407
+ # fetchSettlementHistory
8331
8408
  #
8332
8409
  # [
8333
8410
  # {
@@ -8337,6 +8414,21 @@ class bybit(Exchange, ImplicitAPI):
8337
8414
  # }
8338
8415
  # ]
8339
8416
  #
8417
+ # fetchMySettlementHistory
8418
+ #
8419
+ # [
8420
+ # {
8421
+ # "symbol": "SOL-27JUN23-20-C",
8422
+ # "deliveryPrice": "16.62258889",
8423
+ # "deliveryTime": "1687852800000",
8424
+ # "side": "Buy",
8425
+ # "strike": "20",
8426
+ # "fee": "0.00000000",
8427
+ # "position": "0.01",
8428
+ # "deliveryRpl": "3.5"
8429
+ # }
8430
+ # ]
8431
+ #
8340
8432
  result = []
8341
8433
  for i in range(0, len(settlements)):
8342
8434
  result.append(self.parse_settlement(settlements[i], market))
@@ -78,6 +78,7 @@ class cryptocom(Exchange, ImplicitAPI):
78
78
  'fetchMarketLeverageTiers': False,
79
79
  'fetchMarkets': True,
80
80
  'fetchMarkOHLCV': False,
81
+ 'fetchMySettlementHistory': False,
81
82
  'fetchMyTrades': True,
82
83
  'fetchOHLCV': True,
83
84
  'fetchOpenOrders': True,
@@ -63,6 +63,7 @@ class delta(Exchange, ImplicitAPI):
63
63
  'fetchMarketLeverageTiers': False,
64
64
  'fetchMarkets': True,
65
65
  'fetchMarkOHLCV': True,
66
+ 'fetchMySettlementHistory': False,
66
67
  'fetchMyTrades': True,
67
68
  'fetchOHLCV': True,
68
69
  'fetchOpenInterest': True,
@@ -76,6 +76,7 @@ class deribit(Exchange, ImplicitAPI):
76
76
  'fetchMarginMode': False,
77
77
  'fetchMarkets': True,
78
78
  'fetchMarkOHLCV': False,
79
+ 'fetchMySettlementHistory': False,
79
80
  'fetchMyTrades': True,
80
81
  'fetchOHLCV': True,
81
82
  'fetchOpenOrders': True,