ccxt 4.2.55__py2.py3-none-any.whl → 4.2.56__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/woo.py +9 -0
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/base/exchange.py +1 -1
- ccxt/async_support/bingx.py +36 -35
- ccxt/async_support/upbit.py +1 -1
- ccxt/async_support/woo.py +37 -0
- ccxt/base/exchange.py +2 -2
- ccxt/base/types.py +2 -1
- ccxt/bingx.py +36 -35
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/bitget.py +65 -72
- ccxt/pro/bybit.py +19 -5
- ccxt/pro/currencycom.py +2 -1
- ccxt/pro/kraken.py +1 -1
- ccxt/upbit.py +1 -1
- ccxt/woo.py +37 -0
- {ccxt-4.2.55.dist-info → ccxt-4.2.56.dist-info}/METADATA +4 -4
- {ccxt-4.2.55.dist-info → ccxt-4.2.56.dist-info}/RECORD +21 -21
- {ccxt-4.2.55.dist-info → ccxt-4.2.56.dist-info}/WHEEL +0 -0
- {ccxt-4.2.55.dist-info → ccxt-4.2.56.dist-info}/top_level.txt +0 -0
ccxt/bingx.py
CHANGED
@@ -722,7 +722,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
722
722
|
if paginate:
|
723
723
|
return self.fetch_paginated_call_deterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 1440)
|
724
724
|
market = self.market(symbol)
|
725
|
-
request = {
|
725
|
+
request: dict = {
|
726
726
|
'symbol': market['id'],
|
727
727
|
}
|
728
728
|
request['interval'] = self.safe_string(self.timeframes, timeframe, timeframe)
|
@@ -849,7 +849,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
849
849
|
"""
|
850
850
|
self.load_markets()
|
851
851
|
market = self.market(symbol)
|
852
|
-
request = {
|
852
|
+
request: dict = {
|
853
853
|
'symbol': market['id'],
|
854
854
|
}
|
855
855
|
if limit is not None:
|
@@ -1037,7 +1037,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
1037
1037
|
"""
|
1038
1038
|
self.load_markets()
|
1039
1039
|
market = self.market(symbol)
|
1040
|
-
request = {
|
1040
|
+
request: dict = {
|
1041
1041
|
'symbol': market['id'],
|
1042
1042
|
}
|
1043
1043
|
if limit is not None:
|
@@ -1120,7 +1120,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
1120
1120
|
"""
|
1121
1121
|
self.load_markets()
|
1122
1122
|
market = self.market(symbol)
|
1123
|
-
request = {
|
1123
|
+
request: dict = {
|
1124
1124
|
'symbol': market['id'],
|
1125
1125
|
}
|
1126
1126
|
response = self.swapV2PublicGetQuotePremiumIndex(self.extend(request, params))
|
@@ -1216,7 +1216,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
1216
1216
|
if paginate:
|
1217
1217
|
return self.fetch_paginated_call_deterministic('fetchFundingRateHistory', symbol, since, limit, '8h', params)
|
1218
1218
|
market = self.market(symbol)
|
1219
|
-
request = {
|
1219
|
+
request: dict = {
|
1220
1220
|
'symbol': market['id'],
|
1221
1221
|
}
|
1222
1222
|
if since is not None:
|
@@ -1269,7 +1269,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
1269
1269
|
"""
|
1270
1270
|
self.load_markets()
|
1271
1271
|
market = self.market(symbol)
|
1272
|
-
request = {
|
1272
|
+
request: dict = {
|
1273
1273
|
'symbol': market['id'],
|
1274
1274
|
}
|
1275
1275
|
response = self.swapV2PublicGetQuoteOpenInterest(self.extend(request, params))
|
@@ -1321,7 +1321,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
1321
1321
|
"""
|
1322
1322
|
self.load_markets()
|
1323
1323
|
market = self.market(symbol)
|
1324
|
-
request = {
|
1324
|
+
request: dict = {
|
1325
1325
|
'symbol': market['id'],
|
1326
1326
|
}
|
1327
1327
|
response = None
|
@@ -1346,7 +1346,8 @@ class bingx(Exchange, ImplicitAPI):
|
|
1346
1346
|
if symbols is not None:
|
1347
1347
|
symbols = self.market_symbols(symbols)
|
1348
1348
|
firstSymbol = self.safe_string(symbols, 0)
|
1349
|
-
|
1349
|
+
if firstSymbol is not None:
|
1350
|
+
market = self.market(firstSymbol)
|
1350
1351
|
type = None
|
1351
1352
|
type, params = self.handle_market_type_and_params('fetchTickers', market, params)
|
1352
1353
|
response = None
|
@@ -1357,7 +1358,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
1357
1358
|
tickers = self.safe_value(response, 'data')
|
1358
1359
|
return self.parse_tickers(tickers, symbols)
|
1359
1360
|
|
1360
|
-
def parse_ticker(self, ticker, market: Market = None) -> Ticker:
|
1361
|
+
def parse_ticker(self, ticker: dict, market: Market = None) -> Ticker:
|
1361
1362
|
#
|
1362
1363
|
# spot
|
1363
1364
|
# {
|
@@ -1715,7 +1716,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
1715
1716
|
marketType = None
|
1716
1717
|
marketType, params = self.handle_market_type_and_params('createOrder', market, params)
|
1717
1718
|
type = type.upper()
|
1718
|
-
request = {
|
1719
|
+
request: dict = {
|
1719
1720
|
'symbol': market['id'],
|
1720
1721
|
'type': type,
|
1721
1722
|
'side': side.upper(),
|
@@ -1814,7 +1815,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
1814
1815
|
slTriggerPrice = self.safe_string_2(stopLoss, 'triggerPrice', 'stopPrice', stopLoss)
|
1815
1816
|
slWorkingType = self.safe_string(stopLoss, 'workingType', 'MARK_PRICE')
|
1816
1817
|
slType = self.safe_string(stopLoss, 'type', 'STOP_MARKET')
|
1817
|
-
slRequest = {
|
1818
|
+
slRequest: dict = {
|
1818
1819
|
'stopPrice': self.parse_to_numeric(self.price_to_precision(symbol, slTriggerPrice)),
|
1819
1820
|
'workingType': slWorkingType,
|
1820
1821
|
'type': slType,
|
@@ -1829,7 +1830,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
1829
1830
|
tkTriggerPrice = self.safe_string_2(takeProfit, 'triggerPrice', 'stopPrice', takeProfit)
|
1830
1831
|
tkWorkingType = self.safe_string(takeProfit, 'workingType', 'MARK_PRICE')
|
1831
1832
|
tpType = self.safe_string(takeProfit, 'type', 'TAKE_PROFIT_MARKET')
|
1832
|
-
tpRequest = {
|
1833
|
+
tpRequest: dict = {
|
1833
1834
|
'stopPrice': self.parse_to_numeric(self.price_to_precision(symbol, tkTriggerPrice)),
|
1834
1835
|
'workingType': tkWorkingType,
|
1835
1836
|
'type': tpType,
|
@@ -1960,7 +1961,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
1960
1961
|
orderRequest = self.create_order_request(marketId, type, side, amount, price, orderParams)
|
1961
1962
|
ordersRequests.append(orderRequest)
|
1962
1963
|
market = self.market(symbol)
|
1963
|
-
request = {}
|
1964
|
+
request: dict = {}
|
1964
1965
|
response = None
|
1965
1966
|
if market['swap']:
|
1966
1967
|
request['batchOrders'] = self.json(ordersRequests)
|
@@ -2334,7 +2335,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
2334
2335
|
raise ArgumentsRequired(self.id + ' cancelOrder() requires a symbol argument')
|
2335
2336
|
self.load_markets()
|
2336
2337
|
market = self.market(symbol)
|
2337
|
-
request = {
|
2338
|
+
request: dict = {
|
2338
2339
|
'symbol': market['id'],
|
2339
2340
|
}
|
2340
2341
|
clientOrderId = self.safe_string_2(params, 'clientOrderId', 'clientOrderID')
|
@@ -2412,7 +2413,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
2412
2413
|
raise ArgumentsRequired(self.id + ' cancelAllOrders() requires a symbol argument')
|
2413
2414
|
self.load_markets()
|
2414
2415
|
market = self.market(symbol)
|
2415
|
-
request = {
|
2416
|
+
request: dict = {
|
2416
2417
|
'symbol': market['id'],
|
2417
2418
|
}
|
2418
2419
|
response = None
|
@@ -2490,7 +2491,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
2490
2491
|
raise ArgumentsRequired(self.id + ' cancelOrders() requires a symbol argument')
|
2491
2492
|
self.load_markets()
|
2492
2493
|
market = self.market(symbol)
|
2493
|
-
request = {
|
2494
|
+
request: dict = {
|
2494
2495
|
'symbol': market['id'],
|
2495
2496
|
}
|
2496
2497
|
clientOrderIds = self.safe_value(params, 'clientOrderIds')
|
@@ -2559,7 +2560,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
2559
2560
|
raise ArgumentsRequired(self.id + ' fetchOrders() requires a symbol argument')
|
2560
2561
|
self.load_markets()
|
2561
2562
|
market = self.market(symbol)
|
2562
|
-
request = {
|
2563
|
+
request: dict = {
|
2563
2564
|
'symbol': market['id'],
|
2564
2565
|
'orderId': id,
|
2565
2566
|
}
|
@@ -2637,7 +2638,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
2637
2638
|
"""
|
2638
2639
|
self.load_markets()
|
2639
2640
|
market = None
|
2640
|
-
request = {}
|
2641
|
+
request: dict = {}
|
2641
2642
|
if symbol is not None:
|
2642
2643
|
market = self.market(symbol)
|
2643
2644
|
request['symbol'] = market['id']
|
@@ -2724,7 +2725,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
2724
2725
|
raise ArgumentsRequired(self.id + ' fetchClosedOrders() requires a symbol argument')
|
2725
2726
|
self.load_markets()
|
2726
2727
|
market = self.market(symbol)
|
2727
|
-
request = {
|
2728
|
+
request: dict = {
|
2728
2729
|
'symbol': market['id'],
|
2729
2730
|
}
|
2730
2731
|
response = None
|
@@ -2812,7 +2813,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
2812
2813
|
accountsByType = self.safe_value(self.options, 'accountsByType', {})
|
2813
2814
|
fromId = self.safe_string(accountsByType, fromAccount, fromAccount)
|
2814
2815
|
toId = self.safe_string(accountsByType, toAccount, toAccount)
|
2815
|
-
request = {
|
2816
|
+
request: dict = {
|
2816
2817
|
'asset': currency['id'],
|
2817
2818
|
'amount': self.currency_to_precision(code, amount),
|
2818
2819
|
'type': fromId + '_' + toId,
|
@@ -2856,7 +2857,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
2856
2857
|
toId = self.safe_string(accountsByType, toAccount, toAccount)
|
2857
2858
|
if fromId is None or toId is None:
|
2858
2859
|
raise ExchangeError(self.id + ' fromAccount & toAccount parameter are required')
|
2859
|
-
request = {
|
2860
|
+
request: dict = {
|
2860
2861
|
'type': fromId + '_' + toId,
|
2861
2862
|
}
|
2862
2863
|
if since is not None:
|
@@ -2918,7 +2919,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
2918
2919
|
currency = self.currency(code)
|
2919
2920
|
defaultRecvWindow = self.safe_integer(self.options, 'recvWindow')
|
2920
2921
|
recvWindow = self.safe_integer(self.parse_params, 'recvWindow', defaultRecvWindow)
|
2921
|
-
request = {
|
2922
|
+
request: dict = {
|
2922
2923
|
'coin': currency['id'],
|
2923
2924
|
'offset': 0,
|
2924
2925
|
'limit': 1000,
|
@@ -3007,7 +3008,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
3007
3008
|
:returns dict[]: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
|
3008
3009
|
"""
|
3009
3010
|
self.load_markets()
|
3010
|
-
request = {
|
3011
|
+
request: dict = {
|
3011
3012
|
}
|
3012
3013
|
currency = None
|
3013
3014
|
if code is not None:
|
@@ -3048,7 +3049,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
3048
3049
|
:returns dict[]: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
|
3049
3050
|
"""
|
3050
3051
|
self.load_markets()
|
3051
|
-
request = {
|
3052
|
+
request: dict = {
|
3052
3053
|
}
|
3053
3054
|
currency = None
|
3054
3055
|
if code is not None:
|
@@ -3173,7 +3174,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
3173
3174
|
'internal': None,
|
3174
3175
|
}
|
3175
3176
|
|
3176
|
-
def parse_transaction_status(self, status):
|
3177
|
+
def parse_transaction_status(self, status: str):
|
3177
3178
|
statuses = {
|
3178
3179
|
'0': 'pending',
|
3179
3180
|
'1': 'ok',
|
@@ -3212,7 +3213,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
3212
3213
|
marginMode = 'CROSSED'
|
3213
3214
|
if marginMode != 'ISOLATED' and marginMode != 'CROSSED':
|
3214
3215
|
raise BadRequest(self.id + ' setMarginMode() marginMode argument should be isolated or cross')
|
3215
|
-
request = {
|
3216
|
+
request: dict = {
|
3216
3217
|
'symbol': market['id'],
|
3217
3218
|
'marginType': marginMode,
|
3218
3219
|
}
|
@@ -3234,7 +3235,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
3234
3235
|
raise ArgumentsRequired(self.id + ' setMargin() requires a type parameter either 1(increase margin) or 2(decrease margin)')
|
3235
3236
|
self.load_markets()
|
3236
3237
|
market = self.market(symbol)
|
3237
|
-
request = {
|
3238
|
+
request: dict = {
|
3238
3239
|
'symbol': market['id'],
|
3239
3240
|
'amount': self.amount_to_precision(market['symbol'], amount),
|
3240
3241
|
'type': type,
|
@@ -3260,7 +3261,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
3260
3261
|
"""
|
3261
3262
|
self.load_markets()
|
3262
3263
|
market = self.market(symbol)
|
3263
|
-
request = {
|
3264
|
+
request: dict = {
|
3264
3265
|
'symbol': market['id'],
|
3265
3266
|
}
|
3266
3267
|
response = self.swapV2PrivateGetTradeLeverage(self.extend(request, params))
|
@@ -3292,7 +3293,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
3292
3293
|
self.check_required_argument('setLeverage', side, 'side', ['LONG', 'SHORT', 'BOTH'])
|
3293
3294
|
self.load_markets()
|
3294
3295
|
market = self.market(symbol)
|
3295
|
-
request = {
|
3296
|
+
request: dict = {
|
3296
3297
|
'symbol': market['id'],
|
3297
3298
|
'side': side,
|
3298
3299
|
'leverage': leverage,
|
@@ -3328,7 +3329,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
3328
3329
|
market = self.market(symbol)
|
3329
3330
|
now = self.milliseconds()
|
3330
3331
|
response = None
|
3331
|
-
request = {
|
3332
|
+
request: dict = {
|
3332
3333
|
'symbol': market['id'],
|
3333
3334
|
}
|
3334
3335
|
if since is not None:
|
@@ -3492,7 +3493,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
3492
3493
|
walletType = 1
|
3493
3494
|
if not self.in_array(walletType, [1, 2, 3]):
|
3494
3495
|
raise BadRequest(self.id + ' withdraw() requires either 1 fund account, 2 standard futures account, 3 perpetual account for walletType')
|
3495
|
-
request = {
|
3496
|
+
request: dict = {
|
3496
3497
|
'coin': currency['id'],
|
3497
3498
|
'address': address,
|
3498
3499
|
'amount': self.number_to_string(amount),
|
@@ -3640,7 +3641,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
3640
3641
|
"""
|
3641
3642
|
self.load_markets()
|
3642
3643
|
market = self.market(symbol)
|
3643
|
-
request = {
|
3644
|
+
request: dict = {
|
3644
3645
|
'symbol': market['id'],
|
3645
3646
|
}
|
3646
3647
|
response = self.swapV2PrivatePostTradeCloseAllPositions(self.extend(request, params))
|
@@ -3674,7 +3675,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
3674
3675
|
marketType, params = self.handle_market_type_and_params('closeAllPositions', None, params)
|
3675
3676
|
if marketType == 'margin':
|
3676
3677
|
raise BadRequest(self.id + ' closePositions() cannot be used for ' + marketType + ' markets')
|
3677
|
-
request = {
|
3678
|
+
request: dict = {
|
3678
3679
|
'recvWindow': recvWindow,
|
3679
3680
|
}
|
3680
3681
|
response = self.swapV2PrivatePostTradeCloseAllPositions(self.extend(request, params))
|
@@ -3739,7 +3740,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
3739
3740
|
dualSidePosition = 'true'
|
3740
3741
|
else:
|
3741
3742
|
dualSidePosition = 'false'
|
3742
|
-
request = {
|
3743
|
+
request: dict = {
|
3743
3744
|
'dualSidePosition': dualSidePosition,
|
3744
3745
|
}
|
3745
3746
|
#
|
@@ -3928,7 +3929,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
3928
3929
|
def nonce(self):
|
3929
3930
|
return self.milliseconds()
|
3930
3931
|
|
3931
|
-
def set_sandbox_mode(self, enable):
|
3932
|
+
def set_sandbox_mode(self, enable: bool):
|
3932
3933
|
super(bingx, self).set_sandbox_mode(enable)
|
3933
3934
|
self.options['sandboxMode'] = enable
|
3934
3935
|
|
ccxt/pro/__init__.py
CHANGED
ccxt/pro/bitget.py
CHANGED
@@ -96,7 +96,9 @@ class bitget(ccxt.async_support.bitget):
|
|
96
96
|
|
97
97
|
def get_inst_type(self, market, params={}):
|
98
98
|
instType = None
|
99
|
-
if
|
99
|
+
if market is None:
|
100
|
+
instType, params = self.handleProductTypeAndParams(None, params)
|
101
|
+
elif (market['swap']) or (market['future']):
|
100
102
|
instType, params = self.handleProductTypeAndParams(market, params)
|
101
103
|
else:
|
102
104
|
instType = 'SPOT'
|
@@ -635,9 +637,12 @@ class bitget(ccxt.async_support.bitget):
|
|
635
637
|
limit = self.safe_integer(self.options, 'tradesLimit', 1000)
|
636
638
|
stored = ArrayCache(limit)
|
637
639
|
self.trades[symbol] = stored
|
638
|
-
data = self.
|
639
|
-
|
640
|
-
|
640
|
+
data = self.safe_list(message, 'data', [])
|
641
|
+
length = len(data)
|
642
|
+
maxLength = max(length - 1, 0)
|
643
|
+
# fix chronological order by reversing
|
644
|
+
for i in range(maxLength, 0):
|
645
|
+
rawTrade = data[i]
|
641
646
|
parsed = self.parse_ws_trade(rawTrade, market)
|
642
647
|
stored.append(parsed)
|
643
648
|
messageHash = 'trade:' + symbol
|
@@ -653,22 +658,69 @@ class bitget(ccxt.async_support.bitget):
|
|
653
658
|
# "tradeId": "1116461060594286593"
|
654
659
|
# }
|
655
660
|
#
|
656
|
-
|
657
|
-
|
661
|
+
# order with trade in it
|
662
|
+
# {
|
663
|
+
# accBaseVolume: '0.1',
|
664
|
+
# baseVolume: '0.1',
|
665
|
+
# cTime: '1709221342922',
|
666
|
+
# clientOid: '1147122943507734528',
|
667
|
+
# enterPointSource: 'API',
|
668
|
+
# feeDetail: [Array],
|
669
|
+
# fillFee: '-0.0049578',
|
670
|
+
# fillFeeCoin: 'USDT',
|
671
|
+
# fillNotionalUsd: '8.263',
|
672
|
+
# fillPrice: '82.63',
|
673
|
+
# fillTime: '1709221342986',
|
674
|
+
# force: 'gtc',
|
675
|
+
# instId: 'LTCUSDT',
|
676
|
+
# leverage: '10',
|
677
|
+
# marginCoin: 'USDT',
|
678
|
+
# marginMode: 'crossed',
|
679
|
+
# notionalUsd: '8.268',
|
680
|
+
# orderId: '1147122943499345921',
|
681
|
+
# orderType: 'market',
|
682
|
+
# pnl: '0',
|
683
|
+
# posMode: 'hedge_mode',
|
684
|
+
# posSide: 'short',
|
685
|
+
# price: '0',
|
686
|
+
# priceAvg: '82.63',
|
687
|
+
# reduceOnly: 'no',
|
688
|
+
# side: 'sell',
|
689
|
+
# size: '0.1',
|
690
|
+
# status: 'filled',
|
691
|
+
# tradeId: '1147122943772479563',
|
692
|
+
# tradeScope: 'T',
|
693
|
+
# tradeSide: 'open',
|
694
|
+
# uTime: '1709221342986'
|
695
|
+
# }
|
696
|
+
#
|
697
|
+
instId = self.safe_string(trade, 'instId')
|
698
|
+
if market is None:
|
699
|
+
market = self.safe_market(instId, None, None, 'contract')
|
700
|
+
timestamp = self.safe_integer_n(trade, ['uTime', 'cTime', 'ts'])
|
701
|
+
feeCost = self.safe_string(trade, 'fillFee')
|
702
|
+
fee = None
|
703
|
+
if feeCost is not None:
|
704
|
+
feeCurrencyId = self.safe_string(trade, 'fillFeeCoin')
|
705
|
+
feeCurrencyCode = self.safe_currency_code(feeCurrencyId)
|
706
|
+
fee = {
|
707
|
+
'cost': Precise.string_abs(feeCost),
|
708
|
+
'currency': feeCurrencyCode,
|
709
|
+
}
|
658
710
|
return self.safe_trade({
|
659
711
|
'info': trade,
|
660
712
|
'id': self.safe_string(trade, 'tradeId'),
|
661
|
-
'order':
|
713
|
+
'order': self.safe_string(trade, 'orderId'),
|
662
714
|
'timestamp': timestamp,
|
663
715
|
'datetime': self.iso8601(timestamp),
|
664
716
|
'symbol': market['symbol'],
|
665
717
|
'type': None,
|
666
718
|
'side': self.safe_string(trade, 'side'),
|
667
719
|
'takerOrMaker': None,
|
668
|
-
'price': self.
|
720
|
+
'price': self.safe_string_2(trade, 'priceAvg', 'price'),
|
669
721
|
'amount': self.safe_string(trade, 'size'),
|
670
|
-
'cost':
|
671
|
-
'fee':
|
722
|
+
'cost': self.safe_string(trade, 'fillNotionalUsd'),
|
723
|
+
'fee': fee,
|
672
724
|
}, market)
|
673
725
|
|
674
726
|
async def watch_positions(self, symbols: Strings = None, since: Int = None, limit: Int = None, params={}) -> List[Position]:
|
@@ -1047,6 +1099,8 @@ class bitget(ccxt.async_support.bitget):
|
|
1047
1099
|
marketSymbols = {}
|
1048
1100
|
for i in range(0, len(data)):
|
1049
1101
|
order = data[i]
|
1102
|
+
if 'tradeId' in order:
|
1103
|
+
self.handle_my_trades(client, order)
|
1050
1104
|
marketId = self.safe_string(order, 'instId')
|
1051
1105
|
market = self.safe_market(marketId, None, None, marketType)
|
1052
1106
|
parsed = self.parse_ws_order(order, market)
|
@@ -1299,7 +1353,7 @@ class bitget(ccxt.async_support.bitget):
|
|
1299
1353
|
limit = self.safe_integer(self.options, 'tradesLimit', 1000)
|
1300
1354
|
self.myTrades = ArrayCache(limit)
|
1301
1355
|
stored = self.myTrades
|
1302
|
-
parsed = self.
|
1356
|
+
parsed = self.parse_ws_trade(message)
|
1303
1357
|
stored.append(parsed)
|
1304
1358
|
symbol = parsed['symbol']
|
1305
1359
|
messageHash = 'myTrades'
|
@@ -1307,67 +1361,6 @@ class bitget(ccxt.async_support.bitget):
|
|
1307
1361
|
symbolSpecificMessageHash = 'myTrades:' + symbol
|
1308
1362
|
client.resolve(stored, symbolSpecificMessageHash)
|
1309
1363
|
|
1310
|
-
def parse_ws_my_trade(self, trade, market=None):
|
1311
|
-
#
|
1312
|
-
# order and trade mixin(contract)
|
1313
|
-
#
|
1314
|
-
# {
|
1315
|
-
# "accBaseVolume": "0",
|
1316
|
-
# "cTime": "1701920553759",
|
1317
|
-
# "clientOid": "1116501214318198793",
|
1318
|
-
# "enterPointSource": "WEB",
|
1319
|
-
# "feeDetail": [{
|
1320
|
-
# "feeCoin": "USDT",
|
1321
|
-
# "fee": "-0.162003"
|
1322
|
-
# }],
|
1323
|
-
# "force": "gtc",
|
1324
|
-
# "instId": "BTCUSDT",
|
1325
|
-
# "leverage": "20",
|
1326
|
-
# "marginCoin": "USDT",
|
1327
|
-
# "marginMode": "isolated",
|
1328
|
-
# "notionalUsd": "105",
|
1329
|
-
# "orderId": "1116501214293032964",
|
1330
|
-
# "orderType": "limit",
|
1331
|
-
# "posMode": "hedge_mode",
|
1332
|
-
# "posSide": "long",
|
1333
|
-
# "price": "35000",
|
1334
|
-
# "reduceOnly": "no",
|
1335
|
-
# "side": "buy",
|
1336
|
-
# "size": "0.003",
|
1337
|
-
# "status": "canceled",
|
1338
|
-
# "tradeSide": "open",
|
1339
|
-
# "uTime": "1701920595866"
|
1340
|
-
# }
|
1341
|
-
#
|
1342
|
-
marketId = self.safe_string(trade, 'instId')
|
1343
|
-
market = self.safe_market(marketId, market, None, 'contract')
|
1344
|
-
timestamp = self.safe_integer_2(trade, 'uTime', 'cTime')
|
1345
|
-
orderFee = self.safe_value(trade, 'feeDetail', [])
|
1346
|
-
fee = self.safe_value(orderFee, 0)
|
1347
|
-
feeAmount = self.safe_string(fee, 'fee')
|
1348
|
-
feeObject = None
|
1349
|
-
if feeAmount is not None:
|
1350
|
-
feeCurrency = self.safe_string(fee, 'feeCoin')
|
1351
|
-
feeObject = {
|
1352
|
-
'cost': Precise.string_abs(feeAmount),
|
1353
|
-
'currency': self.safe_currency_code(feeCurrency),
|
1354
|
-
}
|
1355
|
-
return self.safe_trade({
|
1356
|
-
'info': trade,
|
1357
|
-
'id': None,
|
1358
|
-
'order': self.safe_string(trade, 'orderId'),
|
1359
|
-
'timestamp': timestamp,
|
1360
|
-
'datetime': self.iso8601(timestamp),
|
1361
|
-
'symbol': market['symbol'],
|
1362
|
-
'type': self.safe_string(trade, 'orderType'),
|
1363
|
-
'side': self.safe_string(trade, 'side'),
|
1364
|
-
'takerOrMaker': None,
|
1365
|
-
'price': self.safe_string(trade, 'price'),
|
1366
|
-
'amount': self.safe_string(trade, 'size'),
|
1367
|
-
'cost': self.safe_string(trade, 'notionalUsd'),
|
1368
|
-
'fee': feeObject,
|
1369
|
-
}, market)
|
1370
|
-
|
1371
1364
|
async def watch_balance(self, params={}) -> Balances:
|
1372
1365
|
"""
|
1373
1366
|
watch balance and get the amount of funds available for trading or funds locked in orders
|
ccxt/pro/bybit.py
CHANGED
@@ -324,15 +324,29 @@ class bybit(ccxt.async_support.bybit):
|
|
324
324
|
# "price24hPcnt": "-0.0388"
|
325
325
|
# }
|
326
326
|
# }
|
327
|
+
# swap delta
|
328
|
+
# {
|
329
|
+
# "topic":"tickers.AAVEUSDT",
|
330
|
+
# "type":"delta",
|
331
|
+
# "data":{
|
332
|
+
# "symbol":"AAVEUSDT",
|
333
|
+
# "bid1Price":"112.89",
|
334
|
+
# "bid1Size":"2.12",
|
335
|
+
# "ask1Price":"112.90",
|
336
|
+
# "ask1Size":"5.02"
|
337
|
+
# },
|
338
|
+
# "cs":78039939929,
|
339
|
+
# "ts":1709210212704
|
340
|
+
# }
|
327
341
|
#
|
328
342
|
topic = self.safe_string(message, 'topic', '')
|
329
343
|
updateType = self.safe_string(message, 'type', '')
|
330
|
-
data = self.
|
331
|
-
isSpot = self.safe_string(data, '
|
344
|
+
data = self.safe_dict(message, 'data', {})
|
345
|
+
isSpot = self.safe_string(data, 'usdIndexPrice') is not None
|
332
346
|
type = 'spot' if isSpot else 'contract'
|
333
347
|
symbol = None
|
334
348
|
parsed = None
|
335
|
-
if (updateType == 'snapshot')
|
349
|
+
if (updateType == 'snapshot'):
|
336
350
|
parsed = self.parse_ticker(data)
|
337
351
|
symbol = parsed['symbol']
|
338
352
|
elif updateType == 'delta':
|
@@ -342,8 +356,8 @@ class bybit(ccxt.async_support.bybit):
|
|
342
356
|
market = self.safe_market(marketId, None, None, type)
|
343
357
|
symbol = market['symbol']
|
344
358
|
# update the info in place
|
345
|
-
ticker = self.
|
346
|
-
rawTicker = self.
|
359
|
+
ticker = self.safe_dict(self.tickers, symbol, {})
|
360
|
+
rawTicker = self.safe_dict(ticker, 'info', {})
|
347
361
|
merged = self.extend(rawTicker, data)
|
348
362
|
parsed = self.parse_ticker(merged)
|
349
363
|
timestamp = self.safe_integer(message, 'ts')
|
ccxt/pro/currencycom.py
CHANGED
@@ -96,7 +96,7 @@ class currencycom(ccxt.async_support.currencycom):
|
|
96
96
|
# "accountId": 5470310874305732,
|
97
97
|
# "collateralCurrency": True,
|
98
98
|
# "asset": "USD",
|
99
|
-
# "free": 47.
|
99
|
+
# "free": 47.82576736,
|
100
100
|
# "locked": 1.187925,
|
101
101
|
# "default": True
|
102
102
|
# },
|
@@ -445,6 +445,7 @@ class currencycom(ccxt.async_support.currencycom):
|
|
445
445
|
if orderbook is None:
|
446
446
|
orderbook = self.order_book()
|
447
447
|
orderbook.reset({
|
448
|
+
'symbol': symbol,
|
448
449
|
'timestamp': timestamp,
|
449
450
|
'datetime': self.iso8601(timestamp),
|
450
451
|
})
|
ccxt/pro/kraken.py
CHANGED
@@ -361,7 +361,7 @@ class kraken(ccxt.async_support.kraken):
|
|
361
361
|
# [
|
362
362
|
# 0, # channelID
|
363
363
|
# [ # price volume time side type misc
|
364
|
-
# ["5541.20000", "0.15850568", "1534614057.
|
364
|
+
# ["5541.20000", "0.15850568", "1534614057.321596", "s", "l", ""],
|
365
365
|
# ["6060.00000", "0.02455000", "1534614057.324998", "b", "l", ""],
|
366
366
|
# ],
|
367
367
|
# "trade",
|
ccxt/upbit.py
CHANGED
@@ -604,7 +604,7 @@ class upbit(Exchange, ImplicitAPI):
|
|
604
604
|
# "trade_time": "104543",
|
605
605
|
# "trade_date_kst": "20181122",
|
606
606
|
# "trade_time_kst": "194543",
|
607
|
-
# "trade_timestamp":
|
607
|
+
# "trade_timestamp": 1542883543096,
|
608
608
|
# "opening_price": 0.02976455,
|
609
609
|
# "high_price": 0.02992577,
|
610
610
|
# "low_price": 0.02934283,
|
ccxt/woo.py
CHANGED
@@ -106,6 +106,7 @@ class woo(Exchange, ImplicitAPI):
|
|
106
106
|
'reduceMargin': False,
|
107
107
|
'setLeverage': True,
|
108
108
|
'setMargin': False,
|
109
|
+
'setPositionMode': True,
|
109
110
|
'transfer': True,
|
110
111
|
'withdraw': True, # exchange have that endpoint disabled atm, but was once implemented in ccxt per old docs: https://kronosresearch.github.io/wootrade-documents/#token-withdraw
|
111
112
|
},
|
@@ -180,10 +181,16 @@ class woo(Exchange, ImplicitAPI):
|
|
180
181
|
'client/trade/{tid}': 1,
|
181
182
|
'order/{oid}/trades': 1,
|
182
183
|
'client/trades': 1,
|
184
|
+
'client/hist_trades': 1,
|
185
|
+
'staking/yield_history': 1,
|
186
|
+
'client/holding': 1,
|
183
187
|
'asset/deposit': 10,
|
184
188
|
'asset/history': 60,
|
185
189
|
'sub_account/all': 60,
|
186
190
|
'sub_account/assets': 60,
|
191
|
+
'sub_account/asset_detail': 60,
|
192
|
+
'sub_account/ip_restriction': 10,
|
193
|
+
'asset/main_sub_transfer_history': 30,
|
187
194
|
'token_interest': 60,
|
188
195
|
'token_interest/{token}': 60,
|
189
196
|
'interest/history': 60,
|
@@ -196,9 +203,12 @@ class woo(Exchange, ImplicitAPI):
|
|
196
203
|
'post': {
|
197
204
|
'order': 5, # 2 requests per 1 second per symbol
|
198
205
|
'asset/main_sub_transfer': 30, # 20 requests per 60 seconds
|
206
|
+
'asset/ltv': 30,
|
199
207
|
'asset/withdraw': 30, # implemented in ccxt, disabled on the exchange side https://kronosresearch.github.io/wootrade-documents/#token-withdraw
|
208
|
+
'asset/internal_withdraw': 30,
|
200
209
|
'interest/repay': 60,
|
201
210
|
'client/account_mode': 120,
|
211
|
+
'client/position_mode': 5,
|
202
212
|
'client/leverage': 120,
|
203
213
|
},
|
204
214
|
'delete': {
|
@@ -2434,6 +2444,33 @@ class woo(Exchange, ImplicitAPI):
|
|
2434
2444
|
sorted = self.sort_by(rates, 'timestamp')
|
2435
2445
|
return self.filter_by_symbol_since_limit(sorted, symbol, since, limit)
|
2436
2446
|
|
2447
|
+
def set_position_mode(self, hedged: bool, symbol: Str = None, params={}):
|
2448
|
+
"""
|
2449
|
+
set hedged to True or False for a market
|
2450
|
+
:see: https://docs.woo.org/#update-position-mode
|
2451
|
+
:param bool hedged: set to True to use HEDGE_MODE, False for ONE_WAY
|
2452
|
+
:param str symbol: not used by woo setPositionMode
|
2453
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2454
|
+
:returns dict: response from the exchange
|
2455
|
+
"""
|
2456
|
+
hedgeMode = None
|
2457
|
+
if hedged:
|
2458
|
+
hedgeMode = 'HEDGE_MODE'
|
2459
|
+
else:
|
2460
|
+
hedgeMode = 'ONE_WAY'
|
2461
|
+
request = {
|
2462
|
+
'position_mode': hedgeMode,
|
2463
|
+
}
|
2464
|
+
response = self.v1PrivatePostClientPositionMode(self.extend(request, params))
|
2465
|
+
#
|
2466
|
+
# {
|
2467
|
+
# "success": True,
|
2468
|
+
# "data": {},
|
2469
|
+
# "timestamp": "1709195608551"
|
2470
|
+
# }
|
2471
|
+
#
|
2472
|
+
return response
|
2473
|
+
|
2437
2474
|
def fetch_leverage(self, symbol: str, params={}):
|
2438
2475
|
self.load_markets()
|
2439
2476
|
response = self.v3PrivateGetAccountinfo(params)
|