ccxt 4.3.2__py2.py3-none-any.whl → 4.3.3__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 +1 -1
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/base/exchange.py +1 -1
- ccxt/async_support/binance.py +295 -20
- ccxt/async_support/bingx.py +4 -4
- ccxt/async_support/bitget.py +69 -1
- ccxt/async_support/coinbase.py +8 -1
- ccxt/async_support/hyperliquid.py +85 -13
- ccxt/async_support/okx.py +108 -0
- ccxt/async_support/poloniexfutures.py +9 -2
- ccxt/async_support/woo.py +102 -6
- ccxt/base/exchange.py +20 -1
- ccxt/binance.py +295 -20
- ccxt/bingx.py +4 -4
- ccxt/bitget.py +69 -1
- ccxt/coinbase.py +8 -1
- ccxt/hyperliquid.py +85 -13
- ccxt/okx.py +108 -0
- ccxt/poloniexfutures.py +9 -2
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/hyperliquid.py +8 -7
- ccxt/pro/kraken.py +1 -1
- ccxt/pro/wazirx.py +2 -1
- ccxt/woo.py +102 -6
- {ccxt-4.3.2.dist-info → ccxt-4.3.3.dist-info}/METADATA +4 -4
- {ccxt-4.3.2.dist-info → ccxt-4.3.3.dist-info}/RECORD +28 -28
- {ccxt-4.3.2.dist-info → ccxt-4.3.3.dist-info}/WHEEL +0 -0
- {ccxt-4.3.2.dist-info → ccxt-4.3.3.dist-info}/top_level.txt +0 -0
ccxt/hyperliquid.py
CHANGED
@@ -314,6 +314,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
314
314
|
# ]
|
315
315
|
# ]
|
316
316
|
#
|
317
|
+
#
|
317
318
|
meta = self.safe_dict(response, 0, {})
|
318
319
|
meta = self.safe_list(meta, 'universe', [])
|
319
320
|
assetCtxs = self.safe_dict(response, 1, {})
|
@@ -372,10 +373,70 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
372
373
|
# },
|
373
374
|
# ],
|
374
375
|
# ]
|
376
|
+
# mainnet
|
377
|
+
# [
|
378
|
+
# {
|
379
|
+
# "canonical_tokens2":[
|
380
|
+
# 0,
|
381
|
+
# 1
|
382
|
+
# ],
|
383
|
+
# "spot_infos":[
|
384
|
+
# {
|
385
|
+
# "name":"PURR/USDC",
|
386
|
+
# "tokens":[
|
387
|
+
# 1,
|
388
|
+
# 0
|
389
|
+
# ]
|
390
|
+
# }
|
391
|
+
# ],
|
392
|
+
# "token_id_to_token":[
|
393
|
+
# [
|
394
|
+
# "0x6d1e7cde53ba9467b783cb7c530ce054",
|
395
|
+
# 0
|
396
|
+
# ],
|
397
|
+
# [
|
398
|
+
# "0xc1fb593aeffbeb02f85e0308e9956a90",
|
399
|
+
# 1
|
400
|
+
# ]
|
401
|
+
# ],
|
402
|
+
# "token_infos":[
|
403
|
+
# {
|
404
|
+
# "deployer":null,
|
405
|
+
# "spec":{
|
406
|
+
# "name":"USDC",
|
407
|
+
# "szDecimals":"8",
|
408
|
+
# "weiDecimals":"8"
|
409
|
+
# },
|
410
|
+
# "spots":[
|
411
|
+
# ]
|
412
|
+
# },
|
413
|
+
# {
|
414
|
+
# "deployer":null,
|
415
|
+
# "spec":{
|
416
|
+
# "name":"PURR",
|
417
|
+
# "szDecimals":"0",
|
418
|
+
# "weiDecimals":"5"
|
419
|
+
# },
|
420
|
+
# "spots":[
|
421
|
+
# 0
|
422
|
+
# ]
|
423
|
+
# }
|
424
|
+
# ]
|
425
|
+
# },
|
426
|
+
# [
|
427
|
+
# {
|
428
|
+
# "dayNtlVlm":"35001170.16631",
|
429
|
+
# "markPx":"0.15743",
|
430
|
+
# "midPx":"0.157555",
|
431
|
+
# "prevDayPx":"0.158"
|
432
|
+
# }
|
433
|
+
# ]
|
434
|
+
# ]
|
375
435
|
#
|
436
|
+
# response differs depending on the environment(mainnet vs sandbox)
|
376
437
|
first = self.safe_dict(response, 0, {})
|
377
|
-
meta = self.
|
378
|
-
tokens = self.
|
438
|
+
meta = self.safe_list_2(first, 'universe', 'spot_infos', [])
|
439
|
+
tokens = self.safe_list_2(first, 'tokens', 'token_infos', [])
|
379
440
|
markets = []
|
380
441
|
for i in range(0, len(meta)):
|
381
442
|
market = self.safe_dict(meta, i, {})
|
@@ -391,14 +452,16 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
391
452
|
maker = self.safe_number(fees, 'maker')
|
392
453
|
tokensPos = self.safe_list(market, 'tokens', [])
|
393
454
|
baseTokenPos = self.safe_integer(tokensPos, 0)
|
394
|
-
quoteTokenPos = self.safe_integer(tokensPos, 1)
|
455
|
+
# quoteTokenPos = self.safe_integer(tokensPos, 1)
|
395
456
|
baseTokenInfo = self.safe_dict(tokens, baseTokenPos, {})
|
396
|
-
quoteTokenInfo = self.safe_dict(tokens, quoteTokenPos, {})
|
397
|
-
|
398
|
-
|
457
|
+
# quoteTokenInfo = self.safe_dict(tokens, quoteTokenPos, {})
|
458
|
+
innerBaseTokenInfo = self.safe_dict(baseTokenInfo, 'spec', baseTokenInfo)
|
459
|
+
# innerQuoteTokenInfo = self.safe_dict(quoteTokenInfo, 'spec', quoteTokenInfo)
|
460
|
+
amountPrecision = self.parse_number(self.parse_precision(self.safe_string(innerBaseTokenInfo, 'szDecimals')))
|
461
|
+
# quotePrecision = self.parse_number(self.parse_precision(self.safe_string(innerQuoteTokenInfo, 'szDecimals')))
|
399
462
|
baseId = self.number_to_string(i + 10000)
|
400
463
|
markets.append(self.safe_market_structure({
|
401
|
-
'id':
|
464
|
+
'id': marketName,
|
402
465
|
'symbol': symbol,
|
403
466
|
'base': base,
|
404
467
|
'quote': quote,
|
@@ -408,14 +471,15 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
408
471
|
'settleId': None,
|
409
472
|
'type': 'spot',
|
410
473
|
'spot': True,
|
474
|
+
'subType': None,
|
411
475
|
'margin': None,
|
412
476
|
'swap': False,
|
413
477
|
'future': False,
|
414
478
|
'option': False,
|
415
479
|
'active': True,
|
416
480
|
'contract': False,
|
417
|
-
'linear':
|
418
|
-
'inverse':
|
481
|
+
'linear': None,
|
482
|
+
'inverse': None,
|
419
483
|
'taker': taker,
|
420
484
|
'maker': maker,
|
421
485
|
'contractSize': None,
|
@@ -424,8 +488,8 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
424
488
|
'strike': None,
|
425
489
|
'optionType': None,
|
426
490
|
'precision': {
|
427
|
-
'amount':
|
428
|
-
'price':
|
491
|
+
'amount': amountPrecision, # decimal places
|
492
|
+
'price': 5, # significant digits
|
429
493
|
},
|
430
494
|
'limits': {
|
431
495
|
'leverage': {
|
@@ -632,7 +696,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
632
696
|
market = self.market(symbol)
|
633
697
|
request = {
|
634
698
|
'type': 'l2Book',
|
635
|
-
'coin': market['base'],
|
699
|
+
'coin': market['base'] if market['swap'] else market['id'],
|
636
700
|
}
|
637
701
|
response = self.publicPostInfo(self.extend(request, params))
|
638
702
|
#
|
@@ -688,7 +752,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
688
752
|
request = {
|
689
753
|
'type': 'candleSnapshot',
|
690
754
|
'req': {
|
691
|
-
'coin': market['base'],
|
755
|
+
'coin': market['base'] if market['swap'] else market['id'],
|
692
756
|
'interval': timeframe,
|
693
757
|
'startTime': since,
|
694
758
|
'endTime': until,
|
@@ -791,6 +855,9 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
791
855
|
return self.parse_trades(response, market, since, limit)
|
792
856
|
|
793
857
|
def amount_to_precision(self, symbol, amount):
|
858
|
+
market = self.market(symbol)
|
859
|
+
if market['spot']:
|
860
|
+
return super(hyperliquid, self).amount_to_precision(symbol, amount)
|
794
861
|
return self.decimal_to_precision(amount, ROUND, self.markets[symbol]['precision']['amount'], self.precisionMode)
|
795
862
|
|
796
863
|
def price_to_precision(self, symbol: str, price) -> str:
|
@@ -2221,6 +2288,11 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
2221
2288
|
return [self.walletAddress, params]
|
2222
2289
|
raise ArgumentsRequired(self.id + ' ' + methodName + '() requires a user parameter inside \'params\' or the wallet address set')
|
2223
2290
|
|
2291
|
+
def coin_to_market_id(self, coin: Str):
|
2292
|
+
if coin.find('/') > -1:
|
2293
|
+
return coin # spot
|
2294
|
+
return coin + '/USDC:USDC'
|
2295
|
+
|
2224
2296
|
def handle_errors(self, code, reason, url, method, headers, body, response, requestHeaders, requestBody):
|
2225
2297
|
if not response:
|
2226
2298
|
return None # fallback to default error handler
|
ccxt/okx.py
CHANGED
@@ -86,6 +86,8 @@ class okx(Exchange, ImplicitAPI):
|
|
86
86
|
'fetchClosedOrders': True,
|
87
87
|
'fetchConvertCurrencies': True,
|
88
88
|
'fetchConvertQuote': True,
|
89
|
+
'fetchConvertTrade': True,
|
90
|
+
'fetchConvertTradeHistory': True,
|
89
91
|
'fetchCrossBorrowRate': True,
|
90
92
|
'fetchCrossBorrowRates': True,
|
91
93
|
'fetchCurrencies': True,
|
@@ -7202,6 +7204,96 @@ class okx(Exchange, ImplicitAPI):
|
|
7202
7204
|
toCurrency = self.currency(toCurrencyId)
|
7203
7205
|
return self.parse_conversion(result, fromCurrency, toCurrency)
|
7204
7206
|
|
7207
|
+
def fetch_convert_trade(self, id: str, code: Str = None, params={}) -> Conversion:
|
7208
|
+
"""
|
7209
|
+
fetch the data for a conversion trade
|
7210
|
+
:see: https://www.okx.com/docs-v5/en/#funding-account-rest-api-get-convert-history
|
7211
|
+
:param str id: the id of the trade that you want to fetch
|
7212
|
+
:param str [code]: the unified currency code of the conversion trade
|
7213
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
7214
|
+
:returns dict: a `conversion structure <https://docs.ccxt.com/#/?id=conversion-structure>`
|
7215
|
+
"""
|
7216
|
+
self.load_markets()
|
7217
|
+
request = {
|
7218
|
+
'clTReqId': id,
|
7219
|
+
}
|
7220
|
+
response = self.privateGetAssetConvertHistory(self.extend(request, params))
|
7221
|
+
#
|
7222
|
+
# {
|
7223
|
+
# "code": "0",
|
7224
|
+
# "data": [
|
7225
|
+
# {
|
7226
|
+
# "clTReqId": "",
|
7227
|
+
# "instId": "ETH-USDT",
|
7228
|
+
# "side": "buy",
|
7229
|
+
# "fillPx": "2932.401044",
|
7230
|
+
# "baseCcy": "ETH",
|
7231
|
+
# "quoteCcy": "USDT",
|
7232
|
+
# "fillBaseSz": "0.01023052",
|
7233
|
+
# "state": "fullyFilled",
|
7234
|
+
# "tradeId": "trader16461885203381437",
|
7235
|
+
# "fillQuoteSz": "30",
|
7236
|
+
# "ts": "1646188520000"
|
7237
|
+
# }
|
7238
|
+
# ],
|
7239
|
+
# "msg": ""
|
7240
|
+
# }
|
7241
|
+
#
|
7242
|
+
data = self.safe_list(response, 'data', [])
|
7243
|
+
result = self.safe_dict(data, 0, {})
|
7244
|
+
fromCurrencyId = self.safe_string(result, 'baseCcy')
|
7245
|
+
toCurrencyId = self.safe_string(result, 'quoteCcy')
|
7246
|
+
fromCurrency = None
|
7247
|
+
toCurrency = None
|
7248
|
+
if fromCurrencyId is not None:
|
7249
|
+
fromCurrency = self.currency(fromCurrencyId)
|
7250
|
+
if toCurrencyId is not None:
|
7251
|
+
toCurrency = self.currency(toCurrencyId)
|
7252
|
+
return self.parse_conversion(result, fromCurrency, toCurrency)
|
7253
|
+
|
7254
|
+
def fetch_convert_trade_history(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Conversion]:
|
7255
|
+
"""
|
7256
|
+
fetch the users history of conversion trades
|
7257
|
+
:see: https://www.okx.com/docs-v5/en/#funding-account-rest-api-get-convert-history
|
7258
|
+
:param str [code]: the unified currency code
|
7259
|
+
:param int [since]: the earliest time in ms to fetch conversions for
|
7260
|
+
:param int [limit]: the maximum number of conversion structures to retrieve
|
7261
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
7262
|
+
:param int [params.until]: timestamp in ms of the latest conversion to fetch
|
7263
|
+
:returns dict[]: a list of `conversion structures <https://docs.ccxt.com/#/?id=conversion-structure>`
|
7264
|
+
"""
|
7265
|
+
self.load_markets()
|
7266
|
+
request = {}
|
7267
|
+
request, params = self.handle_until_option('after', request, params)
|
7268
|
+
if since is not None:
|
7269
|
+
request['before'] = since
|
7270
|
+
if limit is not None:
|
7271
|
+
request['limit'] = limit
|
7272
|
+
response = self.privateGetAssetConvertHistory(self.extend(request, params))
|
7273
|
+
#
|
7274
|
+
# {
|
7275
|
+
# "code": "0",
|
7276
|
+
# "data": [
|
7277
|
+
# {
|
7278
|
+
# "clTReqId": "",
|
7279
|
+
# "instId": "ETH-USDT",
|
7280
|
+
# "side": "buy",
|
7281
|
+
# "fillPx": "2932.401044",
|
7282
|
+
# "baseCcy": "ETH",
|
7283
|
+
# "quoteCcy": "USDT",
|
7284
|
+
# "fillBaseSz": "0.01023052",
|
7285
|
+
# "state": "fullyFilled",
|
7286
|
+
# "tradeId": "trader16461885203381437",
|
7287
|
+
# "fillQuoteSz": "30",
|
7288
|
+
# "ts": "1646188520000"
|
7289
|
+
# }
|
7290
|
+
# ],
|
7291
|
+
# "msg": ""
|
7292
|
+
# }
|
7293
|
+
#
|
7294
|
+
rows = self.safe_list(response, 'data', [])
|
7295
|
+
return self.parse_conversions(rows, 'baseCcy', 'quoteCcy', since, limit)
|
7296
|
+
|
7205
7297
|
def parse_conversion(self, conversion, fromCurrency: Currency = None, toCurrency: Currency = None) -> Conversion:
|
7206
7298
|
#
|
7207
7299
|
# fetchConvertQuote
|
@@ -7239,6 +7331,22 @@ class okx(Exchange, ImplicitAPI):
|
|
7239
7331
|
# "ts": "1646188520338"
|
7240
7332
|
# }
|
7241
7333
|
#
|
7334
|
+
# fetchConvertTrade, fetchConvertTradeHistory
|
7335
|
+
#
|
7336
|
+
# {
|
7337
|
+
# "clTReqId": "",
|
7338
|
+
# "instId": "ETH-USDT",
|
7339
|
+
# "side": "buy",
|
7340
|
+
# "fillPx": "2932.401044",
|
7341
|
+
# "baseCcy": "ETH",
|
7342
|
+
# "quoteCcy": "USDT",
|
7343
|
+
# "fillBaseSz": "0.01023052",
|
7344
|
+
# "state": "fullyFilled",
|
7345
|
+
# "tradeId": "trader16461885203381437",
|
7346
|
+
# "fillQuoteSz": "30",
|
7347
|
+
# "ts": "1646188520000"
|
7348
|
+
# }
|
7349
|
+
#
|
7242
7350
|
timestamp = self.safe_integer_2(conversion, 'quoteTime', 'ts')
|
7243
7351
|
fromCoin = self.safe_string(conversion, 'baseCcy')
|
7244
7352
|
fromCode = self.safe_currency_code(fromCoin, fromCurrency)
|
ccxt/poloniexfutures.py
CHANGED
@@ -383,8 +383,15 @@ class poloniexfutures(Exchange, ImplicitAPI):
|
|
383
383
|
marketId = self.safe_string(ticker, 'symbol')
|
384
384
|
symbol = self.safe_symbol(marketId, market)
|
385
385
|
timestampString = self.safe_string(ticker, 'ts')
|
386
|
-
# check timestamp bcz bug: https://app.travis-ci.com/github/ccxt/ccxt/builds/269959181#L4011
|
387
|
-
multiplier =
|
386
|
+
# check timestamp bcz bug: https://app.travis-ci.com/github/ccxt/ccxt/builds/269959181#L4011 and also 17 digits occured
|
387
|
+
multiplier = None
|
388
|
+
if len(timestampString) == 17:
|
389
|
+
multiplier = 0.0001
|
390
|
+
elif len(timestampString) == 18:
|
391
|
+
multiplier = 0.00001
|
392
|
+
else:
|
393
|
+
# 19 length default
|
394
|
+
multiplier = 0.000001
|
388
395
|
timestamp = self.safe_integer_product(ticker, 'ts', multiplier)
|
389
396
|
last = self.safe_string_2(ticker, 'price', 'lastPrice')
|
390
397
|
percentage = Precise.string_mul(self.safe_string(ticker, 'priceChgPct'), '100')
|
ccxt/pro/__init__.py
CHANGED
ccxt/pro/hyperliquid.py
CHANGED
@@ -70,7 +70,7 @@ class hyperliquid(ccxt.async_support.hyperliquid):
|
|
70
70
|
'method': 'subscribe',
|
71
71
|
'subscription': {
|
72
72
|
'type': 'l2Book',
|
73
|
-
'coin': market['base'],
|
73
|
+
'coin': market['base'] if market['swap'] else market['id'],
|
74
74
|
},
|
75
75
|
}
|
76
76
|
message = self.extend(request, params)
|
@@ -105,7 +105,7 @@ class hyperliquid(ccxt.async_support.hyperliquid):
|
|
105
105
|
#
|
106
106
|
entry = self.safe_dict(message, 'data', {})
|
107
107
|
coin = self.safe_string(entry, 'coin')
|
108
|
-
marketId = coin
|
108
|
+
marketId = self.coinToMarketId(coin)
|
109
109
|
market = self.market(marketId)
|
110
110
|
symbol = market['symbol']
|
111
111
|
rawData = self.safe_list(entry, 'levels', [])
|
@@ -225,7 +225,7 @@ class hyperliquid(ccxt.async_support.hyperliquid):
|
|
225
225
|
'method': 'subscribe',
|
226
226
|
'subscription': {
|
227
227
|
'type': 'trades',
|
228
|
-
'coin': market['base'],
|
228
|
+
'coin': market['base'] if market['swap'] else market['id'],
|
229
229
|
},
|
230
230
|
}
|
231
231
|
message = self.extend(request, params)
|
@@ -254,7 +254,7 @@ class hyperliquid(ccxt.async_support.hyperliquid):
|
|
254
254
|
entry = self.safe_list(message, 'data', [])
|
255
255
|
first = self.safe_dict(entry, 0, {})
|
256
256
|
coin = self.safe_string(first, 'coin')
|
257
|
-
marketId = coin
|
257
|
+
marketId = self.coinToMarketId(coin)
|
258
258
|
market = self.market(marketId)
|
259
259
|
symbol = market['symbol']
|
260
260
|
if not (symbol in self.trades):
|
@@ -307,7 +307,7 @@ class hyperliquid(ccxt.async_support.hyperliquid):
|
|
307
307
|
price = self.safe_string(trade, 'px')
|
308
308
|
amount = self.safe_string(trade, 'sz')
|
309
309
|
coin = self.safe_string(trade, 'coin')
|
310
|
-
marketId = coin
|
310
|
+
marketId = self.coinToMarketId(coin)
|
311
311
|
market = self.safe_market(marketId, None)
|
312
312
|
symbol = market['symbol']
|
313
313
|
id = self.safe_string(trade, 'tid')
|
@@ -349,7 +349,7 @@ class hyperliquid(ccxt.async_support.hyperliquid):
|
|
349
349
|
'method': 'subscribe',
|
350
350
|
'subscription': {
|
351
351
|
'type': 'candle',
|
352
|
-
'coin': market['base'],
|
352
|
+
'coin': market['base'] if market['swap'] else market['id'],
|
353
353
|
'interval': timeframe,
|
354
354
|
},
|
355
355
|
}
|
@@ -380,7 +380,8 @@ class hyperliquid(ccxt.async_support.hyperliquid):
|
|
380
380
|
#
|
381
381
|
data = self.safe_dict(message, 'data', {})
|
382
382
|
base = self.safe_string(data, 's')
|
383
|
-
|
383
|
+
marketId = self.coinToMarketId(base)
|
384
|
+
symbol = self.safe_symbol(marketId)
|
384
385
|
timeframe = self.safe_string(data, 'i')
|
385
386
|
if not (symbol in self.ohlcvs):
|
386
387
|
self.ohlcvs[symbol] = {}
|
ccxt/pro/kraken.py
CHANGED
@@ -1242,7 +1242,7 @@ class kraken(ccxt.async_support.kraken):
|
|
1242
1242
|
},
|
1243
1243
|
}
|
1244
1244
|
url = self.urls['api']['ws']['public']
|
1245
|
-
return await self.watch_multiple(url, messageHashes, self.
|
1245
|
+
return await self.watch_multiple(url, messageHashes, self.deep_extend(request, params), messageHashes, subscriptionArgs)
|
1246
1246
|
|
1247
1247
|
def get_message_hash(self, unifiedElementName: str, subChannelName: Str = None, symbol: Str = None):
|
1248
1248
|
# unifiedElementName can be : orderbook, trade, ticker, bidask ...
|
ccxt/pro/wazirx.py
CHANGED
@@ -722,7 +722,8 @@ class wazirx(ccxt.async_support.wazirx):
|
|
722
722
|
}
|
723
723
|
streams = list(streamHandlers.keys())
|
724
724
|
for i in range(0, len(streams)):
|
725
|
-
|
725
|
+
streamContains = stream.find(streams[i]) > -1
|
726
|
+
if streamContains:
|
726
727
|
handler = streamHandlers[streams[i]]
|
727
728
|
handler(client, message)
|
728
729
|
return
|
ccxt/woo.py
CHANGED
@@ -69,6 +69,8 @@ class woo(Exchange, ImplicitAPI):
|
|
69
69
|
'fetchClosedOrders': True,
|
70
70
|
'fetchConvertCurrencies': True,
|
71
71
|
'fetchConvertQuote': True,
|
72
|
+
'fetchConvertTrade': True,
|
73
|
+
'fetchConvertTradeHistory': True,
|
72
74
|
'fetchCurrencies': True,
|
73
75
|
'fetchDepositAddress': True,
|
74
76
|
'fetchDeposits': True,
|
@@ -2853,6 +2855,88 @@ class woo(Exchange, ImplicitAPI):
|
|
2853
2855
|
data = self.safe_dict(response, 'data', {})
|
2854
2856
|
return self.parse_conversion(data)
|
2855
2857
|
|
2858
|
+
def fetch_convert_trade(self, id: str, code: Str = None, params={}) -> Conversion:
|
2859
|
+
"""
|
2860
|
+
fetch the data for a conversion trade
|
2861
|
+
:see: https://docs.woo.org/#get-quote-trade
|
2862
|
+
:param str id: the id of the trade that you want to fetch
|
2863
|
+
:param str [code]: the unified currency code of the conversion trade
|
2864
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2865
|
+
:returns dict: a `conversion structure <https://docs.ccxt.com/#/?id=conversion-structure>`
|
2866
|
+
"""
|
2867
|
+
self.load_markets()
|
2868
|
+
request = {
|
2869
|
+
'quoteId': id,
|
2870
|
+
}
|
2871
|
+
response = self.v3PrivateGetConvertTrade(self.extend(request, params))
|
2872
|
+
#
|
2873
|
+
# {
|
2874
|
+
# "success": True,
|
2875
|
+
# "data": {
|
2876
|
+
# "quoteId": 12,
|
2877
|
+
# "buyAsset": "",
|
2878
|
+
# "sellAsset": "",
|
2879
|
+
# "buyAmount": 12.11,
|
2880
|
+
# "sellAmount": 12.11,
|
2881
|
+
# "tradeStatus": 12,
|
2882
|
+
# "createdTime": ""
|
2883
|
+
# }
|
2884
|
+
# }
|
2885
|
+
#
|
2886
|
+
data = self.safe_dict(response, 'data', {})
|
2887
|
+
fromCurrencyId = self.safe_string(data, 'sellAsset')
|
2888
|
+
toCurrencyId = self.safe_string(data, 'buyAsset')
|
2889
|
+
fromCurrency = None
|
2890
|
+
toCurrency = None
|
2891
|
+
if fromCurrencyId is not None:
|
2892
|
+
fromCurrency = self.currency(fromCurrencyId)
|
2893
|
+
if toCurrencyId is not None:
|
2894
|
+
toCurrency = self.currency(toCurrencyId)
|
2895
|
+
return self.parse_conversion(data, fromCurrency, toCurrency)
|
2896
|
+
|
2897
|
+
def fetch_convert_trade_history(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Conversion]:
|
2898
|
+
"""
|
2899
|
+
fetch the users history of conversion trades
|
2900
|
+
:see: https://docs.woo.org/#get-quote-trades
|
2901
|
+
:param str [code]: the unified currency code
|
2902
|
+
:param int [since]: the earliest time in ms to fetch conversions for
|
2903
|
+
:param int [limit]: the maximum number of conversion structures to retrieve
|
2904
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2905
|
+
:param int [params.until]: timestamp in ms of the latest conversion to fetch
|
2906
|
+
:returns dict[]: a list of `conversion structures <https://docs.ccxt.com/#/?id=conversion-structure>`
|
2907
|
+
"""
|
2908
|
+
self.load_markets()
|
2909
|
+
request = {}
|
2910
|
+
request, params = self.handle_until_option('endTime', request, params)
|
2911
|
+
if since is not None:
|
2912
|
+
request['startTime'] = since
|
2913
|
+
if limit is not None:
|
2914
|
+
request['size'] = limit
|
2915
|
+
response = self.v3PrivateGetConvertTrades(self.extend(request, params))
|
2916
|
+
#
|
2917
|
+
# {
|
2918
|
+
# "success": True,
|
2919
|
+
# "data": {
|
2920
|
+
# "count": 12,
|
2921
|
+
# "tradeVos":[
|
2922
|
+
# {
|
2923
|
+
# "quoteId": 12,
|
2924
|
+
# "buyAsset": "",
|
2925
|
+
# "sellAsset": "",
|
2926
|
+
# "buyAmount": 12.11,
|
2927
|
+
# "sellAmount": 12.11,
|
2928
|
+
# "tradeStatus": 12,
|
2929
|
+
# "createdTime": ""
|
2930
|
+
# }
|
2931
|
+
# ...
|
2932
|
+
# ]
|
2933
|
+
# }
|
2934
|
+
# }
|
2935
|
+
#
|
2936
|
+
data = self.safe_dict(response, 'data', {})
|
2937
|
+
rows = self.safe_list(data, 'tradeVos', [])
|
2938
|
+
return self.parse_conversions(rows, 'sellAsset', 'buyAsset', since, limit)
|
2939
|
+
|
2856
2940
|
def parse_conversion(self, conversion, fromCurrency: Currency = None, toCurrency: Currency = None) -> Conversion:
|
2857
2941
|
#
|
2858
2942
|
# fetchConvertQuote
|
@@ -2877,10 +2961,22 @@ class woo(Exchange, ImplicitAPI):
|
|
2877
2961
|
# "rftAccepted": 1 # 1 -> success; 2 -> processing; 3 -> fail
|
2878
2962
|
# }
|
2879
2963
|
#
|
2880
|
-
|
2881
|
-
|
2882
|
-
|
2883
|
-
|
2964
|
+
# fetchConvertTrade, fetchConvertTradeHistory
|
2965
|
+
#
|
2966
|
+
# {
|
2967
|
+
# "quoteId": 12,
|
2968
|
+
# "buyAsset": "",
|
2969
|
+
# "sellAsset": "",
|
2970
|
+
# "buyAmount": 12.11,
|
2971
|
+
# "sellAmount": 12.11,
|
2972
|
+
# "tradeStatus": 12,
|
2973
|
+
# "createdTime": ""
|
2974
|
+
# }
|
2975
|
+
#
|
2976
|
+
timestamp = self.safe_integer_2(conversion, 'expireTimestamp', 'createdTime')
|
2977
|
+
fromCurr = self.safe_string_2(conversion, 'sellToken', 'buyAsset')
|
2978
|
+
fromCode = self.safe_currency_code(fromCurr, fromCurrency)
|
2979
|
+
to = self.safe_string_2(conversion, 'buyToken', 'sellAsset')
|
2884
2980
|
toCode = self.safe_currency_code(to, toCurrency)
|
2885
2981
|
return {
|
2886
2982
|
'info': conversion,
|
@@ -2888,9 +2984,9 @@ class woo(Exchange, ImplicitAPI):
|
|
2888
2984
|
'datetime': self.iso8601(timestamp),
|
2889
2985
|
'id': self.safe_string(conversion, 'quoteId'),
|
2890
2986
|
'fromCurrency': fromCode,
|
2891
|
-
'fromAmount': self.
|
2987
|
+
'fromAmount': self.safe_number_2(conversion, 'sellQuantity', 'sellAmount'),
|
2892
2988
|
'toCurrency': toCode,
|
2893
|
-
'toAmount': self.
|
2989
|
+
'toAmount': self.safe_number_2(conversion, 'buyQuantity', 'buyAmount'),
|
2894
2990
|
'price': self.safe_number(conversion, 'buyPrice'),
|
2895
2991
|
'fee': None,
|
2896
2992
|
}
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: ccxt
|
3
|
-
Version: 4.3.
|
3
|
+
Version: 4.3.3
|
4
4
|
Summary: A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading library with support for 100+ exchanges
|
5
5
|
Home-page: https://ccxt.com
|
6
6
|
Author: Igor Kroitor
|
@@ -262,13 +262,13 @@ console.log(version, Object.keys(exchanges));
|
|
262
262
|
|
263
263
|
All-in-one browser bundle (dependencies included), served from a CDN of your choice:
|
264
264
|
|
265
|
-
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.3.
|
266
|
-
* unpkg: https://unpkg.com/ccxt@4.3.
|
265
|
+
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.3.3/dist/ccxt.browser.js
|
266
|
+
* unpkg: https://unpkg.com/ccxt@4.3.3/dist/ccxt.browser.js
|
267
267
|
|
268
268
|
CDNs are not updated in real-time and may have delays. Defaulting to the most recent version without specifying the version number is not recommended. Please, keep in mind that we are not responsible for the correct operation of those CDN servers.
|
269
269
|
|
270
270
|
```HTML
|
271
|
-
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.3.
|
271
|
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.3.3/dist/ccxt.browser.js"></script>
|
272
272
|
```
|
273
273
|
|
274
274
|
Creates a global `ccxt` object:
|