ccxt 4.3.2 → 4.3.4
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.
- package/README.md +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +22 -0
- package/dist/cjs/src/binance.js +320 -21
- package/dist/cjs/src/bingx.js +2 -2
- package/dist/cjs/src/bitget.js +76 -1
- package/dist/cjs/src/coinbase.js +9 -1
- package/dist/cjs/src/hyperliquid.js +87 -13
- package/dist/cjs/src/okx.js +116 -0
- package/dist/cjs/src/phemex.js +5 -0
- package/dist/cjs/src/poloniexfutures.js +12 -2
- package/dist/cjs/src/pro/hyperliquid.js +8 -7
- package/dist/cjs/src/pro/kraken.js +1 -1
- package/dist/cjs/src/pro/wazirx.js +2 -1
- package/dist/cjs/src/static_dependencies/jsencrypt/lib/jsrsasign/asn1-1.0.js +27 -2
- package/dist/cjs/src/woo.js +110 -6
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/base/Exchange.d.ts +1 -0
- package/js/src/base/Exchange.js +22 -0
- package/js/src/binance.d.ts +3 -0
- package/js/src/binance.js +320 -21
- package/js/src/bingx.js +3 -3
- package/js/src/bitget.d.ts +1 -0
- package/js/src/bitget.js +76 -1
- package/js/src/coinbase.js +9 -1
- package/js/src/coinbasepro.d.ts +1 -1
- package/js/src/hyperliquid.d.ts +1 -0
- package/js/src/hyperliquid.js +87 -13
- package/js/src/okx.d.ts +2 -0
- package/js/src/okx.js +116 -0
- package/js/src/phemex.js +5 -0
- package/js/src/poloniexfutures.js +12 -2
- package/js/src/pro/hyperliquid.js +8 -7
- package/js/src/pro/kraken.js +1 -1
- package/js/src/pro/wazirx.js +2 -1
- package/js/src/static_dependencies/jsencrypt/JSEncryptRSAKey.d.ts +2 -2
- package/js/src/static_dependencies/jsencrypt/lib/jsrsasign/asn1-1.0.d.ts +24 -357
- package/js/src/static_dependencies/jsencrypt/lib/jsrsasign/asn1-1.0.js +27 -0
- package/js/src/woo.d.ts +2 -0
- package/js/src/woo.js +110 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -213,13 +213,13 @@ console.log(version, Object.keys(exchanges));
|
|
|
213
213
|
|
|
214
214
|
All-in-one browser bundle (dependencies included), served from a CDN of your choice:
|
|
215
215
|
|
|
216
|
-
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.3.
|
|
217
|
-
* unpkg: https://unpkg.com/ccxt@4.3.
|
|
216
|
+
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.3.4/dist/ccxt.browser.js
|
|
217
|
+
* unpkg: https://unpkg.com/ccxt@4.3.4/dist/ccxt.browser.js
|
|
218
218
|
|
|
219
219
|
CDNs are not updated in real-time and may have delays. Defaulting to the most recent version without specifying the version number is not recommended. Please, keep in mind that we are not responsible for the correct operation of those CDN servers.
|
|
220
220
|
|
|
221
221
|
```HTML
|
|
222
|
-
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.3.
|
|
222
|
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.3.4/dist/ccxt.browser.js"></script>
|
|
223
223
|
```
|
|
224
224
|
|
|
225
225
|
Creates a global `ccxt` object:
|
package/dist/cjs/ccxt.js
CHANGED
|
@@ -182,7 +182,7 @@ var woo$1 = require('./src/pro/woo.js');
|
|
|
182
182
|
|
|
183
183
|
//-----------------------------------------------------------------------------
|
|
184
184
|
// this is updated by vss.js when building
|
|
185
|
-
const version = '4.3.
|
|
185
|
+
const version = '4.3.4';
|
|
186
186
|
Exchange["default"].ccxtVersion = version;
|
|
187
187
|
const exchanges = {
|
|
188
188
|
'ace': ace,
|
|
@@ -5809,6 +5809,28 @@ class Exchange {
|
|
|
5809
5809
|
parseLeverage(leverage, market = undefined) {
|
|
5810
5810
|
throw new errors.NotSupported(this.id + ' parseLeverage () is not supported yet');
|
|
5811
5811
|
}
|
|
5812
|
+
parseConversions(conversions, fromCurrencyKey = undefined, toCurrencyKey = undefined, since = undefined, limit = undefined, params = {}) {
|
|
5813
|
+
conversions = this.toArray(conversions);
|
|
5814
|
+
const result = [];
|
|
5815
|
+
let fromCurrency = undefined;
|
|
5816
|
+
let toCurrency = undefined;
|
|
5817
|
+
for (let i = 0; i < conversions.length; i++) {
|
|
5818
|
+
const entry = conversions[i];
|
|
5819
|
+
const fromId = this.safeString(entry, fromCurrencyKey);
|
|
5820
|
+
const toId = this.safeString(entry, toCurrencyKey);
|
|
5821
|
+
if (fromId !== undefined) {
|
|
5822
|
+
fromCurrency = this.currency(fromId);
|
|
5823
|
+
}
|
|
5824
|
+
if (toId !== undefined) {
|
|
5825
|
+
toCurrency = this.currency(toId);
|
|
5826
|
+
}
|
|
5827
|
+
const conversion = this.extend(this.parseConversion(entry, fromCurrency, toCurrency), params);
|
|
5828
|
+
result.push(conversion);
|
|
5829
|
+
}
|
|
5830
|
+
const sorted = this.sortBy(result, 'timestamp');
|
|
5831
|
+
const code = (fromCurrency !== undefined) ? fromCurrency['code'] : undefined;
|
|
5832
|
+
return this.filterByCurrencySinceLimit(sorted, code, since, limit);
|
|
5833
|
+
}
|
|
5812
5834
|
parseConversion(conversion, fromCurrency = undefined, toCurrency = undefined) {
|
|
5813
5835
|
throw new errors.NotSupported(this.id + ' parseConversion () is not supported yet');
|
|
5814
5836
|
}
|
package/dist/cjs/src/binance.js
CHANGED
|
@@ -73,7 +73,9 @@ class binance extends binance$1 {
|
|
|
73
73
|
'fetchClosedOrder': false,
|
|
74
74
|
'fetchClosedOrders': 'emulated',
|
|
75
75
|
'fetchConvertCurrencies': true,
|
|
76
|
-
'fetchConvertQuote':
|
|
76
|
+
'fetchConvertQuote': true,
|
|
77
|
+
'fetchConvertTrade': true,
|
|
78
|
+
'fetchConvertTradeHistory': true,
|
|
77
79
|
'fetchCrossBorrowRate': true,
|
|
78
80
|
'fetchCrossBorrowRates': false,
|
|
79
81
|
'fetchCurrencies': true,
|
|
@@ -12647,57 +12649,354 @@ class binance extends binance$1 {
|
|
|
12647
12649
|
}
|
|
12648
12650
|
return result;
|
|
12649
12651
|
}
|
|
12650
|
-
async
|
|
12652
|
+
async fetchConvertQuote(fromCode, toCode, amount = undefined, params = {}) {
|
|
12651
12653
|
/**
|
|
12652
12654
|
* @method
|
|
12653
|
-
* @name binance#
|
|
12654
|
-
* @description
|
|
12655
|
-
* @see https://binance-docs.github.io/apidocs/spot/en/#
|
|
12656
|
-
* @param {string} id the id of the trade that you want to make
|
|
12655
|
+
* @name binance#fetchConvertQuote
|
|
12656
|
+
* @description fetch a quote for converting from one currency to another
|
|
12657
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#send-quote-request-user_data
|
|
12657
12658
|
* @param {string} fromCode the currency that you want to sell and convert from
|
|
12658
12659
|
* @param {string} toCode the currency that you want to buy and convert into
|
|
12659
|
-
* @param {float}
|
|
12660
|
+
* @param {float} amount how much you want to trade in units of the from currency
|
|
12660
12661
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
12662
|
+
* @param {string} [params.walletType] either 'SPOT' or 'FUNDING', the default is 'SPOT'
|
|
12661
12663
|
* @returns {object} a [conversion structure]{@link https://docs.ccxt.com/#/?id=conversion-structure}
|
|
12662
12664
|
*/
|
|
12665
|
+
if (amount === undefined) {
|
|
12666
|
+
throw new errors.ArgumentsRequired(this.id + ' fetchConvertQuote() requires an amount argument');
|
|
12667
|
+
}
|
|
12663
12668
|
await this.loadMarkets();
|
|
12664
12669
|
const request = {
|
|
12665
|
-
'
|
|
12666
|
-
'
|
|
12667
|
-
'
|
|
12668
|
-
'amount': amount,
|
|
12670
|
+
'fromAsset': fromCode,
|
|
12671
|
+
'toAsset': toCode,
|
|
12672
|
+
'fromAmount': amount,
|
|
12669
12673
|
};
|
|
12670
|
-
const response = await this.
|
|
12674
|
+
const response = await this.sapiPostConvertGetQuote(this.extend(request, params));
|
|
12671
12675
|
//
|
|
12672
12676
|
// {
|
|
12673
|
-
// "
|
|
12674
|
-
// "
|
|
12677
|
+
// "quoteId":"12415572564",
|
|
12678
|
+
// "ratio":"38163.7",
|
|
12679
|
+
// "inverseRatio":"0.0000262",
|
|
12680
|
+
// "validTimestamp":1623319461670,
|
|
12681
|
+
// "toAmount":"3816.37",
|
|
12682
|
+
// "fromAmount":"0.1"
|
|
12675
12683
|
// }
|
|
12676
12684
|
//
|
|
12677
12685
|
const fromCurrency = this.currency(fromCode);
|
|
12678
12686
|
const toCurrency = this.currency(toCode);
|
|
12679
12687
|
return this.parseConversion(response, fromCurrency, toCurrency);
|
|
12680
12688
|
}
|
|
12689
|
+
async createConvertTrade(id, fromCode, toCode, amount = undefined, params = {}) {
|
|
12690
|
+
/**
|
|
12691
|
+
* @method
|
|
12692
|
+
* @name binance#createConvertTrade
|
|
12693
|
+
* @description convert from one currency to another
|
|
12694
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#busd-convert-trade
|
|
12695
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#accept-quote-trade
|
|
12696
|
+
* @param {string} id the id of the trade that you want to make
|
|
12697
|
+
* @param {string} fromCode the currency that you want to sell and convert from
|
|
12698
|
+
* @param {string} toCode the currency that you want to buy and convert into
|
|
12699
|
+
* @param {float} [amount] how much you want to trade in units of the from currency
|
|
12700
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
12701
|
+
* @returns {object} a [conversion structure]{@link https://docs.ccxt.com/#/?id=conversion-structure}
|
|
12702
|
+
*/
|
|
12703
|
+
await this.loadMarkets();
|
|
12704
|
+
const request = {};
|
|
12705
|
+
let response = undefined;
|
|
12706
|
+
if ((fromCode === 'BUSD') || (toCode === 'BUSD')) {
|
|
12707
|
+
if (amount === undefined) {
|
|
12708
|
+
throw new errors.ArgumentsRequired(this.id + ' createConvertTrade() requires an amount argument');
|
|
12709
|
+
}
|
|
12710
|
+
request['clientTranId'] = id;
|
|
12711
|
+
request['asset'] = fromCode;
|
|
12712
|
+
request['targetAsset'] = toCode;
|
|
12713
|
+
request['amount'] = amount;
|
|
12714
|
+
response = await this.sapiPostAssetConvertTransfer(this.extend(request, params));
|
|
12715
|
+
//
|
|
12716
|
+
// {
|
|
12717
|
+
// "tranId": 118263407119,
|
|
12718
|
+
// "status": "S"
|
|
12719
|
+
// }
|
|
12720
|
+
//
|
|
12721
|
+
}
|
|
12722
|
+
else {
|
|
12723
|
+
request['quoteId'] = id;
|
|
12724
|
+
response = await this.sapiPostConvertAcceptQuote(this.extend(request, params));
|
|
12725
|
+
//
|
|
12726
|
+
// {
|
|
12727
|
+
// "orderId":"933256278426274426",
|
|
12728
|
+
// "createTime":1623381330472,
|
|
12729
|
+
// "orderStatus":"PROCESS"
|
|
12730
|
+
// }
|
|
12731
|
+
//
|
|
12732
|
+
}
|
|
12733
|
+
const fromCurrency = this.currency(fromCode);
|
|
12734
|
+
const toCurrency = this.currency(toCode);
|
|
12735
|
+
return this.parseConversion(response, fromCurrency, toCurrency);
|
|
12736
|
+
}
|
|
12737
|
+
async fetchConvertTrade(id, code = undefined, params = {}) {
|
|
12738
|
+
/**
|
|
12739
|
+
* @method
|
|
12740
|
+
* @name binance#fetchConvertTrade
|
|
12741
|
+
* @description fetch the data for a conversion trade
|
|
12742
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#busd-convert-history-user_data
|
|
12743
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#order-status-user_data
|
|
12744
|
+
* @param {string} id the id of the trade that you want to fetch
|
|
12745
|
+
* @param {string} [code] the unified currency code of the conversion trade
|
|
12746
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
12747
|
+
* @returns {object} a [conversion structure]{@link https://docs.ccxt.com/#/?id=conversion-structure}
|
|
12748
|
+
*/
|
|
12749
|
+
await this.loadMarkets();
|
|
12750
|
+
const request = {};
|
|
12751
|
+
let response = undefined;
|
|
12752
|
+
if (code === 'BUSD') {
|
|
12753
|
+
const msInDay = 86400000;
|
|
12754
|
+
const now = this.milliseconds();
|
|
12755
|
+
if (code !== undefined) {
|
|
12756
|
+
const currency = this.currency(code);
|
|
12757
|
+
request['asset'] = currency['id'];
|
|
12758
|
+
}
|
|
12759
|
+
request['tranId'] = id;
|
|
12760
|
+
request['startTime'] = now - msInDay;
|
|
12761
|
+
request['endTime'] = now;
|
|
12762
|
+
response = await this.sapiGetAssetConvertTransferQueryByPage(this.extend(request, params));
|
|
12763
|
+
//
|
|
12764
|
+
// {
|
|
12765
|
+
// "total": 3,
|
|
12766
|
+
// "rows": [
|
|
12767
|
+
// {
|
|
12768
|
+
// "tranId": 118263615991,
|
|
12769
|
+
// "type": 244,
|
|
12770
|
+
// "time": 1664442078000,
|
|
12771
|
+
// "deductedAsset": "BUSD",
|
|
12772
|
+
// "deductedAmount": "1",
|
|
12773
|
+
// "targetAsset": "USDC",
|
|
12774
|
+
// "targetAmount": "1",
|
|
12775
|
+
// "status": "S",
|
|
12776
|
+
// "accountType": "MAIN"
|
|
12777
|
+
// },
|
|
12778
|
+
// ]
|
|
12779
|
+
// }
|
|
12780
|
+
//
|
|
12781
|
+
}
|
|
12782
|
+
else {
|
|
12783
|
+
request['orderId'] = id;
|
|
12784
|
+
response = await this.sapiGetConvertOrderStatus(this.extend(request, params));
|
|
12785
|
+
//
|
|
12786
|
+
// {
|
|
12787
|
+
// "orderId":933256278426274426,
|
|
12788
|
+
// "orderStatus":"SUCCESS",
|
|
12789
|
+
// "fromAsset":"BTC",
|
|
12790
|
+
// "fromAmount":"0.00054414",
|
|
12791
|
+
// "toAsset":"USDT",
|
|
12792
|
+
// "toAmount":"20",
|
|
12793
|
+
// "ratio":"36755",
|
|
12794
|
+
// "inverseRatio":"0.00002721",
|
|
12795
|
+
// "createTime":1623381330472
|
|
12796
|
+
// }
|
|
12797
|
+
//
|
|
12798
|
+
}
|
|
12799
|
+
let data = response;
|
|
12800
|
+
if (code === 'BUSD') {
|
|
12801
|
+
const rows = this.safeList(response, 'rows', []);
|
|
12802
|
+
data = this.safeDict(rows, 0, {});
|
|
12803
|
+
}
|
|
12804
|
+
const fromCurrencyId = this.safeString2(data, 'deductedAsset', 'fromAsset');
|
|
12805
|
+
const toCurrencyId = this.safeString2(data, 'targetAsset', 'toAsset');
|
|
12806
|
+
let fromCurrency = undefined;
|
|
12807
|
+
let toCurrency = undefined;
|
|
12808
|
+
if (fromCurrencyId !== undefined) {
|
|
12809
|
+
fromCurrency = this.currency(fromCurrencyId);
|
|
12810
|
+
}
|
|
12811
|
+
if (toCurrencyId !== undefined) {
|
|
12812
|
+
toCurrency = this.currency(toCurrencyId);
|
|
12813
|
+
}
|
|
12814
|
+
return this.parseConversion(data, fromCurrency, toCurrency);
|
|
12815
|
+
}
|
|
12816
|
+
async fetchConvertTradeHistory(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
12817
|
+
/**
|
|
12818
|
+
* @method
|
|
12819
|
+
* @name binance#fetchConvertTradeHistory
|
|
12820
|
+
* @description fetch the users history of conversion trades
|
|
12821
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#busd-convert-history-user_data
|
|
12822
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#get-convert-trade-history-user_data
|
|
12823
|
+
* @param {string} [code] the unified currency code
|
|
12824
|
+
* @param {int} [since] the earliest time in ms to fetch conversions for
|
|
12825
|
+
* @param {int} [limit] the maximum number of conversion structures to retrieve
|
|
12826
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
12827
|
+
* @param {int} [params.until] timestamp in ms of the latest conversion to fetch
|
|
12828
|
+
* @returns {object[]} a list of [conversion structures]{@link https://docs.ccxt.com/#/?id=conversion-structure}
|
|
12829
|
+
*/
|
|
12830
|
+
await this.loadMarkets();
|
|
12831
|
+
const request = {};
|
|
12832
|
+
const msInThirtyDays = 2592000000;
|
|
12833
|
+
const now = this.milliseconds();
|
|
12834
|
+
if (since !== undefined) {
|
|
12835
|
+
request['startTime'] = since;
|
|
12836
|
+
}
|
|
12837
|
+
else {
|
|
12838
|
+
request['startTime'] = now - msInThirtyDays;
|
|
12839
|
+
}
|
|
12840
|
+
const endTime = this.safeString2(params, 'endTime', 'until');
|
|
12841
|
+
if (endTime !== undefined) {
|
|
12842
|
+
request['endTime'] = endTime;
|
|
12843
|
+
}
|
|
12844
|
+
else {
|
|
12845
|
+
request['endTime'] = now;
|
|
12846
|
+
}
|
|
12847
|
+
params = this.omit(params, 'until');
|
|
12848
|
+
let response = undefined;
|
|
12849
|
+
let responseQuery = undefined;
|
|
12850
|
+
let fromCurrencyKey = undefined;
|
|
12851
|
+
let toCurrencyKey = undefined;
|
|
12852
|
+
if (code === 'BUSD') {
|
|
12853
|
+
const currency = this.currency(code);
|
|
12854
|
+
request['asset'] = currency['id'];
|
|
12855
|
+
if (limit !== undefined) {
|
|
12856
|
+
request['size'] = limit;
|
|
12857
|
+
}
|
|
12858
|
+
fromCurrencyKey = 'deductedAsset';
|
|
12859
|
+
toCurrencyKey = 'targetAsset';
|
|
12860
|
+
responseQuery = 'rows';
|
|
12861
|
+
response = await this.sapiGetAssetConvertTransferQueryByPage(this.extend(request, params));
|
|
12862
|
+
//
|
|
12863
|
+
// {
|
|
12864
|
+
// "total": 3,
|
|
12865
|
+
// "rows": [
|
|
12866
|
+
// {
|
|
12867
|
+
// "tranId": 118263615991,
|
|
12868
|
+
// "type": 244,
|
|
12869
|
+
// "time": 1664442078000,
|
|
12870
|
+
// "deductedAsset": "BUSD",
|
|
12871
|
+
// "deductedAmount": "1",
|
|
12872
|
+
// "targetAsset": "USDC",
|
|
12873
|
+
// "targetAmount": "1",
|
|
12874
|
+
// "status": "S",
|
|
12875
|
+
// "accountType": "MAIN"
|
|
12876
|
+
// },
|
|
12877
|
+
// ]
|
|
12878
|
+
// }
|
|
12879
|
+
//
|
|
12880
|
+
}
|
|
12881
|
+
else {
|
|
12882
|
+
if (limit !== undefined) {
|
|
12883
|
+
request['limit'] = limit;
|
|
12884
|
+
}
|
|
12885
|
+
fromCurrencyKey = 'fromAsset';
|
|
12886
|
+
toCurrencyKey = 'toAsset';
|
|
12887
|
+
responseQuery = 'list';
|
|
12888
|
+
response = await this.sapiGetConvertTradeFlow(this.extend(request, params));
|
|
12889
|
+
//
|
|
12890
|
+
// {
|
|
12891
|
+
// "list": [
|
|
12892
|
+
// {
|
|
12893
|
+
// "quoteId": "f3b91c525b2644c7bc1e1cd31b6e1aa6",
|
|
12894
|
+
// "orderId": 940708407462087195,
|
|
12895
|
+
// "orderStatus": "SUCCESS",
|
|
12896
|
+
// "fromAsset": "USDT",
|
|
12897
|
+
// "fromAmount": "20",
|
|
12898
|
+
// "toAsset": "BNB",
|
|
12899
|
+
// "toAmount": "0.06154036",
|
|
12900
|
+
// "ratio": "0.00307702",
|
|
12901
|
+
// "inverseRatio": "324.99",
|
|
12902
|
+
// "createTime": 1624248872184
|
|
12903
|
+
// }
|
|
12904
|
+
// ],
|
|
12905
|
+
// "startTime": 1623824139000,
|
|
12906
|
+
// "endTime": 1626416139000,
|
|
12907
|
+
// "limit": 100,
|
|
12908
|
+
// "moreData": false
|
|
12909
|
+
// }
|
|
12910
|
+
//
|
|
12911
|
+
}
|
|
12912
|
+
const rows = this.safeList(response, responseQuery, []);
|
|
12913
|
+
return this.parseConversions(rows, fromCurrencyKey, toCurrencyKey, since, limit);
|
|
12914
|
+
}
|
|
12681
12915
|
parseConversion(conversion, fromCurrency = undefined, toCurrency = undefined) {
|
|
12916
|
+
//
|
|
12917
|
+
// fetchConvertQuote
|
|
12918
|
+
//
|
|
12919
|
+
// {
|
|
12920
|
+
// "quoteId":"12415572564",
|
|
12921
|
+
// "ratio":"38163.7",
|
|
12922
|
+
// "inverseRatio":"0.0000262",
|
|
12923
|
+
// "validTimestamp":1623319461670,
|
|
12924
|
+
// "toAmount":"3816.37",
|
|
12925
|
+
// "fromAmount":"0.1"
|
|
12926
|
+
// }
|
|
12682
12927
|
//
|
|
12683
12928
|
// createConvertTrade
|
|
12684
12929
|
//
|
|
12685
12930
|
// {
|
|
12931
|
+
// "orderId":"933256278426274426",
|
|
12932
|
+
// "createTime":1623381330472,
|
|
12933
|
+
// "orderStatus":"PROCESS"
|
|
12934
|
+
// }
|
|
12935
|
+
//
|
|
12936
|
+
// createConvertTrade BUSD
|
|
12937
|
+
//
|
|
12938
|
+
// {
|
|
12686
12939
|
// "tranId": 118263407119,
|
|
12687
12940
|
// "status": "S"
|
|
12688
12941
|
// }
|
|
12689
12942
|
//
|
|
12690
|
-
|
|
12691
|
-
|
|
12943
|
+
// fetchConvertTrade, fetchConvertTradeHistory BUSD
|
|
12944
|
+
//
|
|
12945
|
+
// {
|
|
12946
|
+
// "tranId": 118263615991,
|
|
12947
|
+
// "type": 244,
|
|
12948
|
+
// "time": 1664442078000,
|
|
12949
|
+
// "deductedAsset": "BUSD",
|
|
12950
|
+
// "deductedAmount": "1",
|
|
12951
|
+
// "targetAsset": "USDC",
|
|
12952
|
+
// "targetAmount": "1",
|
|
12953
|
+
// "status": "S",
|
|
12954
|
+
// "accountType": "MAIN"
|
|
12955
|
+
// }
|
|
12956
|
+
//
|
|
12957
|
+
// fetchConvertTrade
|
|
12958
|
+
//
|
|
12959
|
+
// {
|
|
12960
|
+
// "orderId":933256278426274426,
|
|
12961
|
+
// "orderStatus":"SUCCESS",
|
|
12962
|
+
// "fromAsset":"BTC",
|
|
12963
|
+
// "fromAmount":"0.00054414",
|
|
12964
|
+
// "toAsset":"USDT",
|
|
12965
|
+
// "toAmount":"20",
|
|
12966
|
+
// "ratio":"36755",
|
|
12967
|
+
// "inverseRatio":"0.00002721",
|
|
12968
|
+
// "createTime":1623381330472
|
|
12969
|
+
// }
|
|
12970
|
+
//
|
|
12971
|
+
// fetchConvertTradeHistory
|
|
12972
|
+
//
|
|
12973
|
+
// {
|
|
12974
|
+
// "quoteId": "f3b91c525b2644c7bc1e1cd31b6e1aa6",
|
|
12975
|
+
// "orderId": 940708407462087195,
|
|
12976
|
+
// "orderStatus": "SUCCESS",
|
|
12977
|
+
// "fromAsset": "USDT",
|
|
12978
|
+
// "fromAmount": "20",
|
|
12979
|
+
// "toAsset": "BNB",
|
|
12980
|
+
// "toAmount": "0.06154036",
|
|
12981
|
+
// "ratio": "0.00307702",
|
|
12982
|
+
// "inverseRatio": "324.99",
|
|
12983
|
+
// "createTime": 1624248872184
|
|
12984
|
+
// }
|
|
12985
|
+
//
|
|
12986
|
+
const timestamp = this.safeIntegerN(conversion, ['time', 'validTimestamp', 'createTime']);
|
|
12987
|
+
const fromCur = this.safeString2(conversion, 'deductedAsset', 'fromAsset');
|
|
12988
|
+
const fromCode = this.safeCurrencyCode(fromCur, fromCurrency);
|
|
12989
|
+
const to = this.safeString2(conversion, 'targetAsset', 'toAsset');
|
|
12990
|
+
const toCode = this.safeCurrencyCode(to, toCurrency);
|
|
12692
12991
|
return {
|
|
12693
12992
|
'info': conversion,
|
|
12694
|
-
'timestamp':
|
|
12695
|
-
'datetime':
|
|
12696
|
-
'id': this.
|
|
12993
|
+
'timestamp': timestamp,
|
|
12994
|
+
'datetime': this.iso8601(timestamp),
|
|
12995
|
+
'id': this.safeStringN(conversion, ['tranId', 'orderId', 'quoteId']),
|
|
12697
12996
|
'fromCurrency': fromCode,
|
|
12698
|
-
'fromAmount':
|
|
12997
|
+
'fromAmount': this.safeNumber2(conversion, 'deductedAmount', 'fromAmount'),
|
|
12699
12998
|
'toCurrency': toCode,
|
|
12700
|
-
'toAmount':
|
|
12999
|
+
'toAmount': this.safeNumber2(conversion, 'targetAmount', 'toAmount'),
|
|
12701
13000
|
'price': undefined,
|
|
12702
13001
|
'fee': undefined,
|
|
12703
13002
|
};
|
package/dist/cjs/src/bingx.js
CHANGED
|
@@ -384,7 +384,7 @@ class bingx extends bingx$1 {
|
|
|
384
384
|
'100400': errors.BadRequest,
|
|
385
385
|
'100421': errors.BadSymbol,
|
|
386
386
|
'100440': errors.ExchangeError,
|
|
387
|
-
'100500': errors.
|
|
387
|
+
'100500': errors.OperationFailed,
|
|
388
388
|
'100503': errors.ExchangeError,
|
|
389
389
|
'80001': errors.BadRequest,
|
|
390
390
|
'80012': errors.InsufficientFunds,
|
|
@@ -394,7 +394,7 @@ class bingx extends bingx$1 {
|
|
|
394
394
|
'100414': errors.AccountSuspended,
|
|
395
395
|
'100419': errors.PermissionDenied,
|
|
396
396
|
'100437': errors.BadRequest,
|
|
397
|
-
'101204': errors.InsufficientFunds, //
|
|
397
|
+
'101204': errors.InsufficientFunds, // {"code":101204,"msg":"","data":{}}
|
|
398
398
|
},
|
|
399
399
|
'broad': {},
|
|
400
400
|
},
|
package/dist/cjs/src/bitget.js
CHANGED
|
@@ -66,6 +66,8 @@ class bitget extends bitget$1 {
|
|
|
66
66
|
'fetchClosedOrders': true,
|
|
67
67
|
'fetchConvertCurrencies': true,
|
|
68
68
|
'fetchConvertQuote': true,
|
|
69
|
+
'fetchConvertTrade': false,
|
|
70
|
+
'fetchConvertTradeHistory': true,
|
|
69
71
|
'fetchCrossBorrowRate': true,
|
|
70
72
|
'fetchCrossBorrowRates': false,
|
|
71
73
|
'fetchCurrencies': true,
|
|
@@ -8539,6 +8541,66 @@ class bitget extends bitget$1 {
|
|
|
8539
8541
|
const toCurrency = this.currency(toCurrencyId);
|
|
8540
8542
|
return this.parseConversion(data, undefined, toCurrency);
|
|
8541
8543
|
}
|
|
8544
|
+
async fetchConvertTradeHistory(code = undefined, since = undefined, limit = undefined, params = {}) {
|
|
8545
|
+
/**
|
|
8546
|
+
* @method
|
|
8547
|
+
* @name bitget#fetchConvertTradeHistory
|
|
8548
|
+
* @description fetch the users history of conversion trades
|
|
8549
|
+
* @see https://www.bitget.com/api-doc/common/convert/Get-Convert-Record
|
|
8550
|
+
* @param {string} [code] the unified currency code
|
|
8551
|
+
* @param {int} [since] the earliest time in ms to fetch conversions for
|
|
8552
|
+
* @param {int} [limit] the maximum number of conversion structures to retrieve
|
|
8553
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
8554
|
+
* @returns {object[]} a list of [conversion structures]{@link https://docs.ccxt.com/#/?id=conversion-structure}
|
|
8555
|
+
*/
|
|
8556
|
+
await this.loadMarkets();
|
|
8557
|
+
const request = {};
|
|
8558
|
+
const msInDay = 86400000;
|
|
8559
|
+
const now = this.milliseconds();
|
|
8560
|
+
if (since !== undefined) {
|
|
8561
|
+
request['startTime'] = since;
|
|
8562
|
+
}
|
|
8563
|
+
else {
|
|
8564
|
+
request['startTime'] = now - msInDay;
|
|
8565
|
+
}
|
|
8566
|
+
const endTime = this.safeString2(params, 'endTime', 'until');
|
|
8567
|
+
if (endTime !== undefined) {
|
|
8568
|
+
request['endTime'] = endTime;
|
|
8569
|
+
}
|
|
8570
|
+
else {
|
|
8571
|
+
request['endTime'] = now;
|
|
8572
|
+
}
|
|
8573
|
+
if (limit !== undefined) {
|
|
8574
|
+
request['limit'] = limit;
|
|
8575
|
+
}
|
|
8576
|
+
params = this.omit(params, 'until');
|
|
8577
|
+
const response = await this.privateConvertGetV2ConvertConvertRecord(this.extend(request, params));
|
|
8578
|
+
//
|
|
8579
|
+
// {
|
|
8580
|
+
// "code": "00000",
|
|
8581
|
+
// "msg": "success",
|
|
8582
|
+
// "requestTime": 1712124371799,
|
|
8583
|
+
// "data": {
|
|
8584
|
+
// "dataList": [
|
|
8585
|
+
// {
|
|
8586
|
+
// "id": "1159296505255219205",
|
|
8587
|
+
// "fromCoin": "USDT",
|
|
8588
|
+
// "fromCoinSize": "5",
|
|
8589
|
+
// "cnvtPrice": "0.99940076",
|
|
8590
|
+
// "toCoin": "USDC",
|
|
8591
|
+
// "toCoinSize": "4.99700379",
|
|
8592
|
+
// "ts": "1712123746217",
|
|
8593
|
+
// "fee": "0"
|
|
8594
|
+
// }
|
|
8595
|
+
// ],
|
|
8596
|
+
// "endId": "1159296505255219205"
|
|
8597
|
+
// }
|
|
8598
|
+
// }
|
|
8599
|
+
//
|
|
8600
|
+
const data = this.safeDict(response, 'data', {});
|
|
8601
|
+
const dataList = this.safeList(data, 'dataList', []);
|
|
8602
|
+
return this.parseConversions(dataList, 'fromCoin', 'toCoin', since, limit);
|
|
8603
|
+
}
|
|
8542
8604
|
parseConversion(conversion, fromCurrency = undefined, toCurrency = undefined) {
|
|
8543
8605
|
//
|
|
8544
8606
|
// fetchConvertQuote
|
|
@@ -8562,6 +8624,19 @@ class bitget extends bitget$1 {
|
|
|
8562
8624
|
// "ts": "1712123746217"
|
|
8563
8625
|
// }
|
|
8564
8626
|
//
|
|
8627
|
+
// fetchConvertTradeHistory
|
|
8628
|
+
//
|
|
8629
|
+
// {
|
|
8630
|
+
// "id": "1159296505255219205",
|
|
8631
|
+
// "fromCoin": "USDT",
|
|
8632
|
+
// "fromCoinSize": "5",
|
|
8633
|
+
// "cnvtPrice": "0.99940076",
|
|
8634
|
+
// "toCoin": "USDC",
|
|
8635
|
+
// "toCoinSize": "4.99700379",
|
|
8636
|
+
// "ts": "1712123746217",
|
|
8637
|
+
// "fee": "0"
|
|
8638
|
+
// }
|
|
8639
|
+
//
|
|
8565
8640
|
const timestamp = this.safeInteger(conversion, 'ts');
|
|
8566
8641
|
const fromCoin = this.safeString(conversion, 'fromCoin');
|
|
8567
8642
|
const fromCode = this.safeCurrencyCode(fromCoin, fromCurrency);
|
|
@@ -8571,7 +8646,7 @@ class bitget extends bitget$1 {
|
|
|
8571
8646
|
'info': conversion,
|
|
8572
8647
|
'timestamp': timestamp,
|
|
8573
8648
|
'datetime': this.iso8601(timestamp),
|
|
8574
|
-
'id': this.
|
|
8649
|
+
'id': this.safeString2(conversion, 'id', 'traceId'),
|
|
8575
8650
|
'fromCurrency': fromCode,
|
|
8576
8651
|
'fromAmount': this.safeNumber(conversion, 'fromCoinSize'),
|
|
8577
8652
|
'toCurrency': toCode,
|
package/dist/cjs/src/coinbase.js
CHANGED
|
@@ -2589,7 +2589,7 @@ class coinbase extends coinbase$1 {
|
|
|
2589
2589
|
* @param {float} [params.stopLossPrice] price to trigger stop-loss orders
|
|
2590
2590
|
* @param {float} [params.takeProfitPrice] price to trigger take-profit orders
|
|
2591
2591
|
* @param {bool} [params.postOnly] true or false
|
|
2592
|
-
* @param {string} [params.timeInForce] 'GTC', 'IOC', 'GTD' or 'PO'
|
|
2592
|
+
* @param {string} [params.timeInForce] 'GTC', 'IOC', 'GTD' or 'PO', 'FOK'
|
|
2593
2593
|
* @param {string} [params.stop_direction] 'UNKNOWN_STOP_DIRECTION', 'STOP_DIRECTION_STOP_UP', 'STOP_DIRECTION_STOP_DOWN' the direction the stopPrice is triggered from
|
|
2594
2594
|
* @param {string} [params.end_time] '2023-05-25T17:01:05.092Z' for 'GTD' orders
|
|
2595
2595
|
* @param {float} [params.cost] *spot market buy only* the quote quantity that can be used as an alternative for the amount
|
|
@@ -2694,6 +2694,14 @@ class coinbase extends coinbase$1 {
|
|
|
2694
2694
|
},
|
|
2695
2695
|
};
|
|
2696
2696
|
}
|
|
2697
|
+
else if (timeInForce === 'FOK') {
|
|
2698
|
+
request['order_configuration'] = {
|
|
2699
|
+
'limit_limit_fok': {
|
|
2700
|
+
'base_size': this.amountToPrecision(symbol, amount),
|
|
2701
|
+
'limit_price': this.priceToPrecision(symbol, price),
|
|
2702
|
+
},
|
|
2703
|
+
};
|
|
2704
|
+
}
|
|
2697
2705
|
else {
|
|
2698
2706
|
request['order_configuration'] = {
|
|
2699
2707
|
'limit_limit_gtc': {
|