ccxt 4.4.75__py2.py3-none-any.whl → 4.4.78__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/myokx.py +4 -0
- ccxt/abstract/okx.py +4 -0
- ccxt/abstract/upbit.py +51 -37
- ccxt/abstract/xt.py +3 -0
- ccxt/apex.py +1884 -0
- ccxt/ascendex.py +2 -2
- ccxt/async_support/__init__.py +3 -3
- ccxt/async_support/apex.py +1884 -0
- ccxt/async_support/ascendex.py +2 -2
- ccxt/async_support/base/exchange.py +2 -2
- ccxt/async_support/binance.py +39 -217
- ccxt/async_support/bingx.py +1 -1
- ccxt/async_support/bitfinex.py +2 -2
- ccxt/async_support/bitflyer.py +2 -2
- ccxt/async_support/bitget.py +135 -65
- ccxt/async_support/bitmart.py +2 -2
- ccxt/async_support/bitmex.py +6 -6
- ccxt/async_support/bitrue.py +48 -0
- ccxt/async_support/cex.py +1 -1
- ccxt/async_support/coinbase.py +29 -4
- ccxt/async_support/coincatch.py +66 -0
- ccxt/async_support/coinex.py +3 -1
- ccxt/async_support/coinlist.py +85 -2
- ccxt/async_support/cryptocom.py +2 -2
- ccxt/async_support/defx.py +1 -1
- ccxt/async_support/delta.py +1 -1
- ccxt/async_support/deribit.py +2 -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/htx.py +2 -2
- ccxt/async_support/hyperliquid.py +13 -6
- ccxt/async_support/kraken.py +2 -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 +21 -9
- ccxt/async_support/oxfun.py +2 -2
- ccxt/async_support/paradex.py +5 -10
- ccxt/async_support/phemex.py +4 -3
- ccxt/async_support/poloniex.py +3 -3
- ccxt/async_support/probit.py +1 -0
- ccxt/async_support/tradeogre.py +2 -1
- ccxt/async_support/upbit.py +265 -89
- ccxt/async_support/vertex.py +2 -2
- ccxt/async_support/whitebit.py +1 -0
- ccxt/async_support/woo.py +5 -3
- ccxt/async_support/woofipro.py +2 -2
- ccxt/async_support/xt.py +115 -5
- ccxt/base/exchange.py +76 -3
- ccxt/binance.py +39 -217
- ccxt/bingx.py +1 -1
- ccxt/bitfinex.py +2 -2
- ccxt/bitflyer.py +2 -2
- ccxt/bitget.py +135 -65
- ccxt/bitmart.py +2 -2
- ccxt/bitmex.py +6 -6
- ccxt/bitrue.py +48 -0
- ccxt/cex.py +1 -1
- ccxt/coinbase.py +29 -4
- ccxt/coincatch.py +66 -0
- ccxt/coinex.py +3 -1
- ccxt/coinlist.py +85 -2
- ccxt/cryptocom.py +2 -2
- ccxt/defx.py +1 -1
- ccxt/delta.py +1 -1
- ccxt/deribit.py +2 -2
- ccxt/derive.py +2 -2
- ccxt/digifinex.py +2 -2
- ccxt/gate.py +1 -1
- ccxt/hitbtc.py +5 -2
- ccxt/htx.py +2 -2
- ccxt/hyperliquid.py +13 -6
- ccxt/kraken.py +2 -2
- ccxt/krakenfutures.py +2 -2
- ccxt/kucoinfutures.py +2 -2
- ccxt/mexc.py +50 -52
- ccxt/okx.py +21 -9
- ccxt/oxfun.py +2 -2
- ccxt/paradex.py +5 -10
- ccxt/phemex.py +4 -3
- ccxt/poloniex.py +3 -3
- ccxt/pro/__init__.py +5 -1
- ccxt/pro/apex.py +984 -0
- ccxt/pro/coinbase.py +4 -6
- ccxt/pro/gate.py +22 -2
- ccxt/pro/hollaex.py +2 -2
- ccxt/pro/hyperliquid.py +1 -1
- ccxt/pro/p2b.py +2 -2
- ccxt/pro/tradeogre.py +272 -0
- ccxt/probit.py +1 -0
- ccxt/test/tests_async.py +27 -0
- ccxt/test/tests_sync.py +27 -0
- ccxt/tradeogre.py +2 -1
- ccxt/upbit.py +265 -89
- ccxt/vertex.py +2 -2
- ccxt/whitebit.py +1 -0
- ccxt/woo.py +5 -3
- ccxt/woofipro.py +2 -2
- ccxt/xt.py +115 -5
- {ccxt-4.4.75.dist-info → ccxt-4.4.78.dist-info}/METADATA +4 -4
- {ccxt-4.4.75.dist-info → ccxt-4.4.78.dist-info}/RECORD +108 -106
- ccxt/abstract/ace.py +0 -15
- ccxt/ace.py +0 -1152
- ccxt/async_support/ace.py +0 -1152
- {ccxt-4.4.75.dist-info → ccxt-4.4.78.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.4.75.dist-info → ccxt-4.4.78.dist-info}/WHEEL +0 -0
- {ccxt-4.4.75.dist-info → ccxt-4.4.78.dist-info}/top_level.txt +0 -0
ccxt/coincatch.py
CHANGED
@@ -90,6 +90,7 @@ class coincatch(Exchange, ImplicitAPI):
|
|
90
90
|
'fetchDepositAddress': True,
|
91
91
|
'fetchDeposits': True,
|
92
92
|
'fetchDepositsWithdrawals': False,
|
93
|
+
'fetchDepositWithdrawFees': True,
|
93
94
|
'fetchFundingHistory': False,
|
94
95
|
'fetchFundingRate': True,
|
95
96
|
'fetchFundingRateHistory': True,
|
@@ -724,6 +725,71 @@ class coincatch(Exchange, ImplicitAPI):
|
|
724
725
|
self.options['currencyIdsListForParseMarket'] = currenciesIds
|
725
726
|
return result
|
726
727
|
|
728
|
+
def fetch_deposit_withdraw_fees(self, codes: Strings = None, params={}):
|
729
|
+
"""
|
730
|
+
fetch deposit and withdraw fees
|
731
|
+
|
732
|
+
https://coincatch.github.io/github.io/en/spot/#get-coin-list
|
733
|
+
|
734
|
+
:param str[] [codes]: list of unified currency codes
|
735
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
736
|
+
:returns dict: a list of `fee structures <https://docs.ccxt.com/#/?id=fee-structure>`
|
737
|
+
"""
|
738
|
+
self.load_markets()
|
739
|
+
response = self.publicGetApiSpotV1PublicCurrencies(params)
|
740
|
+
data = self.safe_list(response, 'data', [])
|
741
|
+
return self.parse_deposit_withdraw_fees(data, codes, 'coinName')
|
742
|
+
|
743
|
+
def parse_deposit_withdraw_fee(self, fee, currency: Currency = None):
|
744
|
+
#
|
745
|
+
# {
|
746
|
+
# "coinId":"1",
|
747
|
+
# "coinName":"BTC",
|
748
|
+
# "transfer":"true",
|
749
|
+
# "chains":[
|
750
|
+
# {
|
751
|
+
# "chain":null,
|
752
|
+
# "needTag":"false",
|
753
|
+
# "withdrawable":"true",
|
754
|
+
# "rechargeAble":"true",
|
755
|
+
# "withdrawFee":"0.005",
|
756
|
+
# "depositConfirm":"1",
|
757
|
+
# "withdrawConfirm":"1",
|
758
|
+
# "minDepositAmount":"0.001",
|
759
|
+
# "minWithdrawAmount":"0.001",
|
760
|
+
# "browserUrl":"https://blockchair.com/bitcoin/testnet/transaction/"
|
761
|
+
# }
|
762
|
+
# ]
|
763
|
+
# }
|
764
|
+
#
|
765
|
+
chains = self.safe_list(fee, 'chains', [])
|
766
|
+
chainsLength = len(chains)
|
767
|
+
result: dict = {
|
768
|
+
'info': fee,
|
769
|
+
'withdraw': {
|
770
|
+
'fee': None,
|
771
|
+
'percentage': None,
|
772
|
+
},
|
773
|
+
'deposit': {
|
774
|
+
'fee': None,
|
775
|
+
'percentage': None,
|
776
|
+
},
|
777
|
+
'networks': {},
|
778
|
+
}
|
779
|
+
for i in range(0, chainsLength):
|
780
|
+
chain = chains[i]
|
781
|
+
networkId = self.safe_string(chain, 'chain')
|
782
|
+
currencyCode = self.safe_string(currency, 'code')
|
783
|
+
networkCode = self.network_id_to_code(networkId, currencyCode)
|
784
|
+
result['networks'][networkCode] = {
|
785
|
+
'deposit': {'fee': None, 'percentage': None},
|
786
|
+
'withdraw': {'fee': self.safe_number(chain, 'withdrawFee'), 'percentage': False},
|
787
|
+
}
|
788
|
+
if chainsLength == 1:
|
789
|
+
result['withdraw']['fee'] = self.safe_number(chain, 'withdrawFee')
|
790
|
+
result['withdraw']['percentage'] = False
|
791
|
+
return result
|
792
|
+
|
727
793
|
def fetch_markets(self, params={}) -> List[Market]:
|
728
794
|
"""
|
729
795
|
retrieves data on all markets for the exchange
|
ccxt/coinex.py
CHANGED
@@ -762,6 +762,8 @@ class coinex(Exchange, ImplicitAPI):
|
|
762
762
|
for j in range(0, len(chains)):
|
763
763
|
chain = chains[j]
|
764
764
|
networkId = self.safe_string(chain, 'chain')
|
765
|
+
if networkId is None:
|
766
|
+
continue
|
765
767
|
precisionString = self.parse_precision(self.safe_string(chain, 'withdrawal_precision'))
|
766
768
|
feeString = self.safe_string(chain, 'withdrawal_fee')
|
767
769
|
minNetworkDepositString = self.safe_string(chain, 'min_deposit_amount')
|
@@ -3856,7 +3858,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
3856
3858
|
data = self.safe_list(response, 'data', [])
|
3857
3859
|
return self.parse_trades(data, market, since, limit)
|
3858
3860
|
|
3859
|
-
def fetch_positions(self, symbols: Strings = None, params={}):
|
3861
|
+
def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
|
3860
3862
|
"""
|
3861
3863
|
fetch all open positions
|
3862
3864
|
|
ccxt/coinlist.py
CHANGED
@@ -7,7 +7,7 @@ from ccxt.base.exchange import Exchange
|
|
7
7
|
from ccxt.abstract.coinlist import ImplicitAPI
|
8
8
|
import hashlib
|
9
9
|
import math
|
10
|
-
from ccxt.base.types import Account, Any, Balances, Currencies, Currency, Int, LedgerEntry, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFees, Transaction, TransferEntry
|
10
|
+
from ccxt.base.types import Account, Any, Balances, Currencies, Currency, Int, LedgerEntry, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, FundingRate, 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
|
@@ -79,7 +79,7 @@ class coinlist(Exchange, ImplicitAPI):
|
|
79
79
|
'fetchDepositWithdrawFee': False,
|
80
80
|
'fetchDepositWithdrawFees': False,
|
81
81
|
'fetchFundingHistory': False,
|
82
|
-
'fetchFundingRate':
|
82
|
+
'fetchFundingRate': True,
|
83
83
|
'fetchFundingRateHistory': False,
|
84
84
|
'fetchFundingRates': False,
|
85
85
|
'fetchIndexOHLCV': False,
|
@@ -2405,6 +2405,89 @@ class coinlist(Exchange, ImplicitAPI):
|
|
2405
2405
|
}
|
2406
2406
|
return self.safe_string(types, type, type)
|
2407
2407
|
|
2408
|
+
def fetch_funding_rate(self, symbol: str, params={}) -> FundingRate:
|
2409
|
+
"""
|
2410
|
+
fetch the current funding rate
|
2411
|
+
|
2412
|
+
https://trade-docs.coinlist.co/#coinlist-pro-api-Funding-Rates
|
2413
|
+
|
2414
|
+
:param str symbol: unified market symbol
|
2415
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2416
|
+
:returns dict: a `funding rate structure <https://docs.ccxt.com/#/?id=funding-rate-structure>`
|
2417
|
+
"""
|
2418
|
+
self.load_markets()
|
2419
|
+
market = self.market(symbol)
|
2420
|
+
if not market['swap']:
|
2421
|
+
raise BadSymbol(self.id + ' fetchFundingRate() supports swap contracts only')
|
2422
|
+
request: dict = {
|
2423
|
+
'symbol': market['id'],
|
2424
|
+
}
|
2425
|
+
response = self.publicGetV1SymbolsSymbolFunding(self.extend(request, params))
|
2426
|
+
#
|
2427
|
+
# {
|
2428
|
+
# "last": {
|
2429
|
+
# "funding_rate": "-0.00043841",
|
2430
|
+
# "funding_time": "2025-04-15T04:00:00.000Z"
|
2431
|
+
# },
|
2432
|
+
# "next": {
|
2433
|
+
# "funding_rate": "-0.00046952",
|
2434
|
+
# "funding_time": "2025-04-15T12:00:00.000Z"
|
2435
|
+
# },
|
2436
|
+
# "indicative": {
|
2437
|
+
# "funding_rate": "-0.00042517",
|
2438
|
+
# "funding_time": "2025-04-15T20:00:00.000Z"
|
2439
|
+
# },
|
2440
|
+
# "timestamp": "2025-04-15T07:01:15.219Z"
|
2441
|
+
# }
|
2442
|
+
#
|
2443
|
+
return self.parse_funding_rate(response, market)
|
2444
|
+
|
2445
|
+
def parse_funding_rate(self, contract, market: Market = None) -> FundingRate:
|
2446
|
+
#
|
2447
|
+
# {
|
2448
|
+
# "last": {
|
2449
|
+
# "funding_rate": "-0.00043841",
|
2450
|
+
# "funding_time": "2025-04-15T04:00:00.000Z"
|
2451
|
+
# },
|
2452
|
+
# "next": {
|
2453
|
+
# "funding_rate": "-0.00046952",
|
2454
|
+
# "funding_time": "2025-04-15T12:00:00.000Z"
|
2455
|
+
# },
|
2456
|
+
# "indicative": {
|
2457
|
+
# "funding_rate": "-0.00042517",
|
2458
|
+
# "funding_time": "2025-04-15T20:00:00.000Z"
|
2459
|
+
# },
|
2460
|
+
# "timestamp": "2025-04-15T07:01:15.219Z"
|
2461
|
+
# }
|
2462
|
+
#
|
2463
|
+
previous = self.safe_dict(contract, 'last', {})
|
2464
|
+
current = self.safe_dict(contract, 'next', {})
|
2465
|
+
next = self.safe_dict(contract, 'indicative', {})
|
2466
|
+
previousDatetime = self.safe_string(previous, 'funding_time')
|
2467
|
+
currentDatetime = self.safe_string(current, 'funding_time')
|
2468
|
+
nextDatetime = self.safe_string(next, 'funding_time')
|
2469
|
+
datetime = self.safe_string(contract, 'timestamp')
|
2470
|
+
return {
|
2471
|
+
'info': contract,
|
2472
|
+
'symbol': self.safe_symbol(None, market),
|
2473
|
+
'markPrice': None,
|
2474
|
+
'indexPrice': None,
|
2475
|
+
'interestRate': None,
|
2476
|
+
'estimatedSettlePrice': None,
|
2477
|
+
'timestamp': self.parse8601(datetime),
|
2478
|
+
'datetime': datetime,
|
2479
|
+
'fundingRate': self.safe_number(current, 'funding_rate'),
|
2480
|
+
'fundingTimestamp': self.parse8601(currentDatetime),
|
2481
|
+
'fundingDatetime': currentDatetime,
|
2482
|
+
'nextFundingRate': self.safe_number(next, 'funding_rate'),
|
2483
|
+
'nextFundingTimestamp': self.parse8601(nextDatetime),
|
2484
|
+
'nextFundingDatetime': nextDatetime,
|
2485
|
+
'previousFundingRate': self.safe_number(previous, 'funding_rate'),
|
2486
|
+
'previousFundingTimestamp': self.parse8601(previousDatetime),
|
2487
|
+
'previousFundingDatetime': previousDatetime,
|
2488
|
+
'interval': '8h',
|
2489
|
+
}
|
2490
|
+
|
2408
2491
|
def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
|
2409
2492
|
request = self.omit(params, self.extract_params(path))
|
2410
2493
|
endpoint = '/' + self.implode_params(path, params)
|
ccxt/cryptocom.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.cryptocom import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Account, Any, Balances, Currency, DepositAddress, Int, LedgerEntry, Market, Num, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction
|
9
|
+
from ccxt.base.types import Account, Any, Balances, Currency, DepositAddress, Int, LedgerEntry, Market, Num, Order, OrderBook, OrderRequest, CancellationRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import AuthenticationError
|
@@ -2789,7 +2789,7 @@ class cryptocom(Exchange, ImplicitAPI):
|
|
2789
2789
|
data = self.safe_list(result, 'data', [])
|
2790
2790
|
return self.parse_position(self.safe_dict(data, 0), market)
|
2791
2791
|
|
2792
|
-
def fetch_positions(self, symbols: Strings = None, params={}):
|
2792
|
+
def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
|
2793
2793
|
"""
|
2794
2794
|
fetch all open positions
|
2795
2795
|
|
ccxt/defx.py
CHANGED
@@ -1494,7 +1494,7 @@ class defx(Exchange, ImplicitAPI):
|
|
1494
1494
|
first = self.safe_dict(data, 0, {})
|
1495
1495
|
return self.parse_position(first, market)
|
1496
1496
|
|
1497
|
-
def fetch_positions(self, symbols: Strings = None, params={}):
|
1497
|
+
def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
|
1498
1498
|
"""
|
1499
1499
|
fetch all open positions
|
1500
1500
|
|
ccxt/delta.py
CHANGED
@@ -1660,7 +1660,7 @@ class delta(Exchange, ImplicitAPI):
|
|
1660
1660
|
result = self.safe_dict(response, 'result', {})
|
1661
1661
|
return self.parse_position(result, market)
|
1662
1662
|
|
1663
|
-
def fetch_positions(self, symbols: Strings = None, params={}):
|
1663
|
+
def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
|
1664
1664
|
"""
|
1665
1665
|
fetch all open positions
|
1666
1666
|
|
ccxt/deribit.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.deribit import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Account, Any, Balances, Currencies, Currency, DepositAddress, Greeks, Int, Market, Num, Option, OptionChain, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, FundingRate, Trade, TradingFees, Transaction, MarketInterface, TransferEntry
|
9
|
+
from ccxt.base.types import Account, Any, Balances, Currencies, Currency, DepositAddress, Greeks, Int, Market, Num, Option, OptionChain, Order, OrderBook, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, FundingRate, Trade, TradingFees, Transaction, MarketInterface, TransferEntry
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import AuthenticationError
|
@@ -2673,7 +2673,7 @@ class deribit(Exchange, ImplicitAPI):
|
|
2673
2673
|
result = self.safe_dict(response, 'result')
|
2674
2674
|
return self.parse_position(result)
|
2675
2675
|
|
2676
|
-
def fetch_positions(self, symbols: Strings = None, params={}):
|
2676
|
+
def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
|
2677
2677
|
"""
|
2678
2678
|
fetch all open positions
|
2679
2679
|
|
ccxt/derive.py
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
from ccxt.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.derive import ImplicitAPI
|
8
|
-
from ccxt.base.types import Any, Balances, Bool, Currencies, Currency, Int, Market, MarketType, Num, Order, OrderSide, OrderType, Str, Strings, Ticker, FundingRate, Trade, Transaction
|
8
|
+
from ccxt.base.types import Any, Balances, Bool, Currencies, Currency, Int, Market, MarketType, Num, Order, OrderSide, OrderType, Position, Str, Strings, Ticker, FundingRate, Trade, Transaction
|
9
9
|
from typing import List
|
10
10
|
from ccxt.base.errors import ExchangeError
|
11
11
|
from ccxt.base.errors import AuthenticationError
|
@@ -2027,7 +2027,7 @@ class derive(Exchange, ImplicitAPI):
|
|
2027
2027
|
trades = self.safe_list(result, 'trades', [])
|
2028
2028
|
return self.parse_trades(trades, market, since, limit, params)
|
2029
2029
|
|
2030
|
-
def fetch_positions(self, symbols: Strings = None, params={}):
|
2030
|
+
def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
|
2031
2031
|
"""
|
2032
2032
|
fetch all open positions
|
2033
2033
|
|
ccxt/digifinex.py
CHANGED
@@ -7,7 +7,7 @@ from ccxt.base.exchange import Exchange
|
|
7
7
|
from ccxt.abstract.digifinex import ImplicitAPI
|
8
8
|
import hashlib
|
9
9
|
import json
|
10
|
-
from ccxt.base.types import Any, Balances, BorrowInterest, CrossBorrowRate, CrossBorrowRates, Currencies, Currency, DepositAddress, Int, LedgerEntry, LeverageTier, LeverageTiers, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Str, Strings, Ticker, Tickers, FundingRate, Trade, TradingFeeInterface, Transaction, TransferEntry
|
10
|
+
from ccxt.base.types import Any, Balances, BorrowInterest, CrossBorrowRate, CrossBorrowRates, Currencies, Currency, DepositAddress, Int, LedgerEntry, LeverageTier, LeverageTiers, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, FundingRate, 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
|
@@ -3375,7 +3375,7 @@ class digifinex(Exchange, ImplicitAPI):
|
|
3375
3375
|
'tierBased': None,
|
3376
3376
|
}
|
3377
3377
|
|
3378
|
-
def fetch_positions(self, symbols: Strings = None, params={}):
|
3378
|
+
def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
|
3379
3379
|
"""
|
3380
3380
|
fetch all open positions
|
3381
3381
|
|
ccxt/gate.py
CHANGED
@@ -5723,7 +5723,7 @@ class gate(Exchange, ImplicitAPI):
|
|
5723
5723
|
#
|
5724
5724
|
return self.parse_position(response, market)
|
5725
5725
|
|
5726
|
-
def fetch_positions(self, symbols: Strings = None, params={}):
|
5726
|
+
def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
|
5727
5727
|
"""
|
5728
5728
|
fetch all open positions
|
5729
5729
|
|
ccxt/hitbtc.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.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
|
-
def fetch_positions(self, symbols: Strings = None, params={}):
|
2829
|
+
def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
|
2827
2830
|
"""
|
2828
2831
|
fetch all open positions
|
2829
2832
|
|
ccxt/htx.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.htx import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
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
|
9
|
+
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
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import AuthenticationError
|
@@ -7337,7 +7337,7 @@ class htx(Exchange, ImplicitAPI):
|
|
7337
7337
|
'takeProfitPrice': None,
|
7338
7338
|
})
|
7339
7339
|
|
7340
|
-
def fetch_positions(self, symbols: Strings = None, params={}):
|
7340
|
+
def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
|
7341
7341
|
"""
|
7342
7342
|
fetch all open positions
|
7343
7343
|
|
ccxt/hyperliquid.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.hyperliquid import ImplicitAPI
|
8
8
|
import math
|
9
|
-
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
|
9
|
+
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
|
10
10
|
from typing import List
|
11
11
|
from ccxt.base.errors import ExchangeError
|
12
12
|
from ccxt.base.errors import ArgumentsRequired
|
@@ -771,12 +771,15 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
771
771
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
772
772
|
:param str [params.user]: user address, will default to self.walletAddress if not provided
|
773
773
|
:param str [params.type]: wallet type, ['spot', 'swap'], defaults to swap
|
774
|
+
:param str [params.marginMode]: 'cross' or 'isolated', for margin trading, uses self.options.defaultMarginMode if not passed, defaults to None/None/None
|
774
775
|
:returns dict: a `balance structure <https://docs.ccxt.com/#/?id=balance-structure>`
|
775
776
|
"""
|
776
777
|
userAddress = None
|
777
778
|
userAddress, params = self.handle_public_address('fetchBalance', params)
|
778
779
|
type = None
|
779
780
|
type, params = self.handle_market_type_and_params('fetchBalance', None, params)
|
781
|
+
marginMode = None
|
782
|
+
marginMode, params = self.handle_margin_mode_and_params('fetchBalance', params)
|
780
783
|
isSpot = (type == 'spot')
|
781
784
|
reqType = 'spotClearinghouseState' if (isSpot) else 'clearinghouseState'
|
782
785
|
request: dict = {
|
@@ -833,12 +836,16 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
833
836
|
spotBalances[code] = account
|
834
837
|
return self.safe_balance(spotBalances)
|
835
838
|
data = self.safe_dict(response, 'marginSummary', {})
|
839
|
+
usdcBalance = {
|
840
|
+
'total': self.safe_number(data, 'accountValue'),
|
841
|
+
}
|
842
|
+
if (marginMode is not None) and (marginMode == 'isolated'):
|
843
|
+
usdcBalance['free'] = self.safe_number(response, 'withdrawable')
|
844
|
+
else:
|
845
|
+
usdcBalance['used'] = self.safe_number(data, 'totalMarginUsed')
|
836
846
|
result: dict = {
|
837
847
|
'info': response,
|
838
|
-
'USDC':
|
839
|
-
'total': self.safe_number(data, 'accountValue'),
|
840
|
-
'used': self.safe_number(data, 'totalMarginUsed'),
|
841
|
-
},
|
848
|
+
'USDC': usdcBalance,
|
842
849
|
}
|
843
850
|
timestamp = self.safe_integer(response, 'time')
|
844
851
|
result['timestamp'] = timestamp
|
@@ -2452,7 +2459,7 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
2452
2459
|
positions = self.fetch_positions([symbol], params)
|
2453
2460
|
return self.safe_dict(positions, 0, {})
|
2454
2461
|
|
2455
|
-
def fetch_positions(self, symbols: Strings = None, params={}):
|
2462
|
+
def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
|
2456
2463
|
"""
|
2457
2464
|
fetch all open positions
|
2458
2465
|
|
ccxt/kraken.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.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
|
@@ -3067,7 +3067,7 @@ class kraken(Exchange, ImplicitAPI):
|
|
3067
3067
|
return self.parse_transaction(result, currency)
|
3068
3068
|
raise ExchangeError(self.id + " withdraw() requires a 'key' parameter(withdrawal key name, up on your account)")
|
3069
3069
|
|
3070
|
-
def fetch_positions(self, symbols: Strings = None, params={}):
|
3070
|
+
def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
|
3071
3071
|
"""
|
3072
3072
|
fetch all open positions
|
3073
3073
|
|
ccxt/krakenfutures.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.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
|
-
def fetch_positions(self, symbols: Strings = None, params={}):
|
2290
|
+
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
|
ccxt/kucoinfutures.py
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
from ccxt.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
|
-
def fetch_positions(self, symbols: Strings = None, params={}):
|
1235
|
+
def fetch_positions(self, symbols: Strings = None, params={}) -> List[Position]:
|
1236
1236
|
"""
|
1237
1237
|
fetch all open positions
|
1238
1238
|
|