ccxt 4.4.26__py2.py3-none-any.whl → 4.4.27__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 +1 -1
- ccxt/abstract/alpaca.py +2 -0
- ccxt/abstract/hyperliquid.py +1 -1
- ccxt/ace.py +1 -1
- ccxt/alpaca.py +182 -6
- ccxt/ascendex.py +1 -1
- ccxt/async_support/__init__.py +1 -1
- ccxt/async_support/ace.py +1 -1
- ccxt/async_support/alpaca.py +182 -6
- ccxt/async_support/ascendex.py +1 -1
- ccxt/async_support/base/exchange.py +19 -1
- ccxt/async_support/bequant.py +1 -1
- ccxt/async_support/bigone.py +1 -1
- ccxt/async_support/binance.py +1 -1
- ccxt/async_support/binancecoinm.py +1 -1
- ccxt/async_support/binanceus.py +1 -1
- ccxt/async_support/binanceusdm.py +1 -1
- ccxt/async_support/bingx.py +23 -28
- ccxt/async_support/bit2c.py +1 -1
- ccxt/async_support/bitbank.py +1 -1
- ccxt/async_support/bitbns.py +1 -1
- ccxt/async_support/bitfinex.py +1 -1
- ccxt/async_support/bitfinex2.py +1 -1
- ccxt/async_support/bitflyer.py +1 -1
- ccxt/async_support/bitget.py +1 -1
- ccxt/async_support/bithumb.py +1 -1
- ccxt/async_support/bitmart.py +1 -1
- ccxt/async_support/bitmex.py +1 -1
- ccxt/async_support/bitopro.py +1 -1
- ccxt/async_support/bitrue.py +1 -1
- ccxt/async_support/bitso.py +1 -1
- ccxt/async_support/bitstamp.py +1 -1
- ccxt/async_support/bitteam.py +1 -1
- ccxt/async_support/bitvavo.py +1 -1
- ccxt/async_support/bl3p.py +1 -1
- ccxt/async_support/blockchaincom.py +1 -1
- ccxt/async_support/blofin.py +1 -1
- ccxt/async_support/btcalpha.py +1 -1
- ccxt/async_support/btcbox.py +1 -1
- ccxt/async_support/btcmarkets.py +1 -1
- ccxt/async_support/btcturk.py +1 -1
- ccxt/async_support/bybit.py +4 -1
- ccxt/async_support/coinbase.py +89 -11
- ccxt/async_support/coinex.py +1 -1
- ccxt/async_support/gate.py +20 -16
- ccxt/async_support/hyperliquid.py +19 -1
- ccxt/async_support/lbank.py +97 -2
- ccxt/async_support/wavesexchange.py +13 -2
- ccxt/base/exchange.py +19 -1
- ccxt/bequant.py +1 -1
- ccxt/bigone.py +1 -1
- ccxt/binance.py +1 -1
- ccxt/binancecoinm.py +1 -1
- ccxt/binanceus.py +1 -1
- ccxt/binanceusdm.py +1 -1
- ccxt/bingx.py +23 -28
- ccxt/bit2c.py +1 -1
- ccxt/bitbank.py +1 -1
- ccxt/bitbns.py +1 -1
- ccxt/bitfinex.py +1 -1
- ccxt/bitfinex2.py +1 -1
- ccxt/bitflyer.py +1 -1
- ccxt/bitget.py +1 -1
- ccxt/bithumb.py +1 -1
- ccxt/bitmart.py +1 -1
- ccxt/bitmex.py +1 -1
- ccxt/bitopro.py +1 -1
- ccxt/bitrue.py +1 -1
- ccxt/bitso.py +1 -1
- ccxt/bitstamp.py +1 -1
- ccxt/bitteam.py +1 -1
- ccxt/bitvavo.py +1 -1
- ccxt/bl3p.py +1 -1
- ccxt/blockchaincom.py +1 -1
- ccxt/blofin.py +1 -1
- ccxt/btcalpha.py +1 -1
- ccxt/btcbox.py +1 -1
- ccxt/btcmarkets.py +1 -1
- ccxt/btcturk.py +1 -1
- ccxt/bybit.py +4 -1
- ccxt/coinbase.py +89 -11
- ccxt/coinex.py +1 -1
- ccxt/gate.py +20 -16
- ccxt/hyperliquid.py +19 -1
- ccxt/lbank.py +97 -2
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/binance.py +2 -2
- ccxt/pro/bybit.py +1 -1
- ccxt/pro/lbank.py +7 -4
- ccxt/pro/okx.py +1 -1
- ccxt/wavesexchange.py +13 -2
- ccxt-4.4.27.dist-info/METADATA +637 -0
- {ccxt-4.4.26.dist-info → ccxt-4.4.27.dist-info}/RECORD +96 -96
- ccxt-4.4.26.dist-info/METADATA +0 -636
- {ccxt-4.4.26.dist-info → ccxt-4.4.27.dist-info}/LICENSE.txt +0 -0
- {ccxt-4.4.26.dist-info → ccxt-4.4.27.dist-info}/WHEEL +0 -0
- {ccxt-4.4.26.dist-info → ccxt-4.4.27.dist-info}/top_level.txt +0 -0
ccxt/blofin.py
CHANGED
@@ -162,7 +162,7 @@ class blofin(Exchange, ImplicitAPI):
|
|
162
162
|
},
|
163
163
|
'hostname': 'www.blofin.com',
|
164
164
|
'urls': {
|
165
|
-
'logo': 'https://github.com/
|
165
|
+
'logo': 'https://github.com/user-attachments/assets/518cdf80-f05d-4821-a3e3-d48ceb41d73b',
|
166
166
|
'api': {
|
167
167
|
'rest': 'https://openapi.blofin.com',
|
168
168
|
},
|
ccxt/btcalpha.py
CHANGED
@@ -103,7 +103,7 @@ class btcalpha(Exchange, ImplicitAPI):
|
|
103
103
|
'1d': 'D',
|
104
104
|
},
|
105
105
|
'urls': {
|
106
|
-
'logo': 'https://
|
106
|
+
'logo': 'https://github.com/user-attachments/assets/dce49f3a-61e5-4ba0-a2fe-41d192fd0e5d',
|
107
107
|
'api': {
|
108
108
|
'rest': 'https://btc-alpha.com/api',
|
109
109
|
},
|
ccxt/btcbox.py
CHANGED
@@ -88,7 +88,7 @@ class btcbox(Exchange, ImplicitAPI):
|
|
88
88
|
'ws': False,
|
89
89
|
},
|
90
90
|
'urls': {
|
91
|
-
'logo': 'https://
|
91
|
+
'logo': 'https://github.com/user-attachments/assets/1e2cb499-8d0f-4f8f-9464-3c015cfbc76b',
|
92
92
|
'api': {
|
93
93
|
'rest': 'https://www.btcbox.co.jp/api',
|
94
94
|
},
|
ccxt/btcmarkets.py
CHANGED
@@ -91,7 +91,7 @@ class btcmarkets(Exchange, ImplicitAPI):
|
|
91
91
|
'withdraw': True,
|
92
92
|
},
|
93
93
|
'urls': {
|
94
|
-
'logo': 'https://
|
94
|
+
'logo': 'https://github.com/user-attachments/assets/8c8d6907-3873-4cc4-ad20-e22fba28247e',
|
95
95
|
'api': {
|
96
96
|
'public': 'https://api.btcmarkets.net',
|
97
97
|
'private': 'https://api.btcmarkets.net',
|
ccxt/btcturk.py
CHANGED
@@ -93,7 +93,7 @@ class btcturk(Exchange, ImplicitAPI):
|
|
93
93
|
'1y': '1 y',
|
94
94
|
},
|
95
95
|
'urls': {
|
96
|
-
'logo': 'https://
|
96
|
+
'logo': 'https://github.com/user-attachments/assets/10e0a238-9f60-4b06-9dda-edfc7602f1d6',
|
97
97
|
'api': {
|
98
98
|
'public': 'https://api.btcturk.com/api/v2',
|
99
99
|
'private': 'https://api.btcturk.com/api/v1',
|
ccxt/bybit.py
CHANGED
@@ -173,7 +173,7 @@ class bybit(Exchange, ImplicitAPI):
|
|
173
173
|
'public': 'https://api-testnet.{hostname}',
|
174
174
|
'private': 'https://api-testnet.{hostname}',
|
175
175
|
},
|
176
|
-
'logo': 'https://
|
176
|
+
'logo': 'https://github.com/user-attachments/assets/97a5d0b3-de10-423d-90e1-6620960025ed',
|
177
177
|
'api': {
|
178
178
|
'spot': 'https://api.{hostname}',
|
179
179
|
'futures': 'https://api.{hostname}',
|
@@ -2487,6 +2487,9 @@ class bybit(Exchange, ImplicitAPI):
|
|
2487
2487
|
#
|
2488
2488
|
data = self.safe_dict(response, 'result', {})
|
2489
2489
|
tickerList = self.safe_list(data, 'list', [])
|
2490
|
+
timestamp = self.safe_integer(response, 'time')
|
2491
|
+
for i in range(0, len(tickerList)):
|
2492
|
+
tickerList[i]['timestamp'] = timestamp # will be removed inside the parser
|
2490
2493
|
result = self.parse_funding_rates(tickerList)
|
2491
2494
|
return self.filter_by_array(result, 'symbol', symbols)
|
2492
2495
|
|
ccxt/coinbase.py
CHANGED
@@ -89,6 +89,7 @@ class coinbase(Exchange, ImplicitAPI):
|
|
89
89
|
'fetchDepositAddresses': False,
|
90
90
|
'fetchDepositAddressesByNetwork': True,
|
91
91
|
'fetchDeposits': True,
|
92
|
+
'fetchDepositsWithdrawals': True,
|
92
93
|
'fetchFundingHistory': False,
|
93
94
|
'fetchFundingRate': False,
|
94
95
|
'fetchFundingRateHistory': False,
|
@@ -757,8 +758,14 @@ class coinbase(Exchange, ImplicitAPI):
|
|
757
758
|
:param int [since]: the earliest time in ms to fetch withdrawals for
|
758
759
|
:param int [limit]: the maximum number of withdrawals structures to retrieve
|
759
760
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
761
|
+
:param str [params.currencyType]: "fiat" or "crypto"
|
760
762
|
:returns dict[]: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
|
761
763
|
"""
|
764
|
+
currencyType = None
|
765
|
+
currencyType, params = self.handle_option_and_params(params, 'fetchWithdrawals', 'currencyType')
|
766
|
+
if currencyType == 'crypto':
|
767
|
+
results = self.fetch_transactions_with_method('v2PrivateGetAccountsAccountIdTransactions', code, since, limit, params)
|
768
|
+
return self.filter_by_array(results, 'type', 'withdrawal', False)
|
762
769
|
return self.fetch_transactions_with_method('v2PrivateGetAccountsAccountIdWithdrawals', code, since, limit, params)
|
763
770
|
|
764
771
|
def fetch_deposits(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
|
@@ -769,10 +776,30 @@ class coinbase(Exchange, ImplicitAPI):
|
|
769
776
|
:param int [since]: the earliest time in ms to fetch deposits for
|
770
777
|
:param int [limit]: the maximum number of deposits structures to retrieve
|
771
778
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
779
|
+
:param str [params.currencyType]: "fiat" or "crypto"
|
772
780
|
:returns dict[]: a list of `transaction structures <https://docs.ccxt.com/#/?id=transaction-structure>`
|
773
781
|
"""
|
782
|
+
currencyType = None
|
783
|
+
currencyType, params = self.handle_option_and_params(params, 'fetchWithdrawals', 'currencyType')
|
784
|
+
if currencyType == 'crypto':
|
785
|
+
results = self.fetch_transactions_with_method('v2PrivateGetAccountsAccountIdTransactions', code, since, limit, params)
|
786
|
+
return self.filter_by_array(results, 'type', 'deposit', False)
|
774
787
|
return self.fetch_transactions_with_method('v2PrivateGetAccountsAccountIdDeposits', code, since, limit, params)
|
775
788
|
|
789
|
+
def fetch_deposits_withdrawals(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Transaction]:
|
790
|
+
"""
|
791
|
+
fetch history of deposits and withdrawals
|
792
|
+
:see: https://docs.cdp.coinbase.com/coinbase-app/docs/api-transactions
|
793
|
+
:param str [code]: unified currency code for the currency of the deposit/withdrawals, default is None
|
794
|
+
:param int [since]: timestamp in ms of the earliest deposit/withdrawal, default is None
|
795
|
+
:param int [limit]: max number of deposit/withdrawals to return, default = 50, Min: 1, Max: 100
|
796
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
797
|
+
:returns dict: a list of `transaction structure <https://docs.ccxt.com/#/?id=transaction-structure>`
|
798
|
+
"""
|
799
|
+
self.load_markets()
|
800
|
+
results = self.fetch_transactions_with_method('v2PrivateGetAccountsAccountIdTransactions', code, since, limit, params)
|
801
|
+
return self.filter_by_array(results, 'type', ['deposit', 'withdrawal'], False)
|
802
|
+
|
776
803
|
def parse_transaction_status(self, status: Str):
|
777
804
|
statuses: dict = {
|
778
805
|
'created': 'pending',
|
@@ -896,16 +923,59 @@ class coinbase(Exchange, ImplicitAPI):
|
|
896
923
|
# "hide_native_amount": False
|
897
924
|
# }
|
898
925
|
#
|
926
|
+
#
|
927
|
+
# crypto deposit & withdrawal(using `/transactions` endpoint)
|
928
|
+
# {
|
929
|
+
# "amount": {
|
930
|
+
# "amount": "0.00014200",(negative for withdrawal)
|
931
|
+
# "currency": "BTC"
|
932
|
+
# },
|
933
|
+
# "created_at": "2024-03-29T15:48:30Z",
|
934
|
+
# "id": "0031a605-241d-514d-a97b-d4b99f3225d3",
|
935
|
+
# "idem": "092a979b-017e-4403-940a-2ca57811f442", # field present only in case of withdrawal
|
936
|
+
# "native_amount": {
|
937
|
+
# "amount": "9.85",(negative for withdrawal)
|
938
|
+
# "currency": "USD"
|
939
|
+
# },
|
940
|
+
# "network": {
|
941
|
+
# "status": "pending", # if status is `off_blockchain` then no more other fields are hasattr(self, present) object
|
942
|
+
# "hash": "5jYuvrNsvX2DZoMnzGYzVpYxJLfYu4GSK3xetG1H5LHrSovsuFCFYdFMwNRoiht3s6fBk92MM8QLLnz65xuEFTrE",
|
943
|
+
# "network_name": "solana",
|
944
|
+
# "transaction_fee": {
|
945
|
+
# "amount": "0.000100000",
|
946
|
+
# "currency": "SOL"
|
947
|
+
# }
|
948
|
+
# },
|
949
|
+
# "resource": "transaction",
|
950
|
+
# "resource_path": "/v2/accounts/dc504b1c-248e-5b68-a3b0-b991f7fa84e6/transactions/0031a605-241d-514d-a97b-d4b99f3225d3",
|
951
|
+
# "status": "completed",
|
952
|
+
# "type": "send",
|
953
|
+
# "from": { # in some cases, field might be present for deposit
|
954
|
+
# "id": "7fd10cd7-b091-5cee-ba41-c29e49a7cccf",
|
955
|
+
# "name": "Coinbase",
|
956
|
+
# "resource": "user"
|
957
|
+
# },
|
958
|
+
# "to": { # field only present for withdrawal
|
959
|
+
# "address": "5HA12BNthAvBwNYARYf9y5MqqCpB4qhCNFCs1Qw48ACE",
|
960
|
+
# "resource": "address"
|
961
|
+
# },
|
962
|
+
# "description": "C3 - One Time BTC Credit . Reference Case # 123.", # in some cases, field might be present for deposit
|
963
|
+
# }
|
964
|
+
#
|
899
965
|
transactionType = self.safe_string(transaction, 'type')
|
900
966
|
amountAndCurrencyObject = None
|
901
967
|
feeObject = None
|
968
|
+
network = self.safe_dict(transaction, 'network', {})
|
902
969
|
if transactionType == 'send':
|
903
|
-
|
904
|
-
amountAndCurrencyObject = self.safe_dict(network, 'transaction_amount', {})
|
970
|
+
amountAndCurrencyObject = self.safe_dict(network, 'transaction_amount')
|
905
971
|
feeObject = self.safe_dict(network, 'transaction_fee', {})
|
906
972
|
else:
|
907
|
-
amountAndCurrencyObject = self.safe_dict(transaction, 'subtotal'
|
973
|
+
amountAndCurrencyObject = self.safe_dict(transaction, 'subtotal')
|
908
974
|
feeObject = self.safe_dict(transaction, 'fee', {})
|
975
|
+
if amountAndCurrencyObject is None:
|
976
|
+
amountAndCurrencyObject = self.safe_dict(transaction, 'amount')
|
977
|
+
amountString = self.safe_string(amountAndCurrencyObject, 'amount')
|
978
|
+
amountStringAbs = Precise.string_abs(amountString)
|
909
979
|
status = self.parse_transaction_status(self.safe_string(transaction, 'status'))
|
910
980
|
if status is None:
|
911
981
|
committed = self.safe_bool(transaction, 'committed')
|
@@ -914,23 +984,31 @@ class coinbase(Exchange, ImplicitAPI):
|
|
914
984
|
currencyId = self.safe_string(amountAndCurrencyObject, 'currency')
|
915
985
|
feeCurrencyId = self.safe_string(feeObject, 'currency')
|
916
986
|
datetime = self.safe_string(transaction, 'created_at')
|
917
|
-
|
918
|
-
|
987
|
+
resource = self.safe_string(transaction, 'resource')
|
988
|
+
type = resource
|
989
|
+
if not self.in_array(type, ['deposit', 'withdrawal']):
|
990
|
+
if Precise.string_gt(amountString, '0'):
|
991
|
+
type = 'deposit'
|
992
|
+
elif Precise.string_lt(amountString, '0'):
|
993
|
+
type = 'withdrawal'
|
994
|
+
toObject = self.safe_dict(transaction, 'to')
|
995
|
+
addressTo = self.safe_string(toObject, 'address')
|
996
|
+
networkId = self.safe_string(network, 'network_name')
|
919
997
|
return {
|
920
998
|
'info': transaction,
|
921
999
|
'id': id,
|
922
|
-
'txid': id,
|
1000
|
+
'txid': self.safe_string(network, 'hash', id),
|
923
1001
|
'timestamp': self.parse8601(datetime),
|
924
1002
|
'datetime': datetime,
|
925
|
-
'network':
|
926
|
-
'address':
|
927
|
-
'addressTo':
|
1003
|
+
'network': self.network_id_to_code(networkId),
|
1004
|
+
'address': addressTo,
|
1005
|
+
'addressTo': addressTo,
|
928
1006
|
'addressFrom': None,
|
929
1007
|
'tag': None,
|
930
1008
|
'tagTo': None,
|
931
1009
|
'tagFrom': None,
|
932
|
-
'type':
|
933
|
-
'amount': self.
|
1010
|
+
'type': type,
|
1011
|
+
'amount': self.parse_number(amountStringAbs),
|
934
1012
|
'currency': self.safe_currency_code(currencyId, currency),
|
935
1013
|
'status': status,
|
936
1014
|
'updated': self.parse8601(self.safe_string(transaction, 'updated_at')),
|
ccxt/coinex.py
CHANGED
@@ -4672,7 +4672,7 @@ class coinex(Exchange, ImplicitAPI):
|
|
4672
4672
|
self.load_markets()
|
4673
4673
|
currency = self.currency(code)
|
4674
4674
|
amountToPrecision = self.currency_to_precision(code, amount)
|
4675
|
-
accountsByType = self.safe_dict(self.options, '
|
4675
|
+
accountsByType = self.safe_dict(self.options, 'accountsByType', {})
|
4676
4676
|
fromId = self.safe_string(accountsByType, fromAccount, fromAccount)
|
4677
4677
|
toId = self.safe_string(accountsByType, toAccount, toAccount)
|
4678
4678
|
request: dict = {
|
ccxt/gate.py
CHANGED
@@ -922,22 +922,26 @@ class gate(Exchange, ImplicitAPI):
|
|
922
922
|
"""
|
923
923
|
unifiedAccount = self.safe_bool(self.options, 'unifiedAccount')
|
924
924
|
if unifiedAccount is None:
|
925
|
-
|
926
|
-
|
927
|
-
|
928
|
-
|
929
|
-
|
930
|
-
|
931
|
-
|
932
|
-
|
933
|
-
|
934
|
-
|
935
|
-
|
936
|
-
|
937
|
-
|
938
|
-
|
939
|
-
|
940
|
-
|
925
|
+
try:
|
926
|
+
#
|
927
|
+
# {
|
928
|
+
# "user_id": 10406147,
|
929
|
+
# "ip_whitelist": [],
|
930
|
+
# "currency_pairs": [],
|
931
|
+
# "key": {
|
932
|
+
# "mode": 1
|
933
|
+
# },
|
934
|
+
# "tier": 0,
|
935
|
+
# "tier_expire_time": "0001-01-01T00:00:00Z",
|
936
|
+
# "copy_trading_role": 0
|
937
|
+
# }
|
938
|
+
#
|
939
|
+
response = self.privateAccountGetDetail(params)
|
940
|
+
result = self.safe_dict(response, 'key', {})
|
941
|
+
self.options['unifiedAccount'] = self.safe_integer(result, 'mode') == 2
|
942
|
+
except Exception as e:
|
943
|
+
# if the request fails, the unifiedAccount is disabled
|
944
|
+
self.options['unifiedAccount'] = False
|
941
945
|
|
942
946
|
def upgrade_unified_trade_account(self, params={}):
|
943
947
|
return self.privateUnifiedPutUnifiedMode(params)
|
ccxt/hyperliquid.py
CHANGED
@@ -156,7 +156,17 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
156
156
|
'api': {
|
157
157
|
'public': {
|
158
158
|
'post': {
|
159
|
-
'info':
|
159
|
+
'info': {
|
160
|
+
'cost': 20,
|
161
|
+
'byType': {
|
162
|
+
'l2Book': 2,
|
163
|
+
'allMids': 2,
|
164
|
+
'clearinghouseState': 2,
|
165
|
+
'orderStatus': 2,
|
166
|
+
'spotClearinghouseState': 2,
|
167
|
+
'exchangeStatus': 2,
|
168
|
+
},
|
169
|
+
},
|
160
170
|
},
|
161
171
|
},
|
162
172
|
'private': {
|
@@ -2851,6 +2861,14 @@ class hyperliquid(Exchange, ImplicitAPI):
|
|
2851
2861
|
body = self.json(params)
|
2852
2862
|
return {'url': url, 'method': method, 'body': body, 'headers': headers}
|
2853
2863
|
|
2864
|
+
def calculate_rate_limiter_cost(self, api, method, path, params, config={}):
|
2865
|
+
if ('byType' in config) and ('type' in params):
|
2866
|
+
type = params['type']
|
2867
|
+
byType = config['byType']
|
2868
|
+
if type in byType:
|
2869
|
+
return byType[type]
|
2870
|
+
return self.safe_value(config, 'cost', 1)
|
2871
|
+
|
2854
2872
|
def parse_create_order_args(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
|
2855
2873
|
market = self.market(symbol)
|
2856
2874
|
vaultAddress = self.safe_string(params, 'vaultAddress')
|
ccxt/lbank.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
from ccxt.base.exchange import Exchange
|
7
7
|
from ccxt.abstract.lbank import ImplicitAPI
|
8
8
|
import hashlib
|
9
|
-
from ccxt.base.types import Balances, Currency, DepositAddress, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, Trade, TradingFeeInterface, TradingFees, Transaction
|
9
|
+
from ccxt.base.types import Balances, Currency, DepositAddress, Int, Market, Num, Order, OrderBook, OrderSide, OrderType, Str, Strings, Ticker, Tickers, FundingRate, FundingRates, 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
|
@@ -69,7 +69,7 @@ class lbank(Exchange, ImplicitAPI):
|
|
69
69
|
'fetchFundingHistory': False,
|
70
70
|
'fetchFundingRate': False,
|
71
71
|
'fetchFundingRateHistory': False,
|
72
|
-
'fetchFundingRates':
|
72
|
+
'fetchFundingRates': True,
|
73
73
|
'fetchIndexOHLCV': False,
|
74
74
|
'fetchIsolatedBorrowRate': False,
|
75
75
|
'fetchIsolatedBorrowRates': False,
|
@@ -1132,6 +1132,101 @@ class lbank(Exchange, ImplicitAPI):
|
|
1132
1132
|
return self.safe_balance(result)
|
1133
1133
|
return None
|
1134
1134
|
|
1135
|
+
def parse_funding_rate(self, ticker, market: Market = None) -> FundingRate:
|
1136
|
+
# {
|
1137
|
+
# "symbol": "BTCUSDT",
|
1138
|
+
# "highestPrice": "69495.5",
|
1139
|
+
# "underlyingPrice": "68455.904",
|
1140
|
+
# "lowestPrice": "68182.1",
|
1141
|
+
# "openPrice": "68762.4",
|
1142
|
+
# "positionFeeRate": "0.0001",
|
1143
|
+
# "volume": "33534.2858",
|
1144
|
+
# "markedPrice": "68434.1",
|
1145
|
+
# "turnover": "1200636218.210558",
|
1146
|
+
# "positionFeeTime": "28800",
|
1147
|
+
# "lastPrice": "68427.3",
|
1148
|
+
# "nextFeeTime": "1730736000000",
|
1149
|
+
# "fundingRate": "0.0001",
|
1150
|
+
# }
|
1151
|
+
marketId = self.safe_string(ticker, 'symbol')
|
1152
|
+
symbol = self.safe_symbol(marketId, market)
|
1153
|
+
markPrice = self.safe_number(ticker, 'markedPrice')
|
1154
|
+
indexPrice = self.safe_number(ticker, 'underlyingPrice')
|
1155
|
+
fundingRate = self.safe_number(ticker, 'fundingRate')
|
1156
|
+
fundingTime = self.safe_integer(ticker, 'nextFeeTime')
|
1157
|
+
return {
|
1158
|
+
'info': ticker,
|
1159
|
+
'symbol': symbol,
|
1160
|
+
'markPrice': markPrice,
|
1161
|
+
'indexPrice': indexPrice,
|
1162
|
+
'fundingRate': fundingRate,
|
1163
|
+
'fundingTimestamp': fundingTime,
|
1164
|
+
'fundingDatetime': self.iso8601(fundingTime),
|
1165
|
+
'timestamp': None,
|
1166
|
+
'datetime': None,
|
1167
|
+
'nextFundingRate': None,
|
1168
|
+
'nextFundingTimestamp': None,
|
1169
|
+
'nextFundingDatetime': None,
|
1170
|
+
'previousFundingRate': None,
|
1171
|
+
'previousFundingTimestamp': None,
|
1172
|
+
'previousFundingDatetime': None,
|
1173
|
+
'interval': None,
|
1174
|
+
}
|
1175
|
+
|
1176
|
+
def fetch_funding_rate(self, symbol: str, params={}) -> FundingRate:
|
1177
|
+
"""
|
1178
|
+
fetch the current funding rate
|
1179
|
+
:see: https://www.lbank.com/en-US/docs/contract.html#query-contract-market-list
|
1180
|
+
:param str symbol: unified market symbol
|
1181
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1182
|
+
:returns dict: a `funding rate structure <https://docs.ccxt.com/#/?id=funding-rate-structure>`
|
1183
|
+
"""
|
1184
|
+
self.load_markets()
|
1185
|
+
market = self.market(symbol)
|
1186
|
+
responseForSwap = self.fetch_funding_rates([market['symbol']], params)
|
1187
|
+
return self.safe_value(responseForSwap, market['symbol'])
|
1188
|
+
|
1189
|
+
def fetch_funding_rates(self, symbols: Strings = None, params={}) -> FundingRates:
|
1190
|
+
"""
|
1191
|
+
fetch the funding rate for multiple markets
|
1192
|
+
:see: https://www.lbank.com/en-US/docs/contract.html#query-contract-market-list
|
1193
|
+
:param str[]|None symbols: list of unified market symbols
|
1194
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
1195
|
+
:returns dict: a dictionary of `funding rate structures <https://docs.ccxt.com/#/?id=funding-rates-structure>`, indexed by market symbols
|
1196
|
+
"""
|
1197
|
+
self.load_markets()
|
1198
|
+
symbols = self.market_symbols(symbols)
|
1199
|
+
request: dict = {
|
1200
|
+
'productGroup': 'SwapU',
|
1201
|
+
}
|
1202
|
+
response = self.contractPublicGetCfdOpenApiV1PubMarketData(self.extend(request, params))
|
1203
|
+
# {
|
1204
|
+
# "data": [
|
1205
|
+
# {
|
1206
|
+
# "symbol": "BTCUSDT",
|
1207
|
+
# "highestPrice": "69495.5",
|
1208
|
+
# "underlyingPrice": "68455.904",
|
1209
|
+
# "lowestPrice": "68182.1",
|
1210
|
+
# "openPrice": "68762.4",
|
1211
|
+
# "positionFeeRate": "0.0001",
|
1212
|
+
# "volume": "33534.2858",
|
1213
|
+
# "markedPrice": "68434.1",
|
1214
|
+
# "turnover": "1200636218.210558",
|
1215
|
+
# "positionFeeTime": "28800",
|
1216
|
+
# "lastPrice": "68427.3",
|
1217
|
+
# "nextFeeTime": "1730736000000",
|
1218
|
+
# "fundingRate": "0.0001",
|
1219
|
+
# }
|
1220
|
+
# ],
|
1221
|
+
# "error_code": "0",
|
1222
|
+
# "msg": "Success",
|
1223
|
+
# "result": "true",
|
1224
|
+
# "success": True,
|
1225
|
+
# }
|
1226
|
+
data = self.safe_list(response, 'data', [])
|
1227
|
+
result = self.parse_funding_rates(data)
|
1228
|
+
return self.filter_by_array(result, 'symbol', symbols)
|
1229
|
+
|
1135
1230
|
def fetch_balance(self, params={}) -> Balances:
|
1136
1231
|
"""
|
1137
1232
|
query for balance and get the amount of funds available for trading or funds locked in orders
|
ccxt/pro/__init__.py
CHANGED
ccxt/pro/binance.py
CHANGED
@@ -1359,7 +1359,7 @@ class binance(ccxt.async_support.binance):
|
|
1359
1359
|
filtered = self.filter_by_since_limit(candles, since, limit, 0, True)
|
1360
1360
|
return self.create_ohlcv_object(symbol, timeframe, filtered)
|
1361
1361
|
|
1362
|
-
async def un_watch_ohlcv_for_symbols(self, symbolsAndTimeframes: List[List[str]], params={}):
|
1362
|
+
async def un_watch_ohlcv_for_symbols(self, symbolsAndTimeframes: List[List[str]], params={}) -> Any:
|
1363
1363
|
"""
|
1364
1364
|
unWatches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
1365
1365
|
:see: https://binance-docs.github.io/apidocs/spot/en/#kline-candlestick-data
|
@@ -1819,7 +1819,7 @@ class binance(ccxt.async_support.binance):
|
|
1819
1819
|
symbolsDefined = (symbols is not None)
|
1820
1820
|
if symbolsDefined:
|
1821
1821
|
firstMarket = self.market(symbols[0])
|
1822
|
-
defaultMarket = 'swap' if (isMarkPrice) else
|
1822
|
+
defaultMarket = 'swap' if (isMarkPrice) else None
|
1823
1823
|
marketType, params = self.handle_market_type_and_params(methodName, firstMarket, params, defaultMarket)
|
1824
1824
|
subType = None
|
1825
1825
|
subType, params = self.handle_sub_type_and_params(methodName, firstMarket, params)
|
ccxt/pro/bybit.py
CHANGED
@@ -651,7 +651,7 @@ class bybit(ccxt.async_support.bybit):
|
|
651
651
|
filtered = self.filter_by_since_limit(stored, since, limit, 0, True)
|
652
652
|
return self.create_ohlcv_object(symbol, timeframe, filtered)
|
653
653
|
|
654
|
-
async def un_watch_ohlcv_for_symbols(self, symbolsAndTimeframes: List[List[str]], params={}):
|
654
|
+
async def un_watch_ohlcv_for_symbols(self, symbolsAndTimeframes: List[List[str]], params={}) -> Any:
|
655
655
|
"""
|
656
656
|
unWatches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
657
657
|
:see: https://bybit-exchange.github.io/docs/v5/websocket/public/kline
|
ccxt/pro/lbank.py
CHANGED
@@ -780,10 +780,13 @@ class lbank(ccxt.async_support.lbank):
|
|
780
780
|
# {ping: 'a13a939c-5f25-4e06-9981-93cb3b890707', action: 'ping'}
|
781
781
|
#
|
782
782
|
pingId = self.safe_string(message, 'ping')
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
783
|
+
try:
|
784
|
+
await client.send({
|
785
|
+
'action': 'pong',
|
786
|
+
'pong': pingId,
|
787
|
+
})
|
788
|
+
except Exception as e:
|
789
|
+
self.on_error(client, e)
|
787
790
|
|
788
791
|
def handle_message(self, client, message):
|
789
792
|
status = self.safe_string(message, 'status')
|
ccxt/pro/okx.py
CHANGED
@@ -930,7 +930,7 @@ class okx(ccxt.async_support.okx):
|
|
930
930
|
filtered = self.filter_by_since_limit(candles, since, limit, 0, True)
|
931
931
|
return self.create_ohlcv_object(symbol, timeframe, filtered)
|
932
932
|
|
933
|
-
async def un_watch_ohlcv_for_symbols(self, symbolsAndTimeframes: List[List[str]], params={}):
|
933
|
+
async def un_watch_ohlcv_for_symbols(self, symbolsAndTimeframes: List[List[str]], params={}) -> Any:
|
934
934
|
"""
|
935
935
|
unWatches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
936
936
|
:param str[][] symbolsAndTimeframes: array of arrays containing unified symbols and timeframes to fetch OHLCV data for, example [['BTC/USDT', '1m'], ['LTC/USDT', '5m']]
|
ccxt/wavesexchange.py
CHANGED
@@ -137,7 +137,13 @@ class wavesexchange(Exchange, ImplicitAPI):
|
|
137
137
|
'forward': 'https://wx.network/api/v1/forward/matcher',
|
138
138
|
'market': 'https://wx.network/api/v1/forward/marketdata/api/v1',
|
139
139
|
},
|
140
|
-
'doc':
|
140
|
+
'doc': [
|
141
|
+
'https://docs.wx.network',
|
142
|
+
'https://docs.waves.tech',
|
143
|
+
'https://api.wavesplatform.com/v0/docs/',
|
144
|
+
'https://nodes.wavesnodes.com/api-docs/index.html',
|
145
|
+
'https://matcher.waves.exchange/api-docs/index.html',
|
146
|
+
],
|
141
147
|
'www': 'https://wx.network',
|
142
148
|
},
|
143
149
|
'api': {
|
@@ -601,6 +607,7 @@ class wavesexchange(Exchange, ImplicitAPI):
|
|
601
607
|
def fetch_order_book(self, symbol: str, limit: Int = None, params={}) -> OrderBook:
|
602
608
|
"""
|
603
609
|
fetches information on open orders with bid(buy) and ask(sell) prices, volumes and other data
|
610
|
+
:see: https://matcher.waves.exchange/api-docs/index.html#/markets/getOrderBook
|
604
611
|
:param str symbol: unified symbol of the market to fetch the order book for
|
605
612
|
:param int [limit]: the maximum amount of order book entries to return
|
606
613
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
@@ -721,6 +728,7 @@ class wavesexchange(Exchange, ImplicitAPI):
|
|
721
728
|
def sign_in(self, params={}):
|
722
729
|
"""
|
723
730
|
sign in, must be called prior to using other authenticated methods
|
731
|
+
:see: https://docs.wx.network/en/api/auth/oauth2-token
|
724
732
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
725
733
|
:returns: response from exchange
|
726
734
|
"""
|
@@ -831,6 +839,7 @@ class wavesexchange(Exchange, ImplicitAPI):
|
|
831
839
|
def fetch_ticker(self, symbol: str, params={}) -> Ticker:
|
832
840
|
"""
|
833
841
|
fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
842
|
+
:see: https://api.wavesplatform.com/v0/docs/#/pairs/getPairsListAll
|
834
843
|
:param str symbol: unified symbol of the market to fetch the ticker for
|
835
844
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
836
845
|
:returns dict: a `ticker structure <https://docs.ccxt.com/#/?id=ticker-structure>`
|
@@ -872,7 +881,7 @@ class wavesexchange(Exchange, ImplicitAPI):
|
|
872
881
|
def fetch_tickers(self, symbols: Strings = None, params={}) -> Tickers:
|
873
882
|
"""
|
874
883
|
fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
875
|
-
:param str[]
|
884
|
+
:param str[] [symbols]: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
876
885
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
877
886
|
:returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`
|
878
887
|
"""
|
@@ -911,6 +920,7 @@ class wavesexchange(Exchange, ImplicitAPI):
|
|
911
920
|
def fetch_ohlcv(self, symbol: str, timeframe='1m', since: Int = None, limit: Int = None, params={}) -> List[list]:
|
912
921
|
"""
|
913
922
|
fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
923
|
+
:see: https://api.wavesplatform.com/v0/docs/#/candles/getCandles
|
914
924
|
:param str symbol: unified symbol of the market to fetch OHLCV data for
|
915
925
|
:param str timeframe: the length of time each candle represents
|
916
926
|
:param int [since]: timestamp in ms of the earliest candle to fetch
|
@@ -1216,6 +1226,7 @@ class wavesexchange(Exchange, ImplicitAPI):
|
|
1216
1226
|
def create_order(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
|
1217
1227
|
"""
|
1218
1228
|
create a trade order
|
1229
|
+
:see: https://matcher.waves.exchange/api-docs/index.html#/serialize/serializeOrder
|
1219
1230
|
:param str symbol: unified symbol of the market to create an order in
|
1220
1231
|
:param str type: 'market' or 'limit'
|
1221
1232
|
:param str side: 'buy' or 'sell'
|