ccxt 4.2.48__py2.py3-none-any.whl → 4.2.49__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/abstract/bitstamp.py +8 -0
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/base/exchange.py +1 -1
- ccxt/async_support/binance.py +6 -3
- ccxt/async_support/bitmart.py +24 -2
- ccxt/async_support/bitstamp.py +8 -0
- ccxt/async_support/btcalpha.py +4 -0
- ccxt/async_support/btcmarkets.py +4 -0
- ccxt/async_support/btcturk.py +4 -0
- ccxt/async_support/bybit.py +132 -6
- ccxt/async_support/independentreserve.py +47 -1
- ccxt/async_support/latoken.py +16 -0
- ccxt/async_support/luno.py +18 -0
- ccxt/async_support/lykke.py +19 -0
- ccxt/async_support/ndax.py +18 -0
- ccxt/async_support/upbit.py +8 -1
- ccxt/base/exchange.py +2 -2
- ccxt/binance.py +6 -3
- ccxt/bitmart.py +24 -2
- ccxt/bitstamp.py +8 -0
- ccxt/btcalpha.py +4 -0
- ccxt/btcmarkets.py +4 -0
- ccxt/btcturk.py +4 -0
- ccxt/bybit.py +132 -6
- ccxt/independentreserve.py +47 -1
- ccxt/latoken.py +16 -0
- ccxt/luno.py +18 -0
- ccxt/lykke.py +19 -0
- ccxt/ndax.py +18 -0
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/ascendex.py +19 -7
- ccxt/pro/bitget.py +24 -7
- ccxt/pro/bitstamp.py +1 -1
- ccxt/pro/mexc.py +2 -1
- ccxt/test/test_async.py +10 -10
- ccxt/test/test_sync.py +10 -10
- ccxt/upbit.py +8 -1
- {ccxt-4.2.48.dist-info → ccxt-4.2.49.dist-info}/METADATA +4 -4
- {ccxt-4.2.48.dist-info → ccxt-4.2.49.dist-info}/RECORD +42 -42
- {ccxt-4.2.48.dist-info → ccxt-4.2.49.dist-info}/WHEEL +0 -0
- {ccxt-4.2.48.dist-info → ccxt-4.2.49.dist-info}/top_level.txt +0 -0
ccxt/__init__.py
CHANGED
ccxt/abstract/bitstamp.py
CHANGED
@@ -226,3 +226,11 @@ class ImplicitAPI:
|
|
226
226
|
private_post_eurcv_address = privatePostEurcvAddress = Entry('eurcv_address/', 'private', 'POST', {'cost': 1})
|
227
227
|
private_post_pyusd_withdrawal = privatePostPyusdWithdrawal = Entry('pyusd_withdrawal/', 'private', 'POST', {'cost': 1})
|
228
228
|
private_post_pyusd_address = privatePostPyusdAddress = Entry('pyusd_address/', 'private', 'POST', {'cost': 1})
|
229
|
+
private_post_lmwr_withdrawal = privatePostLmwrWithdrawal = Entry('lmwr_withdrawal/', 'private', 'POST', {'cost': 1})
|
230
|
+
private_post_lmwr_address = privatePostLmwrAddress = Entry('lmwr_address/', 'private', 'POST', {'cost': 1})
|
231
|
+
private_post_pepe_withdrawal = privatePostPepeWithdrawal = Entry('pepe_withdrawal/', 'private', 'POST', {'cost': 1})
|
232
|
+
private_post_pepe_address = privatePostPepeAddress = Entry('pepe_address/', 'private', 'POST', {'cost': 1})
|
233
|
+
private_post_blur_withdrawal = privatePostBlurWithdrawal = Entry('blur_withdrawal/', 'private', 'POST', {'cost': 1})
|
234
|
+
private_post_blur_address = privatePostBlurAddress = Entry('blur_address/', 'private', 'POST', {'cost': 1})
|
235
|
+
private_post_vext_withdrawal = privatePostVextWithdrawal = Entry('vext_withdrawal/', 'private', 'POST', {'cost': 1})
|
236
|
+
private_post_vext_address = privatePostVextAddress = Entry('vext_address/', 'private', 'POST', {'cost': 1})
|
ccxt/async_support/__init__.py
CHANGED
ccxt/async_support/binance.py
CHANGED
@@ -2986,7 +2986,7 @@ class binance(Exchange, ImplicitAPI):
|
|
2986
2986
|
fees = self.fees
|
2987
2987
|
linear = None
|
2988
2988
|
inverse = None
|
2989
|
-
strike = self.
|
2989
|
+
strike = self.safe_string(market, 'strikePrice')
|
2990
2990
|
symbol = base + '/' + quote
|
2991
2991
|
if contract:
|
2992
2992
|
if swap:
|
@@ -2994,7 +2994,7 @@ class binance(Exchange, ImplicitAPI):
|
|
2994
2994
|
elif future:
|
2995
2995
|
symbol = symbol + ':' + settle + '-' + self.yymmdd(expiry)
|
2996
2996
|
elif option:
|
2997
|
-
symbol = symbol + ':' + settle + '-' + self.yymmdd(expiry) + '-' +
|
2997
|
+
symbol = symbol + ':' + settle + '-' + self.yymmdd(expiry) + '-' + strike + '-' + self.safe_string(optionParts, 3)
|
2998
2998
|
contractSize = self.safe_number_2(market, 'contractSize', 'unit', self.parse_number('1'))
|
2999
2999
|
linear = settle == quote
|
3000
3000
|
inverse = settle == base
|
@@ -3018,6 +3018,9 @@ class binance(Exchange, ImplicitAPI):
|
|
3018
3018
|
elif option:
|
3019
3019
|
unifiedType = 'option'
|
3020
3020
|
active = None
|
3021
|
+
parsedStrike = None
|
3022
|
+
if strike is not None:
|
3023
|
+
parsedStrike = self.parse_to_numeric(strike)
|
3021
3024
|
entry = {
|
3022
3025
|
'id': id,
|
3023
3026
|
'lowercaseId': lowercaseId,
|
@@ -3043,7 +3046,7 @@ class binance(Exchange, ImplicitAPI):
|
|
3043
3046
|
'contractSize': contractSize,
|
3044
3047
|
'expiry': expiry,
|
3045
3048
|
'expiryDatetime': self.iso8601(expiry),
|
3046
|
-
'strike':
|
3049
|
+
'strike': parsedStrike,
|
3047
3050
|
'optionType': self.safe_string_lower(market, 'side'),
|
3048
3051
|
'precision': {
|
3049
3052
|
'amount': self.safe_integer_2(market, 'quantityPrecision', 'quantityScale'),
|
ccxt/async_support/bitmart.py
CHANGED
@@ -1121,7 +1121,7 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1121
1121
|
|
1122
1122
|
def parse_ticker(self, ticker, market: Market = None) -> Ticker:
|
1123
1123
|
#
|
1124
|
-
# spot
|
1124
|
+
# spot(REST)
|
1125
1125
|
#
|
1126
1126
|
# {
|
1127
1127
|
# "symbol": "SOLAR_USDT",
|
@@ -1141,6 +1141,17 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1141
1141
|
# "timestamp": 1667403439367
|
1142
1142
|
# }
|
1143
1143
|
#
|
1144
|
+
# spot(WS)
|
1145
|
+
# {
|
1146
|
+
# "symbol":"BTC_USDT",
|
1147
|
+
# "last_price":"146.24",
|
1148
|
+
# "open_24h":"147.17",
|
1149
|
+
# "high_24h":"147.48",
|
1150
|
+
# "low_24h":"143.88",
|
1151
|
+
# "base_volume_24h":"117387.58", # NOT base, but quote currencynot !!
|
1152
|
+
# "s_t": 1610936002
|
1153
|
+
# }
|
1154
|
+
#
|
1144
1155
|
# swap
|
1145
1156
|
#
|
1146
1157
|
# {
|
@@ -1157,6 +1168,9 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1157
1168
|
# }
|
1158
1169
|
#
|
1159
1170
|
timestamp = self.safe_integer(ticker, 'timestamp')
|
1171
|
+
if timestamp is None:
|
1172
|
+
# ticker from WS has a different field(in seconds)
|
1173
|
+
timestamp = self.safe_integer_product(ticker, 's_t', 1000)
|
1160
1174
|
marketId = self.safe_string_2(ticker, 'symbol', 'contract_symbol')
|
1161
1175
|
market = self.safe_market(marketId, market)
|
1162
1176
|
symbol = market['symbol']
|
@@ -1171,7 +1185,15 @@ class bitmart(Exchange, ImplicitAPI):
|
|
1171
1185
|
percentage = '0'
|
1172
1186
|
baseVolume = self.safe_string(ticker, 'base_volume_24h')
|
1173
1187
|
quoteVolume = self.safe_string(ticker, 'quote_volume_24h')
|
1174
|
-
quoteVolume
|
1188
|
+
if quoteVolume is None:
|
1189
|
+
if baseVolume is None:
|
1190
|
+
# self is swap
|
1191
|
+
quoteVolume = self.safe_string(ticker, 'volume_24h', quoteVolume)
|
1192
|
+
else:
|
1193
|
+
# self is a ticker from websockets
|
1194
|
+
# contrary to name and documentation, base_volume_24h is actually the quote volume
|
1195
|
+
quoteVolume = baseVolume
|
1196
|
+
baseVolume = None
|
1175
1197
|
average = self.safe_string_2(ticker, 'avg_price', 'index_price')
|
1176
1198
|
high = self.safe_string_2(ticker, 'high_24h', 'high_price')
|
1177
1199
|
low = self.safe_string_2(ticker, 'low_24h', 'low_price')
|
ccxt/async_support/bitstamp.py
CHANGED
@@ -361,6 +361,14 @@ class bitstamp(Exchange, ImplicitAPI):
|
|
361
361
|
'eurcv_address/': 1,
|
362
362
|
'pyusd_withdrawal/': 1,
|
363
363
|
'pyusd_address/': 1,
|
364
|
+
'lmwr_withdrawal/': 1,
|
365
|
+
'lmwr_address/': 1,
|
366
|
+
'pepe_withdrawal/': 1,
|
367
|
+
'pepe_address/': 1,
|
368
|
+
'blur_withdrawal/': 1,
|
369
|
+
'blur_address/': 1,
|
370
|
+
'vext_withdrawal/': 1,
|
371
|
+
'vext_address/': 1,
|
364
372
|
},
|
365
373
|
},
|
366
374
|
},
|
ccxt/async_support/btcalpha.py
CHANGED
@@ -36,6 +36,7 @@ class btcalpha(Exchange, ImplicitAPI):
|
|
36
36
|
'cancelOrder': True,
|
37
37
|
'closeAllPositions': False,
|
38
38
|
'closePosition': False,
|
39
|
+
'createDepositAddress': False,
|
39
40
|
'createOrder': True,
|
40
41
|
'createReduceOnlyOrder': False,
|
41
42
|
'createStopLimitOrder': False,
|
@@ -48,6 +49,9 @@ class btcalpha(Exchange, ImplicitAPI):
|
|
48
49
|
'fetchCrossBorrowRate': False,
|
49
50
|
'fetchCrossBorrowRates': False,
|
50
51
|
'fetchDeposit': False,
|
52
|
+
'fetchDepositAddress': False,
|
53
|
+
'fetchDepositAddresses': False,
|
54
|
+
'fetchDepositAddressesByNetwork': False,
|
51
55
|
'fetchDeposits': True,
|
52
56
|
'fetchFundingHistory': False,
|
53
57
|
'fetchFundingRate': False,
|
ccxt/async_support/btcmarkets.py
CHANGED
@@ -40,6 +40,7 @@ class btcmarkets(Exchange, ImplicitAPI):
|
|
40
40
|
'cancelOrders': True,
|
41
41
|
'closeAllPositions': False,
|
42
42
|
'closePosition': False,
|
43
|
+
'createDepositAddress': False,
|
43
44
|
'createOrder': True,
|
44
45
|
'createReduceOnlyOrder': False,
|
45
46
|
'fetchBalance': True,
|
@@ -48,6 +49,9 @@ class btcmarkets(Exchange, ImplicitAPI):
|
|
48
49
|
'fetchClosedOrders': 'emulated',
|
49
50
|
'fetchCrossBorrowRate': False,
|
50
51
|
'fetchCrossBorrowRates': False,
|
52
|
+
'fetchDepositAddress': False,
|
53
|
+
'fetchDepositAddresses': False,
|
54
|
+
'fetchDepositAddressesByNetwork': False,
|
51
55
|
'fetchDeposits': True,
|
52
56
|
'fetchDepositsWithdrawals': True,
|
53
57
|
'fetchFundingHistory': False,
|
ccxt/async_support/btcturk.py
CHANGED
@@ -37,6 +37,7 @@ class btcturk(Exchange, ImplicitAPI):
|
|
37
37
|
'cancelOrder': True,
|
38
38
|
'closeAllPositions': False,
|
39
39
|
'closePosition': False,
|
40
|
+
'createDepositAddress': False,
|
40
41
|
'createOrder': True,
|
41
42
|
'createReduceOnlyOrder': False,
|
42
43
|
'fetchBalance': True,
|
@@ -44,6 +45,9 @@ class btcturk(Exchange, ImplicitAPI):
|
|
44
45
|
'fetchBorrowRateHistory': False,
|
45
46
|
'fetchCrossBorrowRate': False,
|
46
47
|
'fetchCrossBorrowRates': False,
|
48
|
+
'fetchDepositAddress': False,
|
49
|
+
'fetchDepositAddresses': False,
|
50
|
+
'fetchDepositAddressesByNetwork': False,
|
47
51
|
'fetchFundingHistory': False,
|
48
52
|
'fetchFundingRate': False,
|
49
53
|
'fetchFundingRateHistory': False,
|
ccxt/async_support/bybit.py
CHANGED
@@ -96,6 +96,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
96
96
|
'fetchMarketLeverageTiers': True,
|
97
97
|
'fetchMarkets': True,
|
98
98
|
'fetchMarkOHLCV': True,
|
99
|
+
'fetchMyLiquidations': True,
|
99
100
|
'fetchMySettlementHistory': True,
|
100
101
|
'fetchMyTrades': True,
|
101
102
|
'fetchOHLCV': True,
|
@@ -4263,7 +4264,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
4263
4264
|
paginate = False
|
4264
4265
|
paginate, params = self.handle_option_and_params(params, 'fetchOrders', 'paginate')
|
4265
4266
|
if paginate:
|
4266
|
-
return await self.fetch_paginated_call_cursor('fetchOrders', symbol, since, limit, params, 'nextPageCursor', '
|
4267
|
+
return await self.fetch_paginated_call_cursor('fetchOrders', symbol, since, limit, params, 'nextPageCursor', 'cursor', None, 50)
|
4267
4268
|
enableUnifiedMargin, enableUnifiedAccount = await self.is_unified_enabled()
|
4268
4269
|
isUnifiedAccount = (enableUnifiedMargin or enableUnifiedAccount)
|
4269
4270
|
request = {}
|
@@ -4423,7 +4424,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
4423
4424
|
paginate = False
|
4424
4425
|
paginate, params = self.handle_option_and_params(params, 'fetchCanceledAndClosedOrders', 'paginate')
|
4425
4426
|
if paginate:
|
4426
|
-
return await self.fetch_paginated_call_cursor('fetchCanceledAndClosedOrders', symbol, since, limit, params, 'nextPageCursor', '
|
4427
|
+
return await self.fetch_paginated_call_cursor('fetchCanceledAndClosedOrders', symbol, since, limit, params, 'nextPageCursor', 'cursor', None, 50)
|
4427
4428
|
enableUnifiedMargin, enableUnifiedAccount = await self.is_unified_enabled()
|
4428
4429
|
isUnifiedAccount = (enableUnifiedMargin or enableUnifiedAccount)
|
4429
4430
|
request = {}
|
@@ -4767,7 +4768,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
4767
4768
|
paginate = False
|
4768
4769
|
paginate, params = self.handle_option_and_params(params, 'fetchMyTrades', 'paginate')
|
4769
4770
|
if paginate:
|
4770
|
-
return await self.fetch_paginated_call_cursor('fetchMyTrades', symbol, since, limit, params, 'nextPageCursor', '
|
4771
|
+
return await self.fetch_paginated_call_cursor('fetchMyTrades', symbol, since, limit, params, 'nextPageCursor', 'cursor', None, 100)
|
4771
4772
|
enableUnifiedMargin, enableUnifiedAccount = await self.is_unified_enabled()
|
4772
4773
|
isUnifiedAccount = (enableUnifiedMargin or enableUnifiedAccount)
|
4773
4774
|
request = {}
|
@@ -4957,7 +4958,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
4957
4958
|
paginate = False
|
4958
4959
|
paginate, params = self.handle_option_and_params(params, 'fetchDeposits', 'paginate')
|
4959
4960
|
if paginate:
|
4960
|
-
return await self.fetch_paginated_call_cursor('fetchDeposits', code, since, limit, params, 'nextPageCursor', '
|
4961
|
+
return await self.fetch_paginated_call_cursor('fetchDeposits', code, since, limit, params, 'nextPageCursor', 'cursor', None, 50)
|
4961
4962
|
request = {
|
4962
4963
|
# 'coin': currency['id'],
|
4963
4964
|
# 'limit': 20, # max 50
|
@@ -5019,7 +5020,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
5019
5020
|
paginate = False
|
5020
5021
|
paginate, params = self.handle_option_and_params(params, 'fetchWithdrawals', 'paginate')
|
5021
5022
|
if paginate:
|
5022
|
-
return await self.fetch_paginated_call_cursor('fetchWithdrawals', code, since, limit, params, 'nextPageCursor', '
|
5023
|
+
return await self.fetch_paginated_call_cursor('fetchWithdrawals', code, since, limit, params, 'nextPageCursor', 'cursor', None, 50)
|
5023
5024
|
request = {
|
5024
5025
|
# 'coin': currency['id'],
|
5025
5026
|
# 'limit': 20, # max 50
|
@@ -6420,7 +6421,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
6420
6421
|
paginate = False
|
6421
6422
|
paginate, params = self.handle_option_and_params(params, 'fetchTransfers', 'paginate')
|
6422
6423
|
if paginate:
|
6423
|
-
return await self.fetch_paginated_call_cursor('fetchTransfers', code, since, limit, params, 'nextPageCursor', '
|
6424
|
+
return await self.fetch_paginated_call_cursor('fetchTransfers', code, since, limit, params, 'nextPageCursor', 'cursor', None, 50)
|
6424
6425
|
currency = None
|
6425
6426
|
request = {}
|
6426
6427
|
if code is not None:
|
@@ -7213,6 +7214,131 @@ class bybit(Exchange, ImplicitAPI):
|
|
7213
7214
|
'info': greeks,
|
7214
7215
|
}
|
7215
7216
|
|
7217
|
+
async def fetch_my_liquidations(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
7218
|
+
"""
|
7219
|
+
retrieves the users liquidated positions
|
7220
|
+
:see: https://bybit-exchange.github.io/docs/api-explorer/v5/position/execution
|
7221
|
+
:param str [symbol]: unified CCXT market symbol
|
7222
|
+
:param int [since]: the earliest time in ms to fetch liquidations for
|
7223
|
+
:param int [limit]: the maximum number of liquidation structures to retrieve
|
7224
|
+
:param dict [params]: exchange specific parameters for the exchange API endpoint
|
7225
|
+
:param str [params.type]: market type, ['swap', 'option', 'spot']
|
7226
|
+
:param str [params.subType]: market subType, ['linear', 'inverse']
|
7227
|
+
:param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
7228
|
+
:returns dict: an array of `liquidation structures <https://docs.ccxt.com/#/?id=liquidation-structure>`
|
7229
|
+
"""
|
7230
|
+
await self.load_markets()
|
7231
|
+
paginate = False
|
7232
|
+
paginate, params = self.handle_option_and_params(params, 'fetchMyLiquidations', 'paginate')
|
7233
|
+
if paginate:
|
7234
|
+
return await self.fetch_paginated_call_cursor('fetchMyLiquidations', symbol, since, limit, params, 'nextPageCursor', 'cursor', None, 100)
|
7235
|
+
request = {
|
7236
|
+
'execType': 'BustTrade',
|
7237
|
+
}
|
7238
|
+
market = None
|
7239
|
+
if symbol is not None:
|
7240
|
+
market = self.market(symbol)
|
7241
|
+
request['symbol'] = market['id']
|
7242
|
+
type = None
|
7243
|
+
type, params = self.get_bybit_type('fetchMyLiquidations', market, params)
|
7244
|
+
request['category'] = type
|
7245
|
+
if limit is not None:
|
7246
|
+
request['limit'] = limit
|
7247
|
+
if since is not None:
|
7248
|
+
request['startTime'] = since
|
7249
|
+
request, params = self.handle_until_option('endTime', request, params)
|
7250
|
+
response = await self.privateGetV5ExecutionList(self.extend(request, params))
|
7251
|
+
#
|
7252
|
+
# {
|
7253
|
+
# "retCode": 0,
|
7254
|
+
# "retMsg": "OK",
|
7255
|
+
# "result": {
|
7256
|
+
# "nextPageCursor": "132766%3A2%2C132766%3A2",
|
7257
|
+
# "category": "linear",
|
7258
|
+
# "list": [
|
7259
|
+
# {
|
7260
|
+
# "symbol": "ETHPERP",
|
7261
|
+
# "orderType": "Market",
|
7262
|
+
# "underlyingPrice": "",
|
7263
|
+
# "orderLinkId": "",
|
7264
|
+
# "side": "Buy",
|
7265
|
+
# "indexPrice": "",
|
7266
|
+
# "orderId": "8c065341-7b52-4ca9-ac2c-37e31ac55c94",
|
7267
|
+
# "stopOrderType": "UNKNOWN",
|
7268
|
+
# "leavesQty": "0",
|
7269
|
+
# "execTime": "1672282722429",
|
7270
|
+
# "isMaker": False,
|
7271
|
+
# "execFee": "0.071409",
|
7272
|
+
# "feeRate": "0.0006",
|
7273
|
+
# "execId": "e0cbe81d-0f18-5866-9415-cf319b5dab3b",
|
7274
|
+
# "tradeIv": "",
|
7275
|
+
# "blockTradeId": "",
|
7276
|
+
# "markPrice": "1183.54",
|
7277
|
+
# "execPrice": "1190.15",
|
7278
|
+
# "markIv": "",
|
7279
|
+
# "orderQty": "0.1",
|
7280
|
+
# "orderPrice": "1236.9",
|
7281
|
+
# "execValue": "119.015",
|
7282
|
+
# "execType": "Trade",
|
7283
|
+
# "execQty": "0.1"
|
7284
|
+
# }
|
7285
|
+
# ]
|
7286
|
+
# },
|
7287
|
+
# "retExtInfo": {},
|
7288
|
+
# "time": 1672283754510
|
7289
|
+
# }
|
7290
|
+
#
|
7291
|
+
liquidations = self.add_pagination_cursor_to_result(response)
|
7292
|
+
return self.parse_liquidations(liquidations, market, since, limit)
|
7293
|
+
|
7294
|
+
def parse_liquidation(self, liquidation, market: Market = None):
|
7295
|
+
#
|
7296
|
+
# {
|
7297
|
+
# "symbol": "ETHPERP",
|
7298
|
+
# "orderType": "Market",
|
7299
|
+
# "underlyingPrice": "",
|
7300
|
+
# "orderLinkId": "",
|
7301
|
+
# "side": "Buy",
|
7302
|
+
# "indexPrice": "",
|
7303
|
+
# "orderId": "8c065341-7b52-4ca9-ac2c-37e31ac55c94",
|
7304
|
+
# "stopOrderType": "UNKNOWN",
|
7305
|
+
# "leavesQty": "0",
|
7306
|
+
# "execTime": "1672282722429",
|
7307
|
+
# "isMaker": False,
|
7308
|
+
# "execFee": "0.071409",
|
7309
|
+
# "feeRate": "0.0006",
|
7310
|
+
# "execId": "e0cbe81d-0f18-5866-9415-cf319b5dab3b",
|
7311
|
+
# "tradeIv": "",
|
7312
|
+
# "blockTradeId": "",
|
7313
|
+
# "markPrice": "1183.54",
|
7314
|
+
# "execPrice": "1190.15",
|
7315
|
+
# "markIv": "",
|
7316
|
+
# "orderQty": "0.1",
|
7317
|
+
# "orderPrice": "1236.9",
|
7318
|
+
# "execValue": "119.015",
|
7319
|
+
# "execType": "Trade",
|
7320
|
+
# "execQty": "0.1"
|
7321
|
+
# }
|
7322
|
+
#
|
7323
|
+
marketId = self.safe_string(liquidation, 'symbol')
|
7324
|
+
timestamp = self.safe_integer(liquidation, 'execTime')
|
7325
|
+
contractsString = self.safe_string(liquidation, 'execQty')
|
7326
|
+
contractSizeString = self.safe_string(market, 'contractSize')
|
7327
|
+
priceString = self.safe_string(liquidation, 'execPrice')
|
7328
|
+
baseValueString = Precise.string_mul(contractsString, contractSizeString)
|
7329
|
+
quoteValueString = Precise.string_mul(baseValueString, priceString)
|
7330
|
+
return self.safe_liquidation({
|
7331
|
+
'info': liquidation,
|
7332
|
+
'symbol': self.safe_symbol(marketId, market),
|
7333
|
+
'contracts': self.parse_number(contractsString),
|
7334
|
+
'contractSize': self.parse_number(contractSizeString),
|
7335
|
+
'price': self.parse_number(priceString),
|
7336
|
+
'baseValue': self.parse_number(baseValueString),
|
7337
|
+
'quoteValue': self.parse_number(quoteValueString),
|
7338
|
+
'timestamp': timestamp,
|
7339
|
+
'datetime': self.iso8601(timestamp),
|
7340
|
+
})
|
7341
|
+
|
7216
7342
|
def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
|
7217
7343
|
url = self.implode_hostname(self.urls['api'][api]) + '/' + path
|
7218
7344
|
if api == 'public':
|
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.async_support.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.independentreserve import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Balances, Int, Market, Order, OrderBook, OrderSide, OrderType, Str, Ticker, Trade
|
9
|
+
from ccxt.base.types import Balances, Currency, Int, Market, Order, OrderBook, OrderSide, OrderType, Str, Ticker, Trade
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.decimal_to_precision import TICK_SIZE
|
12
12
|
from ccxt.base.precise import Precise
|
@@ -43,6 +43,9 @@ class independentreserve(Exchange, ImplicitAPI):
|
|
43
43
|
'fetchClosedOrders': True,
|
44
44
|
'fetchCrossBorrowRate': False,
|
45
45
|
'fetchCrossBorrowRates': False,
|
46
|
+
'fetchDepositAddress': True,
|
47
|
+
'fetchDepositAddresses': False,
|
48
|
+
'fetchDepositAddressesByNetwork': False,
|
46
49
|
'fetchFundingHistory': False,
|
47
50
|
'fetchFundingRate': False,
|
48
51
|
'fetchFundingRateHistory': False,
|
@@ -671,6 +674,49 @@ class independentreserve(Exchange, ImplicitAPI):
|
|
671
674
|
}
|
672
675
|
return await self.privatePostCancelOrder(self.extend(request, params))
|
673
676
|
|
677
|
+
async def fetch_deposit_address(self, code: str, params={}):
|
678
|
+
"""
|
679
|
+
fetch the deposit address for a currency associated with self account
|
680
|
+
:see: https://www.independentreserve.com/features/api#GetDigitalCurrencyDepositAddress
|
681
|
+
:param str code: unified currency code
|
682
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
683
|
+
:returns dict: an `address structure <https://docs.ccxt.com/#/?id=address-structure>`
|
684
|
+
"""
|
685
|
+
await self.load_markets()
|
686
|
+
currency = self.currency(code)
|
687
|
+
request = {
|
688
|
+
'primaryCurrencyCode': currency['id'],
|
689
|
+
}
|
690
|
+
response = await self.privatePostGetDigitalCurrencyDepositAddress(self.extend(request, params))
|
691
|
+
#
|
692
|
+
# {
|
693
|
+
# Tag: '3307446684',
|
694
|
+
# DepositAddress: 'GCCQH4HACMRAD56EZZZ4TOIDQQRVNADMJ35QOFWF4B2VQGODMA2WVQ22',
|
695
|
+
# LastCheckedTimestampUtc: '2024-02-20T11:13:35.6912985Z',
|
696
|
+
# NextUpdateTimestampUtc: '2024-02-20T11:14:56.5112394Z'
|
697
|
+
# }
|
698
|
+
#
|
699
|
+
return self.parse_deposit_address(response)
|
700
|
+
|
701
|
+
def parse_deposit_address(self, depositAddress, currency: Currency = None):
|
702
|
+
#
|
703
|
+
# {
|
704
|
+
# Tag: '3307446684',
|
705
|
+
# DepositAddress: 'GCCQH4HACMRAD56EZZZ4TOIDQQRVNADMJ35QOFWF4B2VQGODMA2WVQ22',
|
706
|
+
# LastCheckedTimestampUtc: '2024-02-20T11:13:35.6912985Z',
|
707
|
+
# NextUpdateTimestampUtc: '2024-02-20T11:14:56.5112394Z'
|
708
|
+
# }
|
709
|
+
#
|
710
|
+
address = self.safe_string(depositAddress, 'DepositAddress')
|
711
|
+
self.check_address(address)
|
712
|
+
return {
|
713
|
+
'info': depositAddress,
|
714
|
+
'currency': self.safe_string(currency, 'code'),
|
715
|
+
'address': address,
|
716
|
+
'tag': self.safe_string(depositAddress, 'Tag'),
|
717
|
+
'network': None,
|
718
|
+
}
|
719
|
+
|
674
720
|
def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
|
675
721
|
url = self.urls['api'][api] + '/' + path
|
676
722
|
if api == 'public':
|
ccxt/async_support/latoken.py
CHANGED
@@ -244,6 +244,7 @@ class latoken(Exchange, ImplicitAPI):
|
|
244
244
|
async def fetch_time(self, params={}):
|
245
245
|
"""
|
246
246
|
fetches the current integer timestamp in milliseconds from the exchange server
|
247
|
+
:see: https://api.latoken.com/doc/v2/#tag/Time/operation/currentTime
|
247
248
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
248
249
|
:returns int: the current integer timestamp in milliseconds from the exchange server
|
249
250
|
"""
|
@@ -258,6 +259,7 @@ class latoken(Exchange, ImplicitAPI):
|
|
258
259
|
async def fetch_markets(self, params={}):
|
259
260
|
"""
|
260
261
|
retrieves data on all markets for latoken
|
262
|
+
:see: https://api.latoken.com/doc/v2/#tag/Pair/operation/getActivePairs
|
261
263
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
262
264
|
:returns dict[]: an array of objects representing market data
|
263
265
|
"""
|
@@ -483,6 +485,7 @@ class latoken(Exchange, ImplicitAPI):
|
|
483
485
|
async def fetch_balance(self, params={}) -> Balances:
|
484
486
|
"""
|
485
487
|
query for balance and get the amount of funds available for trading or funds locked in orders
|
488
|
+
:see: https://api.latoken.com/doc/v2/#tag/Account/operation/getBalancesByUser
|
486
489
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
487
490
|
:returns dict: a `balance structure <https://docs.ccxt.com/#/?id=balance-structure>`
|
488
491
|
"""
|
@@ -543,6 +546,7 @@ class latoken(Exchange, ImplicitAPI):
|
|
543
546
|
async def fetch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook:
|
544
547
|
"""
|
545
548
|
fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
|
549
|
+
:see: https://api.latoken.com/doc/v2/#tag/Order-Book/operation/getOrderBook
|
546
550
|
:param str symbol: unified symbol of the market to fetch the order book for
|
547
551
|
:param int [limit]: the maximum amount of order book entries to return
|
548
552
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -625,6 +629,7 @@ class latoken(Exchange, ImplicitAPI):
|
|
625
629
|
async def fetch_ticker(self, symbol: str, params={}) -> Ticker:
|
626
630
|
"""
|
627
631
|
fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
632
|
+
:see: https://api.latoken.com/doc/v2/#tag/Ticker/operation/getTicker
|
628
633
|
:param str symbol: unified symbol of the market to fetch the ticker for
|
629
634
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
630
635
|
:returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
|
@@ -661,6 +666,7 @@ class latoken(Exchange, ImplicitAPI):
|
|
661
666
|
async def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
|
662
667
|
"""
|
663
668
|
fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
669
|
+
:see: https://api.latoken.com/doc/v2/#tag/Ticker/operation/getAllTickers
|
664
670
|
:param str[]|None symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
665
671
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
666
672
|
:returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
|
@@ -775,6 +781,7 @@ class latoken(Exchange, ImplicitAPI):
|
|
775
781
|
async def fetch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
|
776
782
|
"""
|
777
783
|
get the list of most recent trades for a particular symbol
|
784
|
+
:see: https://api.latoken.com/doc/v2/#tag/Trade/operation/getTradesByPair
|
778
785
|
:param str symbol: unified symbol of the market to fetch trades for
|
779
786
|
:param int [since]: timestamp in ms of the earliest trade to fetch
|
780
787
|
:param int [limit]: the maximum amount of trades to fetch
|
@@ -804,6 +811,8 @@ class latoken(Exchange, ImplicitAPI):
|
|
804
811
|
async def fetch_trading_fee(self, symbol: str, params={}):
|
805
812
|
"""
|
806
813
|
fetch the trading fees for a market
|
814
|
+
:see: https://api.latoken.com/doc/v2/#tag/Trade/operation/getFeeByPair
|
815
|
+
:see: https://api.latoken.com/doc/v2/#tag/Trade/operation/getAuthFeeByPair
|
807
816
|
:param str symbol: unified market symbol
|
808
817
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
809
818
|
:returns dict: a `fee structure <https://docs.ccxt.com/#/?id=fee-structure>`
|
@@ -868,6 +877,8 @@ class latoken(Exchange, ImplicitAPI):
|
|
868
877
|
async def fetch_my_trades(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
869
878
|
"""
|
870
879
|
fetch all trades made by the user
|
880
|
+
:see: https://api.latoken.com/doc/v2/#tag/Trade/operation/getTradesByTrader
|
881
|
+
:see: https://api.latoken.com/doc/v2/#tag/Trade/operation/getTradesByAssetAndTrader
|
871
882
|
:param str symbol: unified market symbol
|
872
883
|
:param int [since]: the earliest time in ms to fetch trades for
|
873
884
|
:param int [limit]: the maximum number of trades structures to retrieve
|
@@ -1329,6 +1340,7 @@ class latoken(Exchange, ImplicitAPI):
|
|
1329
1340
|
"""
|
1330
1341
|
* @deprecated
|
1331
1342
|
use fetchDepositsWithdrawals instead
|
1343
|
+
:see: https://api.latoken.com/doc/v2/#tag/Transaction/operation/getUserTransactions
|
1332
1344
|
:param str code: unified currency code for the currency of the transactions, default is None
|
1333
1345
|
:param int [since]: timestamp in ms of the earliest transaction, default is None
|
1334
1346
|
:param int [limit]: max number of transactions to return, default is None
|
@@ -1453,6 +1465,7 @@ class latoken(Exchange, ImplicitAPI):
|
|
1453
1465
|
async def fetch_transfers(self, code: Str = None, since: Int = None, limit: Int = None, params={}):
|
1454
1466
|
"""
|
1455
1467
|
fetch a history of internal transfers made on an account
|
1468
|
+
:see: https://api.latoken.com/doc/v2/#tag/Transfer/operation/getUsersTransfers
|
1456
1469
|
:param str code: unified currency code of the currency transferred
|
1457
1470
|
:param int [since]: the earliest time in ms to fetch transfers for
|
1458
1471
|
:param int [limit]: the maximum number of transfers structures to retrieve
|
@@ -1499,6 +1512,9 @@ class latoken(Exchange, ImplicitAPI):
|
|
1499
1512
|
async def transfer(self, code: str, amount: float, fromAccount: str, toAccount: str, params={}) -> TransferEntry:
|
1500
1513
|
"""
|
1501
1514
|
transfer currency internally between wallets on the same account
|
1515
|
+
:see: https://api.latoken.com/doc/v2/#tag/Transfer/operation/transferByEmail
|
1516
|
+
:see: https://api.latoken.com/doc/v2/#tag/Transfer/operation/transferById
|
1517
|
+
:see: https://api.latoken.com/doc/v2/#tag/Transfer/operation/transferByPhone
|
1502
1518
|
:param str code: unified currency code
|
1503
1519
|
:param float amount: amount to transfer
|
1504
1520
|
:param str fromAccount: account to transfer from
|