ccxt 4.3.5__py2.py3-none-any.whl → 4.3.7__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/abstract/binance.py +1 -0
- ccxt/abstract/binancecoinm.py +1 -0
- ccxt/abstract/binanceus.py +1 -0
- ccxt/abstract/binanceusdm.py +1 -0
- ccxt/abstract/bingx.py +1 -0
- ccxt/abstract/coinbase.py +5 -0
- ccxt/abstract/woo.py +1 -0
- ccxt/ace.py +5 -0
- ccxt/alpaca.py +6 -0
- ccxt/ascendex.py +2 -2
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/ace.py +5 -0
- ccxt/async_support/alpaca.py +6 -0
- ccxt/async_support/ascendex.py +2 -2
- ccxt/async_support/base/exchange.py +30 -1
- ccxt/async_support/bigone.py +1 -1
- ccxt/async_support/binance.py +7 -3
- ccxt/async_support/bingx.py +43 -1
- ccxt/async_support/bitbank.py +4 -1
- ccxt/async_support/bitfinex.py +1 -1
- ccxt/async_support/bitfinex2.py +1 -1
- ccxt/async_support/bitflyer.py +1 -1
- ccxt/async_support/bitget.py +70 -4
- ccxt/async_support/bithumb.py +5 -1
- ccxt/async_support/bitmart.py +1 -1
- ccxt/async_support/bitmex.py +25 -1
- ccxt/async_support/bitopro.py +6 -1
- ccxt/async_support/bitrue.py +1 -1
- ccxt/async_support/bitso.py +4 -1
- ccxt/async_support/bitstamp.py +4 -1
- ccxt/async_support/bitteam.py +4 -0
- ccxt/async_support/bitvavo.py +4 -1
- ccxt/async_support/bl3p.py +3 -0
- ccxt/async_support/blockchaincom.py +1 -1
- ccxt/async_support/btcalpha.py +3 -0
- ccxt/async_support/btcbox.py +3 -0
- ccxt/async_support/btcmarkets.py +4 -1
- ccxt/async_support/btcturk.py +3 -0
- ccxt/async_support/bybit.py +196 -14
- ccxt/async_support/cex.py +6 -0
- ccxt/async_support/coinbase.py +98 -22
- ccxt/async_support/coinbaseinternational.py +3 -1
- ccxt/async_support/coinbasepro.py +7 -1
- ccxt/async_support/coincheck.py +3 -0
- ccxt/async_support/coinex.py +180 -79
- ccxt/async_support/coinlist.py +5 -1
- ccxt/async_support/coinmate.py +4 -1
- ccxt/async_support/coinone.py +3 -0
- ccxt/async_support/coinsph.py +5 -1
- ccxt/async_support/coinspot.py +3 -0
- ccxt/async_support/cryptocom.py +33 -2
- ccxt/async_support/delta.py +2 -2
- ccxt/async_support/deribit.py +1 -1
- ccxt/async_support/digifinex.py +3 -3
- ccxt/async_support/exmo.py +8 -3
- ccxt/async_support/gate.py +112 -24
- ccxt/async_support/gemini.py +1 -1
- ccxt/async_support/hitbtc.py +7 -6
- ccxt/async_support/hollaex.py +1 -1
- ccxt/async_support/htx.py +29 -1
- ccxt/async_support/huobijp.py +1 -1
- ccxt/async_support/hyperliquid.py +39 -2
- ccxt/async_support/idex.py +4 -1
- ccxt/async_support/independentreserve.py +3 -0
- ccxt/async_support/indodax.py +4 -1
- ccxt/async_support/kraken.py +28 -1
- ccxt/async_support/krakenfutures.py +26 -0
- ccxt/async_support/kucoin.py +3 -1
- ccxt/async_support/kucoinfutures.py +5 -3
- ccxt/async_support/kuna.py +1 -1
- ccxt/async_support/latoken.py +6 -0
- ccxt/async_support/lbank.py +1 -1
- ccxt/async_support/luno.py +3 -0
- ccxt/async_support/lykke.py +6 -1
- ccxt/async_support/mercado.py +4 -1
- ccxt/async_support/mexc.py +110 -4
- ccxt/async_support/ndax.py +5 -1
- ccxt/async_support/novadax.py +5 -1
- ccxt/async_support/okcoin.py +1 -1
- ccxt/async_support/okx.py +183 -4
- ccxt/async_support/onetrading.py +4 -1
- ccxt/async_support/p2b.py +3 -0
- ccxt/async_support/phemex.py +1 -1
- ccxt/async_support/poloniex.py +1 -1
- ccxt/async_support/probit.py +4 -1
- ccxt/async_support/timex.py +3 -0
- ccxt/async_support/tokocrypto.py +1 -1
- ccxt/async_support/tradeogre.py +3 -0
- ccxt/async_support/upbit.py +1 -1
- ccxt/async_support/wavesexchange.py +4 -1
- ccxt/async_support/wazirx.py +3 -0
- ccxt/async_support/whitebit.py +38 -1
- ccxt/async_support/woo.py +30 -1
- ccxt/async_support/yobit.py +4 -1
- ccxt/async_support/zaif.py +1 -1
- ccxt/async_support/zonda.py +1 -1
- ccxt/base/exchange.py +30 -1
- ccxt/bigone.py +1 -1
- ccxt/binance.py +7 -3
- ccxt/bingx.py +43 -1
- ccxt/bitbank.py +4 -1
- ccxt/bitfinex.py +1 -1
- ccxt/bitfinex2.py +1 -1
- ccxt/bitflyer.py +1 -1
- ccxt/bitget.py +70 -4
- ccxt/bithumb.py +5 -1
- ccxt/bitmart.py +1 -1
- ccxt/bitmex.py +25 -1
- ccxt/bitopro.py +6 -1
- ccxt/bitrue.py +1 -1
- ccxt/bitso.py +4 -1
- ccxt/bitstamp.py +4 -1
- ccxt/bitteam.py +4 -0
- ccxt/bitvavo.py +4 -1
- ccxt/bl3p.py +3 -0
- ccxt/blockchaincom.py +1 -1
- ccxt/btcalpha.py +3 -0
- ccxt/btcbox.py +3 -0
- ccxt/btcmarkets.py +4 -1
- ccxt/btcturk.py +3 -0
- ccxt/bybit.py +196 -14
- ccxt/cex.py +6 -0
- ccxt/coinbase.py +98 -22
- ccxt/coinbaseinternational.py +3 -1
- ccxt/coinbasepro.py +7 -1
- ccxt/coincheck.py +3 -0
- ccxt/coinex.py +180 -79
- ccxt/coinlist.py +5 -1
- ccxt/coinmate.py +4 -1
- ccxt/coinone.py +3 -0
- ccxt/coinsph.py +5 -1
- ccxt/coinspot.py +3 -0
- ccxt/cryptocom.py +33 -2
- ccxt/delta.py +2 -2
- ccxt/deribit.py +1 -1
- ccxt/digifinex.py +3 -3
- ccxt/exmo.py +8 -3
- ccxt/gate.py +112 -24
- ccxt/gemini.py +1 -1
- ccxt/hitbtc.py +7 -6
- ccxt/hollaex.py +1 -1
- ccxt/htx.py +29 -1
- ccxt/huobijp.py +1 -1
- ccxt/hyperliquid.py +39 -2
- ccxt/idex.py +4 -1
- ccxt/independentreserve.py +3 -0
- ccxt/indodax.py +4 -1
- ccxt/kraken.py +28 -1
- ccxt/krakenfutures.py +26 -0
- ccxt/kucoin.py +3 -1
- ccxt/kucoinfutures.py +5 -3
- ccxt/kuna.py +1 -1
- ccxt/latoken.py +6 -0
- ccxt/lbank.py +1 -1
- ccxt/luno.py +3 -0
- ccxt/lykke.py +6 -1
- ccxt/mercado.py +4 -1
- ccxt/mexc.py +110 -4
- ccxt/ndax.py +5 -1
- ccxt/novadax.py +5 -1
- ccxt/okcoin.py +1 -1
- ccxt/okx.py +183 -4
- ccxt/onetrading.py +4 -1
- ccxt/p2b.py +3 -0
- ccxt/phemex.py +1 -1
- ccxt/poloniex.py +1 -1
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/bitget.py +1 -1
- ccxt/pro/bybit.py +1 -1
- ccxt/pro/coinbase.py +28 -28
- ccxt/probit.py +4 -1
- ccxt/test/test_async.py +2 -0
- ccxt/test/test_sync.py +2 -0
- ccxt/timex.py +3 -0
- ccxt/tokocrypto.py +1 -1
- ccxt/tradeogre.py +3 -0
- ccxt/upbit.py +1 -1
- ccxt/wavesexchange.py +4 -1
- ccxt/wazirx.py +3 -0
- ccxt/whitebit.py +38 -1
- ccxt/woo.py +30 -1
- ccxt/yobit.py +4 -1
- ccxt/zaif.py +1 -1
- ccxt/zonda.py +1 -1
- {ccxt-4.3.5.dist-info → ccxt-4.3.7.dist-info}/METADATA +4 -4
- {ccxt-4.3.5.dist-info → ccxt-4.3.7.dist-info}/RECORD +189 -189
- {ccxt-4.3.5.dist-info → ccxt-4.3.7.dist-info}/WHEEL +0 -0
- {ccxt-4.3.5.dist-info → ccxt-4.3.7.dist-info}/top_level.txt +0 -0
ccxt/coinex.py
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
from ccxt.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.coinex import ImplicitAPI
|
8
|
-
from ccxt.base.types import Balances, Currencies, Currency, Int, Leverage, Leverages, MarginModification, Market, Num, Order, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry
|
8
|
+
from ccxt.base.types import Balances, Currencies, Currency, Int, Leverage, Leverages, MarginModification, Market, Num, Order, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry
|
9
9
|
from typing import List
|
10
10
|
from ccxt.base.errors import ExchangeError
|
11
11
|
from ccxt.base.errors import AuthenticationError
|
@@ -102,7 +102,9 @@ class coinex(Exchange, ImplicitAPI):
|
|
102
102
|
'fetchOrder': True,
|
103
103
|
'fetchOrderBook': True,
|
104
104
|
'fetchPosition': True,
|
105
|
+
'fetchPositionHistory': True,
|
105
106
|
'fetchPositions': True,
|
107
|
+
'fetchPositionsHistory': False,
|
106
108
|
'fetchPositionsRisk': False,
|
107
109
|
'fetchPremiumIndexOHLCV': False,
|
108
110
|
'fetchTicker': True,
|
@@ -1115,14 +1117,13 @@ class coinex(Exchange, ImplicitAPI):
|
|
1115
1117
|
#
|
1116
1118
|
# Spot and Swap fetchTrades(public)
|
1117
1119
|
#
|
1118
|
-
#
|
1119
|
-
#
|
1120
|
-
#
|
1121
|
-
#
|
1122
|
-
#
|
1123
|
-
#
|
1124
|
-
#
|
1125
|
-
# },
|
1120
|
+
# {
|
1121
|
+
# "amount": "0.00049432",
|
1122
|
+
# "created_at": 1713849825667,
|
1123
|
+
# "deal_id": 4137517302,
|
1124
|
+
# "price": "66251",
|
1125
|
+
# "side": "buy"
|
1126
|
+
# }
|
1126
1127
|
#
|
1127
1128
|
# Spot and Margin fetchMyTrades(private)
|
1128
1129
|
#
|
@@ -1176,8 +1177,8 @@ class coinex(Exchange, ImplicitAPI):
|
|
1176
1177
|
#
|
1177
1178
|
timestamp = self.safe_timestamp_2(trade, 'create_time', 'time')
|
1178
1179
|
if timestamp is None:
|
1179
|
-
timestamp = self.safe_integer(trade, '
|
1180
|
-
tradeId = self.
|
1180
|
+
timestamp = self.safe_integer(trade, 'created_at')
|
1181
|
+
tradeId = self.safe_string_2(trade, 'id', 'deal_id')
|
1181
1182
|
orderId = self.safe_string(trade, 'order_id')
|
1182
1183
|
priceString = self.safe_string(trade, 'price')
|
1183
1184
|
amountString = self.safe_string(trade, 'amount')
|
@@ -1209,9 +1210,9 @@ class coinex(Exchange, ImplicitAPI):
|
|
1209
1210
|
elif rawSide == 2:
|
1210
1211
|
side = 'buy'
|
1211
1212
|
if side is None:
|
1212
|
-
side = self.
|
1213
|
+
side = self.safe_string_2(trade, 'type', 'side')
|
1213
1214
|
else:
|
1214
|
-
side = self.
|
1215
|
+
side = self.safe_string_2(trade, 'type', 'side')
|
1215
1216
|
return self.safe_trade({
|
1216
1217
|
'info': trade,
|
1217
1218
|
'timestamp': timestamp,
|
@@ -1230,9 +1231,9 @@ class coinex(Exchange, ImplicitAPI):
|
|
1230
1231
|
|
1231
1232
|
def fetch_trades(self, symbol: str, since: Int = None, limit: Int = None, params={}) -> List[Trade]:
|
1232
1233
|
"""
|
1233
|
-
get the list of most recent trades for a particular symbol
|
1234
|
-
:see: https://
|
1235
|
-
:see: https://
|
1234
|
+
get the list of the most recent trades for a particular symbol
|
1235
|
+
:see: https://docs.coinex.com/api/v2/spot/market/http/list-market-deals
|
1236
|
+
:see: https://docs.coinex.com/api/v2/futures/market/http/list-market-deals
|
1236
1237
|
:param str symbol: unified symbol of the market to fetch trades for
|
1237
1238
|
:param int [since]: timestamp in ms of the earliest trade to fetch
|
1238
1239
|
:param int [limit]: the maximum amount of trades to fetch
|
@@ -1249,26 +1250,25 @@ class coinex(Exchange, ImplicitAPI):
|
|
1249
1250
|
request['limit'] = limit
|
1250
1251
|
response = None
|
1251
1252
|
if market['swap']:
|
1252
|
-
response = self.
|
1253
|
+
response = self.v2PublicGetFuturesDeals(self.extend(request, params))
|
1253
1254
|
else:
|
1254
|
-
response = self.
|
1255
|
+
response = self.v2PublicGetSpotDeals(self.extend(request, params))
|
1255
1256
|
#
|
1256
1257
|
# Spot and Swap
|
1257
1258
|
#
|
1258
|
-
#
|
1259
|
-
#
|
1260
|
-
#
|
1261
|
-
#
|
1262
|
-
#
|
1263
|
-
#
|
1264
|
-
#
|
1265
|
-
#
|
1266
|
-
#
|
1267
|
-
#
|
1268
|
-
#
|
1269
|
-
#
|
1270
|
-
#
|
1271
|
-
# }
|
1259
|
+
# {
|
1260
|
+
# "code": 0,
|
1261
|
+
# "data": [
|
1262
|
+
# {
|
1263
|
+
# "amount": "0.00049432",
|
1264
|
+
# "created_at": 1713849825667,
|
1265
|
+
# "deal_id": 4137517302,
|
1266
|
+
# "price": "66251",
|
1267
|
+
# "side": "buy"
|
1268
|
+
# },
|
1269
|
+
# ],
|
1270
|
+
# "message": "OK"
|
1271
|
+
# }
|
1272
1272
|
#
|
1273
1273
|
return self.parse_trades(response['data'], market, since, limit)
|
1274
1274
|
|
@@ -1417,31 +1417,31 @@ class coinex(Exchange, ImplicitAPI):
|
|
1417
1417
|
|
1418
1418
|
def parse_ohlcv(self, ohlcv, market: Market = None) -> list:
|
1419
1419
|
#
|
1420
|
-
#
|
1421
|
-
#
|
1422
|
-
# "
|
1423
|
-
# "
|
1424
|
-
# "
|
1425
|
-
# "
|
1426
|
-
# "
|
1427
|
-
# "
|
1428
|
-
# "
|
1429
|
-
#
|
1420
|
+
# {
|
1421
|
+
# "close": "66999.95",
|
1422
|
+
# "created_at": 1713934620000,
|
1423
|
+
# "high": "66999.95",
|
1424
|
+
# "low": "66988.53",
|
1425
|
+
# "market": "BTCUSDT",
|
1426
|
+
# "open": "66988.53",
|
1427
|
+
# "value": "0.1572393", # base volume
|
1428
|
+
# "volume": "10533.2501364336" # quote volume
|
1429
|
+
# }
|
1430
1430
|
#
|
1431
1431
|
return [
|
1432
|
-
self.
|
1433
|
-
self.safe_number(ohlcv,
|
1434
|
-
self.safe_number(ohlcv,
|
1435
|
-
self.safe_number(ohlcv,
|
1436
|
-
self.safe_number(ohlcv,
|
1437
|
-
self.safe_number(ohlcv,
|
1432
|
+
self.safe_integer(ohlcv, 'created_at'),
|
1433
|
+
self.safe_number(ohlcv, 'open'),
|
1434
|
+
self.safe_number(ohlcv, 'high'),
|
1435
|
+
self.safe_number(ohlcv, 'low'),
|
1436
|
+
self.safe_number(ohlcv, 'close'),
|
1437
|
+
self.safe_number(ohlcv, 'value'),
|
1438
1438
|
]
|
1439
1439
|
|
1440
1440
|
def fetch_ohlcv(self, symbol: str, timeframe='1m', since: Int = None, limit: Int = None, params={}) -> List[list]:
|
1441
1441
|
"""
|
1442
1442
|
fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
1443
|
-
:see: https://
|
1444
|
-
:see: https://
|
1443
|
+
:see: https://docs.coinex.com/api/v2/spot/market/http/list-market-kline
|
1444
|
+
:see: https://docs.coinex.com/api/v2/futures/market/http/list-market-kline
|
1445
1445
|
:param str symbol: unified symbol of the market to fetch OHLCV data for
|
1446
1446
|
:param str timeframe: the length of time each candle represents
|
1447
1447
|
:param int [since]: timestamp in ms of the earliest candle to fetch
|
@@ -1453,36 +1453,31 @@ class coinex(Exchange, ImplicitAPI):
|
|
1453
1453
|
market = self.market(symbol)
|
1454
1454
|
request = {
|
1455
1455
|
'market': market['id'],
|
1456
|
-
'
|
1456
|
+
'period': self.safe_string(self.timeframes, timeframe, timeframe),
|
1457
1457
|
}
|
1458
1458
|
if limit is not None:
|
1459
1459
|
request['limit'] = limit
|
1460
1460
|
response = None
|
1461
1461
|
if market['swap']:
|
1462
|
-
response = self.
|
1462
|
+
response = self.v2PublicGetFuturesKline(self.extend(request, params))
|
1463
1463
|
else:
|
1464
|
-
response = self.
|
1464
|
+
response = self.v2PublicGetSpotKline(self.extend(request, params))
|
1465
1465
|
#
|
1466
|
-
# Spot
|
1467
|
-
#
|
1468
|
-
# {
|
1469
|
-
# "code": 0,
|
1470
|
-
# "data": [
|
1471
|
-
# [1591484400, "0.02505349", "0.02506988", "0.02507000", "0.02505304", "343.19716223", "8.6021323866383196", "ETHBTC"],
|
1472
|
-
# [1591484700, "0.02506990", "0.02508109", "0.02508109", "0.02506979", "91.59841581", "2.2972047780447000", "ETHBTC"],
|
1473
|
-
# [1591485000, "0.02508106", "0.02507996", "0.02508106", "0.02507500", "65.15307697", "1.6340597822306000", "ETHBTC"],
|
1474
|
-
# ],
|
1475
|
-
# "message": "OK"
|
1476
|
-
# }
|
1477
|
-
#
|
1478
|
-
# Swap
|
1466
|
+
# Spot and Swap
|
1479
1467
|
#
|
1480
1468
|
# {
|
1481
1469
|
# "code": 0,
|
1482
1470
|
# "data": [
|
1483
|
-
#
|
1484
|
-
#
|
1485
|
-
#
|
1471
|
+
# {
|
1472
|
+
# "close": "66999.95",
|
1473
|
+
# "created_at": 1713934620000,
|
1474
|
+
# "high": "66999.95",
|
1475
|
+
# "low": "66988.53",
|
1476
|
+
# "market": "BTCUSDT",
|
1477
|
+
# "open": "66988.53",
|
1478
|
+
# "value": "0.1572393",
|
1479
|
+
# "volume": "10533.2501364336"
|
1480
|
+
# },
|
1486
1481
|
# ],
|
1487
1482
|
# "message": "OK"
|
1488
1483
|
# }
|
@@ -3520,7 +3515,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
3520
3515
|
# "side": 2,
|
3521
3516
|
# "stop_loss_price": "0.00000000000000000000",
|
3522
3517
|
# "stop_loss_type": 0,
|
3523
|
-
# "
|
3518
|
+
# "sy s": 0,
|
3524
3519
|
# "take_profit_price": "0.00000000000000000000",
|
3525
3520
|
# "take_profit_type": 0,
|
3526
3521
|
# "taker_fee": "0.00000000000000000000",
|
@@ -3599,7 +3594,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
3599
3594
|
# "side": 2,
|
3600
3595
|
# "stop_loss_price": "0.00000000000000000000",
|
3601
3596
|
# "stop_loss_type": 0,
|
3602
|
-
# "
|
3597
|
+
# "s ys": 0,
|
3603
3598
|
# "take_profit_price": "0.00000000000000000000",
|
3604
3599
|
# "take_profit_type": 0,
|
3605
3600
|
# "taker_fee": "0.00000000000000000000",
|
@@ -3616,6 +3611,8 @@ class coinex(Exchange, ImplicitAPI):
|
|
3616
3611
|
return self.parse_position(data[0], market)
|
3617
3612
|
|
3618
3613
|
def parse_position(self, position, market: Market = None):
|
3614
|
+
#
|
3615
|
+
# fetchPosition
|
3619
3616
|
#
|
3620
3617
|
# {
|
3621
3618
|
# "adl_sort": 3396,
|
@@ -3659,7 +3656,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
3659
3656
|
# "side": 2,
|
3660
3657
|
# "stop_loss_price": "0.00000000000000000000",
|
3661
3658
|
# "stop_loss_type": 0,
|
3662
|
-
# "
|
3659
|
+
# "s ys": 0,
|
3663
3660
|
# "take_profit_price": "0.00000000000000000000",
|
3664
3661
|
# "take_profit_type": 0,
|
3665
3662
|
# "taker_fee": "0.00000000000000000000",
|
@@ -3669,6 +3666,40 @@ class coinex(Exchange, ImplicitAPI):
|
|
3669
3666
|
# "user_id": 3620173
|
3670
3667
|
# }
|
3671
3668
|
#
|
3669
|
+
#
|
3670
|
+
# fetchPositionHistory
|
3671
|
+
#
|
3672
|
+
# {
|
3673
|
+
# amount_max: '10',
|
3674
|
+
# amount_max_margin: '2.03466666666666666666',
|
3675
|
+
# bkr_price: '0',
|
3676
|
+
# create_time: '1711150526.2581',
|
3677
|
+
# deal_all: '12.591',
|
3678
|
+
# deal_asset_fee: '0',
|
3679
|
+
# fee_asset: '',
|
3680
|
+
# finish_type: '5',
|
3681
|
+
# first_price: '0.6104',
|
3682
|
+
# latest_price: '0.6487',
|
3683
|
+
# leverage: '3',
|
3684
|
+
# liq_amount: '0',
|
3685
|
+
# liq_price: '0',
|
3686
|
+
# liq_profit: '0',
|
3687
|
+
# mainten_margin: '0.01',
|
3688
|
+
# market: 'XRPUSDT',
|
3689
|
+
# market_type: '1',
|
3690
|
+
# open_price: '0.6104',
|
3691
|
+
# open_val_max: '6.104',
|
3692
|
+
# position_id: '297371462',
|
3693
|
+
# profit_real: '0.35702107169',
|
3694
|
+
# settle_price: '0.6104',
|
3695
|
+
# settle_val: '0',
|
3696
|
+
# side: '2',
|
3697
|
+
# s ys: "0",
|
3698
|
+
# type: '2',
|
3699
|
+
# update_time: '1711391446.133233',
|
3700
|
+
# user_id: '3685860'
|
3701
|
+
# }
|
3702
|
+
#
|
3672
3703
|
marketId = self.safe_string(position, 'market')
|
3673
3704
|
market = self.safe_market(marketId, market, None, 'swap')
|
3674
3705
|
symbol = market['symbol']
|
@@ -3684,7 +3715,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
3684
3715
|
timestamp = self.safe_timestamp(position, 'update_time')
|
3685
3716
|
maintenanceMargin = self.safe_string(position, 'mainten_margin_amount')
|
3686
3717
|
maintenanceMarginPercentage = self.safe_string(position, 'mainten_margin')
|
3687
|
-
collateral = self.
|
3718
|
+
collateral = self.safe_string_2(position, 'margin_amount', 'amount_max_margin')
|
3688
3719
|
leverage = self.safe_string(position, 'leverage')
|
3689
3720
|
notional = self.safe_string(position, 'open_val')
|
3690
3721
|
initialMargin = Precise.string_div(notional, leverage)
|
@@ -3894,7 +3925,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
3894
3925
|
# "side": 2,
|
3895
3926
|
# "stop_loss_price": "0.00000000000000000000",
|
3896
3927
|
# "stop_loss_type": 0,
|
3897
|
-
# "
|
3928
|
+
# "s ys": 0,
|
3898
3929
|
# "take_profit_price": "0.00000000000000000000",
|
3899
3930
|
# "take_profit_type": 0,
|
3900
3931
|
# "taker_fee": "0.00000000000000000000",
|
@@ -3959,7 +3990,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
3959
3990
|
# "side": 2,
|
3960
3991
|
# "stop_loss_price": "0.00000000000000000000",
|
3961
3992
|
# "stop_loss_type": 0,
|
3962
|
-
# "
|
3993
|
+
# "sy s": 0,
|
3963
3994
|
# "take_profit_price": "0.00000000000000000000",
|
3964
3995
|
# "take_profit_type": 0,
|
3965
3996
|
# "taker_fee": "0.00000000000000000000",
|
@@ -4003,7 +4034,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
4003
4034
|
'datetime': self.iso8601(timestamp),
|
4004
4035
|
}
|
4005
4036
|
|
4006
|
-
def add_margin(self, symbol: str, amount, params={}) -> MarginModification:
|
4037
|
+
def add_margin(self, symbol: str, amount: float, params={}) -> MarginModification:
|
4007
4038
|
"""
|
4008
4039
|
add margin
|
4009
4040
|
:see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http032_adjust_position_margin
|
@@ -4014,7 +4045,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
4014
4045
|
"""
|
4015
4046
|
return self.modify_margin_helper(symbol, amount, 1, params)
|
4016
4047
|
|
4017
|
-
def reduce_margin(self, symbol: str, amount, params={}) -> MarginModification:
|
4048
|
+
def reduce_margin(self, symbol: str, amount: float, params={}) -> MarginModification:
|
4018
4049
|
"""
|
4019
4050
|
remove margin from a position
|
4020
4051
|
:see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http032_adjust_position_margin
|
@@ -4204,7 +4235,6 @@ class coinex(Exchange, ImplicitAPI):
|
|
4204
4235
|
|
4205
4236
|
def fetch_funding_rates(self, symbols: Strings = None, params={}):
|
4206
4237
|
"""
|
4207
|
-
* @method
|
4208
4238
|
fetch the current funding rates
|
4209
4239
|
:see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http009_market_ticker_all
|
4210
4240
|
:param str[] symbols: unified market symbols
|
@@ -4267,7 +4297,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
4267
4297
|
result.append(self.parse_funding_rate(ticker, marketInner))
|
4268
4298
|
return self.filter_by_array(result, 'symbol', symbols)
|
4269
4299
|
|
4270
|
-
def withdraw(self, code: str, amount: float, address, tag=None, params={}):
|
4300
|
+
def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
|
4271
4301
|
"""
|
4272
4302
|
make a withdrawal
|
4273
4303
|
:see: https://viabtc.github.io/coinex_api_en_doc/spot/#docsspot002_account015_submit_withdraw
|
@@ -5254,6 +5284,77 @@ class coinex(Exchange, ImplicitAPI):
|
|
5254
5284
|
'shortLeverage': leverageValue,
|
5255
5285
|
}
|
5256
5286
|
|
5287
|
+
def fetch_position_history(self, symbol: str, since: Int = None, limit: Int = None, params={}) -> Position:
|
5288
|
+
"""
|
5289
|
+
fetches historical positions
|
5290
|
+
:see: https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http033-0_finished_position
|
5291
|
+
:param str symbol: unified contract symbol
|
5292
|
+
:param int [since]: not used by coinex fetchPositionHistory
|
5293
|
+
:param int [limit]: the maximum amount of records to fetch, default=1000
|
5294
|
+
:param dict params: extra parameters specific to the exchange api endpoint
|
5295
|
+
*
|
5296
|
+
* EXCHANGE SPECIFIC PARAMETERS
|
5297
|
+
:param int [params.side]: 0: all 1: sell, 2: buy
|
5298
|
+
:returns dict[]: a list of `position structures <https://docs.ccxt.com/#/?id=position-structure>`
|
5299
|
+
"""
|
5300
|
+
self.load_markets()
|
5301
|
+
market = self.market(symbol)
|
5302
|
+
if limit is None:
|
5303
|
+
limit = 1000
|
5304
|
+
request = {
|
5305
|
+
'market': market['id'],
|
5306
|
+
'side': 0,
|
5307
|
+
'limit': limit,
|
5308
|
+
}
|
5309
|
+
response = self.v1PerpetualPrivateGetPositionFinished(self.extend(request, params))
|
5310
|
+
#
|
5311
|
+
# {
|
5312
|
+
# code: '0',
|
5313
|
+
# data: {
|
5314
|
+
# limit: '1000',
|
5315
|
+
# offset: '0',
|
5316
|
+
# records: [
|
5317
|
+
# {
|
5318
|
+
# amount_max: '10',
|
5319
|
+
# amount_max_margin: '2.03466666666666666666',
|
5320
|
+
# bkr_price: '0',
|
5321
|
+
# create_time: '1711150526.2581',
|
5322
|
+
# deal_all: '12.591',
|
5323
|
+
# deal_asset_fee: '0',
|
5324
|
+
# fee_asset: '',
|
5325
|
+
# finish_type: '5',
|
5326
|
+
# first_price: '0.6104',
|
5327
|
+
# latest_price: '0.6487',
|
5328
|
+
# leverage: '3',
|
5329
|
+
# liq_amount: '0',
|
5330
|
+
# liq_price: '0',
|
5331
|
+
# liq_profit: '0',
|
5332
|
+
# mainten_margin: '0.01',
|
5333
|
+
# market: 'XRPUSDT',
|
5334
|
+
# market_type: '1',
|
5335
|
+
# open_price: '0.6104',
|
5336
|
+
# open_val_max: '6.104',
|
5337
|
+
# position_id: '297371462',
|
5338
|
+
# profit_real: '0.35702107169',
|
5339
|
+
# settle_price: '0.6104',
|
5340
|
+
# settle_val: '0',
|
5341
|
+
# side: '2',
|
5342
|
+
# sy s: '0',
|
5343
|
+
# type: '2',
|
5344
|
+
# update_time: '1711391446.133233',
|
5345
|
+
# user_id: '3685860'
|
5346
|
+
# },
|
5347
|
+
# ...
|
5348
|
+
# ]
|
5349
|
+
# },
|
5350
|
+
# message: 'OK'
|
5351
|
+
# }
|
5352
|
+
#
|
5353
|
+
data = self.safe_dict(response, 'data')
|
5354
|
+
records = self.safe_list(data, 'records')
|
5355
|
+
positions = self.parse_positions(records)
|
5356
|
+
return self.filter_by_symbol_since_limit(positions, symbol, since, limit)
|
5357
|
+
|
5257
5358
|
def handle_margin_mode_and_params(self, methodName, params={}, defaultValue=None):
|
5258
5359
|
"""
|
5259
5360
|
* @ignore
|
ccxt/coinlist.py
CHANGED
@@ -103,7 +103,11 @@ class coinlist(Exchange, ImplicitAPI):
|
|
103
103
|
'fetchOrders': True,
|
104
104
|
'fetchOrderTrades': True,
|
105
105
|
'fetchPosition': False,
|
106
|
+
'fetchPositionHistory': False,
|
107
|
+
'fetchPositionMode': False,
|
106
108
|
'fetchPositions': False,
|
109
|
+
'fetchPositionsForSymbol': False,
|
110
|
+
'fetchPositionsHistory': False,
|
107
111
|
'fetchPositionsRisk': False,
|
108
112
|
'fetchPremiumIndexOHLCV': False,
|
109
113
|
'fetchStatus': False,
|
@@ -1865,7 +1869,7 @@ class coinlist(Exchange, ImplicitAPI):
|
|
1865
1869
|
# coinlist returns both internal transfers and blockchain transactions
|
1866
1870
|
return self.parse_transactions(response, currency, since, limit)
|
1867
1871
|
|
1868
|
-
def withdraw(self, code: str, amount: float, address, tag=None, params={}):
|
1872
|
+
def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
|
1869
1873
|
"""
|
1870
1874
|
request a withdrawal from CoinList wallet.(Disabled by default. Contact CoinList to apply for an exception.)
|
1871
1875
|
:see: https://trade-docs.coinlist.co/?javascript--nodejs#request-withdrawal-from-wallet
|
ccxt/coinmate.py
CHANGED
@@ -65,8 +65,11 @@ class coinmate(Exchange, ImplicitAPI):
|
|
65
65
|
'fetchOrderBook': True,
|
66
66
|
'fetchOrders': True,
|
67
67
|
'fetchPosition': False,
|
68
|
+
'fetchPositionHistory': False,
|
68
69
|
'fetchPositionMode': False,
|
69
70
|
'fetchPositions': False,
|
71
|
+
'fetchPositionsForSymbol': False,
|
72
|
+
'fetchPositionsHistory': False,
|
70
73
|
'fetchPositionsRisk': False,
|
71
74
|
'fetchPremiumIndexOHLCV': False,
|
72
75
|
'fetchTicker': True,
|
@@ -584,7 +587,7 @@ class coinmate(Exchange, ImplicitAPI):
|
|
584
587
|
},
|
585
588
|
}
|
586
589
|
|
587
|
-
def withdraw(self, code: str, amount: float, address, tag=None, params={}):
|
590
|
+
def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
|
588
591
|
"""
|
589
592
|
make a withdrawal
|
590
593
|
:see: https://coinmate.docs.apiary.io/#reference/bitcoin-withdrawal-and-deposit/withdraw-bitcoins/post
|
ccxt/coinone.py
CHANGED
@@ -72,8 +72,11 @@ class coinone(Exchange, ImplicitAPI):
|
|
72
72
|
'fetchOrder': True,
|
73
73
|
'fetchOrderBook': True,
|
74
74
|
'fetchPosition': False,
|
75
|
+
'fetchPositionHistory': False,
|
75
76
|
'fetchPositionMode': False,
|
76
77
|
'fetchPositions': False,
|
78
|
+
'fetchPositionsForSymbol': False,
|
79
|
+
'fetchPositionsHistory': False,
|
77
80
|
'fetchPositionsRisk': False,
|
78
81
|
'fetchPremiumIndexOHLCV': False,
|
79
82
|
'fetchTicker': True,
|
ccxt/coinsph.py
CHANGED
@@ -108,7 +108,11 @@ class coinsph(Exchange, ImplicitAPI):
|
|
108
108
|
'fetchOrders': False,
|
109
109
|
'fetchOrderTrades': True,
|
110
110
|
'fetchPosition': False,
|
111
|
+
'fetchPositionHistory': False,
|
112
|
+
'fetchPositionMode': False,
|
111
113
|
'fetchPositions': False,
|
114
|
+
'fetchPositionsForSymbol': False,
|
115
|
+
'fetchPositionsHistory': False,
|
112
116
|
'fetchPositionsRisk': False,
|
113
117
|
'fetchPremiumIndexOHLCV': False,
|
114
118
|
'fetchStatus': True,
|
@@ -1497,7 +1501,7 @@ class coinsph(Exchange, ImplicitAPI):
|
|
1497
1501
|
'tierBased': None,
|
1498
1502
|
}
|
1499
1503
|
|
1500
|
-
def withdraw(self, code: str, amount: float, address, tag=None, params={}):
|
1504
|
+
def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
|
1501
1505
|
"""
|
1502
1506
|
make a withdrawal to coins_ph account
|
1503
1507
|
:see: https://coins-docs.github.io/rest-api/#withdrawuser_data
|
ccxt/coinspot.py
CHANGED
@@ -60,8 +60,11 @@ class coinspot(Exchange, ImplicitAPI):
|
|
60
60
|
'fetchOpenInterestHistory': False,
|
61
61
|
'fetchOrderBook': True,
|
62
62
|
'fetchPosition': False,
|
63
|
+
'fetchPositionHistory': False,
|
63
64
|
'fetchPositionMode': False,
|
64
65
|
'fetchPositions': False,
|
66
|
+
'fetchPositionsForSymbol': False,
|
67
|
+
'fetchPositionsHistory': False,
|
65
68
|
'fetchPositionsRisk': False,
|
66
69
|
'fetchPremiumIndexOHLCV': False,
|
67
70
|
'fetchTicker': True,
|
ccxt/cryptocom.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.cryptocom import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Account, Balances, Currency, Int, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
|
9
|
+
from ccxt.base.types import Account, Balances, Currency, Int, Market, Num, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import AuthenticationError
|
@@ -47,6 +47,7 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
47
47
|
'cancelAllOrders': True,
|
48
48
|
'cancelOrder': True,
|
49
49
|
'cancelOrders': True,
|
50
|
+
'cancelOrdersForSymbols': True,
|
50
51
|
'closeAllPositions': False,
|
51
52
|
'closePosition': True,
|
52
53
|
'createMarketBuyOrderWithCost': False,
|
@@ -94,8 +95,10 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
94
95
|
'fetchOrderBook': True,
|
95
96
|
'fetchOrders': True,
|
96
97
|
'fetchPosition': True,
|
98
|
+
'fetchPositionHistory': False,
|
97
99
|
'fetchPositionMode': False,
|
98
100
|
'fetchPositions': True,
|
101
|
+
'fetchPositionsHistory': False,
|
99
102
|
'fetchPremiumIndexOHLCV': False,
|
100
103
|
'fetchSettlementHistory': True,
|
101
104
|
'fetchStatus': False,
|
@@ -1353,6 +1356,34 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
1353
1356
|
result = self.safe_list(response, 'result', [])
|
1354
1357
|
return self.parse_orders(result, market, None, None, params)
|
1355
1358
|
|
1359
|
+
def cancel_orders_for_symbols(self, orders: List[CancellationRequest], params={}):
|
1360
|
+
"""
|
1361
|
+
cancel multiple orders for multiple symbols
|
1362
|
+
:see: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-cancel-order-list-list
|
1363
|
+
:param CancellationRequest[] orders: each order should contain the parameters required by cancelOrder namely id and symbol
|
1364
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1365
|
+
:returns dict: an list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
1366
|
+
"""
|
1367
|
+
self.load_markets()
|
1368
|
+
orderRequests = []
|
1369
|
+
for i in range(0, len(orders)):
|
1370
|
+
order = orders[i]
|
1371
|
+
id = self.safe_string(order, 'id')
|
1372
|
+
symbol = self.safe_string(order, 'symbol')
|
1373
|
+
market = self.market(symbol)
|
1374
|
+
orderItem = {
|
1375
|
+
'instrument_name': market['id'],
|
1376
|
+
'order_id': str(id),
|
1377
|
+
}
|
1378
|
+
orderRequests.append(orderItem)
|
1379
|
+
request = {
|
1380
|
+
'contingency_type': 'LIST',
|
1381
|
+
'order_list': orderRequests,
|
1382
|
+
}
|
1383
|
+
response = self.v1PrivatePostPrivateCancelOrderList(self.extend(request, params))
|
1384
|
+
result = self.safe_list(response, 'result', [])
|
1385
|
+
return self.parse_orders(result, None, None, None, params)
|
1386
|
+
|
1356
1387
|
def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Order]:
|
1357
1388
|
"""
|
1358
1389
|
fetch all unfilled currently open orders
|
@@ -1487,7 +1518,7 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
1487
1518
|
address = addressString
|
1488
1519
|
return [address, tag]
|
1489
1520
|
|
1490
|
-
def withdraw(self, code: str, amount: float, address, tag=None, params={}):
|
1521
|
+
def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
|
1491
1522
|
"""
|
1492
1523
|
make a withdrawal
|
1493
1524
|
:see: https://exchange-docs.crypto.com/exchange/v1/rest-ws/index.html#private-create-withdrawal
|
ccxt/delta.py
CHANGED
@@ -2480,7 +2480,7 @@ class delta(Exchange, ImplicitAPI):
|
|
2480
2480
|
'previousFundingDatetime': None,
|
2481
2481
|
}
|
2482
2482
|
|
2483
|
-
def add_margin(self, symbol: str, amount, params={}) -> MarginModification:
|
2483
|
+
def add_margin(self, symbol: str, amount: float, params={}) -> MarginModification:
|
2484
2484
|
"""
|
2485
2485
|
add margin
|
2486
2486
|
:see: https://docs.delta.exchange/#add-remove-position-margin
|
@@ -2491,7 +2491,7 @@ class delta(Exchange, ImplicitAPI):
|
|
2491
2491
|
"""
|
2492
2492
|
return self.modify_margin_helper(symbol, amount, 'add', params)
|
2493
2493
|
|
2494
|
-
def reduce_margin(self, symbol: str, amount, params={}) -> MarginModification:
|
2494
|
+
def reduce_margin(self, symbol: str, amount: float, params={}) -> MarginModification:
|
2495
2495
|
"""
|
2496
2496
|
remove margin from a position
|
2497
2497
|
:see: https://docs.delta.exchange/#add-remove-position-margin
|
ccxt/deribit.py
CHANGED
@@ -2749,7 +2749,7 @@ class deribit(Exchange, ImplicitAPI):
|
|
2749
2749
|
}
|
2750
2750
|
return self.safe_string(statuses, status, status)
|
2751
2751
|
|
2752
|
-
def withdraw(self, code: str, amount: float, address, tag=None, params={}):
|
2752
|
+
def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
|
2753
2753
|
"""
|
2754
2754
|
make a withdrawal
|
2755
2755
|
:see: https://docs.deribit.com/#private-withdraw
|
ccxt/digifinex.py
CHANGED
@@ -2754,7 +2754,7 @@ class digifinex(Exchange, ImplicitAPI):
|
|
2754
2754
|
#
|
2755
2755
|
return self.parse_transfer(response, currency)
|
2756
2756
|
|
2757
|
-
def withdraw(self, code: str, amount: float, address, tag=None, params={}):
|
2757
|
+
def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
|
2758
2758
|
"""
|
2759
2759
|
make a withdrawal
|
2760
2760
|
:param str code: unified currency code
|
@@ -3734,7 +3734,7 @@ class digifinex(Exchange, ImplicitAPI):
|
|
3734
3734
|
depositWithdrawFees[code] = self.assign_default_deposit_withdraw_fees(depositWithdrawFees[code], currency)
|
3735
3735
|
return depositWithdrawFees
|
3736
3736
|
|
3737
|
-
def add_margin(self, symbol: str, amount, params={}) -> MarginModification:
|
3737
|
+
def add_margin(self, symbol: str, amount: float, params={}) -> MarginModification:
|
3738
3738
|
"""
|
3739
3739
|
add margin to a position
|
3740
3740
|
:see: https://docs.digifinex.com/en-ww/swap/v2/rest.html#positionmargin
|
@@ -3748,7 +3748,7 @@ class digifinex(Exchange, ImplicitAPI):
|
|
3748
3748
|
self.check_required_argument('addMargin', side, 'side', ['long', 'short'])
|
3749
3749
|
return self.modify_margin_helper(symbol, amount, 1, params)
|
3750
3750
|
|
3751
|
-
def reduce_margin(self, symbol: str, amount, params={}) -> MarginModification:
|
3751
|
+
def reduce_margin(self, symbol: str, amount: float, params={}) -> MarginModification:
|
3752
3752
|
"""
|
3753
3753
|
remove margin from a position
|
3754
3754
|
:see: https://docs.digifinex.com/en-ww/swap/v2/rest.html#positionmargin
|