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/kuna.py
CHANGED
@@ -1340,7 +1340,7 @@ class kuna(Exchange, ImplicitAPI):
|
|
1340
1340
|
data = self.safe_list(response, 'data')
|
1341
1341
|
return self.parse_trades(data, market, since, limit)
|
1342
1342
|
|
1343
|
-
def withdraw(self, code: str, amount: float, address, tag=None, params={}):
|
1343
|
+
def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
|
1344
1344
|
"""
|
1345
1345
|
make a withdrawal
|
1346
1346
|
:see: https://docs.kuna.io/docs/create-a-withdraw
|
ccxt/latoken.py
CHANGED
@@ -69,7 +69,13 @@ class latoken(Exchange, ImplicitAPI):
|
|
69
69
|
'fetchOrder': True,
|
70
70
|
'fetchOrderBook': True,
|
71
71
|
'fetchOrders': True,
|
72
|
+
'fetchPosition': False,
|
73
|
+
'fetchPositionHistory': False,
|
72
74
|
'fetchPositionMode': False,
|
75
|
+
'fetchPositions': False,
|
76
|
+
'fetchPositionsForSymbol': False,
|
77
|
+
'fetchPositionsHistory': False,
|
78
|
+
'fetchPositionsRisk': False,
|
73
79
|
'fetchTicker': True,
|
74
80
|
'fetchTickers': True,
|
75
81
|
'fetchTime': True,
|
ccxt/lbank.py
CHANGED
@@ -1908,7 +1908,7 @@ class lbank(Exchange, ImplicitAPI):
|
|
1908
1908
|
'info': response,
|
1909
1909
|
}
|
1910
1910
|
|
1911
|
-
def withdraw(self, code: str, amount: float, address, tag=None, params={}) -> Transaction:
|
1911
|
+
def withdraw(self, code: str, amount: float, address: str, tag=None, params={}) -> Transaction:
|
1912
1912
|
"""
|
1913
1913
|
make a withdrawal
|
1914
1914
|
:see: https://www.lbank.com/en-US/docs/index.html#withdrawal
|
ccxt/luno.py
CHANGED
@@ -64,8 +64,11 @@ class luno(Exchange, ImplicitAPI):
|
|
64
64
|
'fetchOrderBook': True,
|
65
65
|
'fetchOrders': True,
|
66
66
|
'fetchPosition': False,
|
67
|
+
'fetchPositionHistory': False,
|
67
68
|
'fetchPositionMode': False,
|
68
69
|
'fetchPositions': False,
|
70
|
+
'fetchPositionsForSymbol': False,
|
71
|
+
'fetchPositionsHistory': False,
|
69
72
|
'fetchPositionsRisk': False,
|
70
73
|
'fetchPremiumIndexOHLCV': False,
|
71
74
|
'fetchTicker': True,
|
ccxt/lykke.py
CHANGED
@@ -70,8 +70,13 @@ class lykke(Exchange, ImplicitAPI):
|
|
70
70
|
'fetchOrderBook': True,
|
71
71
|
'fetchOrders': False,
|
72
72
|
'fetchOrderTrades': False,
|
73
|
+
'fetchPosition': False,
|
74
|
+
'fetchPositionHistory': False,
|
73
75
|
'fetchPositionMode': False,
|
74
76
|
'fetchPositions': False,
|
77
|
+
'fetchPositionsForSymbol': False,
|
78
|
+
'fetchPositionsHistory': False,
|
79
|
+
'fetchPositionsRisk': False,
|
75
80
|
'fetchPremiumIndexOHLCV': False,
|
76
81
|
'fetchTicker': True,
|
77
82
|
'fetchTickers': True,
|
@@ -1192,7 +1197,7 @@ class lykke(Exchange, ImplicitAPI):
|
|
1192
1197
|
currency = self.currency(code)
|
1193
1198
|
return self.parse_transactions(payload, currency, since, limit)
|
1194
1199
|
|
1195
|
-
def withdraw(self, code: str, amount: float, address, tag=None, params={}):
|
1200
|
+
def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
|
1196
1201
|
"""
|
1197
1202
|
make a withdrawal
|
1198
1203
|
:see: https://lykkecity.github.io/Trading-API/#withdrawal
|
ccxt/mercado.py
CHANGED
@@ -67,8 +67,11 @@ class mercado(Exchange, ImplicitAPI):
|
|
67
67
|
'fetchOrderBook': True,
|
68
68
|
'fetchOrders': True,
|
69
69
|
'fetchPosition': False,
|
70
|
+
'fetchPositionHistory': False,
|
70
71
|
'fetchPositionMode': False,
|
71
72
|
'fetchPositions': False,
|
73
|
+
'fetchPositionsForSymbol': False,
|
74
|
+
'fetchPositionsHistory': False,
|
72
75
|
'fetchPositionsRisk': False,
|
73
76
|
'fetchPremiumIndexOHLCV': False,
|
74
77
|
'fetchTicker': True,
|
@@ -594,7 +597,7 @@ class mercado(Exchange, ImplicitAPI):
|
|
594
597
|
order = self.safe_dict(responseData, 'order')
|
595
598
|
return self.parse_order(order, market)
|
596
599
|
|
597
|
-
def withdraw(self, code: str, amount: float, address, tag=None, params={}):
|
600
|
+
def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
|
598
601
|
"""
|
599
602
|
make a withdrawal
|
600
603
|
:param str code: unified currency code
|
ccxt/mexc.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.mexc import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Account, Balances, Currencies, Currency, IndexType, Int, Leverage, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction, TransferEntry
|
9
|
+
from ccxt.base.types import Account, Balances, Currencies, Currency, IndexType, Int, Leverage, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction, TransferEntry
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import AuthenticationError
|
@@ -104,8 +104,10 @@ class mexc(Exchange, ImplicitAPI):
|
|
104
104
|
'fetchOrders': True,
|
105
105
|
'fetchOrderTrades': True,
|
106
106
|
'fetchPosition': True,
|
107
|
+
'fetchPositionHistory': 'emulated',
|
107
108
|
'fetchPositionMode': True,
|
108
109
|
'fetchPositions': True,
|
110
|
+
'fetchPositionsHistory': True,
|
109
111
|
'fetchPositionsRisk': None,
|
110
112
|
'fetchPremiumIndexOHLCV': False,
|
111
113
|
'fetchStatus': True,
|
@@ -3779,7 +3781,7 @@ class mexc(Exchange, ImplicitAPI):
|
|
3779
3781
|
# }
|
3780
3782
|
return response
|
3781
3783
|
|
3782
|
-
def reduce_margin(self, symbol: str, amount, params={}) -> MarginModification:
|
3784
|
+
def reduce_margin(self, symbol: str, amount: float, params={}) -> MarginModification:
|
3783
3785
|
"""
|
3784
3786
|
remove margin from a position
|
3785
3787
|
:param str symbol: unified market symbol
|
@@ -3789,7 +3791,7 @@ class mexc(Exchange, ImplicitAPI):
|
|
3789
3791
|
"""
|
3790
3792
|
return self.modify_margin_helper(symbol, amount, 'SUB', params)
|
3791
3793
|
|
3792
|
-
def add_margin(self, symbol: str, amount, params={}) -> MarginModification:
|
3794
|
+
def add_margin(self, symbol: str, amount: float, params={}) -> MarginModification:
|
3793
3795
|
"""
|
3794
3796
|
add margin
|
3795
3797
|
:param str symbol: unified market symbol
|
@@ -4557,6 +4559,8 @@ class mexc(Exchange, ImplicitAPI):
|
|
4557
4559
|
return self.parse_positions(data, symbols)
|
4558
4560
|
|
4559
4561
|
def parse_position(self, position, market: Market = None):
|
4562
|
+
#
|
4563
|
+
# fetchPositions
|
4560
4564
|
#
|
4561
4565
|
# {
|
4562
4566
|
# "positionId": 1394650,
|
@@ -4581,6 +4585,40 @@ class mexc(Exchange, ImplicitAPI):
|
|
4581
4585
|
# "autoAddIm": False
|
4582
4586
|
# }
|
4583
4587
|
#
|
4588
|
+
# fetchPositionsHistory
|
4589
|
+
#
|
4590
|
+
# {
|
4591
|
+
# positionId: '390281084',
|
4592
|
+
# symbol: 'RVN_USDT',
|
4593
|
+
# positionType: '1',
|
4594
|
+
# openType: '2',
|
4595
|
+
# state: '3',
|
4596
|
+
# holdVol: '0',
|
4597
|
+
# frozenVol: '0',
|
4598
|
+
# closeVol: '1141',
|
4599
|
+
# holdAvgPrice: '0.03491',
|
4600
|
+
# holdAvgPriceFullyScale: '0.03491',
|
4601
|
+
# openAvgPrice: '0.03491',
|
4602
|
+
# openAvgPriceFullyScale: '0.03491',
|
4603
|
+
# closeAvgPrice: '0.03494',
|
4604
|
+
# liquidatePrice: '0.03433',
|
4605
|
+
# oim: '0',
|
4606
|
+
# im: '0',
|
4607
|
+
# holdFee: '0',
|
4608
|
+
# realised: '0.1829',
|
4609
|
+
# leverage: '50',
|
4610
|
+
# createTime: '1711512408000',
|
4611
|
+
# updateTime: '1711512553000',
|
4612
|
+
# autoAddIm: False,
|
4613
|
+
# version: '4',
|
4614
|
+
# profitRatio: '0.0227',
|
4615
|
+
# newOpenAvgPrice: '0.03491',
|
4616
|
+
# newCloseAvgPrice: '0.03494',
|
4617
|
+
# closeProfitLoss: '0.3423',
|
4618
|
+
# fee: '0.1593977',
|
4619
|
+
# positionShowStatus: 'CLOSED'
|
4620
|
+
# }
|
4621
|
+
#
|
4584
4622
|
market = self.safe_market(self.safe_string(position, 'symbol'), market)
|
4585
4623
|
symbol = market['symbol']
|
4586
4624
|
contracts = self.safe_string(position, 'holdVol')
|
@@ -4853,7 +4891,7 @@ class mexc(Exchange, ImplicitAPI):
|
|
4853
4891
|
}
|
4854
4892
|
return self.safe_string(statuses, status, status)
|
4855
4893
|
|
4856
|
-
def withdraw(self, code: str, amount: float, address, tag=None, params={}):
|
4894
|
+
def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
|
4857
4895
|
"""
|
4858
4896
|
make a withdrawal
|
4859
4897
|
:see: https://mexcdevelop.github.io/apidocs/spot_v3_en/#withdraw
|
@@ -5180,6 +5218,74 @@ class mexc(Exchange, ImplicitAPI):
|
|
5180
5218
|
marginMode = 'isolated'
|
5181
5219
|
return [marginMode, params]
|
5182
5220
|
|
5221
|
+
def fetch_positions_history(self, symbols: Strings = None, since: Int = None, limit: Int = None, params={}) -> List[Position]:
|
5222
|
+
"""
|
5223
|
+
fetches historical positions
|
5224
|
+
:see: https://mexcdevelop.github.io/apidocs/contract_v1_en/#get-the-user-s-history-position-information
|
5225
|
+
:param str[] [symbols]: unified contract symbols
|
5226
|
+
:param int [since]: not used by mexc fetchPositionsHistory
|
5227
|
+
:param int [limit]: the maximum amount of candles to fetch, default=1000
|
5228
|
+
:param dict params: extra parameters specific to the exchange api endpoint
|
5229
|
+
*
|
5230
|
+
* EXCHANGE SPECIFIC PARAMETERS
|
5231
|
+
:param int type: position type,1: long, 2: short
|
5232
|
+
:param int page_num: current page number, default is 1
|
5233
|
+
:returns dict[]: a list of `position structures <https://docs.ccxt.com/#/?id=position-structure>`
|
5234
|
+
"""
|
5235
|
+
self.load_markets()
|
5236
|
+
request = {}
|
5237
|
+
if symbols is not None:
|
5238
|
+
symbolsLength = len(symbols)
|
5239
|
+
if symbolsLength == 1:
|
5240
|
+
market = self.market(symbols[0])
|
5241
|
+
request['symbol'] = market['id']
|
5242
|
+
if limit is not None:
|
5243
|
+
request['page_size'] = limit
|
5244
|
+
response = self.contractPrivateGetPositionListHistoryPositions(self.extend(request, params))
|
5245
|
+
#
|
5246
|
+
# {
|
5247
|
+
# success: True,
|
5248
|
+
# code: '0',
|
5249
|
+
# data: [
|
5250
|
+
# {
|
5251
|
+
# positionId: '390281084',
|
5252
|
+
# symbol: 'RVN_USDT',
|
5253
|
+
# positionType: '1',
|
5254
|
+
# openType: '2',
|
5255
|
+
# state: '3',
|
5256
|
+
# holdVol: '0',
|
5257
|
+
# frozenVol: '0',
|
5258
|
+
# closeVol: '1141',
|
5259
|
+
# holdAvgPrice: '0.03491',
|
5260
|
+
# holdAvgPriceFullyScale: '0.03491',
|
5261
|
+
# openAvgPrice: '0.03491',
|
5262
|
+
# openAvgPriceFullyScale: '0.03491',
|
5263
|
+
# closeAvgPrice: '0.03494',
|
5264
|
+
# liquidatePrice: '0.03433',
|
5265
|
+
# oim: '0',
|
5266
|
+
# im: '0',
|
5267
|
+
# holdFee: '0',
|
5268
|
+
# realised: '0.1829',
|
5269
|
+
# leverage: '50',
|
5270
|
+
# createTime: '1711512408000',
|
5271
|
+
# updateTime: '1711512553000',
|
5272
|
+
# autoAddIm: False,
|
5273
|
+
# version: '4',
|
5274
|
+
# profitRatio: '0.0227',
|
5275
|
+
# newOpenAvgPrice: '0.03491',
|
5276
|
+
# newCloseAvgPrice: '0.03494',
|
5277
|
+
# closeProfitLoss: '0.3423',
|
5278
|
+
# fee: '0.1593977',
|
5279
|
+
# positionShowStatus: 'CLOSED'
|
5280
|
+
# },
|
5281
|
+
# ...
|
5282
|
+
# ]
|
5283
|
+
# }
|
5284
|
+
#
|
5285
|
+
data = self.safe_list(response, 'data')
|
5286
|
+
positions = self.parse_positions(data, symbols, params)
|
5287
|
+
return self.filter_by_since_limit(positions, since, limit)
|
5288
|
+
|
5183
5289
|
def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
|
5184
5290
|
section = self.safe_string(api, 0)
|
5185
5291
|
access = self.safe_string(api, 1)
|
ccxt/ndax.py
CHANGED
@@ -76,7 +76,11 @@ class ndax(Exchange, ImplicitAPI):
|
|
76
76
|
'fetchOrders': True,
|
77
77
|
'fetchOrderTrades': True,
|
78
78
|
'fetchPosition': False,
|
79
|
+
'fetchPositionHistory': False,
|
80
|
+
'fetchPositionMode': False,
|
79
81
|
'fetchPositions': False,
|
82
|
+
'fetchPositionsForSymbol': False,
|
83
|
+
'fetchPositionsHistory': False,
|
80
84
|
'fetchPositionsRisk': False,
|
81
85
|
'fetchPremiumIndexOHLCV': False,
|
82
86
|
'fetchTicker': True,
|
@@ -2191,7 +2195,7 @@ class ndax(Exchange, ImplicitAPI):
|
|
2191
2195
|
'network': None,
|
2192
2196
|
}
|
2193
2197
|
|
2194
|
-
def withdraw(self, code: str, amount: float, address, tag=None, params={}):
|
2198
|
+
def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
|
2195
2199
|
"""
|
2196
2200
|
make a withdrawal
|
2197
2201
|
:param str code: unified currency code
|
ccxt/novadax.py
CHANGED
@@ -89,7 +89,11 @@ class novadax(Exchange, ImplicitAPI):
|
|
89
89
|
'fetchOrders': True,
|
90
90
|
'fetchOrderTrades': True,
|
91
91
|
'fetchPosition': False,
|
92
|
+
'fetchPositionHistory': False,
|
93
|
+
'fetchPositionMode': False,
|
92
94
|
'fetchPositions': False,
|
95
|
+
'fetchPositionsForSymbol': False,
|
96
|
+
'fetchPositionsHistory': False,
|
93
97
|
'fetchPositionsRisk': False,
|
94
98
|
'fetchPremiumIndexOHLCV': False,
|
95
99
|
'fetchTicker': True,
|
@@ -1154,7 +1158,7 @@ class novadax(Exchange, ImplicitAPI):
|
|
1154
1158
|
}
|
1155
1159
|
return self.safe_string(statuses, status, 'failed')
|
1156
1160
|
|
1157
|
-
def withdraw(self, code: str, amount: float, address, tag=None, params={}):
|
1161
|
+
def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
|
1158
1162
|
"""
|
1159
1163
|
make a withdrawal
|
1160
1164
|
:see: https://doc.novadax.com/en-US/#send-cryptocurrencies
|
ccxt/okcoin.py
CHANGED
@@ -2309,7 +2309,7 @@ class okcoin(Exchange, ImplicitAPI):
|
|
2309
2309
|
}
|
2310
2310
|
return self.safe_string(statuses, status, status)
|
2311
2311
|
|
2312
|
-
def withdraw(self, code: str, amount: float, address, tag=None, params={}):
|
2312
|
+
def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
|
2313
2313
|
"""
|
2314
2314
|
:see: https://www.okcoin.com/docs-v5/en/#rest-api-funding-withdrawal
|
2315
2315
|
make a withdrawal
|
ccxt/okx.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.okx import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Account, Balances, Conversion, Currencies, Currency, Greeks, Int, Leverage, MarginModification, Market, MarketInterface, Num, Option, OptionChain, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction, TransferEntry
|
9
|
+
from ccxt.base.types import Account, Balances, Conversion, Currencies, Currency, Greeks, Int, Leverage, MarginModification, Market, MarketInterface, Num, Option, OptionChain, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction, TransferEntry
|
10
10
|
from typing import List
|
11
11
|
from typing import Any
|
12
12
|
from ccxt.base.errors import ExchangeError
|
@@ -54,8 +54,10 @@ class okx(Exchange, ImplicitAPI):
|
|
54
54
|
'option': True,
|
55
55
|
'addMargin': True,
|
56
56
|
'cancelAllOrders': False,
|
57
|
+
'cancelAllOrdersAfter': True,
|
57
58
|
'cancelOrder': True,
|
58
59
|
'cancelOrders': True,
|
60
|
+
'cancelOrdersForSymbols': True,
|
59
61
|
'closeAllPositions': False,
|
60
62
|
'closePosition': True,
|
61
63
|
'createConvertTrade': True,
|
@@ -132,8 +134,10 @@ class okx(Exchange, ImplicitAPI):
|
|
132
134
|
'fetchOrderTrades': True,
|
133
135
|
'fetchPermissions': None,
|
134
136
|
'fetchPosition': True,
|
137
|
+
'fetchPositionHistory': 'emulated',
|
135
138
|
'fetchPositions': True,
|
136
139
|
'fetchPositionsForSymbol': True,
|
140
|
+
'fetchPositionsHistory': True,
|
137
141
|
'fetchPositionsRisk': False,
|
138
142
|
'fetchPremiumIndexOHLCV': False,
|
139
143
|
'fetchSettlementHistory': True,
|
@@ -3083,6 +3087,107 @@ class okx(Exchange, ImplicitAPI):
|
|
3083
3087
|
ordersData = self.safe_list(response, 'data', [])
|
3084
3088
|
return self.parse_orders(ordersData, market, None, None, params)
|
3085
3089
|
|
3090
|
+
def cancel_orders_for_symbols(self, orders: List[CancellationRequest], params={}):
|
3091
|
+
"""
|
3092
|
+
cancel multiple orders for multiple symbols
|
3093
|
+
:see: https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-cancel-multiple-orders
|
3094
|
+
:see: https://www.okx.com/docs-v5/en/#order-book-trading-algo-trading-post-cancel-algo-order
|
3095
|
+
:param CancellationRequest[] orders: each order should contain the parameters required by cancelOrder namely id and symbol
|
3096
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
3097
|
+
:param boolean [params.trigger]: whether the order is a stop/trigger order
|
3098
|
+
:param boolean [params.trailing]: set to True if you want to cancel trailing orders
|
3099
|
+
:returns dict: an list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`
|
3100
|
+
"""
|
3101
|
+
self.load_markets()
|
3102
|
+
request = []
|
3103
|
+
options = self.safe_dict(self.options, 'cancelOrders', {})
|
3104
|
+
defaultMethod = self.safe_string(options, 'method', 'privatePostTradeCancelBatchOrders')
|
3105
|
+
method = self.safe_string(params, 'method', defaultMethod)
|
3106
|
+
stop = self.safe_bool_2(params, 'stop', 'trigger')
|
3107
|
+
trailing = self.safe_bool(params, 'trailing', False)
|
3108
|
+
isStopOrTrailing = stop or trailing
|
3109
|
+
if isStopOrTrailing:
|
3110
|
+
method = 'privatePostTradeCancelAlgos'
|
3111
|
+
for i in range(0, len(orders)):
|
3112
|
+
order = orders[i]
|
3113
|
+
id = self.safe_string(order, 'id')
|
3114
|
+
clientOrderId = self.safe_string_2(order, 'clOrdId', 'clientOrderId')
|
3115
|
+
symbol = self.safe_string(order, 'symbol')
|
3116
|
+
market = self.market(symbol)
|
3117
|
+
idKey = 'ordId'
|
3118
|
+
if isStopOrTrailing:
|
3119
|
+
idKey = 'algoId'
|
3120
|
+
elif clientOrderId is not None:
|
3121
|
+
idKey = 'clOrdId'
|
3122
|
+
requestItem = {
|
3123
|
+
'instId': market['id'],
|
3124
|
+
}
|
3125
|
+
requestItem[idKey] = clientOrderId if (clientOrderId is not None) else id
|
3126
|
+
request.append(requestItem)
|
3127
|
+
response = None
|
3128
|
+
if method == 'privatePostTradeCancelAlgos':
|
3129
|
+
response = self.privatePostTradeCancelAlgos(request) # * dont self.extend with params, otherwise ARRAY will be turned into OBJECT
|
3130
|
+
else:
|
3131
|
+
response = self.privatePostTradeCancelBatchOrders(request) # * dont self.extend with params, otherwise ARRAY will be turned into OBJECT
|
3132
|
+
#
|
3133
|
+
# {
|
3134
|
+
# "code": "0",
|
3135
|
+
# "data": [
|
3136
|
+
# {
|
3137
|
+
# "clOrdId": "e123456789ec4dBC1123456ba123b45e",
|
3138
|
+
# "ordId": "405071912345641543",
|
3139
|
+
# "sCode": "0",
|
3140
|
+
# "sMsg": ""
|
3141
|
+
# },
|
3142
|
+
# ...
|
3143
|
+
# ],
|
3144
|
+
# "msg": ""
|
3145
|
+
# }
|
3146
|
+
#
|
3147
|
+
# Algo order
|
3148
|
+
#
|
3149
|
+
# {
|
3150
|
+
# "code": "0",
|
3151
|
+
# "data": [
|
3152
|
+
# {
|
3153
|
+
# "algoId": "431375349042380800",
|
3154
|
+
# "sCode": "0",
|
3155
|
+
# "sMsg": ""
|
3156
|
+
# }
|
3157
|
+
# ],
|
3158
|
+
# "msg": ""
|
3159
|
+
# }
|
3160
|
+
#
|
3161
|
+
ordersData = self.safe_list(response, 'data', [])
|
3162
|
+
return self.parse_orders(ordersData, None, None, None, params)
|
3163
|
+
|
3164
|
+
def cancel_all_orders_after(self, timeout: Int, params={}):
|
3165
|
+
"""
|
3166
|
+
dead man's switch, cancel all orders after the given timeout
|
3167
|
+
:see: https://www.okx.com/docs-v5/en/#order-book-trading-trade-post-cancel-all-after
|
3168
|
+
:param number timeout: time in milliseconds, 0 represents cancel the timer
|
3169
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
3170
|
+
:returns dict: the api result
|
3171
|
+
"""
|
3172
|
+
self.load_markets()
|
3173
|
+
request: dict = {
|
3174
|
+
'timeOut': self.parse_to_int(timeout / 1000) if (timeout > 0) else 0,
|
3175
|
+
}
|
3176
|
+
response = self.privatePostTradeCancelAllAfter(self.extend(request, params))
|
3177
|
+
#
|
3178
|
+
# {
|
3179
|
+
# "code":"0",
|
3180
|
+
# "msg":"",
|
3181
|
+
# "data":[
|
3182
|
+
# {
|
3183
|
+
# "triggerTime":"1587971460",
|
3184
|
+
# "ts":"1587971400"
|
3185
|
+
# }
|
3186
|
+
# ]
|
3187
|
+
# }
|
3188
|
+
#
|
3189
|
+
return response
|
3190
|
+
|
3086
3191
|
def parse_order_status(self, status):
|
3087
3192
|
statuses = {
|
3088
3193
|
'canceled': 'canceled',
|
@@ -4397,7 +4502,7 @@ class okx(Exchange, ImplicitAPI):
|
|
4397
4502
|
raise InvalidAddress(self.id + ' fetchDepositAddress() cannot find ' + network + ' deposit address for ' + code)
|
4398
4503
|
return result
|
4399
4504
|
|
4400
|
-
def withdraw(self, code: str, amount: float, address, tag=None, params={}):
|
4505
|
+
def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
|
4401
4506
|
"""
|
4402
4507
|
make a withdrawal
|
4403
4508
|
:see: https://www.okx.com/docs-v5/en/#funding-account-rest-api-withdrawal
|
@@ -6121,7 +6226,7 @@ class okx(Exchange, ImplicitAPI):
|
|
6121
6226
|
'datetime': self.iso8601(timestamp),
|
6122
6227
|
}
|
6123
6228
|
|
6124
|
-
def reduce_margin(self, symbol: str, amount, params={}) -> MarginModification:
|
6229
|
+
def reduce_margin(self, symbol: str, amount: float, params={}) -> MarginModification:
|
6125
6230
|
"""
|
6126
6231
|
remove margin from a position
|
6127
6232
|
:see: https://www.okx.com/docs-v5/en/#trading-account-rest-api-increase-decrease-margin
|
@@ -6132,7 +6237,7 @@ class okx(Exchange, ImplicitAPI):
|
|
6132
6237
|
"""
|
6133
6238
|
return self.modify_margin_helper(symbol, amount, 'reduce', params)
|
6134
6239
|
|
6135
|
-
def add_margin(self, symbol: str, amount, params={}) -> MarginModification:
|
6240
|
+
def add_margin(self, symbol: str, amount: float, params={}) -> MarginModification:
|
6136
6241
|
"""
|
6137
6242
|
add margin
|
6138
6243
|
:see: https://www.okx.com/docs-v5/en/#trading-account-rest-api-increase-decrease-margin
|
@@ -7549,3 +7654,77 @@ class okx(Exchange, ImplicitAPI):
|
|
7549
7654
|
data = self.safe_list(response, 'data')
|
7550
7655
|
modifications = self.parse_margin_modifications(data)
|
7551
7656
|
return self.filter_by_symbol_since_limit(modifications, symbol, since, limit)
|
7657
|
+
|
7658
|
+
def fetch_positions_history(self, symbols: Strings = None, since: Int = None, limit: Int = None, params={}) -> List[Position]:
|
7659
|
+
"""
|
7660
|
+
fetches historical positions
|
7661
|
+
:see: https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-positions-history
|
7662
|
+
:param str [symbols]: unified market symbols
|
7663
|
+
:param int [since]: timestamp in ms of the earliest position to fetch
|
7664
|
+
:param int [limit]: the maximum amount of records to fetch, default=100, max=100
|
7665
|
+
:param dict params: extra parameters specific to the exchange api endpoint
|
7666
|
+
:param str [params.marginMode]: "cross" or "isolated"
|
7667
|
+
*
|
7668
|
+
* EXCHANGE SPECIFIC PARAMETERS
|
7669
|
+
:param str [params.instType]: margin, swap, futures or option
|
7670
|
+
:param str [params.type]: the type of latest close position 1: close position partially, 2:close all, 3:liquidation, 4:partial liquidation; 5:adl, is it is the latest type if there are several types for the same position
|
7671
|
+
:param str [params.posId]: position id, there is attribute expiration, the posid will be expired if it is more than 30 days after the last full close position, then position will use new posid
|
7672
|
+
:param str [params.before]: timestamp in ms of the earliest position to fetch based on the last update time of the position
|
7673
|
+
:param str [params.after]: timestamp in ms of the latest position to fetch based on the last update time of the position
|
7674
|
+
:returns dict[]: a list of `position structures <https://docs.ccxt.com/#/?id=position-structure>`
|
7675
|
+
"""
|
7676
|
+
self.load_markets()
|
7677
|
+
marginMode = self.safe_string(params, 'marginMode')
|
7678
|
+
instType = self.safe_string_upper(params, 'instType')
|
7679
|
+
params = self.omit(params, ['until', 'marginMode', 'instType'])
|
7680
|
+
if limit is None:
|
7681
|
+
limit = 100
|
7682
|
+
request = {
|
7683
|
+
'limit': limit,
|
7684
|
+
}
|
7685
|
+
if symbols is not None:
|
7686
|
+
symbolsLength = len(symbols)
|
7687
|
+
if symbolsLength == 1:
|
7688
|
+
market = self.market(symbols[0])
|
7689
|
+
request['instId'] = market['id']
|
7690
|
+
if marginMode is not None:
|
7691
|
+
request['mgnMode'] = marginMode
|
7692
|
+
if instType is not None:
|
7693
|
+
request['instType'] = instType
|
7694
|
+
response = self.privateGetAccountPositionsHistory(self.extend(request, params))
|
7695
|
+
#
|
7696
|
+
# {
|
7697
|
+
# code: '0',
|
7698
|
+
# data: [
|
7699
|
+
# {
|
7700
|
+
# cTime: '1708735940395',
|
7701
|
+
# ccy: 'USDT',
|
7702
|
+
# closeAvgPx: '0.6330444444444444',
|
7703
|
+
# closeTotalPos: '27',
|
7704
|
+
# direction: 'long',
|
7705
|
+
# fee: '-1.69566',
|
7706
|
+
# fundingFee: '-11.870404179341788',
|
7707
|
+
# instId: 'XRP-USDT-SWAP',
|
7708
|
+
# instType: 'SWAP',
|
7709
|
+
# lever: '3.0',
|
7710
|
+
# liqPenalty: '0',
|
7711
|
+
# mgnMode: 'cross',
|
7712
|
+
# openAvgPx: '0.623',
|
7713
|
+
# openMaxPos: '15',
|
7714
|
+
# pnl: '27.11999999999988',
|
7715
|
+
# pnlRatio: '0.0241732402722634',
|
7716
|
+
# posId: '681423155054862336',
|
7717
|
+
# realizedPnl: '13.553935820658092',
|
7718
|
+
# triggerPx: '',
|
7719
|
+
# type: '2',
|
7720
|
+
# uTime: '1711088748170',
|
7721
|
+
# uly: 'XRP-USDT'
|
7722
|
+
# },
|
7723
|
+
# ...
|
7724
|
+
# ],
|
7725
|
+
# msg: ''
|
7726
|
+
# }
|
7727
|
+
#
|
7728
|
+
data = self.safe_list(response, 'data')
|
7729
|
+
positions = self.parse_positions(data, symbols, params)
|
7730
|
+
return self.filter_by_since_limit(positions, since, limit)
|
ccxt/onetrading.py
CHANGED
@@ -86,8 +86,11 @@ class onetrading(Exchange, ImplicitAPI):
|
|
86
86
|
'fetchOrders': False,
|
87
87
|
'fetchOrderTrades': True,
|
88
88
|
'fetchPosition': False,
|
89
|
+
'fetchPositionHistory': False,
|
89
90
|
'fetchPositionMode': False,
|
90
91
|
'fetchPositions': False,
|
92
|
+
'fetchPositionsForSymbol': False,
|
93
|
+
'fetchPositionsHistory': False,
|
91
94
|
'fetchPositionsRisk': False,
|
92
95
|
'fetchPremiumIndexOHLCV': False,
|
93
96
|
'fetchTicker': True,
|
@@ -1179,7 +1182,7 @@ class onetrading(Exchange, ImplicitAPI):
|
|
1179
1182
|
withdrawalHistory = self.safe_list(response, 'withdrawal_history', [])
|
1180
1183
|
return self.parse_transactions(withdrawalHistory, currency, since, limit, {'type': 'withdrawal'})
|
1181
1184
|
|
1182
|
-
def withdraw(self, code: str, amount: float, address, tag=None, params={}):
|
1185
|
+
def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
|
1183
1186
|
"""
|
1184
1187
|
make a withdrawal
|
1185
1188
|
:param str code: unified currency code
|
ccxt/p2b.py
CHANGED
@@ -85,8 +85,11 @@ class p2b(Exchange, ImplicitAPI):
|
|
85
85
|
'fetchOrderTrades': True,
|
86
86
|
'fetchPermissions': False,
|
87
87
|
'fetchPosition': False,
|
88
|
+
'fetchPositionHistory': False,
|
89
|
+
'fetchPositionMode': False,
|
88
90
|
'fetchPositions': False,
|
89
91
|
'fetchPositionsForSymbol': False,
|
92
|
+
'fetchPositionsHistory': False,
|
90
93
|
'fetchPositionsRisk': False,
|
91
94
|
'fetchPremiumIndexOHLCV': False,
|
92
95
|
'fetchTicker': True,
|
ccxt/phemex.py
CHANGED
@@ -4319,7 +4319,7 @@ class phemex(Exchange, ImplicitAPI):
|
|
4319
4319
|
sorted = self.sort_by(result, 'timestamp')
|
4320
4320
|
return self.filter_by_symbol_since_limit(sorted, symbol, since, limit)
|
4321
4321
|
|
4322
|
-
def withdraw(self, code: str, amount: float, address, tag=None, params={}):
|
4322
|
+
def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
|
4323
4323
|
"""
|
4324
4324
|
make a withdrawal
|
4325
4325
|
:see: https://phemex-docs.github.io/#create-withdraw-request
|
ccxt/poloniex.py
CHANGED
@@ -1787,7 +1787,7 @@ class poloniex(Exchange, ImplicitAPI):
|
|
1787
1787
|
'status': None,
|
1788
1788
|
}
|
1789
1789
|
|
1790
|
-
def withdraw(self, code: str, amount: float, address, tag=None, params={}):
|
1790
|
+
def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
|
1791
1791
|
"""
|
1792
1792
|
make a withdrawal
|
1793
1793
|
:see: https://docs.poloniex.com/#authenticated-endpoints-wallets-withdraw-currency
|
ccxt/pro/__init__.py
CHANGED
ccxt/pro/bitget.py
CHANGED
@@ -947,7 +947,7 @@ class bitget(ccxt.async_support.bitget):
|
|
947
947
|
limit = orders.getLimit(symbol, limit)
|
948
948
|
return self.filter_by_symbol_since_limit(orders, symbol, since, limit, True)
|
949
949
|
|
950
|
-
def handle_order(self, client: Client, message
|
950
|
+
def handle_order(self, client: Client, message):
|
951
951
|
#
|
952
952
|
# spot
|
953
953
|
#
|