ccxt 4.3.2__py2.py3-none-any.whl → 4.3.3__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/async_support/__init__.py +1 -1
- ccxt/async_support/base/exchange.py +1 -1
- ccxt/async_support/binance.py +295 -20
- ccxt/async_support/bingx.py +4 -4
- ccxt/async_support/bitget.py +69 -1
- ccxt/async_support/coinbase.py +8 -1
- ccxt/async_support/hyperliquid.py +85 -13
- ccxt/async_support/okx.py +108 -0
- ccxt/async_support/poloniexfutures.py +9 -2
- ccxt/async_support/woo.py +102 -6
- ccxt/base/exchange.py +20 -1
- ccxt/binance.py +295 -20
- ccxt/bingx.py +4 -4
- ccxt/bitget.py +69 -1
- ccxt/coinbase.py +8 -1
- ccxt/hyperliquid.py +85 -13
- ccxt/okx.py +108 -0
- ccxt/poloniexfutures.py +9 -2
- ccxt/pro/__init__.py +1 -1
- ccxt/pro/hyperliquid.py +8 -7
- ccxt/pro/kraken.py +1 -1
- ccxt/pro/wazirx.py +2 -1
- ccxt/woo.py +102 -6
- {ccxt-4.3.2.dist-info → ccxt-4.3.3.dist-info}/METADATA +4 -4
- {ccxt-4.3.2.dist-info → ccxt-4.3.3.dist-info}/RECORD +28 -28
- {ccxt-4.3.2.dist-info → ccxt-4.3.3.dist-info}/WHEEL +0 -0
- {ccxt-4.3.2.dist-info → ccxt-4.3.3.dist-info}/top_level.txt +0 -0
ccxt/binance.py
CHANGED
@@ -95,7 +95,9 @@ class binance(Exchange, ImplicitAPI):
|
|
95
95
|
'fetchClosedOrder': False,
|
96
96
|
'fetchClosedOrders': 'emulated',
|
97
97
|
'fetchConvertCurrencies': True,
|
98
|
-
'fetchConvertQuote':
|
98
|
+
'fetchConvertQuote': True,
|
99
|
+
'fetchConvertTrade': True,
|
100
|
+
'fetchConvertTradeHistory': True,
|
99
101
|
'fetchCrossBorrowRate': True,
|
100
102
|
'fetchCrossBorrowRates': False,
|
101
103
|
'fetchCurrencies': True,
|
@@ -11637,55 +11639,328 @@ class binance(Exchange, ImplicitAPI):
|
|
11637
11639
|
}
|
11638
11640
|
return result
|
11639
11641
|
|
11640
|
-
def
|
11642
|
+
def fetch_convert_quote(self, fromCode: str, toCode: str, amount: Num = None, params={}) -> Conversion:
|
11641
11643
|
"""
|
11642
|
-
|
11643
|
-
:see: https://binance-docs.github.io/apidocs/spot/en/#
|
11644
|
-
:param str id: the id of the trade that you want to make
|
11644
|
+
fetch a quote for converting from one currency to another
|
11645
|
+
:see: https://binance-docs.github.io/apidocs/spot/en/#send-quote-request-user_data
|
11645
11646
|
:param str fromCode: the currency that you want to sell and convert from
|
11646
11647
|
:param str toCode: the currency that you want to buy and convert into
|
11647
|
-
:param float
|
11648
|
+
:param float amount: how much you want to trade in units of the from currency
|
11648
11649
|
:param dict [params]: extra parameters specific to the exchange API endpoint
|
11650
|
+
:param str [params.walletType]: either 'SPOT' or 'FUNDING', the default is 'SPOT'
|
11649
11651
|
:returns dict: a `conversion structure <https://docs.ccxt.com/#/?id=conversion-structure>`
|
11650
11652
|
"""
|
11653
|
+
if amount is None:
|
11654
|
+
raise ArgumentsRequired(self.id + ' fetchConvertQuote() requires an amount argument')
|
11651
11655
|
self.load_markets()
|
11652
11656
|
request = {
|
11653
|
-
'
|
11654
|
-
'
|
11655
|
-
'
|
11656
|
-
'amount': amount,
|
11657
|
+
'fromAsset': fromCode,
|
11658
|
+
'toAsset': toCode,
|
11659
|
+
'fromAmount': amount,
|
11657
11660
|
}
|
11658
|
-
response = self.
|
11661
|
+
response = self.sapiPostConvertGetQuote(self.extend(request, params))
|
11659
11662
|
#
|
11660
11663
|
# {
|
11661
|
-
# "
|
11662
|
-
# "
|
11664
|
+
# "quoteId":"12415572564",
|
11665
|
+
# "ratio":"38163.7",
|
11666
|
+
# "inverseRatio":"0.0000262",
|
11667
|
+
# "validTimestamp":1623319461670,
|
11668
|
+
# "toAmount":"3816.37",
|
11669
|
+
# "fromAmount":"0.1"
|
11663
11670
|
# }
|
11664
11671
|
#
|
11665
11672
|
fromCurrency = self.currency(fromCode)
|
11666
11673
|
toCurrency = self.currency(toCode)
|
11667
11674
|
return self.parse_conversion(response, fromCurrency, toCurrency)
|
11668
11675
|
|
11676
|
+
def create_convert_trade(self, id: str, fromCode: str, toCode: str, amount: Num = None, params={}) -> Conversion:
|
11677
|
+
"""
|
11678
|
+
convert from one currency to another
|
11679
|
+
:see: https://binance-docs.github.io/apidocs/spot/en/#busd-convert-trade
|
11680
|
+
:see: https://binance-docs.github.io/apidocs/spot/en/#accept-quote-trade
|
11681
|
+
:param str id: the id of the trade that you want to make
|
11682
|
+
:param str fromCode: the currency that you want to sell and convert from
|
11683
|
+
:param str toCode: the currency that you want to buy and convert into
|
11684
|
+
:param float [amount]: how much you want to trade in units of the from currency
|
11685
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
11686
|
+
:returns dict: a `conversion structure <https://docs.ccxt.com/#/?id=conversion-structure>`
|
11687
|
+
"""
|
11688
|
+
self.load_markets()
|
11689
|
+
request = {}
|
11690
|
+
response = None
|
11691
|
+
if (fromCode == 'BUSD') or (toCode == 'BUSD'):
|
11692
|
+
if amount is None:
|
11693
|
+
raise ArgumentsRequired(self.id + ' createConvertTrade() requires an amount argument')
|
11694
|
+
request['clientTranId'] = id
|
11695
|
+
request['asset'] = fromCode
|
11696
|
+
request['targetAsset'] = toCode
|
11697
|
+
request['amount'] = amount
|
11698
|
+
response = self.sapiPostAssetConvertTransfer(self.extend(request, params))
|
11699
|
+
#
|
11700
|
+
# {
|
11701
|
+
# "tranId": 118263407119,
|
11702
|
+
# "status": "S"
|
11703
|
+
# }
|
11704
|
+
#
|
11705
|
+
else:
|
11706
|
+
request['quoteId'] = id
|
11707
|
+
response = self.sapiPostConvertAcceptQuote(self.extend(request, params))
|
11708
|
+
#
|
11709
|
+
# {
|
11710
|
+
# "orderId":"933256278426274426",
|
11711
|
+
# "createTime":1623381330472,
|
11712
|
+
# "orderStatus":"PROCESS"
|
11713
|
+
# }
|
11714
|
+
#
|
11715
|
+
fromCurrency = self.currency(fromCode)
|
11716
|
+
toCurrency = self.currency(toCode)
|
11717
|
+
return self.parse_conversion(response, fromCurrency, toCurrency)
|
11718
|
+
|
11719
|
+
def fetch_convert_trade(self, id: str, code: Str = None, params={}) -> Conversion:
|
11720
|
+
"""
|
11721
|
+
fetch the data for a conversion trade
|
11722
|
+
:see: https://binance-docs.github.io/apidocs/spot/en/#busd-convert-history-user_data
|
11723
|
+
:see: https://binance-docs.github.io/apidocs/spot/en/#order-status-user_data
|
11724
|
+
:param str id: the id of the trade that you want to fetch
|
11725
|
+
:param str [code]: the unified currency code of the conversion trade
|
11726
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
11727
|
+
:returns dict: a `conversion structure <https://docs.ccxt.com/#/?id=conversion-structure>`
|
11728
|
+
"""
|
11729
|
+
self.load_markets()
|
11730
|
+
request = {}
|
11731
|
+
response = None
|
11732
|
+
if code == 'BUSD':
|
11733
|
+
msInDay = 86400000
|
11734
|
+
now = self.milliseconds()
|
11735
|
+
if code is not None:
|
11736
|
+
currency = self.currency(code)
|
11737
|
+
request['asset'] = currency['id']
|
11738
|
+
request['tranId'] = id
|
11739
|
+
request['startTime'] = now - msInDay
|
11740
|
+
request['endTime'] = now
|
11741
|
+
response = self.sapiGetAssetConvertTransferQueryByPage(self.extend(request, params))
|
11742
|
+
#
|
11743
|
+
# {
|
11744
|
+
# "total": 3,
|
11745
|
+
# "rows": [
|
11746
|
+
# {
|
11747
|
+
# "tranId": 118263615991,
|
11748
|
+
# "type": 244,
|
11749
|
+
# "time": 1664442078000,
|
11750
|
+
# "deductedAsset": "BUSD",
|
11751
|
+
# "deductedAmount": "1",
|
11752
|
+
# "targetAsset": "USDC",
|
11753
|
+
# "targetAmount": "1",
|
11754
|
+
# "status": "S",
|
11755
|
+
# "accountType": "MAIN"
|
11756
|
+
# },
|
11757
|
+
# ]
|
11758
|
+
# }
|
11759
|
+
#
|
11760
|
+
else:
|
11761
|
+
request['orderId'] = id
|
11762
|
+
response = self.sapiGetConvertOrderStatus(self.extend(request, params))
|
11763
|
+
#
|
11764
|
+
# {
|
11765
|
+
# "orderId":933256278426274426,
|
11766
|
+
# "orderStatus":"SUCCESS",
|
11767
|
+
# "fromAsset":"BTC",
|
11768
|
+
# "fromAmount":"0.00054414",
|
11769
|
+
# "toAsset":"USDT",
|
11770
|
+
# "toAmount":"20",
|
11771
|
+
# "ratio":"36755",
|
11772
|
+
# "inverseRatio":"0.00002721",
|
11773
|
+
# "createTime":1623381330472
|
11774
|
+
# }
|
11775
|
+
#
|
11776
|
+
data = response
|
11777
|
+
if code == 'BUSD':
|
11778
|
+
rows = self.safe_list(response, 'rows', [])
|
11779
|
+
data = self.safe_dict(rows, 0, {})
|
11780
|
+
fromCurrencyId = self.safe_string_2(data, 'deductedAsset', 'fromAsset')
|
11781
|
+
toCurrencyId = self.safe_string_2(data, 'targetAsset', 'toAsset')
|
11782
|
+
fromCurrency = None
|
11783
|
+
toCurrency = None
|
11784
|
+
if fromCurrencyId is not None:
|
11785
|
+
fromCurrency = self.currency(fromCurrencyId)
|
11786
|
+
if toCurrencyId is not None:
|
11787
|
+
toCurrency = self.currency(toCurrencyId)
|
11788
|
+
return self.parse_conversion(data, fromCurrency, toCurrency)
|
11789
|
+
|
11790
|
+
def fetch_convert_trade_history(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Conversion]:
|
11791
|
+
"""
|
11792
|
+
fetch the users history of conversion trades
|
11793
|
+
:see: https://binance-docs.github.io/apidocs/spot/en/#busd-convert-history-user_data
|
11794
|
+
:see: https://binance-docs.github.io/apidocs/spot/en/#get-convert-trade-history-user_data
|
11795
|
+
:param str [code]: the unified currency code
|
11796
|
+
:param int [since]: the earliest time in ms to fetch conversions for
|
11797
|
+
:param int [limit]: the maximum number of conversion structures to retrieve
|
11798
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
11799
|
+
:param int [params.until]: timestamp in ms of the latest conversion to fetch
|
11800
|
+
:returns dict[]: a list of `conversion structures <https://docs.ccxt.com/#/?id=conversion-structure>`
|
11801
|
+
"""
|
11802
|
+
self.load_markets()
|
11803
|
+
request = {}
|
11804
|
+
msInThirtyDays = 2592000000
|
11805
|
+
now = self.milliseconds()
|
11806
|
+
if since is not None:
|
11807
|
+
request['startTime'] = since
|
11808
|
+
else:
|
11809
|
+
request['startTime'] = now - msInThirtyDays
|
11810
|
+
endTime = self.safe_string_2(params, 'endTime', 'until')
|
11811
|
+
if endTime is not None:
|
11812
|
+
request['endTime'] = endTime
|
11813
|
+
else:
|
11814
|
+
request['endTime'] = now
|
11815
|
+
params = self.omit(params, 'until')
|
11816
|
+
response = None
|
11817
|
+
responseQuery = None
|
11818
|
+
fromCurrencyKey = None
|
11819
|
+
toCurrencyKey = None
|
11820
|
+
if code == 'BUSD':
|
11821
|
+
currency = self.currency(code)
|
11822
|
+
request['asset'] = currency['id']
|
11823
|
+
if limit is not None:
|
11824
|
+
request['size'] = limit
|
11825
|
+
fromCurrencyKey = 'deductedAsset'
|
11826
|
+
toCurrencyKey = 'targetAsset'
|
11827
|
+
responseQuery = 'rows'
|
11828
|
+
response = self.sapiGetAssetConvertTransferQueryByPage(self.extend(request, params))
|
11829
|
+
#
|
11830
|
+
# {
|
11831
|
+
# "total": 3,
|
11832
|
+
# "rows": [
|
11833
|
+
# {
|
11834
|
+
# "tranId": 118263615991,
|
11835
|
+
# "type": 244,
|
11836
|
+
# "time": 1664442078000,
|
11837
|
+
# "deductedAsset": "BUSD",
|
11838
|
+
# "deductedAmount": "1",
|
11839
|
+
# "targetAsset": "USDC",
|
11840
|
+
# "targetAmount": "1",
|
11841
|
+
# "status": "S",
|
11842
|
+
# "accountType": "MAIN"
|
11843
|
+
# },
|
11844
|
+
# ]
|
11845
|
+
# }
|
11846
|
+
#
|
11847
|
+
else:
|
11848
|
+
if limit is not None:
|
11849
|
+
request['limit'] = limit
|
11850
|
+
fromCurrencyKey = 'fromAsset'
|
11851
|
+
toCurrencyKey = 'toAsset'
|
11852
|
+
responseQuery = 'list'
|
11853
|
+
response = self.sapiGetConvertTradeFlow(self.extend(request, params))
|
11854
|
+
#
|
11855
|
+
# {
|
11856
|
+
# "list": [
|
11857
|
+
# {
|
11858
|
+
# "quoteId": "f3b91c525b2644c7bc1e1cd31b6e1aa6",
|
11859
|
+
# "orderId": 940708407462087195,
|
11860
|
+
# "orderStatus": "SUCCESS",
|
11861
|
+
# "fromAsset": "USDT",
|
11862
|
+
# "fromAmount": "20",
|
11863
|
+
# "toAsset": "BNB",
|
11864
|
+
# "toAmount": "0.06154036",
|
11865
|
+
# "ratio": "0.00307702",
|
11866
|
+
# "inverseRatio": "324.99",
|
11867
|
+
# "createTime": 1624248872184
|
11868
|
+
# }
|
11869
|
+
# ],
|
11870
|
+
# "startTime": 1623824139000,
|
11871
|
+
# "endTime": 1626416139000,
|
11872
|
+
# "limit": 100,
|
11873
|
+
# "moreData": False
|
11874
|
+
# }
|
11875
|
+
#
|
11876
|
+
rows = self.safe_list(response, responseQuery, [])
|
11877
|
+
return self.parse_conversions(rows, fromCurrencyKey, toCurrencyKey, since, limit)
|
11878
|
+
|
11669
11879
|
def parse_conversion(self, conversion, fromCurrency: Currency = None, toCurrency: Currency = None) -> Conversion:
|
11880
|
+
#
|
11881
|
+
# fetchConvertQuote
|
11882
|
+
#
|
11883
|
+
# {
|
11884
|
+
# "quoteId":"12415572564",
|
11885
|
+
# "ratio":"38163.7",
|
11886
|
+
# "inverseRatio":"0.0000262",
|
11887
|
+
# "validTimestamp":1623319461670,
|
11888
|
+
# "toAmount":"3816.37",
|
11889
|
+
# "fromAmount":"0.1"
|
11890
|
+
# }
|
11670
11891
|
#
|
11671
11892
|
# createConvertTrade
|
11672
11893
|
#
|
11673
11894
|
# {
|
11895
|
+
# "orderId":"933256278426274426",
|
11896
|
+
# "createTime":1623381330472,
|
11897
|
+
# "orderStatus":"PROCESS"
|
11898
|
+
# }
|
11899
|
+
#
|
11900
|
+
# createConvertTrade BUSD
|
11901
|
+
#
|
11902
|
+
# {
|
11674
11903
|
# "tranId": 118263407119,
|
11675
11904
|
# "status": "S"
|
11676
11905
|
# }
|
11677
11906
|
#
|
11678
|
-
|
11679
|
-
|
11907
|
+
# fetchConvertTrade, fetchConvertTradeHistory BUSD
|
11908
|
+
#
|
11909
|
+
# {
|
11910
|
+
# "tranId": 118263615991,
|
11911
|
+
# "type": 244,
|
11912
|
+
# "time": 1664442078000,
|
11913
|
+
# "deductedAsset": "BUSD",
|
11914
|
+
# "deductedAmount": "1",
|
11915
|
+
# "targetAsset": "USDC",
|
11916
|
+
# "targetAmount": "1",
|
11917
|
+
# "status": "S",
|
11918
|
+
# "accountType": "MAIN"
|
11919
|
+
# }
|
11920
|
+
#
|
11921
|
+
# fetchConvertTrade
|
11922
|
+
#
|
11923
|
+
# {
|
11924
|
+
# "orderId":933256278426274426,
|
11925
|
+
# "orderStatus":"SUCCESS",
|
11926
|
+
# "fromAsset":"BTC",
|
11927
|
+
# "fromAmount":"0.00054414",
|
11928
|
+
# "toAsset":"USDT",
|
11929
|
+
# "toAmount":"20",
|
11930
|
+
# "ratio":"36755",
|
11931
|
+
# "inverseRatio":"0.00002721",
|
11932
|
+
# "createTime":1623381330472
|
11933
|
+
# }
|
11934
|
+
#
|
11935
|
+
# fetchConvertTradeHistory
|
11936
|
+
#
|
11937
|
+
# {
|
11938
|
+
# "quoteId": "f3b91c525b2644c7bc1e1cd31b6e1aa6",
|
11939
|
+
# "orderId": 940708407462087195,
|
11940
|
+
# "orderStatus": "SUCCESS",
|
11941
|
+
# "fromAsset": "USDT",
|
11942
|
+
# "fromAmount": "20",
|
11943
|
+
# "toAsset": "BNB",
|
11944
|
+
# "toAmount": "0.06154036",
|
11945
|
+
# "ratio": "0.00307702",
|
11946
|
+
# "inverseRatio": "324.99",
|
11947
|
+
# "createTime": 1624248872184
|
11948
|
+
# }
|
11949
|
+
#
|
11950
|
+
timestamp = self.safe_integer_n(conversion, ['time', 'validTimestamp', 'createTime'])
|
11951
|
+
fromCur = self.safe_string_2(conversion, 'deductedAsset', 'fromAsset')
|
11952
|
+
fromCode = self.safe_currency_code(fromCur, fromCurrency)
|
11953
|
+
to = self.safe_string_2(conversion, 'targetAsset', 'toAsset')
|
11954
|
+
toCode = self.safe_currency_code(to, toCurrency)
|
11680
11955
|
return {
|
11681
11956
|
'info': conversion,
|
11682
|
-
'timestamp':
|
11683
|
-
'datetime':
|
11684
|
-
'id': self.
|
11957
|
+
'timestamp': timestamp,
|
11958
|
+
'datetime': self.iso8601(timestamp),
|
11959
|
+
'id': self.safe_string_n(conversion, ['tranId', 'orderId', 'quoteId']),
|
11685
11960
|
'fromCurrency': fromCode,
|
11686
|
-
'fromAmount':
|
11961
|
+
'fromAmount': self.safe_number_2(conversion, 'deductedAmount', 'fromAmount'),
|
11687
11962
|
'toCurrency': toCode,
|
11688
|
-
'toAmount':
|
11963
|
+
'toAmount': self.safe_number_2(conversion, 'targetAmount', 'toAmount'),
|
11689
11964
|
'price': None,
|
11690
11965
|
'fee': None,
|
11691
11966
|
}
|
ccxt/bingx.py
CHANGED
@@ -19,8 +19,8 @@ from ccxt.base.errors import BadSymbol
|
|
19
19
|
from ccxt.base.errors import InsufficientFunds
|
20
20
|
from ccxt.base.errors import OrderNotFound
|
21
21
|
from ccxt.base.errors import NotSupported
|
22
|
+
from ccxt.base.errors import OperationFailed
|
22
23
|
from ccxt.base.errors import DDoSProtection
|
23
|
-
from ccxt.base.errors import ExchangeNotAvailable
|
24
24
|
from ccxt.base.decimal_to_precision import DECIMAL_PLACES
|
25
25
|
from ccxt.base.precise import Precise
|
26
26
|
|
@@ -398,17 +398,17 @@ class bingx(Exchange, ImplicitAPI):
|
|
398
398
|
'100400': BadRequest,
|
399
399
|
'100421': BadSymbol, # {"code":100421,"msg":"This pair is currently restricted from API trading","debugMsg":""}
|
400
400
|
'100440': ExchangeError,
|
401
|
-
'100500':
|
401
|
+
'100500': OperationFailed, # {"code":100500,"msg":"The current system is busy, please try again later","debugMsg":""}
|
402
402
|
'100503': ExchangeError,
|
403
403
|
'80001': BadRequest,
|
404
|
-
'80012': InsufficientFunds, #
|
404
|
+
'80012': InsufficientFunds, # {"code":80012,"msg":"{\"Code\":101253,\"Msg\":\"margin is not enough\"}}
|
405
405
|
'80014': BadRequest,
|
406
406
|
'80016': OrderNotFound,
|
407
407
|
'80017': OrderNotFound,
|
408
408
|
'100414': AccountSuspended, # {"code":100414,"msg":"Code: 100414, Msg: risk control check fail,code(1)","debugMsg":""}
|
409
409
|
'100419': PermissionDenied, # {"code":100419,"msg":"IP does not match IP whitelist","success":false,"timestamp":1705274099347}
|
410
410
|
'100437': BadRequest, # {"code":100437,"msg":"The withdrawal amount is lower than the minimum limit, please re-enter.","timestamp":1689258588845}
|
411
|
-
'101204': InsufficientFunds, #
|
411
|
+
'101204': InsufficientFunds, # {"code":101204,"msg":"","data":{}}
|
412
412
|
},
|
413
413
|
'broad': {},
|
414
414
|
},
|
ccxt/bitget.py
CHANGED
@@ -87,6 +87,8 @@ class bitget(Exchange, ImplicitAPI):
|
|
87
87
|
'fetchClosedOrders': True,
|
88
88
|
'fetchConvertCurrencies': True,
|
89
89
|
'fetchConvertQuote': True,
|
90
|
+
'fetchConvertTrade': False,
|
91
|
+
'fetchConvertTradeHistory': True,
|
90
92
|
'fetchCrossBorrowRate': True,
|
91
93
|
'fetchCrossBorrowRates': False,
|
92
94
|
'fetchCurrencies': True,
|
@@ -7943,6 +7945,59 @@ class bitget(Exchange, ImplicitAPI):
|
|
7943
7945
|
toCurrency = self.currency(toCurrencyId)
|
7944
7946
|
return self.parse_conversion(data, None, toCurrency)
|
7945
7947
|
|
7948
|
+
def fetch_convert_trade_history(self, code: Str = None, since: Int = None, limit: Int = None, params={}) -> List[Conversion]:
|
7949
|
+
"""
|
7950
|
+
fetch the users history of conversion trades
|
7951
|
+
:see: https://www.bitget.com/api-doc/common/convert/Get-Convert-Record
|
7952
|
+
:param str [code]: the unified currency code
|
7953
|
+
:param int [since]: the earliest time in ms to fetch conversions for
|
7954
|
+
:param int [limit]: the maximum number of conversion structures to retrieve
|
7955
|
+
:param dict [params]: extra parameters specific to the exchange API endpoint
|
7956
|
+
:returns dict[]: a list of `conversion structures <https://docs.ccxt.com/#/?id=conversion-structure>`
|
7957
|
+
"""
|
7958
|
+
self.load_markets()
|
7959
|
+
request = {}
|
7960
|
+
msInDay = 86400000
|
7961
|
+
now = self.milliseconds()
|
7962
|
+
if since is not None:
|
7963
|
+
request['startTime'] = since
|
7964
|
+
else:
|
7965
|
+
request['startTime'] = now - msInDay
|
7966
|
+
endTime = self.safe_string_2(params, 'endTime', 'until')
|
7967
|
+
if endTime is not None:
|
7968
|
+
request['endTime'] = endTime
|
7969
|
+
else:
|
7970
|
+
request['endTime'] = now
|
7971
|
+
if limit is not None:
|
7972
|
+
request['limit'] = limit
|
7973
|
+
params = self.omit(params, 'until')
|
7974
|
+
response = self.privateConvertGetV2ConvertConvertRecord(self.extend(request, params))
|
7975
|
+
#
|
7976
|
+
# {
|
7977
|
+
# "code": "00000",
|
7978
|
+
# "msg": "success",
|
7979
|
+
# "requestTime": 1712124371799,
|
7980
|
+
# "data": {
|
7981
|
+
# "dataList": [
|
7982
|
+
# {
|
7983
|
+
# "id": "1159296505255219205",
|
7984
|
+
# "fromCoin": "USDT",
|
7985
|
+
# "fromCoinSize": "5",
|
7986
|
+
# "cnvtPrice": "0.99940076",
|
7987
|
+
# "toCoin": "USDC",
|
7988
|
+
# "toCoinSize": "4.99700379",
|
7989
|
+
# "ts": "1712123746217",
|
7990
|
+
# "fee": "0"
|
7991
|
+
# }
|
7992
|
+
# ],
|
7993
|
+
# "endId": "1159296505255219205"
|
7994
|
+
# }
|
7995
|
+
# }
|
7996
|
+
#
|
7997
|
+
data = self.safe_dict(response, 'data', {})
|
7998
|
+
dataList = self.safe_list(data, 'dataList', [])
|
7999
|
+
return self.parse_conversions(dataList, 'fromCoin', 'toCoin', since, limit)
|
8000
|
+
|
7946
8001
|
def parse_conversion(self, conversion, fromCurrency: Currency = None, toCurrency: Currency = None) -> Conversion:
|
7947
8002
|
#
|
7948
8003
|
# fetchConvertQuote
|
@@ -7966,6 +8021,19 @@ class bitget(Exchange, ImplicitAPI):
|
|
7966
8021
|
# "ts": "1712123746217"
|
7967
8022
|
# }
|
7968
8023
|
#
|
8024
|
+
# fetchConvertTradeHistory
|
8025
|
+
#
|
8026
|
+
# {
|
8027
|
+
# "id": "1159296505255219205",
|
8028
|
+
# "fromCoin": "USDT",
|
8029
|
+
# "fromCoinSize": "5",
|
8030
|
+
# "cnvtPrice": "0.99940076",
|
8031
|
+
# "toCoin": "USDC",
|
8032
|
+
# "toCoinSize": "4.99700379",
|
8033
|
+
# "ts": "1712123746217",
|
8034
|
+
# "fee": "0"
|
8035
|
+
# }
|
8036
|
+
#
|
7969
8037
|
timestamp = self.safe_integer(conversion, 'ts')
|
7970
8038
|
fromCoin = self.safe_string(conversion, 'fromCoin')
|
7971
8039
|
fromCode = self.safe_currency_code(fromCoin, fromCurrency)
|
@@ -7975,7 +8043,7 @@ class bitget(Exchange, ImplicitAPI):
|
|
7975
8043
|
'info': conversion,
|
7976
8044
|
'timestamp': timestamp,
|
7977
8045
|
'datetime': self.iso8601(timestamp),
|
7978
|
-
'id': self.
|
8046
|
+
'id': self.safe_string_2(conversion, 'id', 'traceId'),
|
7979
8047
|
'fromCurrency': fromCode,
|
7980
8048
|
'fromAmount': self.safe_number(conversion, 'fromCoinSize'),
|
7981
8049
|
'toCurrency': toCode,
|
ccxt/coinbase.py
CHANGED
@@ -2491,7 +2491,7 @@ class coinbase(Exchange, ImplicitAPI):
|
|
2491
2491
|
:param float [params.stopLossPrice]: price to trigger stop-loss orders
|
2492
2492
|
:param float [params.takeProfitPrice]: price to trigger take-profit orders
|
2493
2493
|
:param bool [params.postOnly]: True or False
|
2494
|
-
:param str [params.timeInForce]: 'GTC', 'IOC', 'GTD' or 'PO'
|
2494
|
+
:param str [params.timeInForce]: 'GTC', 'IOC', 'GTD' or 'PO', 'FOK'
|
2495
2495
|
:param str [params.stop_direction]: 'UNKNOWN_STOP_DIRECTION', 'STOP_DIRECTION_STOP_UP', 'STOP_DIRECTION_STOP_DOWN' the direction the stopPrice is triggered from
|
2496
2496
|
:param str [params.end_time]: '2023-05-25T17:01:05.092Z' for 'GTD' orders
|
2497
2497
|
:param float [params.cost]: *spot market buy only* the quote quantity that can be used alternative for the amount
|
@@ -2583,6 +2583,13 @@ class coinbase(Exchange, ImplicitAPI):
|
|
2583
2583
|
'limit_price': self.price_to_precision(symbol, price),
|
2584
2584
|
},
|
2585
2585
|
}
|
2586
|
+
elif timeInForce == 'FOK':
|
2587
|
+
request['order_configuration'] = {
|
2588
|
+
'limit_limit_fok': {
|
2589
|
+
'base_size': self.amount_to_precision(symbol, amount),
|
2590
|
+
'limit_price': self.price_to_precision(symbol, price),
|
2591
|
+
},
|
2592
|
+
}
|
2586
2593
|
else:
|
2587
2594
|
request['order_configuration'] = {
|
2588
2595
|
'limit_limit_gtc': {
|