ccxt 4.3.6__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/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 +5 -3
- ccxt/async_support/bingx.py +3 -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 +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 +151 -47
- 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 +80 -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 +1 -1
- ccxt/async_support/woo.py +3 -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 +27 -1
- ccxt/bigone.py +1 -1
- ccxt/binance.py +5 -3
- ccxt/bingx.py +3 -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 +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 +151 -47
- 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 +80 -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/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 +3 -1
- ccxt/yobit.py +4 -1
- ccxt/zaif.py +1 -1
- ccxt/zonda.py +1 -1
- {ccxt-4.3.6.dist-info → ccxt-4.3.7.dist-info}/METADATA +4 -4
- {ccxt-4.3.6.dist-info → ccxt-4.3.7.dist-info}/RECORD +178 -178
- {ccxt-4.3.6.dist-info → ccxt-4.3.7.dist-info}/WHEEL +0 -0
- {ccxt-4.3.6.dist-info → ccxt-4.3.7.dist-info}/top_level.txt +0 -0
ccxt/async_support/mexc.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.async_support.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
|
-
async def reduce_margin(self, symbol: str, amount, params={}) -> MarginModification:
|
3784
|
+
async 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 await self.modify_margin_helper(symbol, amount, 'SUB', params)
|
3791
3793
|
|
3792
|
-
async def add_margin(self, symbol: str, amount, params={}) -> MarginModification:
|
3794
|
+
async 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
|
-
async def withdraw(self, code: str, amount: float, address, tag=None, params={}):
|
4894
|
+
async 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
|
+
async 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
|
+
await 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 = await 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/async_support/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
|
-
async def withdraw(self, code: str, amount: float, address, tag=None, params={}):
|
2198
|
+
async 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/async_support/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
|
-
async def withdraw(self, code: str, amount: float, address, tag=None, params={}):
|
1161
|
+
async 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/async_support/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
|
-
async def withdraw(self, code: str, amount: float, address, tag=None, params={}):
|
2312
|
+
async 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/async_support/okx.py
CHANGED
@@ -7,7 +7,7 @@ from ccxt.async_support.base.exchange import Exchange
|
|
7
7
|
from ccxt.abstract.okx import ImplicitAPI
|
8
8
|
import asyncio
|
9
9
|
import hashlib
|
10
|
-
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
|
10
|
+
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
|
11
11
|
from typing import List
|
12
12
|
from typing import Any
|
13
13
|
from ccxt.base.errors import ExchangeError
|
@@ -135,8 +135,10 @@ class okx(Exchange, ImplicitAPI):
|
|
135
135
|
'fetchOrderTrades': True,
|
136
136
|
'fetchPermissions': None,
|
137
137
|
'fetchPosition': True,
|
138
|
+
'fetchPositionHistory': 'emulated',
|
138
139
|
'fetchPositions': True,
|
139
140
|
'fetchPositionsForSymbol': True,
|
141
|
+
'fetchPositionsHistory': True,
|
140
142
|
'fetchPositionsRisk': False,
|
141
143
|
'fetchPremiumIndexOHLCV': False,
|
142
144
|
'fetchSettlementHistory': True,
|
@@ -4501,7 +4503,7 @@ class okx(Exchange, ImplicitAPI):
|
|
4501
4503
|
raise InvalidAddress(self.id + ' fetchDepositAddress() cannot find ' + network + ' deposit address for ' + code)
|
4502
4504
|
return result
|
4503
4505
|
|
4504
|
-
async def withdraw(self, code: str, amount: float, address, tag=None, params={}):
|
4506
|
+
async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
|
4505
4507
|
"""
|
4506
4508
|
make a withdrawal
|
4507
4509
|
:see: https://www.okx.com/docs-v5/en/#funding-account-rest-api-withdrawal
|
@@ -6225,7 +6227,7 @@ class okx(Exchange, ImplicitAPI):
|
|
6225
6227
|
'datetime': self.iso8601(timestamp),
|
6226
6228
|
}
|
6227
6229
|
|
6228
|
-
async def reduce_margin(self, symbol: str, amount, params={}) -> MarginModification:
|
6230
|
+
async def reduce_margin(self, symbol: str, amount: float, params={}) -> MarginModification:
|
6229
6231
|
"""
|
6230
6232
|
remove margin from a position
|
6231
6233
|
:see: https://www.okx.com/docs-v5/en/#trading-account-rest-api-increase-decrease-margin
|
@@ -6236,7 +6238,7 @@ class okx(Exchange, ImplicitAPI):
|
|
6236
6238
|
"""
|
6237
6239
|
return await self.modify_margin_helper(symbol, amount, 'reduce', params)
|
6238
6240
|
|
6239
|
-
async def add_margin(self, symbol: str, amount, params={}) -> MarginModification:
|
6241
|
+
async def add_margin(self, symbol: str, amount: float, params={}) -> MarginModification:
|
6240
6242
|
"""
|
6241
6243
|
add margin
|
6242
6244
|
:see: https://www.okx.com/docs-v5/en/#trading-account-rest-api-increase-decrease-margin
|
@@ -7653,3 +7655,77 @@ class okx(Exchange, ImplicitAPI):
|
|
7653
7655
|
data = self.safe_list(response, 'data')
|
7654
7656
|
modifications = self.parse_margin_modifications(data)
|
7655
7657
|
return self.filter_by_symbol_since_limit(modifications, symbol, since, limit)
|
7658
|
+
|
7659
|
+
async def fetch_positions_history(self, symbols: Strings = None, since: Int = None, limit: Int = None, params={}) -> List[Position]:
|
7660
|
+
"""
|
7661
|
+
fetches historical positions
|
7662
|
+
:see: https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-positions-history
|
7663
|
+
:param str [symbols]: unified market symbols
|
7664
|
+
:param int [since]: timestamp in ms of the earliest position to fetch
|
7665
|
+
:param int [limit]: the maximum amount of records to fetch, default=100, max=100
|
7666
|
+
:param dict params: extra parameters specific to the exchange api endpoint
|
7667
|
+
:param str [params.marginMode]: "cross" or "isolated"
|
7668
|
+
*
|
7669
|
+
* EXCHANGE SPECIFIC PARAMETERS
|
7670
|
+
:param str [params.instType]: margin, swap, futures or option
|
7671
|
+
: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
|
7672
|
+
: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
|
7673
|
+
:param str [params.before]: timestamp in ms of the earliest position to fetch based on the last update time of the position
|
7674
|
+
:param str [params.after]: timestamp in ms of the latest position to fetch based on the last update time of the position
|
7675
|
+
:returns dict[]: a list of `position structures <https://docs.ccxt.com/#/?id=position-structure>`
|
7676
|
+
"""
|
7677
|
+
await self.load_markets()
|
7678
|
+
marginMode = self.safe_string(params, 'marginMode')
|
7679
|
+
instType = self.safe_string_upper(params, 'instType')
|
7680
|
+
params = self.omit(params, ['until', 'marginMode', 'instType'])
|
7681
|
+
if limit is None:
|
7682
|
+
limit = 100
|
7683
|
+
request = {
|
7684
|
+
'limit': limit,
|
7685
|
+
}
|
7686
|
+
if symbols is not None:
|
7687
|
+
symbolsLength = len(symbols)
|
7688
|
+
if symbolsLength == 1:
|
7689
|
+
market = self.market(symbols[0])
|
7690
|
+
request['instId'] = market['id']
|
7691
|
+
if marginMode is not None:
|
7692
|
+
request['mgnMode'] = marginMode
|
7693
|
+
if instType is not None:
|
7694
|
+
request['instType'] = instType
|
7695
|
+
response = await self.privateGetAccountPositionsHistory(self.extend(request, params))
|
7696
|
+
#
|
7697
|
+
# {
|
7698
|
+
# code: '0',
|
7699
|
+
# data: [
|
7700
|
+
# {
|
7701
|
+
# cTime: '1708735940395',
|
7702
|
+
# ccy: 'USDT',
|
7703
|
+
# closeAvgPx: '0.6330444444444444',
|
7704
|
+
# closeTotalPos: '27',
|
7705
|
+
# direction: 'long',
|
7706
|
+
# fee: '-1.69566',
|
7707
|
+
# fundingFee: '-11.870404179341788',
|
7708
|
+
# instId: 'XRP-USDT-SWAP',
|
7709
|
+
# instType: 'SWAP',
|
7710
|
+
# lever: '3.0',
|
7711
|
+
# liqPenalty: '0',
|
7712
|
+
# mgnMode: 'cross',
|
7713
|
+
# openAvgPx: '0.623',
|
7714
|
+
# openMaxPos: '15',
|
7715
|
+
# pnl: '27.11999999999988',
|
7716
|
+
# pnlRatio: '0.0241732402722634',
|
7717
|
+
# posId: '681423155054862336',
|
7718
|
+
# realizedPnl: '13.553935820658092',
|
7719
|
+
# triggerPx: '',
|
7720
|
+
# type: '2',
|
7721
|
+
# uTime: '1711088748170',
|
7722
|
+
# uly: 'XRP-USDT'
|
7723
|
+
# },
|
7724
|
+
# ...
|
7725
|
+
# ],
|
7726
|
+
# msg: ''
|
7727
|
+
# }
|
7728
|
+
#
|
7729
|
+
data = self.safe_list(response, 'data')
|
7730
|
+
positions = self.parse_positions(data, symbols, params)
|
7731
|
+
return self.filter_by_since_limit(positions, since, limit)
|
ccxt/async_support/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
|
-
async def withdraw(self, code: str, amount: float, address, tag=None, params={}):
|
1185
|
+
async 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/async_support/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/async_support/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
|
-
async def withdraw(self, code: str, amount: float, address, tag=None, params={}):
|
4322
|
+
async 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/async_support/poloniex.py
CHANGED
@@ -1787,7 +1787,7 @@ class poloniex(Exchange, ImplicitAPI):
|
|
1787
1787
|
'status': None,
|
1788
1788
|
}
|
1789
1789
|
|
1790
|
-
async def withdraw(self, code: str, amount: float, address, tag=None, params={}):
|
1790
|
+
async 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/async_support/probit.py
CHANGED
@@ -82,8 +82,11 @@ class probit(Exchange, ImplicitAPI):
|
|
82
82
|
'fetchOrder': True,
|
83
83
|
'fetchOrderBook': True,
|
84
84
|
'fetchPosition': False,
|
85
|
+
'fetchPositionHistory': False,
|
85
86
|
'fetchPositionMode': False,
|
86
87
|
'fetchPositions': False,
|
88
|
+
'fetchPositionsForSymbol': False,
|
89
|
+
'fetchPositionsHistory': False,
|
87
90
|
'fetchPositionsRisk': False,
|
88
91
|
'fetchPremiumIndexOHLCV': False,
|
89
92
|
'fetchTicker': True,
|
@@ -1331,7 +1334,7 @@ class probit(Exchange, ImplicitAPI):
|
|
1331
1334
|
data = self.safe_list(response, 'data', [])
|
1332
1335
|
return self.parse_deposit_addresses(data, codes)
|
1333
1336
|
|
1334
|
-
async def withdraw(self, code: str, amount: float, address, tag=None, params={}):
|
1337
|
+
async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
|
1335
1338
|
"""
|
1336
1339
|
:see: https://docs-en.probit.com/reference/withdrawal
|
1337
1340
|
make a withdrawal
|
ccxt/async_support/timex.py
CHANGED
@@ -78,8 +78,11 @@ class timex(Exchange, ImplicitAPI):
|
|
78
78
|
'fetchOrder': True,
|
79
79
|
'fetchOrderBook': True,
|
80
80
|
'fetchPosition': False,
|
81
|
+
'fetchPositionHistory': False,
|
81
82
|
'fetchPositionMode': False,
|
82
83
|
'fetchPositions': False,
|
84
|
+
'fetchPositionsForSymbol': False,
|
85
|
+
'fetchPositionsHistory': False,
|
83
86
|
'fetchPositionsRisk': False,
|
84
87
|
'fetchPremiumIndexOHLCV': False,
|
85
88
|
'fetchTicker': True,
|
ccxt/async_support/tokocrypto.py
CHANGED
@@ -2237,7 +2237,7 @@ class tokocrypto(Exchange, ImplicitAPI):
|
|
2237
2237
|
'fee': fee,
|
2238
2238
|
}
|
2239
2239
|
|
2240
|
-
async def withdraw(self, code: str, amount: float, address, tag=None, params={}):
|
2240
|
+
async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
|
2241
2241
|
"""
|
2242
2242
|
:see: https://www.tokocrypto.com/apidocs/#withdraw-signed
|
2243
2243
|
make a withdrawal
|
ccxt/async_support/tradeogre.py
CHANGED
@@ -84,8 +84,11 @@ class tradeogre(Exchange, ImplicitAPI):
|
|
84
84
|
'fetchOrderTrades': False,
|
85
85
|
'fetchPermissions': False,
|
86
86
|
'fetchPosition': False,
|
87
|
+
'fetchPositionHistory': False,
|
88
|
+
'fetchPositionMode': False,
|
87
89
|
'fetchPositions': False,
|
88
90
|
'fetchPositionsForSymbol': False,
|
91
|
+
'fetchPositionsHistory': False,
|
89
92
|
'fetchPositionsRisk': False,
|
90
93
|
'fetchPremiumIndexOHLCV': False,
|
91
94
|
'fetchTicker': True,
|
ccxt/async_support/upbit.py
CHANGED
@@ -1717,7 +1717,7 @@ class upbit(Exchange, ImplicitAPI):
|
|
1717
1717
|
raise AddressPending(self.id + ' is generating ' + code + ' deposit address, call fetchDepositAddress or createDepositAddress one more time later to retrieve the generated address')
|
1718
1718
|
return self.parse_deposit_address(response)
|
1719
1719
|
|
1720
|
-
async def withdraw(self, code: str, amount: float, address, tag=None, params={}):
|
1720
|
+
async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
|
1721
1721
|
"""
|
1722
1722
|
:see: https://docs.upbit.com/reference/디지털자산-출금하기
|
1723
1723
|
:see: https://docs.upbit.com/reference/%EC%9B%90%ED%99%94-%EC%B6%9C%EA%B8%88%ED%95%98%EA%B8%B0
|
@@ -80,8 +80,11 @@ class wavesexchange(Exchange, ImplicitAPI):
|
|
80
80
|
'fetchOrderBook': True,
|
81
81
|
'fetchOrders': True,
|
82
82
|
'fetchPosition': False,
|
83
|
+
'fetchPositionHistory': False,
|
83
84
|
'fetchPositionMode': False,
|
84
85
|
'fetchPositions': False,
|
86
|
+
'fetchPositionsForSymbol': False,
|
87
|
+
'fetchPositionsHistory': False,
|
85
88
|
'fetchPositionsRisk': False,
|
86
89
|
'fetchPremiumIndexOHLCV': False,
|
87
90
|
'fetchTicker': True,
|
@@ -2290,7 +2293,7 @@ class wavesexchange(Exchange, ImplicitAPI):
|
|
2290
2293
|
raise ExchangeError(self.id + ' ' + body)
|
2291
2294
|
return None
|
2292
2295
|
|
2293
|
-
async def withdraw(self, code: str, amount: float, address, tag=None, params={}):
|
2296
|
+
async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
|
2294
2297
|
"""
|
2295
2298
|
make a withdrawal
|
2296
2299
|
:param str code: unified currency code
|
ccxt/async_support/wazirx.py
CHANGED
@@ -82,8 +82,11 @@ class wazirx(Exchange, ImplicitAPI):
|
|
82
82
|
'fetchOrderBook': True,
|
83
83
|
'fetchOrders': True,
|
84
84
|
'fetchPosition': False,
|
85
|
+
'fetchPositionHistory': False,
|
85
86
|
'fetchPositionMode': False,
|
86
87
|
'fetchPositions': False,
|
88
|
+
'fetchPositionsForSymbol': False,
|
89
|
+
'fetchPositionsHistory': False,
|
87
90
|
'fetchPositionsRisk': False,
|
88
91
|
'fetchPremiumIndexOHLCV': False,
|
89
92
|
'fetchStatus': True,
|
ccxt/async_support/whitebit.py
CHANGED
@@ -1809,7 +1809,7 @@ class whitebit(Exchange, ImplicitAPI):
|
|
1809
1809
|
'status': None,
|
1810
1810
|
}
|
1811
1811
|
|
1812
|
-
async def withdraw(self, code: str, amount: float, address, tag=None, params={}):
|
1812
|
+
async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
|
1813
1813
|
"""
|
1814
1814
|
make a withdrawal
|
1815
1815
|
:see: https://docs.whitebit.com/private/http-main-v4/#create-withdraw-request
|
ccxt/async_support/woo.py
CHANGED
@@ -97,8 +97,10 @@ class woo(Exchange, ImplicitAPI):
|
|
97
97
|
'fetchOrders': True,
|
98
98
|
'fetchOrderTrades': True,
|
99
99
|
'fetchPosition': True,
|
100
|
+
'fetchPositionHistory': False,
|
100
101
|
'fetchPositionMode': False,
|
101
102
|
'fetchPositions': True,
|
103
|
+
'fetchPositionsHistory': False,
|
102
104
|
'fetchPremiumIndexOHLCV': False,
|
103
105
|
'fetchStatus': True,
|
104
106
|
'fetchTicker': False,
|
@@ -2238,7 +2240,7 @@ class woo(Exchange, ImplicitAPI):
|
|
2238
2240
|
}
|
2239
2241
|
return self.safe_string(statuses, status, status)
|
2240
2242
|
|
2241
|
-
async def withdraw(self, code: str, amount: float, address, tag=None, params={}):
|
2243
|
+
async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
|
2242
2244
|
"""
|
2243
2245
|
make a withdrawal
|
2244
2246
|
:param str code: unified currency code
|
ccxt/async_support/yobit.py
CHANGED
@@ -76,8 +76,11 @@ class yobit(Exchange, ImplicitAPI):
|
|
76
76
|
'fetchOrderBook': True,
|
77
77
|
'fetchOrderBooks': True,
|
78
78
|
'fetchPosition': False,
|
79
|
+
'fetchPositionHistory': False,
|
79
80
|
'fetchPositionMode': False,
|
80
81
|
'fetchPositions': False,
|
82
|
+
'fetchPositionsForSymbol': False,
|
83
|
+
'fetchPositionsHistory': False,
|
81
84
|
'fetchPositionsRisk': False,
|
82
85
|
'fetchPremiumIndexOHLCV': False,
|
83
86
|
'fetchTicker': True,
|
@@ -1150,7 +1153,7 @@ class yobit(Exchange, ImplicitAPI):
|
|
1150
1153
|
},
|
1151
1154
|
}
|
1152
1155
|
|
1153
|
-
async def withdraw(self, code: str, amount: float, address, tag=None, params={}):
|
1156
|
+
async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
|
1154
1157
|
"""
|
1155
1158
|
:see: https://yobit.net/en/api
|
1156
1159
|
make a withdrawal
|
ccxt/async_support/zaif.py
CHANGED
@@ -557,7 +557,7 @@ class zaif(Exchange, ImplicitAPI):
|
|
557
557
|
response = await self.privatePostTradeHistory(self.extend(request, params))
|
558
558
|
return self.parse_orders(response['return'], market, since, limit)
|
559
559
|
|
560
|
-
async def withdraw(self, code: str, amount: float, address, tag=None, params={}):
|
560
|
+
async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
|
561
561
|
"""
|
562
562
|
:see: https://zaif-api-document.readthedocs.io/ja/latest/TradingAPI.html#id41
|
563
563
|
make a withdrawal
|
ccxt/async_support/zonda.py
CHANGED
@@ -1649,7 +1649,7 @@ class zonda(Exchange, ImplicitAPI):
|
|
1649
1649
|
}
|
1650
1650
|
return self.safe_string(statuses, status, status)
|
1651
1651
|
|
1652
|
-
async def withdraw(self, code: str, amount: float, address, tag=None, params={}):
|
1652
|
+
async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
|
1653
1653
|
"""
|
1654
1654
|
:see: https://docs.zondacrypto.exchange/reference/crypto-withdrawal-1
|
1655
1655
|
make a withdrawal
|
ccxt/base/exchange.py
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
# -----------------------------------------------------------------------------
|
6
6
|
|
7
|
-
__version__ = '4.3.
|
7
|
+
__version__ = '4.3.7'
|
8
8
|
|
9
9
|
# -----------------------------------------------------------------------------
|
10
10
|
|
@@ -5772,6 +5772,32 @@ class Exchange(object):
|
|
5772
5772
|
reconstructedDate = day + month + year
|
5773
5773
|
return reconstructedDate
|
5774
5774
|
|
5775
|
+
def fetch_position_history(self, symbol: str, since: Int = None, limit: Int = None, params={}):
|
5776
|
+
"""
|
5777
|
+
fetches the history of margin added or reduced from contract isolated positions
|
5778
|
+
:param str [symbol]: unified market symbol
|
5779
|
+
:param int [since]: timestamp in ms of the position
|
5780
|
+
:param int [limit]: the maximum amount of candles to fetch, default=1000
|
5781
|
+
:param dict params: extra parameters specific to the exchange api endpoint
|
5782
|
+
:returns dict[]: a list of `position structures <https://docs.ccxt.com/#/?id=position-structure>`
|
5783
|
+
"""
|
5784
|
+
if self.has['fetchPositionsHistory']:
|
5785
|
+
positions = self.fetch_positions_history([symbol], since, limit, params)
|
5786
|
+
return self.safe_dict(positions, 0)
|
5787
|
+
else:
|
5788
|
+
raise NotSupported(self.id + ' fetchPositionHistory() is not supported yet')
|
5789
|
+
|
5790
|
+
def fetch_positions_history(self, symbols: Strings = None, since: Int = None, limit: Int = None, params={}):
|
5791
|
+
"""
|
5792
|
+
fetches the history of margin added or reduced from contract isolated positions
|
5793
|
+
:param str [symbol]: unified market symbol
|
5794
|
+
:param int [since]: timestamp in ms of the position
|
5795
|
+
:param int [limit]: the maximum amount of candles to fetch, default=1000
|
5796
|
+
:param dict params: extra parameters specific to the exchange api endpoint
|
5797
|
+
:returns dict[]: a list of `position structures <https://docs.ccxt.com/#/?id=position-structure>`
|
5798
|
+
"""
|
5799
|
+
raise NotSupported(self.id + ' fetchPositionsHistory() is not supported yet')
|
5800
|
+
|
5775
5801
|
def parse_margin_modification(self, data, market: Market = None):
|
5776
5802
|
raise NotSupported(self.id + ' parseMarginModification() is not supported yet')
|
5777
5803
|
|
ccxt/bigone.py
CHANGED
@@ -2043,7 +2043,7 @@ class bigone(Exchange, ImplicitAPI):
|
|
2043
2043
|
}
|
2044
2044
|
return self.safe_string(statuses, status, 'failed')
|
2045
2045
|
|
2046
|
-
def withdraw(self, code: str, amount: float, address, tag=None, params={}):
|
2046
|
+
def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
|
2047
2047
|
"""
|
2048
2048
|
make a withdrawal
|
2049
2049
|
:see: https://open.big.one/docs/spot_withdrawal.html#create-withdrawal-of-user
|