ccxt 4.3.6__py2.py3-none-any.whl → 4.3.8__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/coinbase.py +5 -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 +27 -1
- ccxt/async_support/bigone.py +1 -1
- ccxt/async_support/binance.py +6 -4
- ccxt/async_support/bingx.py +4 -2
- 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 +71 -5
- ccxt/async_support/bithumb.py +5 -1
- ccxt/async_support/bitmart.py +1 -1
- ccxt/async_support/bitmex.py +3 -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 +116 -14
- ccxt/async_support/cex.py +6 -0
- ccxt/async_support/coinbase.py +94 -18
- 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 +255 -192
- 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 +3 -1
- 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 +3 -1
- ccxt/async_support/huobijp.py +1 -1
- ccxt/async_support/hyperliquid.py +2 -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 +1 -1
- ccxt/async_support/kucoin.py +3 -1
- ccxt/async_support/kucoinfutures.py +3 -1
- 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 +81 -5
- 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 +1 -1
- ccxt/async_support/woo.py +4 -2
- 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 +38 -4
- ccxt/bigone.py +1 -1
- ccxt/binance.py +6 -4
- ccxt/bingx.py +4 -2
- ccxt/bitbank.py +4 -1
- ccxt/bitfinex.py +1 -1
- ccxt/bitfinex2.py +1 -1
- ccxt/bitflyer.py +1 -1
- ccxt/bitget.py +71 -5
- ccxt/bithumb.py +5 -1
- ccxt/bitmart.py +1 -1
- ccxt/bitmex.py +3 -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 +116 -14
- ccxt/cex.py +6 -0
- ccxt/coinbase.py +94 -18
- ccxt/coinbaseinternational.py +3 -1
- ccxt/coinbasepro.py +7 -1
- ccxt/coincheck.py +3 -0
- ccxt/coinex.py +255 -192
- 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 +3 -1
- 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 +3 -1
- ccxt/huobijp.py +1 -1
- ccxt/hyperliquid.py +2 -2
- ccxt/idex.py +4 -1
- ccxt/independentreserve.py +3 -0
- ccxt/indodax.py +4 -1
- ccxt/kraken.py +1 -1
- ccxt/kucoin.py +3 -1
- ccxt/kucoinfutures.py +3 -1
- 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 +81 -5
- 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/bybit.py +1 -1
- ccxt/pro/coinbase.py +28 -28
- ccxt/probit.py +4 -1
- 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 +1 -1
- ccxt/woo.py +4 -2
- ccxt/yobit.py +4 -1
- ccxt/zaif.py +1 -1
- ccxt/zonda.py +1 -1
- {ccxt-4.3.6.dist-info → ccxt-4.3.8.dist-info}/METADATA +4 -4
- {ccxt-4.3.6.dist-info → ccxt-4.3.8.dist-info}/RECORD +178 -178
- {ccxt-4.3.6.dist-info → ccxt-4.3.8.dist-info}/WHEEL +0 -0
- {ccxt-4.3.6.dist-info → ccxt-4.3.8.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, CancellationRequest, 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
|
@@ -134,8 +134,10 @@ class okx(Exchange, ImplicitAPI):
|
|
134
134
|
'fetchOrderTrades': True,
|
135
135
|
'fetchPermissions': None,
|
136
136
|
'fetchPosition': True,
|
137
|
+
'fetchPositionHistory': 'emulated',
|
137
138
|
'fetchPositions': True,
|
138
139
|
'fetchPositionsForSymbol': True,
|
140
|
+
'fetchPositionsHistory': True,
|
139
141
|
'fetchPositionsRisk': False,
|
140
142
|
'fetchPremiumIndexOHLCV': False,
|
141
143
|
'fetchSettlementHistory': True,
|
@@ -4500,7 +4502,7 @@ class okx(Exchange, ImplicitAPI):
|
|
4500
4502
|
raise InvalidAddress(self.id + ' fetchDepositAddress() cannot find ' + network + ' deposit address for ' + code)
|
4501
4503
|
return result
|
4502
4504
|
|
4503
|
-
def withdraw(self, code: str, amount: float, address, tag=None, params={}):
|
4505
|
+
def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
|
4504
4506
|
"""
|
4505
4507
|
make a withdrawal
|
4506
4508
|
:see: https://www.okx.com/docs-v5/en/#funding-account-rest-api-withdrawal
|
@@ -6224,7 +6226,7 @@ class okx(Exchange, ImplicitAPI):
|
|
6224
6226
|
'datetime': self.iso8601(timestamp),
|
6225
6227
|
}
|
6226
6228
|
|
6227
|
-
def reduce_margin(self, symbol: str, amount, params={}) -> MarginModification:
|
6229
|
+
def reduce_margin(self, symbol: str, amount: float, params={}) -> MarginModification:
|
6228
6230
|
"""
|
6229
6231
|
remove margin from a position
|
6230
6232
|
:see: https://www.okx.com/docs-v5/en/#trading-account-rest-api-increase-decrease-margin
|
@@ -6235,7 +6237,7 @@ class okx(Exchange, ImplicitAPI):
|
|
6235
6237
|
"""
|
6236
6238
|
return self.modify_margin_helper(symbol, amount, 'reduce', params)
|
6237
6239
|
|
6238
|
-
def add_margin(self, symbol: str, amount, params={}) -> MarginModification:
|
6240
|
+
def add_margin(self, symbol: str, amount: float, params={}) -> MarginModification:
|
6239
6241
|
"""
|
6240
6242
|
add margin
|
6241
6243
|
:see: https://www.okx.com/docs-v5/en/#trading-account-rest-api-increase-decrease-margin
|
@@ -7395,7 +7397,7 @@ class okx(Exchange, ImplicitAPI):
|
|
7395
7397
|
# }
|
7396
7398
|
#
|
7397
7399
|
rows = self.safe_list(response, 'data', [])
|
7398
|
-
return self.parse_conversions(rows, 'baseCcy', 'quoteCcy', since, limit)
|
7400
|
+
return self.parse_conversions(rows, code, 'baseCcy', 'quoteCcy', since, limit)
|
7399
7401
|
|
7400
7402
|
def parse_conversion(self, conversion, fromCurrency: Currency = None, toCurrency: Currency = None) -> Conversion:
|
7401
7403
|
#
|
@@ -7652,3 +7654,77 @@ class okx(Exchange, ImplicitAPI):
|
|
7652
7654
|
data = self.safe_list(response, 'data')
|
7653
7655
|
modifications = self.parse_margin_modifications(data)
|
7654
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/bybit.py
CHANGED
ccxt/pro/coinbase.py
CHANGED
@@ -52,7 +52,7 @@ class coinbase(ccxt.async_support.coinbase):
|
|
52
52
|
},
|
53
53
|
})
|
54
54
|
|
55
|
-
async def subscribe(self, name, symbol=None, params={}):
|
55
|
+
async def subscribe(self, name: str, isPrivate: bool, symbol=None, params={}):
|
56
56
|
"""
|
57
57
|
* @ignore
|
58
58
|
subscribes to a websocket channel
|
@@ -63,7 +63,6 @@ class coinbase(ccxt.async_support.coinbase):
|
|
63
63
|
:returns dict: subscription to a websocket channel
|
64
64
|
"""
|
65
65
|
await self.load_markets()
|
66
|
-
self.check_required_credentials()
|
67
66
|
market = None
|
68
67
|
messageHash = name
|
69
68
|
productIds = []
|
@@ -78,8 +77,6 @@ class coinbase(ccxt.async_support.coinbase):
|
|
78
77
|
productIds = [market['id']]
|
79
78
|
url = self.urls['api']['ws']
|
80
79
|
timestamp = self.number_to_string(self.seconds())
|
81
|
-
isCloudAPiKey = (self.apiKey.find('organizations/') >= 0) or (self.secret.startswith('-----BEGIN'))
|
82
|
-
auth = timestamp + name + ','.join(productIds)
|
83
80
|
subscribe = {
|
84
81
|
'type': 'subscribe',
|
85
82
|
'product_ids': productIds,
|
@@ -88,22 +85,26 @@ class coinbase(ccxt.async_support.coinbase):
|
|
88
85
|
# 'timestamp': timestamp,
|
89
86
|
# 'signature': self.hmac(self.encode(auth), self.encode(self.secret), hashlib.sha256),
|
90
87
|
}
|
91
|
-
if
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
88
|
+
if isPrivate:
|
89
|
+
self.check_required_credentials()
|
90
|
+
isCloudAPiKey = (self.apiKey.find('organizations/') >= 0) or (self.secret.startswith('-----BEGIN'))
|
91
|
+
auth = timestamp + name + ','.join(productIds)
|
92
|
+
if not isCloudAPiKey:
|
93
|
+
subscribe['api_key'] = self.apiKey
|
94
|
+
subscribe['timestamp'] = timestamp
|
95
|
+
subscribe['signature'] = self.hmac(self.encode(auth), self.encode(self.secret), hashlib.sha256)
|
96
|
+
else:
|
97
|
+
if self.apiKey.startswith('-----BEGIN'):
|
98
|
+
raise ArgumentsRequired(self.id + ' apiKey should contain the name(eg: organizations/3b910e93....) and not the public key')
|
99
|
+
currentToken = self.safe_string(self.options, 'wsToken')
|
100
|
+
tokenTimestamp = self.safe_integer(self.options, 'wsTokenTimestamp', 0)
|
101
|
+
seconds = self.seconds()
|
102
|
+
if currentToken is None or tokenTimestamp + 120 < seconds:
|
103
|
+
# we should generate new token
|
104
|
+
token = self.create_auth_token(seconds)
|
105
|
+
self.options['wsToken'] = token
|
106
|
+
self.options['wsTokenTimestamp'] = seconds
|
107
|
+
subscribe['jwt'] = self.safe_string(self.options, 'wsToken')
|
107
108
|
return await self.watch(url, messageHash, subscribe, messageHash)
|
108
109
|
|
109
110
|
async def watch_ticker(self, symbol: str, params={}) -> Ticker:
|
@@ -115,7 +116,7 @@ class coinbase(ccxt.async_support.coinbase):
|
|
115
116
|
:returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
|
116
117
|
"""
|
117
118
|
name = 'ticker'
|
118
|
-
return await self.subscribe(name, symbol, params)
|
119
|
+
return await self.subscribe(name, False, symbol, params)
|
119
120
|
|
120
121
|
async def watch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
|
121
122
|
"""
|
@@ -128,7 +129,7 @@ class coinbase(ccxt.async_support.coinbase):
|
|
128
129
|
if symbols is None:
|
129
130
|
symbols = self.symbols
|
130
131
|
name = 'ticker_batch'
|
131
|
-
tickers = await self.subscribe(name, symbols, params)
|
132
|
+
tickers = await self.subscribe(name, False, symbols, params)
|
132
133
|
if self.newUpdates:
|
133
134
|
return tickers
|
134
135
|
return self.tickers
|
@@ -283,7 +284,7 @@ class coinbase(ccxt.async_support.coinbase):
|
|
283
284
|
await self.load_markets()
|
284
285
|
symbol = self.symbol(symbol)
|
285
286
|
name = 'market_trades'
|
286
|
-
trades = await self.subscribe(name, symbol, params)
|
287
|
+
trades = await self.subscribe(name, False, symbol, params)
|
287
288
|
if self.newUpdates:
|
288
289
|
limit = trades.getLimit(symbol, limit)
|
289
290
|
return self.filter_by_since_limit(trades, since, limit, 'timestamp', True)
|
@@ -300,7 +301,7 @@ class coinbase(ccxt.async_support.coinbase):
|
|
300
301
|
"""
|
301
302
|
await self.load_markets()
|
302
303
|
name = 'user'
|
303
|
-
orders = await self.subscribe(name, symbol, params)
|
304
|
+
orders = await self.subscribe(name, True, symbol, params)
|
304
305
|
if self.newUpdates:
|
305
306
|
limit = orders.getLimit(symbol, limit)
|
306
307
|
return self.filter_by_since_limit(orders, since, limit, 'timestamp', True)
|
@@ -318,7 +319,7 @@ class coinbase(ccxt.async_support.coinbase):
|
|
318
319
|
name = 'level2'
|
319
320
|
market = self.market(symbol)
|
320
321
|
symbol = market['symbol']
|
321
|
-
orderbook = await self.subscribe(name, symbol, params)
|
322
|
+
orderbook = await self.subscribe(name, False, symbol, params)
|
322
323
|
return orderbook.limit()
|
323
324
|
|
324
325
|
def handle_trade(self, client, message):
|
@@ -525,8 +526,8 @@ class coinbase(ccxt.async_support.coinbase):
|
|
525
526
|
self.orderbooks[symbol] = self.order_book({}, limit)
|
526
527
|
orderbook = self.orderbooks[symbol]
|
527
528
|
self.handle_order_book_helper(orderbook, updates)
|
528
|
-
orderbook['timestamp'] =
|
529
|
-
orderbook['datetime'] =
|
529
|
+
orderbook['timestamp'] = self.parse8601(datetime)
|
530
|
+
orderbook['datetime'] = datetime
|
530
531
|
orderbook['symbol'] = symbol
|
531
532
|
client.resolve(orderbook, messageHash)
|
532
533
|
if messageHash.endswith('USD'):
|
@@ -540,7 +541,6 @@ class coinbase(ccxt.async_support.coinbase):
|
|
540
541
|
client.resolve(orderbook, messageHash)
|
541
542
|
if messageHash.endswith('USD'):
|
542
543
|
client.resolve(orderbook, messageHash + 'C') # sometimes we subscribe to BTC/USDC and coinbase returns BTC/USD
|
543
|
-
return message
|
544
544
|
|
545
545
|
def handle_subscription_status(self, client, message):
|
546
546
|
#
|