ccxt 4.4.77__py2.py3-none-any.whl → 4.4.80__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ccxt/__init__.py +3 -3
- ccxt/abstract/apex.py +31 -0
- ccxt/abstract/bitmart.py +1 -0
- ccxt/apex.py +1884 -0
- ccxt/ascendex.py +23 -6
- ccxt/async_support/__init__.py +3 -3
- ccxt/async_support/apex.py +1884 -0
- ccxt/async_support/ascendex.py +23 -6
- ccxt/async_support/base/exchange.py +5 -1
- ccxt/async_support/binance.py +9 -3
- ccxt/async_support/bingx.py +4 -4
- ccxt/async_support/bitfinex.py +61 -36
- ccxt/async_support/bitflyer.py +2 -2
- ccxt/async_support/bitget.py +186 -128
- ccxt/async_support/bitmart.py +9 -4
- ccxt/async_support/bitmex.py +14 -7
- ccxt/async_support/bitopro.py +5 -1
- ccxt/async_support/bitrue.py +2 -1
- ccxt/async_support/bitso.py +1 -1
- ccxt/async_support/bitteam.py +2 -0
- ccxt/async_support/bitvavo.py +25 -10
- ccxt/async_support/btcalpha.py +1 -1
- ccxt/async_support/btcmarkets.py +1 -1
- ccxt/async_support/btcturk.py +1 -1
- ccxt/async_support/bybit.py +27 -15
- ccxt/async_support/cex.py +1 -1
- ccxt/async_support/coinbase.py +17 -4
- ccxt/async_support/coincatch.py +66 -0
- ccxt/async_support/coinex.py +2 -1
- ccxt/async_support/coinlist.py +1 -0
- ccxt/async_support/coinone.py +1 -0
- ccxt/async_support/cryptocom.py +2 -2
- ccxt/async_support/defx.py +1 -1
- ccxt/async_support/delta.py +4 -1
- ccxt/async_support/deribit.py +3 -2
- ccxt/async_support/derive.py +2 -2
- ccxt/async_support/digifinex.py +2 -2
- ccxt/async_support/gate.py +1 -1
- ccxt/async_support/hitbtc.py +5 -2
- ccxt/async_support/hollaex.py +1 -0
- ccxt/async_support/htx.py +9 -5
- ccxt/async_support/huobijp.py +1 -0
- ccxt/async_support/hyperliquid.py +14 -6
- ccxt/async_support/kraken.py +4 -2
- ccxt/async_support/krakenfutures.py +2 -2
- ccxt/async_support/kucoinfutures.py +2 -2
- ccxt/async_support/mexc.py +50 -52
- ccxt/async_support/okx.py +2 -2
- ccxt/async_support/oxfun.py +2 -2
- ccxt/async_support/paradex.py +2 -2
- ccxt/async_support/phemex.py +4 -3
- ccxt/async_support/poloniex.py +4 -3
- ccxt/async_support/probit.py +1 -0
- ccxt/async_support/timex.py +2 -2
- ccxt/async_support/tradeogre.py +2 -1
- ccxt/async_support/upbit.py +243 -63
- ccxt/async_support/vertex.py +2 -2
- ccxt/async_support/whitebit.py +66 -12
- ccxt/async_support/woo.py +5 -3
- ccxt/async_support/woofipro.py +2 -2
- ccxt/async_support/xt.py +9 -2
- ccxt/base/exchange.py +69 -2
- ccxt/binance.py +9 -3
- ccxt/bingx.py +4 -4
- ccxt/bitfinex.py +61 -36
- ccxt/bitflyer.py +2 -2
- ccxt/bitget.py +186 -128
- ccxt/bitmart.py +9 -4
- ccxt/bitmex.py +14 -7
- ccxt/bitopro.py +5 -1
- ccxt/bitrue.py +2 -1
- ccxt/bitso.py +1 -1
- ccxt/bitteam.py +2 -0
- ccxt/bitvavo.py +25 -10
- ccxt/btcalpha.py +1 -1
- ccxt/btcmarkets.py +1 -1
- ccxt/btcturk.py +1 -1
- ccxt/bybit.py +27 -15
- ccxt/cex.py +1 -1
- ccxt/coinbase.py +17 -4
- ccxt/coincatch.py +66 -0
- ccxt/coinex.py +2 -1
- ccxt/coinlist.py +1 -0
- ccxt/coinone.py +1 -0
- ccxt/cryptocom.py +2 -2
- ccxt/defx.py +1 -1
- ccxt/delta.py +4 -1
- ccxt/deribit.py +3 -2
- ccxt/derive.py +2 -2
- ccxt/digifinex.py +2 -2
- ccxt/gate.py +1 -1
- ccxt/hitbtc.py +5 -2
- ccxt/hollaex.py +1 -0
- ccxt/htx.py +9 -5
- ccxt/huobijp.py +1 -0
- ccxt/hyperliquid.py +14 -6
- ccxt/kraken.py +4 -2
- ccxt/krakenfutures.py +2 -2
- ccxt/kucoinfutures.py +2 -2
- ccxt/mexc.py +50 -52
- ccxt/okx.py +2 -2
- ccxt/oxfun.py +2 -2
- ccxt/paradex.py +2 -2
- ccxt/phemex.py +4 -3
- ccxt/poloniex.py +4 -3
- ccxt/pro/__init__.py +5 -1
- ccxt/pro/apex.py +984 -0
- ccxt/pro/binance.py +3 -3
- ccxt/pro/coinbase.py +43 -57
- ccxt/pro/gate.py +22 -2
- ccxt/pro/hollaex.py +2 -2
- ccxt/pro/p2b.py +2 -2
- ccxt/pro/tradeogre.py +272 -0
- ccxt/pro/upbit.py +42 -0
- ccxt/probit.py +1 -0
- ccxt/test/tests_async.py +4 -1
- ccxt/test/tests_sync.py +4 -1
- ccxt/timex.py +2 -2
- ccxt/tradeogre.py +2 -1
- ccxt/upbit.py +243 -63
- ccxt/vertex.py +2 -2
- ccxt/whitebit.py +66 -12
- ccxt/woo.py +5 -3
- ccxt/woofipro.py +2 -2
- ccxt/xt.py +9 -2
- {ccxt-4.4.77.dist-info → ccxt-4.4.80.dist-info}/METADATA +9 -11
- {ccxt-4.4.77.dist-info → ccxt-4.4.80.dist-info}/RECORD +130 -128
- ccxt/abstract/ace.py +0 -15
- ccxt/ace.py +0 -1152
- ccxt/async_support/ace.py +0 -1152
- {ccxt-4.4.77.dist-info → ccxt-4.4.80.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.4.77.dist-info → ccxt-4.4.80.dist-info}/WHEEL +0 -0
- {ccxt-4.4.77.dist-info → ccxt-4.4.80.dist-info}/top_level.txt +0 -0
ccxt/async_support/hitbtc.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.async_support.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.hitbtc import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Any, Balances, Currencies, Currency, DepositAddress, Int, Leverage, MarginMode, MarginModes, MarginModification, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, OrderBooks, Trade, TradingFeeInterface, TradingFees, Transaction, TransferEntry
|
9
|
+
from ccxt.base.types import Any, Balances, Currencies, Currency, DepositAddress, Int, Leverage, MarginMode, MarginModes, MarginModification, Market, Num, Order, OrderBook, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, OrderBooks, Trade, TradingFeeInterface, 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
|
@@ -966,6 +966,8 @@ class hitbtc(Exchange, ImplicitAPI):
|
|
966
966
|
transferEnabled = self.safe_bool(entry, 'transfer_enabled', False)
|
967
967
|
active = payinEnabled and payoutEnabled and transferEnabled
|
968
968
|
rawNetworks = self.safe_value(entry, 'networks', [])
|
969
|
+
isCrypto = self.safe_bool(entry, 'crypto')
|
970
|
+
type = 'crypto' if isCrypto else 'fiat'
|
969
971
|
networks: dict = {}
|
970
972
|
fee = None
|
971
973
|
depositEnabled = None
|
@@ -1023,6 +1025,7 @@ class hitbtc(Exchange, ImplicitAPI):
|
|
1023
1025
|
'max': None,
|
1024
1026
|
},
|
1025
1027
|
},
|
1028
|
+
'type': type,
|
1026
1029
|
}
|
1027
1030
|
return result
|
1028
1031
|
|
@@ -2823,7 +2826,7 @@ class hitbtc(Exchange, ImplicitAPI):
|
|
2823
2826
|
sorted = self.sort_by(rates, 'timestamp')
|
2824
2827
|
return self.filter_by_symbol_since_limit(sorted, symbol, since, limit)
|
2825
2828
|
|
2826
|
-
async def fetch_positions(self, symbols: Strings = None, params={}):
|
2829
|
+
async def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
|
2827
2830
|
"""
|
2828
2831
|
fetch all open positions
|
2829
2832
|
|
ccxt/async_support/hollaex.py
CHANGED
ccxt/async_support/htx.py
CHANGED
@@ -7,7 +7,7 @@ from ccxt.async_support.base.exchange import Exchange
|
|
7
7
|
from ccxt.abstract.htx import ImplicitAPI
|
8
8
|
import asyncio
|
9
9
|
import hashlib
|
10
|
-
from ccxt.base.types import Account, Any, Balances, BorrowInterest, Currencies, Currency, DepositAddress, Int, IsolatedBorrowRate, IsolatedBorrowRates, LedgerEntry, LeverageTier, LeverageTiers, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, Trade, TradingFeeInterface, Transaction, TransferEntry
|
10
|
+
from ccxt.base.types import Account, Any, Balances, BorrowInterest, Currencies, Currency, DepositAddress, Int, IsolatedBorrowRate, IsolatedBorrowRates, LedgerEntry, LeverageTier, LeverageTiers, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, Trade, TradingFeeInterface, Transaction, TransferEntry
|
11
11
|
from typing import List
|
12
12
|
from ccxt.base.errors import ExchangeError
|
13
13
|
from ccxt.base.errors import AuthenticationError
|
@@ -963,6 +963,7 @@ class htx(Exchange, ImplicitAPI):
|
|
963
963
|
},
|
964
964
|
'precisionMode': TICK_SIZE,
|
965
965
|
'options': {
|
966
|
+
'include_OS_certificates': False, # temporarily leave self, remove in future
|
966
967
|
'fetchMarkets': {
|
967
968
|
'types': {
|
968
969
|
'spot': True,
|
@@ -2173,14 +2174,14 @@ class htx(Exchange, ImplicitAPI):
|
|
2173
2174
|
ask = None
|
2174
2175
|
askVolume = None
|
2175
2176
|
if 'bid' in ticker:
|
2176
|
-
if isinstance(ticker['bid'], list):
|
2177
|
+
if ticker['bid'] is not None and isinstance(ticker['bid'], list):
|
2177
2178
|
bid = self.safe_string(ticker['bid'], 0)
|
2178
2179
|
bidVolume = self.safe_string(ticker['bid'], 1)
|
2179
2180
|
else:
|
2180
2181
|
bid = self.safe_string(ticker, 'bid')
|
2181
2182
|
bidVolume = self.safe_string(ticker, 'bidSize')
|
2182
2183
|
if 'ask' in ticker:
|
2183
|
-
if isinstance(ticker['ask'], list):
|
2184
|
+
if ticker['ask'] is not None and isinstance(ticker['ask'], list):
|
2184
2185
|
ask = self.safe_string(ticker['ask'], 0)
|
2185
2186
|
askVolume = self.safe_string(ticker['ask'], 1)
|
2186
2187
|
else:
|
@@ -3271,7 +3272,7 @@ class htx(Exchange, ImplicitAPI):
|
|
3271
3272
|
# "withdrawQuotaPerYear": null,
|
3272
3273
|
# "withdrawQuotaTotal": null,
|
3273
3274
|
# "withdrawFeeType": "fixed",
|
3274
|
-
# "transactFeeWithdraw": "11.
|
3275
|
+
# "transactFeeWithdraw": "11.1654",
|
3275
3276
|
# "addrWithTag": False,
|
3276
3277
|
# "addrDepositTag": False
|
3277
3278
|
# }
|
@@ -3294,6 +3295,8 @@ class htx(Exchange, ImplicitAPI):
|
|
3294
3295
|
chains = self.safe_value(entry, 'chains', [])
|
3295
3296
|
networks: dict = {}
|
3296
3297
|
instStatus = self.safe_string(entry, 'instStatus')
|
3298
|
+
assetType = self.safe_string(entry, 'assetType')
|
3299
|
+
type = assetType == 'crypto' if '1' else 'fiat'
|
3297
3300
|
currencyActive = instStatus == 'normal'
|
3298
3301
|
minPrecision = None
|
3299
3302
|
minDeposit = None
|
@@ -3351,6 +3354,7 @@ class htx(Exchange, ImplicitAPI):
|
|
3351
3354
|
'withdraw': withdraw,
|
3352
3355
|
'fee': None,
|
3353
3356
|
'name': None,
|
3357
|
+
'type': type,
|
3354
3358
|
'limits': {
|
3355
3359
|
'amount': {
|
3356
3360
|
'min': None,
|
@@ -7338,7 +7342,7 @@ class htx(Exchange, ImplicitAPI):
|
|
7338
7342
|
'takeProfitPrice': None,
|
7339
7343
|
})
|
7340
7344
|
|
7341
|
-
async def fetch_positions(self, symbols: Strings = None, params={}):
|
7345
|
+
async def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
|
7342
7346
|
"""
|
7343
7347
|
fetch all open positions
|
7344
7348
|
|
ccxt/async_support/huobijp.py
CHANGED
@@ -7,7 +7,7 @@ from ccxt.async_support.base.exchange import Exchange
|
|
7
7
|
from ccxt.abstract.hyperliquid import ImplicitAPI
|
8
8
|
import asyncio
|
9
9
|
import math
|
10
|
-
from ccxt.base.types import Any, Balances, Currencies, Currency, Int, LedgerEntry, MarginModification, Market, Num, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, Trade, TradingFeeInterface, Transaction, TransferEntry
|
10
|
+
from ccxt.base.types import Any, Balances, Currencies, Currency, Int, LedgerEntry, MarginModification, Market, Num, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, Trade, TradingFeeInterface, Transaction, TransferEntry
|
11
11
|
from typing import List
|
12
12
|
from ccxt.base.errors import ExchangeError
|
13
13
|
from ccxt.base.errors import ArgumentsRequired
|
@@ -380,6 +380,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
380
380
|
'withdraw': None,
|
381
381
|
'networks': None,
|
382
382
|
'fee': None,
|
383
|
+
'type': 'crypto',
|
383
384
|
'limits': {
|
384
385
|
'amount': {
|
385
386
|
'min': None,
|
@@ -772,12 +773,15 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
772
773
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
773
774
|
:param str [params.user]: user address, will default to self.walletAddress if not provided
|
774
775
|
:param str [params.type]: wallet type, ['spot', 'swap'], defaults to swap
|
776
|
+
:param str [params.marginMode]: 'cross' or 'isolated', for margin trading, uses self.options.defaultMarginMode if not passed, defaults to None/None/None
|
775
777
|
:returns dict: a `balance structure <https://docs.ccxt.com/#/?id=balance-structure>`
|
776
778
|
"""
|
777
779
|
userAddress = None
|
778
780
|
userAddress, params = self.handle_public_address('fetchBalance', params)
|
779
781
|
type = None
|
780
782
|
type, params = self.handle_market_type_and_params('fetchBalance', None, params)
|
783
|
+
marginMode = None
|
784
|
+
marginMode, params = self.handle_margin_mode_and_params('fetchBalance', params)
|
781
785
|
isSpot = (type == 'spot')
|
782
786
|
reqType = 'spotClearinghouseState' if (isSpot) else 'clearinghouseState'
|
783
787
|
request: dict = {
|
@@ -834,12 +838,16 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
834
838
|
spotBalances[code] = account
|
835
839
|
return self.safe_balance(spotBalances)
|
836
840
|
data = self.safe_dict(response, 'marginSummary', {})
|
841
|
+
usdcBalance = {
|
842
|
+
'total': self.safe_number(data, 'accountValue'),
|
843
|
+
}
|
844
|
+
if (marginMode is not None) and (marginMode == 'isolated'):
|
845
|
+
usdcBalance['free'] = self.safe_number(response, 'withdrawable')
|
846
|
+
else:
|
847
|
+
usdcBalance['used'] = self.safe_number(data, 'totalMarginUsed')
|
837
848
|
result: dict = {
|
838
849
|
'info': response,
|
839
|
-
'USDC':
|
840
|
-
'total': self.safe_number(data, 'accountValue'),
|
841
|
-
'used': self.safe_number(data, 'totalMarginUsed'),
|
842
|
-
},
|
850
|
+
'USDC': usdcBalance,
|
843
851
|
}
|
844
852
|
timestamp = self.safe_integer(response, 'time')
|
845
853
|
result['timestamp'] = timestamp
|
@@ -2453,7 +2461,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
2453
2461
|
positions = await self.fetch_positions([symbol], params)
|
2454
2462
|
return self.safe_dict(positions, 0, {})
|
2455
2463
|
|
2456
|
-
async def fetch_positions(self, symbols: Strings = None, params={}):
|
2464
|
+
async def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
|
2457
2465
|
"""
|
2458
2466
|
fetch all open positions
|
2459
2467
|
|
ccxt/async_support/kraken.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.async_support.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.kraken import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Any, Balances, Currencies, Currency, DepositAddress, IndexType, Int, LedgerEntry, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction, TransferEntry
|
9
|
+
from ccxt.base.types import Any, Balances, Currencies, Currency, DepositAddress, IndexType, Int, LedgerEntry, Market, Num, Order, OrderBook, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction, TransferEntry
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import AuthenticationError
|
@@ -864,12 +864,14 @@ class kraken(Exchange, ImplicitAPI):
|
|
864
864
|
precision = self.parse_number(self.parse_precision(self.safe_string(currency, 'decimals')))
|
865
865
|
# assumes all currencies are active except those listed above
|
866
866
|
active = self.safe_string(currency, 'status') == 'enabled'
|
867
|
+
isFiat = code.find('.HOLD') >= 0
|
867
868
|
result[code] = {
|
868
869
|
'id': id,
|
869
870
|
'code': code,
|
870
871
|
'info': currency,
|
871
872
|
'name': self.safe_string(currency, 'altname'),
|
872
873
|
'active': active,
|
874
|
+
'type': 'fiat' if isFiat else 'crypto',
|
873
875
|
'deposit': None,
|
874
876
|
'withdraw': None,
|
875
877
|
'fee': None,
|
@@ -3067,7 +3069,7 @@ class kraken(Exchange, ImplicitAPI):
|
|
3067
3069
|
return self.parse_transaction(result, currency)
|
3068
3070
|
raise ExchangeError(self.id + " withdraw() requires a 'key' parameter(withdrawal key name, up on your account)")
|
3069
3071
|
|
3070
|
-
async def fetch_positions(self, symbols: Strings = None, params={}):
|
3072
|
+
async def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
|
3071
3073
|
"""
|
3072
3074
|
fetch all open positions
|
3073
3075
|
|
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.async_support.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.krakenfutures import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Any, Balances, Currency, Int, Leverage, Leverages, LeverageTier, LeverageTiers, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, Trade, TransferEntry
|
9
|
+
from ccxt.base.types import Any, Balances, Currency, Int, Leverage, Leverages, LeverageTier, LeverageTiers, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, Trade, TransferEntry
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import AuthenticationError
|
@@ -2287,7 +2287,7 @@ class krakenfutures(Exchange, ImplicitAPI):
|
|
2287
2287
|
sorted = self.sort_by(result, 'timestamp')
|
2288
2288
|
return self.filter_by_symbol_since_limit(sorted, symbol, since, limit)
|
2289
2289
|
|
2290
|
-
async def fetch_positions(self, symbols: Strings = None, params={}):
|
2290
|
+
async def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
|
2291
2291
|
"""
|
2292
2292
|
|
2293
2293
|
https://docs.futures.kraken.com/#http-api-trading-v3-api-account-information-get-open-positions
|
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
from ccxt.async_support.kucoin import kucoin
|
7
7
|
from ccxt.abstract.kucoinfutures import ImplicitAPI
|
8
|
-
from ccxt.base.types import Any, Balances, Currency, DepositAddress, Int, Leverage, LeverageTier, MarginMode, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, FundingRate, Trade, TradingFeeInterface, Transaction, TransferEntry
|
8
|
+
from ccxt.base.types import Any, Balances, Currency, DepositAddress, Int, Leverage, LeverageTier, MarginMode, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, FundingRate, Trade, TradingFeeInterface, Transaction, TransferEntry
|
9
9
|
from typing import List
|
10
10
|
from ccxt.base.errors import AuthenticationError
|
11
11
|
from ccxt.base.errors import PermissionDenied
|
@@ -1232,7 +1232,7 @@ class kucoinfutures(kucoin, ImplicitAPI):
|
|
1232
1232
|
data = self.safe_dict(response, 'data', {})
|
1233
1233
|
return self.parse_position(data, market)
|
1234
1234
|
|
1235
|
-
async def fetch_positions(self, symbols: Strings = None, params={}):
|
1235
|
+
async def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
|
1236
1236
|
"""
|
1237
1237
|
fetch all open positions
|
1238
1238
|
|
ccxt/async_support/mexc.py
CHANGED
@@ -1098,80 +1098,47 @@ class mexc(Exchange, ImplicitAPI):
|
|
1098
1098
|
id = self.safe_string(currency, 'coin')
|
1099
1099
|
code = self.safe_currency_code(id)
|
1100
1100
|
name = self.safe_string(currency, 'name')
|
1101
|
-
currencyActive = False
|
1102
|
-
currencyFee = None
|
1103
|
-
currencyWithdrawMin = None
|
1104
|
-
currencyWithdrawMax = None
|
1105
|
-
depositEnabled = False
|
1106
|
-
withdrawEnabled = False
|
1107
1101
|
networks: dict = {}
|
1108
1102
|
chains = self.safe_value(currency, 'networkList', [])
|
1109
1103
|
for j in range(0, len(chains)):
|
1110
1104
|
chain = chains[j]
|
1111
1105
|
networkId = self.safe_string_2(chain, 'netWork', 'network')
|
1112
1106
|
network = self.network_id_to_code(networkId)
|
1113
|
-
isDepositEnabled = self.safe_bool(chain, 'depositEnable', False)
|
1114
|
-
isWithdrawEnabled = self.safe_bool(chain, 'withdrawEnable', False)
|
1115
|
-
active = (isDepositEnabled and isWithdrawEnabled)
|
1116
|
-
currencyActive = active or currencyActive
|
1117
|
-
withdrawMin = self.safe_string(chain, 'withdrawMin')
|
1118
|
-
withdrawMax = self.safe_string(chain, 'withdrawMax')
|
1119
|
-
currencyWithdrawMin = withdrawMin if (currencyWithdrawMin is None) else currencyWithdrawMin
|
1120
|
-
currencyWithdrawMax = withdrawMax if (currencyWithdrawMax is None) else currencyWithdrawMax
|
1121
|
-
fee = self.safe_number(chain, 'withdrawFee')
|
1122
|
-
currencyFee = fee if (currencyFee is None) else currencyFee
|
1123
|
-
if Precise.string_gt(currencyWithdrawMin, withdrawMin):
|
1124
|
-
currencyWithdrawMin = withdrawMin
|
1125
|
-
if Precise.string_lt(currencyWithdrawMax, withdrawMax):
|
1126
|
-
currencyWithdrawMax = withdrawMax
|
1127
|
-
if isDepositEnabled:
|
1128
|
-
depositEnabled = True
|
1129
|
-
if isWithdrawEnabled:
|
1130
|
-
withdrawEnabled = True
|
1131
1107
|
networks[network] = {
|
1132
1108
|
'info': chain,
|
1133
1109
|
'id': networkId,
|
1134
1110
|
'network': network,
|
1135
|
-
'active':
|
1136
|
-
'deposit':
|
1137
|
-
'withdraw':
|
1138
|
-
'fee':
|
1111
|
+
'active': None,
|
1112
|
+
'deposit': self.safe_bool(chain, 'depositEnable', False),
|
1113
|
+
'withdraw': self.safe_bool(chain, 'withdrawEnable', False),
|
1114
|
+
'fee': self.safe_number(chain, 'withdrawFee'),
|
1139
1115
|
'precision': None,
|
1140
1116
|
'limits': {
|
1141
1117
|
'withdraw': {
|
1142
|
-
'min': withdrawMin,
|
1143
|
-
'max': withdrawMax,
|
1118
|
+
'min': self.safe_string(chain, 'withdrawMin'),
|
1119
|
+
'max': self.safe_string(chain, 'withdrawMax'),
|
1144
1120
|
},
|
1145
1121
|
},
|
1146
1122
|
}
|
1147
|
-
|
1148
|
-
networkKeysLength = len(networkKeys)
|
1149
|
-
if (networkKeysLength == 1) or ('NONE' in networks):
|
1150
|
-
defaultNetwork = self.safe_value_2(networks, 'NONE', networkKeysLength - 1)
|
1151
|
-
if defaultNetwork is not None:
|
1152
|
-
currencyFee = defaultNetwork['fee']
|
1153
|
-
result[code] = {
|
1123
|
+
result[code] = self.safe_currency_structure({
|
1154
1124
|
'info': currency,
|
1155
1125
|
'id': id,
|
1156
1126
|
'code': code,
|
1157
1127
|
'name': name,
|
1158
|
-
'active':
|
1159
|
-
'deposit':
|
1160
|
-
'withdraw':
|
1161
|
-
'fee':
|
1128
|
+
'active': None,
|
1129
|
+
'deposit': None,
|
1130
|
+
'withdraw': None,
|
1131
|
+
'fee': None,
|
1162
1132
|
'precision': None,
|
1163
1133
|
'limits': {
|
1164
1134
|
'amount': {
|
1165
1135
|
'min': None,
|
1166
1136
|
'max': None,
|
1167
1137
|
},
|
1168
|
-
'withdraw': {
|
1169
|
-
'min': currencyWithdrawMin,
|
1170
|
-
'max': currencyWithdrawMax,
|
1171
|
-
},
|
1172
1138
|
},
|
1139
|
+
'type': 'crypto',
|
1173
1140
|
'networks': networks,
|
1174
|
-
}
|
1141
|
+
})
|
1175
1142
|
return result
|
1176
1143
|
|
1177
1144
|
async def fetch_markets(self, params={}) -> List[Market]:
|
@@ -3254,13 +3221,27 @@ class mexc(Exchange, ImplicitAPI):
|
|
3254
3221
|
|
3255
3222
|
def parse_order(self, order: dict, market: Market = None) -> Order:
|
3256
3223
|
#
|
3257
|
-
# spot
|
3224
|
+
# spot
|
3225
|
+
# createOrder
|
3258
3226
|
#
|
3259
|
-
#
|
3227
|
+
# {
|
3228
|
+
# "symbol": "FARTCOINUSDT",
|
3229
|
+
# "orderId": "C02__342252993005723644225",
|
3230
|
+
# "orderListId": "-1",
|
3231
|
+
# "price": "1.1",
|
3232
|
+
# "origQty": "6.3",
|
3233
|
+
# "type": "IMMEDIATE_OR_CANCEL",
|
3234
|
+
# "side": "SELL",
|
3235
|
+
# "transactTime": "1745852205223"
|
3236
|
+
# }
|
3237
|
+
#
|
3238
|
+
# unknown endpoint on spot
|
3239
|
+
#
|
3240
|
+
# {
|
3260
3241
|
# "symbol": "BTCUSDT",
|
3261
3242
|
# "orderId": "123738410679123456",
|
3262
3243
|
# "orderListId": -1
|
3263
|
-
#
|
3244
|
+
# }
|
3264
3245
|
#
|
3265
3246
|
# margin: createOrder
|
3266
3247
|
#
|
@@ -3422,6 +3403,10 @@ class mexc(Exchange, ImplicitAPI):
|
|
3422
3403
|
id = order
|
3423
3404
|
else:
|
3424
3405
|
id = self.safe_string_2(order, 'orderId', 'id')
|
3406
|
+
timeInForce = self.parse_order_time_in_force(self.safe_string(order, 'timeInForce'))
|
3407
|
+
typeRaw = self.safe_string(order, 'type')
|
3408
|
+
if timeInForce is None:
|
3409
|
+
timeInForce = self.get_tif_from_raw_order_type(typeRaw)
|
3425
3410
|
marketId = self.safe_string(order, 'symbol')
|
3426
3411
|
market = self.safe_market(marketId, market)
|
3427
3412
|
timestamp = self.safe_integer_n(order, ['time', 'createTime', 'transactTime'])
|
@@ -3443,8 +3428,8 @@ class mexc(Exchange, ImplicitAPI):
|
|
3443
3428
|
'lastTradeTimestamp': None, # TODO: self might be 'updateTime' if order-status is filled, otherwise cancellation time. needs to be checked
|
3444
3429
|
'status': self.parse_order_status(self.safe_string_2(order, 'status', 'state')),
|
3445
3430
|
'symbol': market['symbol'],
|
3446
|
-
'type': self.parse_order_type(
|
3447
|
-
'timeInForce':
|
3431
|
+
'type': self.parse_order_type(typeRaw),
|
3432
|
+
'timeInForce': timeInForce,
|
3448
3433
|
'side': self.parse_order_side(self.safe_string(order, 'side')),
|
3449
3434
|
'price': self.safe_number(order, 'price'),
|
3450
3435
|
'triggerPrice': self.safe_number_2(order, 'stopPrice', 'triggerPrice'),
|
@@ -3473,6 +3458,9 @@ class mexc(Exchange, ImplicitAPI):
|
|
3473
3458
|
'MARKET': 'market',
|
3474
3459
|
'LIMIT': 'limit',
|
3475
3460
|
'LIMIT_MAKER': 'limit',
|
3461
|
+
# on spot, during submission below types are used only accepted order
|
3462
|
+
'IMMEDIATE_OR_CANCEL': 'limit',
|
3463
|
+
'FILL_OR_KILL': 'limit',
|
3476
3464
|
}
|
3477
3465
|
return self.safe_string(statuses, status, status)
|
3478
3466
|
|
@@ -3500,6 +3488,16 @@ class mexc(Exchange, ImplicitAPI):
|
|
3500
3488
|
}
|
3501
3489
|
return self.safe_string(statuses, status, status)
|
3502
3490
|
|
3491
|
+
def get_tif_from_raw_order_type(self, orderType: Str = None):
|
3492
|
+
statuses: dict = {
|
3493
|
+
'LIMIT': 'GTC',
|
3494
|
+
'LIMIT_MAKER': 'POST_ONLY',
|
3495
|
+
'IMMEDIATE_OR_CANCEL': 'IOC',
|
3496
|
+
'FILL_OR_KILL': 'FOK',
|
3497
|
+
'MARKET': 'IOC',
|
3498
|
+
}
|
3499
|
+
return self.safe_string(statuses, orderType, orderType)
|
3500
|
+
|
3503
3501
|
async def fetch_account_helper(self, type, params):
|
3504
3502
|
if type == 'spot':
|
3505
3503
|
return await self.spotPrivateGetAccount(params)
|
@@ -4850,7 +4848,7 @@ class mexc(Exchange, ImplicitAPI):
|
|
4850
4848
|
response = await self.fetch_positions(None, self.extend(request, params))
|
4851
4849
|
return self.safe_value(response, 0)
|
4852
4850
|
|
4853
|
-
async def fetch_positions(self, symbols: Strings = None, params={}):
|
4851
|
+
async def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
|
4854
4852
|
"""
|
4855
4853
|
fetch all open positions
|
4856
4854
|
|
ccxt/async_support/okx.py
CHANGED
@@ -4832,7 +4832,7 @@ class okx(Exchange, ImplicitAPI):
|
|
4832
4832
|
:returns dict: an `address structure <https://docs.ccxt.com/#/?id=address-structure>`
|
4833
4833
|
"""
|
4834
4834
|
await self.load_markets()
|
4835
|
-
rawNetwork = self.
|
4835
|
+
rawNetwork = self.safe_string(params, 'network') # some networks are like "Dora Vota Mainnet"
|
4836
4836
|
params = self.omit(params, 'network')
|
4837
4837
|
code = self.safe_currency_code(code)
|
4838
4838
|
network = self.network_id_to_code(rawNetwork, code)
|
@@ -5402,7 +5402,7 @@ class okx(Exchange, ImplicitAPI):
|
|
5402
5402
|
return None
|
5403
5403
|
return self.parse_position(position, market)
|
5404
5404
|
|
5405
|
-
async def fetch_positions(self, symbols: Strings = None, params={}):
|
5405
|
+
async def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
|
5406
5406
|
"""
|
5407
5407
|
|
5408
5408
|
https://www.okx.com/docs-v5/en/#rest-api-account-get-positions
|
ccxt/async_support/oxfun.py
CHANGED
@@ -7,7 +7,7 @@ from ccxt.async_support.base.exchange import Exchange
|
|
7
7
|
from ccxt.abstract.oxfun import ImplicitAPI
|
8
8
|
import asyncio
|
9
9
|
import hashlib
|
10
|
-
from ccxt.base.types import Account, Any, Balances, Bool, Currencies, Currency, DepositAddress, Int, LeverageTier, LeverageTiers, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, Trade, Transaction, TransferEntry
|
10
|
+
from ccxt.base.types import Account, Any, Balances, Bool, Currencies, Currency, DepositAddress, Int, LeverageTier, LeverageTiers, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, Trade, Transaction, TransferEntry
|
11
11
|
from typing import List
|
12
12
|
from ccxt.base.errors import ExchangeError
|
13
13
|
from ccxt.base.errors import AuthenticationError
|
@@ -2130,7 +2130,7 @@ class oxfun(Exchange, ImplicitAPI):
|
|
2130
2130
|
data['type'] = 'withdrawal'
|
2131
2131
|
return self.parse_transaction(data, currency)
|
2132
2132
|
|
2133
|
-
async def fetch_positions(self, symbols: Strings = None, params={}):
|
2133
|
+
async def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
|
2134
2134
|
"""
|
2135
2135
|
fetch all open positions
|
2136
2136
|
|
ccxt/async_support/paradex.py
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
from ccxt.async_support.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.paradex import ImplicitAPI
|
8
|
-
from ccxt.base.types import Any, Balances, Currency, Int, Leverage, MarginMode, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, Transaction
|
8
|
+
from ccxt.base.types import Any, Balances, Currency, Int, Leverage, MarginMode, Market, Num, Order, OrderBook, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, Transaction
|
9
9
|
from typing import List
|
10
10
|
from ccxt.base.errors import ExchangeError
|
11
11
|
from ccxt.base.errors import AuthenticationError
|
@@ -1815,7 +1815,7 @@ class paradex(Exchange, ImplicitAPI):
|
|
1815
1815
|
positions = await self.fetch_positions([market['symbol']], params)
|
1816
1816
|
return self.safe_dict(positions, 0, {})
|
1817
1817
|
|
1818
|
-
async def fetch_positions(self, symbols: Strings = None, params={}):
|
1818
|
+
async def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
|
1819
1819
|
"""
|
1820
1820
|
fetch all open positions
|
1821
1821
|
|
ccxt/async_support/phemex.py
CHANGED
@@ -8,7 +8,7 @@ from ccxt.abstract.phemex import ImplicitAPI
|
|
8
8
|
import asyncio
|
9
9
|
import hashlib
|
10
10
|
import numbers
|
11
|
-
from ccxt.base.types import Any, Balances, Conversion, Currencies, Currency, DepositAddress, Int, LeverageTier, LeverageTiers, MarginModification, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, FundingRate, Trade, Transaction, TransferEntry
|
11
|
+
from ccxt.base.types import Any, Balances, Conversion, Currencies, Currency, DepositAddress, Int, LeverageTier, LeverageTiers, MarginModification, Market, Num, Order, OrderBook, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, FundingRate, Trade, Transaction, TransferEntry
|
12
12
|
from typing import List
|
13
13
|
from ccxt.base.errors import ExchangeError
|
14
14
|
from ccxt.base.errors import AuthenticationError
|
@@ -1167,7 +1167,8 @@ class phemex(Exchange, ImplicitAPI):
|
|
1167
1167
|
},
|
1168
1168
|
},
|
1169
1169
|
'valueScale': valueScale,
|
1170
|
-
'networks':
|
1170
|
+
'networks': None,
|
1171
|
+
'type': 'crypto',
|
1171
1172
|
}
|
1172
1173
|
return result
|
1173
1174
|
|
@@ -3571,7 +3572,7 @@ class phemex(Exchange, ImplicitAPI):
|
|
3571
3572
|
'fee': fee,
|
3572
3573
|
}
|
3573
3574
|
|
3574
|
-
async def fetch_positions(self, symbols: Strings = None, params={}):
|
3575
|
+
async def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
|
3575
3576
|
"""
|
3576
3577
|
fetch all open positions
|
3577
3578
|
|
ccxt/async_support/poloniex.py
CHANGED
@@ -7,7 +7,7 @@ from ccxt.async_support.base.exchange import Exchange
|
|
7
7
|
from ccxt.abstract.poloniex import ImplicitAPI
|
8
8
|
import asyncio
|
9
9
|
import hashlib
|
10
|
-
from ccxt.base.types import Any, Balances, Bool, Currencies, Currency, DepositAddress, Int, Leverage, MarginModification, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction, TransferEntry
|
10
|
+
from ccxt.base.types import Any, Balances, Bool, Currencies, Currency, DepositAddress, Int, Leverage, MarginModification, Market, Num, Order, OrderBook, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction, TransferEntry
|
11
11
|
from typing import List
|
12
12
|
from ccxt.base.errors import ExchangeError
|
13
13
|
from ccxt.base.errors import AuthenticationError
|
@@ -1204,6 +1204,7 @@ class poloniex(Exchange, ImplicitAPI):
|
|
1204
1204
|
'withdraw': withdrawEnabled,
|
1205
1205
|
'fee': self.parse_number(feeString),
|
1206
1206
|
'precision': None,
|
1207
|
+
'type': 'crypto',
|
1207
1208
|
'limits': {
|
1208
1209
|
'amount': {
|
1209
1210
|
'min': None,
|
@@ -1828,7 +1829,7 @@ class poloniex(Exchange, ImplicitAPI):
|
|
1828
1829
|
isTrigger = self.safe_value_2(params, 'trigger', 'stop')
|
1829
1830
|
params = self.omit(params, ['trigger', 'stop'])
|
1830
1831
|
response = None
|
1831
|
-
if
|
1832
|
+
if marketType != 'spot':
|
1832
1833
|
raw = await self.swapPrivateGetV3TradeOrderOpens(self.extend(request, params))
|
1833
1834
|
#
|
1834
1835
|
# {
|
@@ -3285,7 +3286,7 @@ class poloniex(Exchange, ImplicitAPI):
|
|
3285
3286
|
#
|
3286
3287
|
return response
|
3287
3288
|
|
3288
|
-
async def fetch_positions(self, symbols: Strings = None, params={}):
|
3289
|
+
async def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
|
3289
3290
|
"""
|
3290
3291
|
fetch all open positions
|
3291
3292
|
|
ccxt/async_support/probit.py
CHANGED
@@ -563,6 +563,7 @@ class probit(Exchange, ImplicitAPI):
|
|
563
563
|
'active': active,
|
564
564
|
'deposit': deposit,
|
565
565
|
'withdraw': withdraw,
|
566
|
+
'type': 'crypto',
|
566
567
|
'fee': fee,
|
567
568
|
'precision': self.parse_number(self.parse_precision(self.safe_string(platform, 'precision'))),
|
568
569
|
'limits': {
|
ccxt/async_support/timex.py
CHANGED
@@ -1526,7 +1526,7 @@ class timex(Exchange, ImplicitAPI):
|
|
1526
1526
|
'cost': feeCost,
|
1527
1527
|
'currency': feeCurrency,
|
1528
1528
|
}
|
1529
|
-
return {
|
1529
|
+
return self.safe_trade({
|
1530
1530
|
'info': trade,
|
1531
1531
|
'id': id,
|
1532
1532
|
'timestamp': timestamp,
|
@@ -1540,7 +1540,7 @@ class timex(Exchange, ImplicitAPI):
|
|
1540
1540
|
'cost': cost,
|
1541
1541
|
'takerOrMaker': takerOrMaker,
|
1542
1542
|
'fee': fee,
|
1543
|
-
}
|
1543
|
+
})
|
1544
1544
|
|
1545
1545
|
def parse_ohlcv(self, ohlcv, market: Market = None) -> list:
|
1546
1546
|
#
|
ccxt/async_support/tradeogre.py
CHANGED
@@ -24,7 +24,7 @@ class tradeogre(Exchange, ImplicitAPI):
|
|
24
24
|
'countries': [],
|
25
25
|
'rateLimit': 100,
|
26
26
|
'version': 'v2',
|
27
|
-
'pro':
|
27
|
+
'pro': True,
|
28
28
|
'has': {
|
29
29
|
'CORS': None,
|
30
30
|
'spot': True,
|
@@ -525,6 +525,7 @@ class tradeogre(Exchange, ImplicitAPI):
|
|
525
525
|
'asks': rawAsks,
|
526
526
|
}
|
527
527
|
orderbook = self.parse_order_book(rawOrderbook, symbol)
|
528
|
+
orderbook['nonce'] = self.safe_integer(response, 's')
|
528
529
|
return orderbook
|
529
530
|
|
530
531
|
def parse_bids_asks(self, bidasks, priceKey: IndexType = 0, amountKey: IndexType = 1, countOrIdKey: IndexType = 2):
|