ccxt 4.3.63__py2.py3-none-any.whl → 4.3.65__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/kucoin.py +1 -0
- ccxt/abstract/kucoinfutures.py +1 -0
- ccxt/alpaca.py +1 -0
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/alpaca.py +1 -0
- ccxt/async_support/base/exchange.py +4 -4
- ccxt/async_support/bingx.py +83 -1
- ccxt/async_support/bitfinex.py +1 -1
- ccxt/async_support/bitfinex2.py +1 -1
- ccxt/async_support/bybit.py +11 -4
- ccxt/async_support/independentreserve.py +103 -1
- ccxt/async_support/kucoin.py +2 -0
- ccxt/async_support/whitebit.py +1 -1
- ccxt/async_support/woo.py +25 -0
- ccxt/async_support/yobit.py +1 -1
- ccxt/async_support/zonda.py +1 -1
- ccxt/base/exchange.py +4 -4
- ccxt/bingx.py +83 -1
- ccxt/bitfinex.py +1 -1
- ccxt/bitfinex2.py +1 -1
- ccxt/bybit.py +11 -4
- ccxt/independentreserve.py +103 -1
- ccxt/kucoin.py +2 -0
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/bitmart.py +3 -3
- ccxt/pro/gate.py +1 -1
- ccxt/pro/gemini.py +4 -2
- ccxt/pro/okx.py +1 -1
- ccxt/pro/onetrading.py +3 -2
- ccxt/pro/oxfun.py +1 -1
- ccxt/pro/vertex.py +3 -2
- ccxt/pro/woo.py +2 -1
- ccxt/pro/woofipro.py +2 -1
- ccxt/test/tests_async.py +3 -3
- ccxt/test/tests_helpers.py +1 -1
- ccxt/test/tests_init.py +3 -3
- ccxt/test/tests_sync.py +3 -3
- ccxt/whitebit.py +1 -1
- ccxt/woo.py +25 -0
- ccxt/yobit.py +1 -1
- ccxt/zonda.py +1 -1
- {ccxt-4.3.63.dist-info → ccxt-4.3.65.dist-info}/METADATA +4 -4
- {ccxt-4.3.63.dist-info → ccxt-4.3.65.dist-info}/RECORD +47 -47
- {ccxt-4.3.63.dist-info → ccxt-4.3.65.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.3.63.dist-info → ccxt-4.3.65.dist-info}/WHEEL +0 -0
- {ccxt-4.3.63.dist-info → ccxt-4.3.65.dist-info}/top_level.txt +0 -0
ccxt/__init__.py
CHANGED
ccxt/abstract/kucoin.py
CHANGED
@@ -18,6 +18,7 @@ class ImplicitAPI:
|
|
18
18
|
public_get_timestamp = publicGetTimestamp = Entry('timestamp', 'public', 'GET', {'cost': 4.5})
|
19
19
|
public_get_status = publicGetStatus = Entry('status', 'public', 'GET', {'cost': 4.5})
|
20
20
|
public_get_mark_price_symbol_current = publicGetMarkPriceSymbolCurrent = Entry('mark-price/{symbol}/current', 'public', 'GET', {'cost': 3})
|
21
|
+
public_get_mark_price_all_symbols = publicGetMarkPriceAllSymbols = Entry('mark-price/all-symbols', 'public', 'GET', {'cost': 3})
|
21
22
|
public_get_margin_config = publicGetMarginConfig = Entry('margin/config', 'public', 'GET', {'cost': 25})
|
22
23
|
public_post_bullet_public = publicPostBulletPublic = Entry('bullet-public', 'public', 'POST', {'cost': 15})
|
23
24
|
private_get_user_info = privateGetUserInfo = Entry('user-info', 'private', 'GET', {'cost': 30})
|
ccxt/abstract/kucoinfutures.py
CHANGED
@@ -18,6 +18,7 @@ class ImplicitAPI:
|
|
18
18
|
public_get_timestamp = publicGetTimestamp = Entry('timestamp', 'public', 'GET', {'cost': 4.5})
|
19
19
|
public_get_status = publicGetStatus = Entry('status', 'public', 'GET', {'cost': 4.5})
|
20
20
|
public_get_mark_price_symbol_current = publicGetMarkPriceSymbolCurrent = Entry('mark-price/{symbol}/current', 'public', 'GET', {'cost': 3})
|
21
|
+
public_get_mark_price_all_symbols = publicGetMarkPriceAllSymbols = Entry('mark-price/all-symbols', 'public', 'GET', {'cost': 3})
|
21
22
|
public_get_margin_config = publicGetMarginConfig = Entry('margin/config', 'public', 'GET', {'cost': 25})
|
22
23
|
public_post_bullet_public = publicPostBulletPublic = Entry('bullet-public', 'public', 'POST', {'cost': 15})
|
23
24
|
private_get_user_info = privateGetUserInfo = Entry('user-info', 'private', 'GET', {'cost': 30})
|
ccxt/alpaca.py
CHANGED
@@ -1056,6 +1056,7 @@ class alpaca(Exchange, ImplicitAPI):
|
|
1056
1056
|
url = self.implode_hostname(self.urls['api'][api[0]])
|
1057
1057
|
headers = headers if (headers is not None) else {}
|
1058
1058
|
if api[1] == 'private':
|
1059
|
+
self.check_required_credentials()
|
1059
1060
|
headers['APCA-API-KEY-ID'] = self.apiKey
|
1060
1061
|
headers['APCA-API-SECRET-KEY'] = self.secret
|
1061
1062
|
query = self.omit(params, self.extract_params(path))
|
ccxt/async_support/__init__.py
CHANGED
ccxt/async_support/alpaca.py
CHANGED
@@ -1056,6 +1056,7 @@ class alpaca(Exchange, ImplicitAPI):
|
|
1056
1056
|
url = self.implode_hostname(self.urls['api'][api[0]])
|
1057
1057
|
headers = headers if (headers is not None) else {}
|
1058
1058
|
if api[1] == 'private':
|
1059
|
+
self.check_required_credentials()
|
1059
1060
|
headers['APCA-API-KEY-ID'] = self.apiKey
|
1060
1061
|
headers['APCA-API-SECRET-KEY'] = self.secret
|
1061
1062
|
query = self.omit(params, self.extract_params(path))
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
# -----------------------------------------------------------------------------
|
4
4
|
|
5
|
-
__version__ = '4.3.
|
5
|
+
__version__ = '4.3.65'
|
6
6
|
|
7
7
|
# -----------------------------------------------------------------------------
|
8
8
|
|
@@ -1013,14 +1013,14 @@ class Exchange(BaseExchange):
|
|
1013
1013
|
await self.load_markets()
|
1014
1014
|
market = self.market(symbol)
|
1015
1015
|
symbol = market['symbol']
|
1016
|
-
tickers = await self.
|
1016
|
+
tickers = await self.fetch_tickers_ws([symbol], params)
|
1017
1017
|
ticker = self.safe_dict(tickers, symbol)
|
1018
1018
|
if ticker is None:
|
1019
|
-
raise NullResponse(self.id + '
|
1019
|
+
raise NullResponse(self.id + ' fetchTickerWs() could not find a ticker for ' + symbol)
|
1020
1020
|
else:
|
1021
1021
|
return ticker
|
1022
1022
|
else:
|
1023
|
-
raise NotSupported(self.id + '
|
1023
|
+
raise NotSupported(self.id + ' fetchTickerWs() is not supported yet')
|
1024
1024
|
|
1025
1025
|
async def watch_ticker(self, symbol: str, params={}):
|
1026
1026
|
raise NotSupported(self.id + ' watchTicker() is not supported yet')
|
ccxt/async_support/bingx.py
CHANGED
@@ -8,7 +8,7 @@ from ccxt.abstract.bingx import ImplicitAPI
|
|
8
8
|
import asyncio
|
9
9
|
import hashlib
|
10
10
|
import numbers
|
11
|
-
from ccxt.base.types import Balances, Currencies, Currency, Int, Leverage, MarginMode, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry, TransferEntries
|
11
|
+
from ccxt.base.types import Balances, Currencies, Currency, Int, Leverage, MarginMode, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction, TransferEntry, TransferEntries
|
12
12
|
from typing import List
|
13
13
|
from ccxt.base.errors import ExchangeError
|
14
14
|
from ccxt.base.errors import AuthenticationError
|
@@ -95,6 +95,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
95
95
|
'fetchTickers': True,
|
96
96
|
'fetchTime': True,
|
97
97
|
'fetchTrades': True,
|
98
|
+
'fetchTradingFee': True,
|
98
99
|
'fetchTransfers': True,
|
99
100
|
'fetchWithdrawals': True,
|
100
101
|
'reduceMargin': True,
|
@@ -5011,6 +5012,87 @@ class bingx(Exchange, ImplicitAPI):
|
|
5011
5012
|
'marginMode': marginType,
|
5012
5013
|
}
|
5013
5014
|
|
5015
|
+
async def fetch_trading_fee(self, symbol: str, params={}) -> TradingFeeInterface:
|
5016
|
+
"""
|
5017
|
+
fetch the trading fees for a market
|
5018
|
+
:see: https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Query%20Trading%20Commission%20Rate
|
5019
|
+
:see: https://bingx-api.github.io/docs/#/en-us/swapV2/account-api.html#Query%20Trading%20Commission%20Rate
|
5020
|
+
:see: https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Query%20Trade%20Commission%20Rate
|
5021
|
+
:param str symbol: unified market symbol
|
5022
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
5023
|
+
:returns dict: a `fee structure <https://docs.ccxt.com/#/?id=fee-structure>`
|
5024
|
+
"""
|
5025
|
+
await self.load_markets()
|
5026
|
+
market = self.market(symbol)
|
5027
|
+
request: dict = {
|
5028
|
+
'symbol': market['id'],
|
5029
|
+
}
|
5030
|
+
response = None
|
5031
|
+
commission: dict = {}
|
5032
|
+
data = self.safe_dict(response, 'data', {})
|
5033
|
+
if market['spot']:
|
5034
|
+
response = await self.spotV1PrivateGetUserCommissionRate(self.extend(request, params))
|
5035
|
+
#
|
5036
|
+
# {
|
5037
|
+
# "code": 0,
|
5038
|
+
# "msg": "",
|
5039
|
+
# "debugMsg": "",
|
5040
|
+
# "data": {
|
5041
|
+
# "takerCommissionRate": 0.001,
|
5042
|
+
# "makerCommissionRate": 0.001
|
5043
|
+
# }
|
5044
|
+
# }
|
5045
|
+
#
|
5046
|
+
commission = data
|
5047
|
+
else:
|
5048
|
+
if market['inverse']:
|
5049
|
+
response = await self.cswapV1PrivateGetUserCommissionRate(params)
|
5050
|
+
#
|
5051
|
+
# {
|
5052
|
+
# "code": 0,
|
5053
|
+
# "msg": "",
|
5054
|
+
# "timestamp": 1721365261438,
|
5055
|
+
# "data": {
|
5056
|
+
# "takerCommissionRate": "0.0005",
|
5057
|
+
# "makerCommissionRate": "0.0002"
|
5058
|
+
# }
|
5059
|
+
# }
|
5060
|
+
#
|
5061
|
+
commission = data
|
5062
|
+
else:
|
5063
|
+
response = await self.swapV2PrivateGetUserCommissionRate(params)
|
5064
|
+
#
|
5065
|
+
# {
|
5066
|
+
# "code": 0,
|
5067
|
+
# "msg": "",
|
5068
|
+
# "data": {
|
5069
|
+
# "commission": {
|
5070
|
+
# "takerCommissionRate": 0.0005,
|
5071
|
+
# "makerCommissionRate": 0.0002
|
5072
|
+
# }
|
5073
|
+
# }
|
5074
|
+
# }
|
5075
|
+
#
|
5076
|
+
commission = self.safe_dict(data, 'commission', {})
|
5077
|
+
return self.parse_trading_fee(commission, market)
|
5078
|
+
|
5079
|
+
def parse_trading_fee(self, fee: dict, market: Market = None) -> TradingFeeInterface:
|
5080
|
+
#
|
5081
|
+
# {
|
5082
|
+
# "takerCommissionRate": 0.001,
|
5083
|
+
# "makerCommissionRate": 0.001
|
5084
|
+
# }
|
5085
|
+
#
|
5086
|
+
symbol = market['symbol'] if (market is not None) else None
|
5087
|
+
return {
|
5088
|
+
'info': fee,
|
5089
|
+
'symbol': symbol,
|
5090
|
+
'maker': self.safe_number(fee, 'makerCommissionRate'),
|
5091
|
+
'taker': self.safe_number(fee, 'takerCommissionRate'),
|
5092
|
+
'percentage': False,
|
5093
|
+
'tierBased': False,
|
5094
|
+
}
|
5095
|
+
|
5014
5096
|
def sign(self, path, section='public', method='GET', params={}, headers=None, body=None):
|
5015
5097
|
type = section[0]
|
5016
5098
|
version = section[1]
|
ccxt/async_support/bitfinex.py
CHANGED
@@ -1556,7 +1556,7 @@ class bitfinex(Exchange, ImplicitAPI):
|
|
1556
1556
|
# ]
|
1557
1557
|
#
|
1558
1558
|
response = self.safe_value(responses, 0, {})
|
1559
|
-
id = self.
|
1559
|
+
id = self.safe_integer(response, 'withdrawal_id')
|
1560
1560
|
message = self.safe_string(response, 'message')
|
1561
1561
|
errorMessage = self.find_broadly_matched_key(self.exceptions['broad'], message)
|
1562
1562
|
if id == 0:
|
ccxt/async_support/bitfinex2.py
CHANGED
@@ -2237,7 +2237,7 @@ class bitfinex2(Exchange, ImplicitAPI):
|
|
2237
2237
|
if feeCost is not None:
|
2238
2238
|
feeCost = Precise.string_abs(feeCost)
|
2239
2239
|
amount = self.safe_number(data, 5)
|
2240
|
-
id = self.
|
2240
|
+
id = self.safe_integer(data, 0)
|
2241
2241
|
status = 'ok'
|
2242
2242
|
if id == 0:
|
2243
2243
|
id = None
|
ccxt/async_support/bybit.py
CHANGED
@@ -2914,7 +2914,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
2914
2914
|
:see: https://bybit-exchange.github.io/docs/v5/asset/all-balance
|
2915
2915
|
:see: https://bybit-exchange.github.io/docs/v5/account/wallet-balance
|
2916
2916
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2917
|
-
:param str [params.type]: wallet type, ['spot', 'swap', '
|
2917
|
+
:param str [params.type]: wallet type, ['spot', 'swap', 'funding']
|
2918
2918
|
:returns dict: a `balance structure <https://docs.ccxt.com/#/?id=balance-structure>`
|
2919
2919
|
"""
|
2920
2920
|
await self.load_markets()
|
@@ -2922,10 +2922,17 @@ class bybit(Exchange, ImplicitAPI):
|
|
2922
2922
|
enableUnifiedMargin, enableUnifiedAccount = await self.is_unified_enabled()
|
2923
2923
|
isUnifiedAccount = (enableUnifiedMargin or enableUnifiedAccount)
|
2924
2924
|
type = None
|
2925
|
-
|
2925
|
+
# don't use getBybitType here
|
2926
|
+
type, params = self.handle_market_type_and_params('fetchBalance', None, params)
|
2927
|
+
subType = None
|
2928
|
+
subType, params = self.handle_sub_type_and_params('fetchBalance', None, params)
|
2929
|
+
if (type == 'swap') or (type == 'future'):
|
2930
|
+
type = subType
|
2931
|
+
lowercaseRawType = type.lower() if (type is not None) else None
|
2926
2932
|
isSpot = (type == 'spot')
|
2927
2933
|
isLinear = (type == 'linear')
|
2928
2934
|
isInverse = (type == 'inverse')
|
2935
|
+
isFunding = (lowercaseRawType == 'fund') or (lowercaseRawType == 'funding')
|
2929
2936
|
if isUnifiedAccount:
|
2930
2937
|
if isInverse:
|
2931
2938
|
type = 'contract'
|
@@ -2941,10 +2948,10 @@ class bybit(Exchange, ImplicitAPI):
|
|
2941
2948
|
response = None
|
2942
2949
|
if isSpot and (marginMode is not None):
|
2943
2950
|
response = await self.privateGetV5SpotCrossMarginTradeAccount(self.extend(request, params))
|
2944
|
-
elif
|
2951
|
+
elif isFunding:
|
2945
2952
|
# use self endpoint only we have no other choice
|
2946
2953
|
# because it requires transfer permission
|
2947
|
-
request['accountType'] =
|
2954
|
+
request['accountType'] = 'FUND'
|
2948
2955
|
response = await self.privateGetV5AssetTransferQueryAccountCoinsBalance(self.extend(request, params))
|
2949
2956
|
else:
|
2950
2957
|
request['accountType'] = unifiedType
|
@@ -6,8 +6,9 @@
|
|
6
6
|
from ccxt.async_support.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.independentreserve import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Ticker, Trade, TradingFees
|
9
|
+
from ccxt.base.types import Balances, Currency, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Ticker, Trade, TradingFees, Transaction
|
10
10
|
from typing import List
|
11
|
+
from ccxt.base.errors import BadRequest
|
11
12
|
from ccxt.base.decimal_to_precision import TICK_SIZE
|
12
13
|
from ccxt.base.precise import Precise
|
13
14
|
|
@@ -79,6 +80,7 @@ class independentreserve(Exchange, ImplicitAPI):
|
|
79
80
|
'setLeverage': False,
|
80
81
|
'setMarginMode': False,
|
81
82
|
'setPositionMode': False,
|
83
|
+
'withdraw': True,
|
82
84
|
},
|
83
85
|
'urls': {
|
84
86
|
'logo': 'https://user-images.githubusercontent.com/51840849/87182090-1e9e9080-c2ec-11ea-8e49-563db9a38f37.jpg',
|
@@ -752,6 +754,106 @@ class independentreserve(Exchange, ImplicitAPI):
|
|
752
754
|
'network': None,
|
753
755
|
}
|
754
756
|
|
757
|
+
async def withdraw(self, code: str, amount: float, address: str, tag=None, params={}):
|
758
|
+
"""
|
759
|
+
make a withdrawal
|
760
|
+
:see: https://www.independentreserve.com/features/api#WithdrawDigitalCurrency
|
761
|
+
:param str code: unified currency code
|
762
|
+
:param float amount: the amount to withdraw
|
763
|
+
:param str address: the address to withdraw to
|
764
|
+
:param str tag:
|
765
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
766
|
+
*
|
767
|
+
* EXCHANGE SPECIFIC PARAMETERS
|
768
|
+
:param dict [params.comment]: withdrawal comment, should not exceed 500 characters
|
769
|
+
:returns dict: a `transaction structure <https://docs.ccxt.com/#/?id=transaction-structure>`
|
770
|
+
"""
|
771
|
+
tag, params = self.handle_withdraw_tag_and_params(tag, params)
|
772
|
+
await self.load_markets()
|
773
|
+
currency = self.currency(code)
|
774
|
+
request: dict = {
|
775
|
+
'primaryCurrencyCode': currency['id'],
|
776
|
+
'withdrawalAddress': address,
|
777
|
+
'amount': self.currency_to_precision(code, amount),
|
778
|
+
}
|
779
|
+
if tag is not None:
|
780
|
+
request['destinationTag'] = tag
|
781
|
+
networkCode = None
|
782
|
+
networkCode, params = self.handle_network_code_and_params(params)
|
783
|
+
if networkCode is not None:
|
784
|
+
raise BadRequest(self.id + ' withdraw() does not accept params["networkCode"]')
|
785
|
+
response = await self.privatePostWithdrawDigitalCurrency(self.extend(request, params))
|
786
|
+
#
|
787
|
+
# {
|
788
|
+
# "TransactionGuid": "dc932e19-562b-4c50-821e-a73fd048b93b",
|
789
|
+
# "PrimaryCurrencyCode": "Bch",
|
790
|
+
# "CreatedTimestampUtc": "2020-04-01T05:26:30.5093622+00:00",
|
791
|
+
# "Amount": {
|
792
|
+
# "Total": 0.1231,
|
793
|
+
# "Fee": 0.0001
|
794
|
+
# },
|
795
|
+
# "Destination": {
|
796
|
+
# "Address": "bc1qhpqxkjpvgkckw530yfmxyr53c94q8f4273a7ez",
|
797
|
+
# "Tag": null
|
798
|
+
# },
|
799
|
+
# "Status": "Pending",
|
800
|
+
# "Transaction": null
|
801
|
+
# }
|
802
|
+
#
|
803
|
+
return self.parse_transaction(response, currency)
|
804
|
+
|
805
|
+
def parse_transaction(self, transaction: dict, currency: Currency = None) -> Transaction:
|
806
|
+
#
|
807
|
+
# {
|
808
|
+
# "TransactionGuid": "dc932e19-562b-4c50-821e-a73fd048b93b",
|
809
|
+
# "PrimaryCurrencyCode": "Bch",
|
810
|
+
# "CreatedTimestampUtc": "2020-04-01T05:26:30.5093622+00:00",
|
811
|
+
# "Amount": {
|
812
|
+
# "Total": 0.1231,
|
813
|
+
# "Fee": 0.0001
|
814
|
+
# },
|
815
|
+
# "Destination": {
|
816
|
+
# "Address": "bc1qhpqxkjpvgkckw530yfmxyr53c94q8f4273a7ez",
|
817
|
+
# "Tag": null
|
818
|
+
# },
|
819
|
+
# "Status": "Pending",
|
820
|
+
# "Transaction": null
|
821
|
+
# }
|
822
|
+
#
|
823
|
+
amount = self.safe_dict(transaction, 'Amount')
|
824
|
+
destination = self.safe_dict(transaction, 'Destination')
|
825
|
+
currencyId = self.safe_string(transaction, 'PrimaryCurrencyCode')
|
826
|
+
datetime = self.safe_string(transaction, 'CreatedTimestampUtc')
|
827
|
+
address = self.safe_string(destination, 'Address')
|
828
|
+
tag = self.safe_string(destination, 'Tag')
|
829
|
+
code = self.safe_currency_code(currencyId, currency)
|
830
|
+
return {
|
831
|
+
'info': transaction,
|
832
|
+
'id': self.safe_string(transaction, 'TransactionGuid'),
|
833
|
+
'txid': None,
|
834
|
+
'type': 'withdraw',
|
835
|
+
'currency': code,
|
836
|
+
'network': None,
|
837
|
+
'amount': self.safe_number(amount, 'Total'),
|
838
|
+
'status': self.safe_string(transaction, 'Status'),
|
839
|
+
'timestamp': self.parse8601(datetime),
|
840
|
+
'datetime': datetime,
|
841
|
+
'address': address,
|
842
|
+
'addressFrom': None,
|
843
|
+
'addressTo': address,
|
844
|
+
'tag': tag,
|
845
|
+
'tagFrom': None,
|
846
|
+
'tagTo': tag,
|
847
|
+
'updated': None,
|
848
|
+
'comment': None,
|
849
|
+
'fee': {
|
850
|
+
'currency': code,
|
851
|
+
'cost': self.safe_number(amount, 'Fee'),
|
852
|
+
'rate': None,
|
853
|
+
},
|
854
|
+
'internal': False,
|
855
|
+
}
|
856
|
+
|
755
857
|
def sign(self, path, api='public', method='GET', params={}, headers=None, body=None):
|
756
858
|
url = self.urls['api'][api] + '/' + path
|
757
859
|
if api == 'public':
|
ccxt/async_support/kucoin.py
CHANGED
@@ -179,6 +179,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
179
179
|
'status': 4.5, # 3PW
|
180
180
|
# margin trading
|
181
181
|
'mark-price/{symbol}/current': 3, # 2PW
|
182
|
+
'mark-price/all-symbols': 3,
|
182
183
|
'margin/config': 25, # 25SW
|
183
184
|
},
|
184
185
|
'post': {
|
@@ -664,6 +665,7 @@ class kucoin(Exchange, ImplicitAPI):
|
|
664
665
|
'currencies': 'v3',
|
665
666
|
'currencies/{currency}': 'v3',
|
666
667
|
'symbols': 'v2',
|
668
|
+
'mark-price/all-symbols': 'v3',
|
667
669
|
},
|
668
670
|
},
|
669
671
|
'private': {
|
ccxt/async_support/whitebit.py
CHANGED
@@ -2404,7 +2404,7 @@ class whitebit(Exchange, ImplicitAPI):
|
|
2404
2404
|
records = self.safe_list(response, 'records')
|
2405
2405
|
return self.parse_transactions(records, currency, since, limit)
|
2406
2406
|
|
2407
|
-
def is_fiat(self, currency):
|
2407
|
+
def is_fiat(self, currency: str):
|
2408
2408
|
fiatCurrencies = self.safe_value(self.options, 'fiatCurrencies', [])
|
2409
2409
|
return self.in_array(currency, fiatCurrencies)
|
2410
2410
|
|
ccxt/async_support/woo.py
CHANGED
@@ -2481,7 +2481,21 @@ class woo(Exchange, ImplicitAPI):
|
|
2481
2481
|
}
|
2482
2482
|
|
2483
2483
|
async def fetch_funding_history(self, symbol: Str = None, since: Int = None, limit: Int = None, params={}):
|
2484
|
+
"""
|
2485
|
+
fetch the history of funding payments paid and received on self account
|
2486
|
+
:see: https://docs.woo.org/#get-funding-fee-history
|
2487
|
+
:param str [symbol]: unified market symbol
|
2488
|
+
:param int [since]: the earliest time in ms to fetch funding history for
|
2489
|
+
:param int [limit]: the maximum number of funding history structures to retrieve
|
2490
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
2491
|
+
:param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
2492
|
+
:returns dict: a `funding history structure <https://docs.ccxt.com/#/?id=funding-history-structure>`
|
2493
|
+
"""
|
2484
2494
|
await self.load_markets()
|
2495
|
+
paginate = False
|
2496
|
+
paginate, params = self.handle_option_and_params(params, 'fetchFundingHistory', 'paginate')
|
2497
|
+
if paginate:
|
2498
|
+
return await self.fetch_paginated_call_cursor('fetchFundingHistory', symbol, since, limit, params, 'page', 'page', 1, 500)
|
2485
2499
|
request: dict = {}
|
2486
2500
|
market: Market = None
|
2487
2501
|
if symbol is not None:
|
@@ -2489,6 +2503,10 @@ class woo(Exchange, ImplicitAPI):
|
|
2489
2503
|
request['symbol'] = market['id']
|
2490
2504
|
if since is not None:
|
2491
2505
|
request['start_t'] = since
|
2506
|
+
if limit is not None:
|
2507
|
+
request['size'] = limit
|
2508
|
+
else:
|
2509
|
+
request['size'] = 5000
|
2492
2510
|
response = await self.v1PrivateGetFundingFeeHistory(self.extend(request, params))
|
2493
2511
|
#
|
2494
2512
|
# {
|
@@ -2513,7 +2531,14 @@ class woo(Exchange, ImplicitAPI):
|
|
2513
2531
|
# "success":true
|
2514
2532
|
# }
|
2515
2533
|
#
|
2534
|
+
meta = self.safe_dict(response, 'meta', {})
|
2535
|
+
cursor = self.safe_integer(meta, 'current_page')
|
2516
2536
|
result = self.safe_list(response, 'rows', [])
|
2537
|
+
resultLength = len(result)
|
2538
|
+
if resultLength > 0:
|
2539
|
+
lastItem = result[resultLength - 1]
|
2540
|
+
lastItem['page'] = cursor
|
2541
|
+
result[resultLength - 1] = lastItem
|
2517
2542
|
return self.parse_incomes(result, market, since, limit)
|
2518
2543
|
|
2519
2544
|
def parse_funding_rate(self, fundingRate, market: Market = None):
|
ccxt/async_support/yobit.py
CHANGED
@@ -558,7 +558,7 @@ class yobit(Exchange, ImplicitAPI):
|
|
558
558
|
ids = self.ids
|
559
559
|
else:
|
560
560
|
ids = self.market_ids(symbols)
|
561
|
-
idsLength = len(ids)
|
561
|
+
idsLength: number = len(ids)
|
562
562
|
idsString = '-'.join(ids)
|
563
563
|
maxLength = self.safe_integer(self.options, 'maxUrlLength', 2048)
|
564
564
|
# max URL length is 2048 symbols, including http schema, hostname, tld, etc...
|
ccxt/async_support/zonda.py
CHANGED
@@ -1467,7 +1467,7 @@ class zonda(Exchange, ImplicitAPI):
|
|
1467
1467
|
# {status: "Ok", errors: []}
|
1468
1468
|
return self.parse_order(response)
|
1469
1469
|
|
1470
|
-
def is_fiat(self, currency):
|
1470
|
+
def is_fiat(self, currency: str):
|
1471
1471
|
fiatCurrencies: dict = {
|
1472
1472
|
'USD': True,
|
1473
1473
|
'EUR': True,
|
ccxt/base/exchange.py
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
# -----------------------------------------------------------------------------
|
6
6
|
|
7
|
-
__version__ = '4.3.
|
7
|
+
__version__ = '4.3.65'
|
8
8
|
|
9
9
|
# -----------------------------------------------------------------------------
|
10
10
|
|
@@ -4182,14 +4182,14 @@ class Exchange(object):
|
|
4182
4182
|
self.load_markets()
|
4183
4183
|
market = self.market(symbol)
|
4184
4184
|
symbol = market['symbol']
|
4185
|
-
tickers = self.
|
4185
|
+
tickers = self.fetch_tickers_ws([symbol], params)
|
4186
4186
|
ticker = self.safe_dict(tickers, symbol)
|
4187
4187
|
if ticker is None:
|
4188
|
-
raise NullResponse(self.id + '
|
4188
|
+
raise NullResponse(self.id + ' fetchTickerWs() could not find a ticker for ' + symbol)
|
4189
4189
|
else:
|
4190
4190
|
return ticker
|
4191
4191
|
else:
|
4192
|
-
raise NotSupported(self.id + '
|
4192
|
+
raise NotSupported(self.id + ' fetchTickerWs() is not supported yet')
|
4193
4193
|
|
4194
4194
|
def watch_ticker(self, symbol: str, params={}):
|
4195
4195
|
raise NotSupported(self.id + ' watchTicker() is not supported yet')
|
ccxt/bingx.py
CHANGED
@@ -7,7 +7,7 @@ from ccxt.base.exchange import Exchange
|
|
7
7
|
from ccxt.abstract.bingx import ImplicitAPI
|
8
8
|
import hashlib
|
9
9
|
import numbers
|
10
|
-
from ccxt.base.types import Balances, Currencies, Currency, Int, Leverage, MarginMode, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, Transaction, TransferEntry, TransferEntries
|
10
|
+
from ccxt.base.types import Balances, Currencies, Currency, Int, Leverage, MarginMode, MarginModification, Market, Num, Order, OrderBook, OrderRequest, OrderSide, OrderType, Position, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, Transaction, TransferEntry, TransferEntries
|
11
11
|
from typing import List
|
12
12
|
from ccxt.base.errors import ExchangeError
|
13
13
|
from ccxt.base.errors import AuthenticationError
|
@@ -94,6 +94,7 @@ class bingx(Exchange, ImplicitAPI):
|
|
94
94
|
'fetchTickers': True,
|
95
95
|
'fetchTime': True,
|
96
96
|
'fetchTrades': True,
|
97
|
+
'fetchTradingFee': True,
|
97
98
|
'fetchTransfers': True,
|
98
99
|
'fetchWithdrawals': True,
|
99
100
|
'reduceMargin': True,
|
@@ -5010,6 +5011,87 @@ class bingx(Exchange, ImplicitAPI):
|
|
5010
5011
|
'marginMode': marginType,
|
5011
5012
|
}
|
5012
5013
|
|
5014
|
+
def fetch_trading_fee(self, symbol: str, params={}) -> TradingFeeInterface:
|
5015
|
+
"""
|
5016
|
+
fetch the trading fees for a market
|
5017
|
+
:see: https://bingx-api.github.io/docs/#/en-us/spot/trade-api.html#Query%20Trading%20Commission%20Rate
|
5018
|
+
:see: https://bingx-api.github.io/docs/#/en-us/swapV2/account-api.html#Query%20Trading%20Commission%20Rate
|
5019
|
+
:see: https://bingx-api.github.io/docs/#/en-us/cswap/trade-api.html#Query%20Trade%20Commission%20Rate
|
5020
|
+
:param str symbol: unified market symbol
|
5021
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
5022
|
+
:returns dict: a `fee structure <https://docs.ccxt.com/#/?id=fee-structure>`
|
5023
|
+
"""
|
5024
|
+
self.load_markets()
|
5025
|
+
market = self.market(symbol)
|
5026
|
+
request: dict = {
|
5027
|
+
'symbol': market['id'],
|
5028
|
+
}
|
5029
|
+
response = None
|
5030
|
+
commission: dict = {}
|
5031
|
+
data = self.safe_dict(response, 'data', {})
|
5032
|
+
if market['spot']:
|
5033
|
+
response = self.spotV1PrivateGetUserCommissionRate(self.extend(request, params))
|
5034
|
+
#
|
5035
|
+
# {
|
5036
|
+
# "code": 0,
|
5037
|
+
# "msg": "",
|
5038
|
+
# "debugMsg": "",
|
5039
|
+
# "data": {
|
5040
|
+
# "takerCommissionRate": 0.001,
|
5041
|
+
# "makerCommissionRate": 0.001
|
5042
|
+
# }
|
5043
|
+
# }
|
5044
|
+
#
|
5045
|
+
commission = data
|
5046
|
+
else:
|
5047
|
+
if market['inverse']:
|
5048
|
+
response = self.cswapV1PrivateGetUserCommissionRate(params)
|
5049
|
+
#
|
5050
|
+
# {
|
5051
|
+
# "code": 0,
|
5052
|
+
# "msg": "",
|
5053
|
+
# "timestamp": 1721365261438,
|
5054
|
+
# "data": {
|
5055
|
+
# "takerCommissionRate": "0.0005",
|
5056
|
+
# "makerCommissionRate": "0.0002"
|
5057
|
+
# }
|
5058
|
+
# }
|
5059
|
+
#
|
5060
|
+
commission = data
|
5061
|
+
else:
|
5062
|
+
response = self.swapV2PrivateGetUserCommissionRate(params)
|
5063
|
+
#
|
5064
|
+
# {
|
5065
|
+
# "code": 0,
|
5066
|
+
# "msg": "",
|
5067
|
+
# "data": {
|
5068
|
+
# "commission": {
|
5069
|
+
# "takerCommissionRate": 0.0005,
|
5070
|
+
# "makerCommissionRate": 0.0002
|
5071
|
+
# }
|
5072
|
+
# }
|
5073
|
+
# }
|
5074
|
+
#
|
5075
|
+
commission = self.safe_dict(data, 'commission', {})
|
5076
|
+
return self.parse_trading_fee(commission, market)
|
5077
|
+
|
5078
|
+
def parse_trading_fee(self, fee: dict, market: Market = None) -> TradingFeeInterface:
|
5079
|
+
#
|
5080
|
+
# {
|
5081
|
+
# "takerCommissionRate": 0.001,
|
5082
|
+
# "makerCommissionRate": 0.001
|
5083
|
+
# }
|
5084
|
+
#
|
5085
|
+
symbol = market['symbol'] if (market is not None) else None
|
5086
|
+
return {
|
5087
|
+
'info': fee,
|
5088
|
+
'symbol': symbol,
|
5089
|
+
'maker': self.safe_number(fee, 'makerCommissionRate'),
|
5090
|
+
'taker': self.safe_number(fee, 'takerCommissionRate'),
|
5091
|
+
'percentage': False,
|
5092
|
+
'tierBased': False,
|
5093
|
+
}
|
5094
|
+
|
5013
5095
|
def sign(self, path, section='public', method='GET', params={}, headers=None, body=None):
|
5014
5096
|
type = section[0]
|
5015
5097
|
version = section[1]
|
ccxt/bitfinex.py
CHANGED
@@ -1556,7 +1556,7 @@ class bitfinex(Exchange, ImplicitAPI):
|
|
1556
1556
|
# ]
|
1557
1557
|
#
|
1558
1558
|
response = self.safe_value(responses, 0, {})
|
1559
|
-
id = self.
|
1559
|
+
id = self.safe_integer(response, 'withdrawal_id')
|
1560
1560
|
message = self.safe_string(response, 'message')
|
1561
1561
|
errorMessage = self.find_broadly_matched_key(self.exceptions['broad'], message)
|
1562
1562
|
if id == 0:
|
ccxt/bitfinex2.py
CHANGED
@@ -2237,7 +2237,7 @@ class bitfinex2(Exchange, ImplicitAPI):
|
|
2237
2237
|
if feeCost is not None:
|
2238
2238
|
feeCost = Precise.string_abs(feeCost)
|
2239
2239
|
amount = self.safe_number(data, 5)
|
2240
|
-
id = self.
|
2240
|
+
id = self.safe_integer(data, 0)
|
2241
2241
|
status = 'ok'
|
2242
2242
|
if id == 0:
|
2243
2243
|
id = None
|