ccxt 4.2.59 → 4.2.60
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/build.sh +1 -1
- package/dist/ccxt.browser.js +406 -165
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/ascendex.js +10 -12
- package/dist/cjs/src/bingx.js +38 -0
- package/dist/cjs/src/bitfinex2.js +21 -4
- package/dist/cjs/src/bitget.js +9 -2
- package/dist/cjs/src/bitmart.js +41 -23
- package/dist/cjs/src/blofin.js +59 -1
- package/dist/cjs/src/hitbtc.js +1 -1
- package/dist/cjs/src/htx.js +4 -1
- package/dist/cjs/src/kraken.js +42 -39
- package/dist/cjs/src/kucoinfutures.js +1 -0
- package/dist/cjs/src/pro/binance.js +16 -3
- package/dist/cjs/src/wazirx.js +6 -1
- package/dist/cjs/src/woo.js +157 -77
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/blofin.d.ts +1 -0
- package/js/src/abstract/wazirx.d.ts +5 -0
- package/js/src/ascendex.d.ts +2 -2
- package/js/src/ascendex.js +10 -12
- package/js/src/bingx.d.ts +3 -1
- package/js/src/bingx.js +38 -0
- package/js/src/bitfinex2.js +21 -4
- package/js/src/bitget.js +9 -2
- package/js/src/bitmart.d.ts +9 -2
- package/js/src/bitmart.js +41 -23
- package/js/src/blofin.d.ts +2 -1
- package/js/src/blofin.js +59 -1
- package/js/src/hitbtc.js +1 -1
- package/js/src/htx.js +4 -1
- package/js/src/kraken.js +42 -39
- package/js/src/kucoinfutures.js +1 -0
- package/js/src/pro/binance.js +16 -3
- package/js/src/pro/deribit.d.ts +1 -1
- package/js/src/wazirx.js +6 -1
- package/js/src/woo.d.ts +8 -0
- package/js/src/woo.js +157 -77
- package/package.json +1 -1
- package/skip-tests.json +42 -16
package/dist/cjs/src/woo.js
CHANGED
|
@@ -84,10 +84,10 @@ class woo extends woo$1 {
|
|
|
84
84
|
'fetchPositionMode': false,
|
|
85
85
|
'fetchPositions': true,
|
|
86
86
|
'fetchPremiumIndexOHLCV': false,
|
|
87
|
-
'fetchStatus':
|
|
87
|
+
'fetchStatus': true,
|
|
88
88
|
'fetchTicker': false,
|
|
89
89
|
'fetchTickers': false,
|
|
90
|
-
'fetchTime':
|
|
90
|
+
'fetchTime': true,
|
|
91
91
|
'fetchTrades': true,
|
|
92
92
|
'fetchTradingFee': false,
|
|
93
93
|
'fetchTradingFees': true,
|
|
@@ -324,6 +324,67 @@ class woo extends woo$1 {
|
|
|
324
324
|
'precisionMode': number.TICK_SIZE,
|
|
325
325
|
});
|
|
326
326
|
}
|
|
327
|
+
async fetchStatus(params = {}) {
|
|
328
|
+
/**
|
|
329
|
+
* @method
|
|
330
|
+
* @name woo#fetchStatus
|
|
331
|
+
* @description the latest known information on the availability of the exchange API
|
|
332
|
+
* @see https://docs.woo.org/#get-system-maintenance-status-public
|
|
333
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
334
|
+
* @returns {object} a [status structure]{@link https://docs.ccxt.com/#/?id=exchange-status-structure}
|
|
335
|
+
*/
|
|
336
|
+
const response = await this.v1PublicGetSystemInfo(params);
|
|
337
|
+
//
|
|
338
|
+
// {
|
|
339
|
+
// "success": true,
|
|
340
|
+
// "data": {
|
|
341
|
+
// "status": "0",
|
|
342
|
+
// "msg": "System is functioning properly."
|
|
343
|
+
// },
|
|
344
|
+
// "timestamp": "1709274106602"
|
|
345
|
+
// }
|
|
346
|
+
//
|
|
347
|
+
const data = this.safeDict(response, 'data', {});
|
|
348
|
+
let status = this.safeString(data, 'status');
|
|
349
|
+
if (status === undefined) {
|
|
350
|
+
status = 'error';
|
|
351
|
+
}
|
|
352
|
+
else if (status === '0') {
|
|
353
|
+
status = 'ok';
|
|
354
|
+
}
|
|
355
|
+
else {
|
|
356
|
+
status = 'maintenance';
|
|
357
|
+
}
|
|
358
|
+
return {
|
|
359
|
+
'status': status,
|
|
360
|
+
'updated': undefined,
|
|
361
|
+
'eta': undefined,
|
|
362
|
+
'url': undefined,
|
|
363
|
+
'info': response,
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
async fetchTime(params = {}) {
|
|
367
|
+
/**
|
|
368
|
+
* @method
|
|
369
|
+
* @name woo#fetchTime
|
|
370
|
+
* @description fetches the current integer timestamp in milliseconds from the exchange server
|
|
371
|
+
* @see https://docs.woo.org/#get-system-maintenance-status-public
|
|
372
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
373
|
+
* @returns {int} the current integer timestamp in milliseconds from the exchange server
|
|
374
|
+
*/
|
|
375
|
+
const response = await this.v1PublicGetSystemInfo(params);
|
|
376
|
+
//
|
|
377
|
+
// {
|
|
378
|
+
// "success": true,
|
|
379
|
+
// "data": {
|
|
380
|
+
// "status": "0",
|
|
381
|
+
// "msg": "System is functioning properly."
|
|
382
|
+
// },
|
|
383
|
+
// "timestamp": "1709274106602"
|
|
384
|
+
// }
|
|
385
|
+
//
|
|
386
|
+
return this.safeInteger(response, 'timestamp');
|
|
387
|
+
}
|
|
327
388
|
async fetchMarkets(params = {}) {
|
|
328
389
|
/**
|
|
329
390
|
* @method
|
|
@@ -354,7 +415,7 @@ class woo extends woo$1 {
|
|
|
354
415
|
// "success": true
|
|
355
416
|
// }
|
|
356
417
|
//
|
|
357
|
-
const data = this.
|
|
418
|
+
const data = this.safeList(response, 'rows', []);
|
|
358
419
|
return this.parseMarkets(data);
|
|
359
420
|
}
|
|
360
421
|
parseMarket(market) {
|
|
@@ -606,7 +667,7 @@ class woo extends woo$1 {
|
|
|
606
667
|
// "timestamp": 1673323685109
|
|
607
668
|
// }
|
|
608
669
|
//
|
|
609
|
-
const data = this.
|
|
670
|
+
const data = this.safeDict(response, 'data', {});
|
|
610
671
|
const maker = this.safeString(data, 'makerFeeRate');
|
|
611
672
|
const taker = this.safeString(data, 'takerFeeRate');
|
|
612
673
|
const result = {};
|
|
@@ -693,7 +754,7 @@ class woo extends woo$1 {
|
|
|
693
754
|
// "success": true
|
|
694
755
|
// }
|
|
695
756
|
//
|
|
696
|
-
const tokenRows = this.
|
|
757
|
+
const tokenRows = this.safeList(tokenResponse, 'rows', []);
|
|
697
758
|
const networksByCurrencyId = this.groupBy(tokenRows, 'balance_token');
|
|
698
759
|
const currencyIds = Object.keys(networksByCurrencyId);
|
|
699
760
|
for (let i = 0; i < currencyIds.length; i++) {
|
|
@@ -853,7 +914,7 @@ class woo extends woo$1 {
|
|
|
853
914
|
* @param {string} [params.trailingTriggerPrice] the price to trigger a trailing order, default uses the price argument
|
|
854
915
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
855
916
|
*/
|
|
856
|
-
const reduceOnly = this.
|
|
917
|
+
const reduceOnly = this.safeBool2(params, 'reduceOnly', 'reduce_only');
|
|
857
918
|
params = this.omit(params, ['reduceOnly', 'reduce_only']);
|
|
858
919
|
const orderType = type.toUpperCase();
|
|
859
920
|
await this.loadMarkets();
|
|
@@ -1024,9 +1085,9 @@ class woo extends woo$1 {
|
|
|
1024
1085
|
// },
|
|
1025
1086
|
// "timestamp": "1686149372216"
|
|
1026
1087
|
// }
|
|
1027
|
-
const data = this.
|
|
1088
|
+
const data = this.safeDict(response, 'data');
|
|
1028
1089
|
if (data !== undefined) {
|
|
1029
|
-
const rows = this.
|
|
1090
|
+
const rows = this.safeList(data, 'rows', []);
|
|
1030
1091
|
return this.parseOrder(rows[0], market);
|
|
1031
1092
|
}
|
|
1032
1093
|
const order = this.parseOrder(response, market);
|
|
@@ -1127,7 +1188,7 @@ class woo extends woo$1 {
|
|
|
1127
1188
|
// "timestamp": 0
|
|
1128
1189
|
// }
|
|
1129
1190
|
//
|
|
1130
|
-
const data = this.
|
|
1191
|
+
const data = this.safeDict(response, 'data', {});
|
|
1131
1192
|
return this.parseOrder(data, market);
|
|
1132
1193
|
}
|
|
1133
1194
|
async cancelOrder(id, symbol = undefined, params = {}) {
|
|
@@ -1201,8 +1262,8 @@ class woo extends woo$1 {
|
|
|
1201
1262
|
* @returns {object} an list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1202
1263
|
*/
|
|
1203
1264
|
await this.loadMarkets();
|
|
1204
|
-
const stop = this.
|
|
1205
|
-
params = this.omit(params, 'stop');
|
|
1265
|
+
const stop = this.safeBool2(params, 'stop', 'trigger');
|
|
1266
|
+
params = this.omit(params, ['stop', 'trigger']);
|
|
1206
1267
|
if (stop) {
|
|
1207
1268
|
return await this.v3PrivateDeleteAlgoOrdersPending(params);
|
|
1208
1269
|
}
|
|
@@ -1236,8 +1297,8 @@ class woo extends woo$1 {
|
|
|
1236
1297
|
*/
|
|
1237
1298
|
await this.loadMarkets();
|
|
1238
1299
|
const market = (symbol !== undefined) ? this.market(symbol) : undefined;
|
|
1239
|
-
const stop = this.
|
|
1240
|
-
params = this.omit(params, 'stop');
|
|
1300
|
+
const stop = this.safeBool2(params, 'stop', 'trigger');
|
|
1301
|
+
params = this.omit(params, ['stop', 'trigger']);
|
|
1241
1302
|
const request = {};
|
|
1242
1303
|
const clientOrderId = this.safeString2(params, 'clOrdID', 'clientOrderId');
|
|
1243
1304
|
let response = undefined;
|
|
@@ -1311,9 +1372,9 @@ class woo extends woo$1 {
|
|
|
1311
1372
|
await this.loadMarkets();
|
|
1312
1373
|
const request = {};
|
|
1313
1374
|
let market = undefined;
|
|
1314
|
-
const stop = this.
|
|
1375
|
+
const stop = this.safeBool2(params, 'stop', 'trigger');
|
|
1315
1376
|
const trailing = this.safeBool(params, 'trailing', false);
|
|
1316
|
-
params = this.omit(params, ['stop', 'trailing']);
|
|
1377
|
+
params = this.omit(params, ['stop', 'trailing', 'trigger']);
|
|
1317
1378
|
if (symbol !== undefined) {
|
|
1318
1379
|
market = this.market(symbol);
|
|
1319
1380
|
request['symbol'] = market['id'];
|
|
@@ -1371,7 +1432,7 @@ class woo extends woo$1 {
|
|
|
1371
1432
|
// }
|
|
1372
1433
|
//
|
|
1373
1434
|
const data = this.safeValue(response, 'data', response);
|
|
1374
|
-
const orders = this.
|
|
1435
|
+
const orders = this.safeList(data, 'rows');
|
|
1375
1436
|
return this.parseOrders(orders, market, since, limit, params);
|
|
1376
1437
|
}
|
|
1377
1438
|
parseTimeInForce(timeInForce) {
|
|
@@ -1473,7 +1534,7 @@ class woo extends woo$1 {
|
|
|
1473
1534
|
'type': orderType,
|
|
1474
1535
|
'timeInForce': this.parseTimeInForce(orderType),
|
|
1475
1536
|
'postOnly': undefined,
|
|
1476
|
-
'reduceOnly': this.
|
|
1537
|
+
'reduceOnly': this.safeBool(order, 'reduce_only'),
|
|
1477
1538
|
'side': side,
|
|
1478
1539
|
'price': price,
|
|
1479
1540
|
'stopPrice': stopPrice,
|
|
@@ -1631,7 +1692,7 @@ class woo extends woo$1 {
|
|
|
1631
1692
|
// }
|
|
1632
1693
|
//
|
|
1633
1694
|
}
|
|
1634
|
-
const rows = this.
|
|
1695
|
+
const rows = this.safeList(response, 'rows', []);
|
|
1635
1696
|
return this.parseOHLCVs(rows, market, timeframe, since, limit);
|
|
1636
1697
|
}
|
|
1637
1698
|
parseOHLCV(ohlcv, market = undefined) {
|
|
@@ -1684,7 +1745,7 @@ class woo extends woo$1 {
|
|
|
1684
1745
|
// }
|
|
1685
1746
|
// ]
|
|
1686
1747
|
// }
|
|
1687
|
-
const trades = this.
|
|
1748
|
+
const trades = this.safeList(response, 'rows', []);
|
|
1688
1749
|
return this.parseTrades(trades, market, since, limit, params);
|
|
1689
1750
|
}
|
|
1690
1751
|
async fetchMyTrades(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
@@ -1732,7 +1793,7 @@ class woo extends woo$1 {
|
|
|
1732
1793
|
// ...
|
|
1733
1794
|
// ]
|
|
1734
1795
|
// }
|
|
1735
|
-
const trades = this.
|
|
1796
|
+
const trades = this.safeList(response, 'rows', []);
|
|
1736
1797
|
return this.parseTrades(trades, market, since, limit, params);
|
|
1737
1798
|
}
|
|
1738
1799
|
async fetchAccounts(params = {}) {
|
|
@@ -1760,7 +1821,7 @@ class woo extends woo$1 {
|
|
|
1760
1821
|
// "success": true
|
|
1761
1822
|
// }
|
|
1762
1823
|
//
|
|
1763
|
-
const rows = this.
|
|
1824
|
+
const rows = this.safeList(response, 'rows', []);
|
|
1764
1825
|
return this.parseAccounts(rows, params);
|
|
1765
1826
|
}
|
|
1766
1827
|
parseAccount(account) {
|
|
@@ -1814,14 +1875,14 @@ class woo extends woo$1 {
|
|
|
1814
1875
|
// "timestamp": 1673323746259
|
|
1815
1876
|
// }
|
|
1816
1877
|
//
|
|
1817
|
-
const data = this.
|
|
1878
|
+
const data = this.safeDict(response, 'data');
|
|
1818
1879
|
return this.parseBalance(data);
|
|
1819
1880
|
}
|
|
1820
1881
|
parseBalance(response) {
|
|
1821
1882
|
const result = {
|
|
1822
1883
|
'info': response,
|
|
1823
1884
|
};
|
|
1824
|
-
const balances = this.
|
|
1885
|
+
const balances = this.safeList(response, 'holding', []);
|
|
1825
1886
|
for (let i = 0; i < balances.length; i++) {
|
|
1826
1887
|
const balance = balances[i];
|
|
1827
1888
|
const code = this.safeCurrencyCode(this.safeString(balance, 'token'));
|
|
@@ -2098,6 +2159,7 @@ class woo extends woo$1 {
|
|
|
2098
2159
|
/**
|
|
2099
2160
|
* @method
|
|
2100
2161
|
* @name woo#transfer
|
|
2162
|
+
* @see https://docs.woo.org/#get-transfer-history
|
|
2101
2163
|
* @description transfer currency internally between wallets on the same account
|
|
2102
2164
|
* @param {string} code unified currency code
|
|
2103
2165
|
* @param {float} amount amount to transfer
|
|
@@ -2110,7 +2172,7 @@ class woo extends woo$1 {
|
|
|
2110
2172
|
const currency = this.currency(code);
|
|
2111
2173
|
const request = {
|
|
2112
2174
|
'token': currency['id'],
|
|
2113
|
-
'amount': this.
|
|
2175
|
+
'amount': this.parseToNumeric(amount),
|
|
2114
2176
|
'from_application_id': fromAccount,
|
|
2115
2177
|
'to_application_id': toAccount,
|
|
2116
2178
|
};
|
|
@@ -2122,7 +2184,7 @@ class woo extends woo$1 {
|
|
|
2122
2184
|
// }
|
|
2123
2185
|
//
|
|
2124
2186
|
const transfer = this.parseTransfer(response, currency);
|
|
2125
|
-
const transferOptions = this.
|
|
2187
|
+
const transferOptions = this.safeDict(this.options, 'transfer', {});
|
|
2126
2188
|
const fillResponseFromRequest = this.safeBool(transferOptions, 'fillResponseFromRequest', true);
|
|
2127
2189
|
if (fillResponseFromRequest) {
|
|
2128
2190
|
transfer['amount'] = amount;
|
|
@@ -2136,41 +2198,71 @@ class woo extends woo$1 {
|
|
|
2136
2198
|
* @method
|
|
2137
2199
|
* @name woo#fetchTransfers
|
|
2138
2200
|
* @description fetch a history of internal transfers made on an account
|
|
2201
|
+
* @see https://docs.woo.org/#get-transfer-history
|
|
2139
2202
|
* @param {string} code unified currency code of the currency transferred
|
|
2140
2203
|
* @param {int} [since] the earliest time in ms to fetch transfers for
|
|
2141
2204
|
* @param {int} [limit] the maximum number of transfers structures to retrieve
|
|
2142
2205
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2206
|
+
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
2143
2207
|
* @returns {object[]} a list of [transfer structures]{@link https://docs.ccxt.com/#/?id=transfer-structure}
|
|
2144
2208
|
*/
|
|
2145
|
-
const request = {
|
|
2146
|
-
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2209
|
+
const request = {};
|
|
2210
|
+
if (limit !== undefined) {
|
|
2211
|
+
request['size'] = limit;
|
|
2212
|
+
}
|
|
2213
|
+
if (since !== undefined) {
|
|
2214
|
+
request['start_t'] = since;
|
|
2215
|
+
}
|
|
2216
|
+
const until = this.safeInteger2(params, 'until', 'till'); // unified in milliseconds
|
|
2217
|
+
params = this.omit(params, ['until', 'till']);
|
|
2218
|
+
if (until !== undefined) {
|
|
2219
|
+
request['end_t'] = until;
|
|
2220
|
+
}
|
|
2221
|
+
const response = await this.v1PrivateGetAssetMainSubTransferHistory(this.extend(request, params));
|
|
2222
|
+
//
|
|
2223
|
+
// {
|
|
2224
|
+
// "rows": [
|
|
2225
|
+
// {
|
|
2226
|
+
// "id": 46704,
|
|
2227
|
+
// "token": "USDT",
|
|
2228
|
+
// "amount": 30000.00000000,
|
|
2229
|
+
// "status": "COMPLETED",
|
|
2230
|
+
// "from_application_id": "0f1bd3cd-dba2-4563-b8bb-0adb1bfb83a3",
|
|
2231
|
+
// "to_application_id": "c01e6940-a735-4022-9b6c-9d3971cdfdfa",
|
|
2232
|
+
// "from_user": "LeverageLow",
|
|
2233
|
+
// "to_user": "dev",
|
|
2234
|
+
// "created_time": "1709022325.427",
|
|
2235
|
+
// "updated_time": "1709022325.542"
|
|
2236
|
+
// }
|
|
2237
|
+
// ],
|
|
2238
|
+
// "meta": {
|
|
2239
|
+
// "total": 50,
|
|
2240
|
+
// "records_per_page": 25,
|
|
2241
|
+
// "current_page": 1
|
|
2242
|
+
// },
|
|
2243
|
+
// "success": true
|
|
2244
|
+
// }
|
|
2245
|
+
//
|
|
2246
|
+
const data = this.safeList(response, 'rows', []);
|
|
2247
|
+
return this.parseTransfers(data, undefined, since, limit, params);
|
|
2150
2248
|
}
|
|
2151
2249
|
parseTransfer(transfer, currency = undefined) {
|
|
2152
2250
|
//
|
|
2153
|
-
//
|
|
2154
|
-
//
|
|
2155
|
-
//
|
|
2156
|
-
//
|
|
2157
|
-
//
|
|
2158
|
-
//
|
|
2159
|
-
//
|
|
2160
|
-
//
|
|
2161
|
-
//
|
|
2162
|
-
//
|
|
2163
|
-
//
|
|
2164
|
-
//
|
|
2165
|
-
//
|
|
2166
|
-
// "amount": 1000,
|
|
2167
|
-
// "tx_id": "0x8a74c517bc104c8ebad0c3c3f64b1f302ed5f8bca598ae4459c63419038106b6",
|
|
2168
|
-
// "fee_token": null,
|
|
2169
|
-
// "fee_amount": null,
|
|
2170
|
-
// "status": "CONFIRMING"
|
|
2171
|
-
// }
|
|
2251
|
+
// fetchTransfers
|
|
2252
|
+
// {
|
|
2253
|
+
// "id": 46704,
|
|
2254
|
+
// "token": "USDT",
|
|
2255
|
+
// "amount": 30000.00000000,
|
|
2256
|
+
// "status": "COMPLETED",
|
|
2257
|
+
// "from_application_id": "0f1bd3cd-dba2-4563-b8bb-0adb1bfb83a3",
|
|
2258
|
+
// "to_application_id": "c01e6940-a735-4022-9b6c-9d3971cdfdfa",
|
|
2259
|
+
// "from_user": "LeverageLow",
|
|
2260
|
+
// "to_user": "dev",
|
|
2261
|
+
// "created_time": "1709022325.427",
|
|
2262
|
+
// "updated_time": "1709022325.542"
|
|
2263
|
+
// }
|
|
2172
2264
|
//
|
|
2173
|
-
//
|
|
2265
|
+
// transfer
|
|
2174
2266
|
// {
|
|
2175
2267
|
// "success": true,
|
|
2176
2268
|
// "id": 200
|
|
@@ -2179,22 +2271,8 @@ class woo extends woo$1 {
|
|
|
2179
2271
|
const networkizedCode = this.safeString(transfer, 'token');
|
|
2180
2272
|
const currencyDefined = this.getCurrencyFromChaincode(networkizedCode, currency);
|
|
2181
2273
|
const code = currencyDefined['code'];
|
|
2182
|
-
let movementDirection = this.safeStringLower(transfer, 'token_side');
|
|
2183
|
-
if (movementDirection === 'withdraw') {
|
|
2184
|
-
movementDirection = 'withdrawal';
|
|
2185
|
-
}
|
|
2186
|
-
let fromAccount = undefined;
|
|
2187
|
-
let toAccount = undefined;
|
|
2188
|
-
if (movementDirection === 'withdraw') {
|
|
2189
|
-
fromAccount = undefined;
|
|
2190
|
-
toAccount = 'spot';
|
|
2191
|
-
}
|
|
2192
|
-
else if (movementDirection === 'deposit') {
|
|
2193
|
-
fromAccount = 'spot';
|
|
2194
|
-
toAccount = undefined;
|
|
2195
|
-
}
|
|
2196
2274
|
const timestamp = this.safeTimestamp(transfer, 'created_time');
|
|
2197
|
-
const success = this.
|
|
2275
|
+
const success = this.safeBool(transfer, 'success');
|
|
2198
2276
|
let status = undefined;
|
|
2199
2277
|
if (success !== undefined) {
|
|
2200
2278
|
status = success ? 'ok' : 'failed';
|
|
@@ -2205,8 +2283,8 @@ class woo extends woo$1 {
|
|
|
2205
2283
|
'datetime': this.iso8601(timestamp),
|
|
2206
2284
|
'currency': code,
|
|
2207
2285
|
'amount': this.safeNumber(transfer, 'amount'),
|
|
2208
|
-
'fromAccount':
|
|
2209
|
-
'toAccount':
|
|
2286
|
+
'fromAccount': this.safeString(transfer, 'from_application_id'),
|
|
2287
|
+
'toAccount': this.safeString(transfer, 'to_application_id'),
|
|
2210
2288
|
'status': this.parseTransferStatus(this.safeString(transfer, 'status', status)),
|
|
2211
2289
|
'info': transfer,
|
|
2212
2290
|
};
|
|
@@ -2244,11 +2322,11 @@ class woo extends woo$1 {
|
|
|
2244
2322
|
if (tag !== undefined) {
|
|
2245
2323
|
request['extra'] = tag;
|
|
2246
2324
|
}
|
|
2247
|
-
const networks = this.
|
|
2248
|
-
const currencyNetworks = this.
|
|
2325
|
+
const networks = this.safeDict(this.options, 'networks', {});
|
|
2326
|
+
const currencyNetworks = this.safeDict(currency, 'networks', {});
|
|
2249
2327
|
const network = this.safeStringUpper(params, 'network');
|
|
2250
2328
|
const networkId = this.safeString(networks, network, network);
|
|
2251
|
-
const coinNetwork = this.
|
|
2329
|
+
const coinNetwork = this.safeDict(currencyNetworks, networkId, {});
|
|
2252
2330
|
const coinNetworkId = this.safeString(coinNetwork, 'id');
|
|
2253
2331
|
if (coinNetworkId === undefined) {
|
|
2254
2332
|
throw new errors.BadRequest(this.id + ' withdraw() require network parameter');
|
|
@@ -2376,7 +2454,9 @@ class woo extends woo$1 {
|
|
|
2376
2454
|
body = auth;
|
|
2377
2455
|
}
|
|
2378
2456
|
else {
|
|
2379
|
-
|
|
2457
|
+
if (Object.keys(params).length) {
|
|
2458
|
+
url += '?' + auth;
|
|
2459
|
+
}
|
|
2380
2460
|
}
|
|
2381
2461
|
auth += '|' + ts;
|
|
2382
2462
|
headers['content-type'] = 'application/x-www-form-urlencoded';
|
|
@@ -2393,7 +2473,7 @@ class woo extends woo$1 {
|
|
|
2393
2473
|
// 400 Bad Request {"success":false,"code":-1012,"message":"Amount is required for buy market orders when margin disabled."}
|
|
2394
2474
|
// {"code":"-1011","message":"The system is under maintenance.","success":false}
|
|
2395
2475
|
//
|
|
2396
|
-
const success = this.
|
|
2476
|
+
const success = this.safeBool(response, 'success');
|
|
2397
2477
|
const errorCode = this.safeString(response, 'code');
|
|
2398
2478
|
if (!success) {
|
|
2399
2479
|
const feedback = this.id + ' ' + this.json(response);
|
|
@@ -2469,7 +2549,7 @@ class woo extends woo$1 {
|
|
|
2469
2549
|
// "success":true
|
|
2470
2550
|
// }
|
|
2471
2551
|
//
|
|
2472
|
-
const result = this.
|
|
2552
|
+
const result = this.safeList(response, 'rows', []);
|
|
2473
2553
|
return this.parseIncomes(result, market, since, limit);
|
|
2474
2554
|
}
|
|
2475
2555
|
parseFundingRate(fundingRate, market = undefined) {
|
|
@@ -2550,7 +2630,7 @@ class woo extends woo$1 {
|
|
|
2550
2630
|
// "timestamp":1653633985646
|
|
2551
2631
|
// }
|
|
2552
2632
|
//
|
|
2553
|
-
const rows = this.
|
|
2633
|
+
const rows = this.safeList(response, 'rows', []);
|
|
2554
2634
|
const result = this.parseFundingRates(rows);
|
|
2555
2635
|
return this.filterByArray(result, 'symbol', symbols);
|
|
2556
2636
|
}
|
|
@@ -2604,7 +2684,7 @@ class woo extends woo$1 {
|
|
|
2604
2684
|
// "timestamp":1653640814885
|
|
2605
2685
|
// }
|
|
2606
2686
|
//
|
|
2607
|
-
const result = this.
|
|
2687
|
+
const result = this.safeList(response, 'rows');
|
|
2608
2688
|
const rates = [];
|
|
2609
2689
|
for (let i = 0; i < result.length; i++) {
|
|
2610
2690
|
const entry = result[i];
|
|
@@ -2766,8 +2846,8 @@ class woo extends woo$1 {
|
|
|
2766
2846
|
// "timestamp": 1673323880342
|
|
2767
2847
|
// }
|
|
2768
2848
|
//
|
|
2769
|
-
const result = this.
|
|
2770
|
-
const positions = this.
|
|
2849
|
+
const result = this.safeDict(response, 'data', {});
|
|
2850
|
+
const positions = this.safeList(result, 'positions', []);
|
|
2771
2851
|
return this.parsePositions(positions, symbols);
|
|
2772
2852
|
}
|
|
2773
2853
|
parsePosition(position, market = undefined) {
|
package/js/ccxt.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import * as functions from './src/base/functions.js';
|
|
|
4
4
|
import * as errors from './src/base/errors.js';
|
|
5
5
|
import type { Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, FundingRateHistory, Liquidation, FundingHistory, MarginMode, Greeks, Leverage, Leverages } from './src/base/types.js';
|
|
6
6
|
import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
|
|
7
|
-
declare const version = "4.2.
|
|
7
|
+
declare const version = "4.2.59";
|
|
8
8
|
import ace from './src/ace.js';
|
|
9
9
|
import alpaca from './src/alpaca.js';
|
|
10
10
|
import ascendex from './src/ascendex.js';
|
package/js/ccxt.js
CHANGED
|
@@ -38,7 +38,7 @@ import * as errors from './src/base/errors.js';
|
|
|
38
38
|
import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
|
|
39
39
|
//-----------------------------------------------------------------------------
|
|
40
40
|
// this is updated by vss.js when building
|
|
41
|
-
const version = '4.2.
|
|
41
|
+
const version = '4.2.60';
|
|
42
42
|
Exchange.ccxtVersion = version;
|
|
43
43
|
//-----------------------------------------------------------------------------
|
|
44
44
|
import ace from './src/ace.js';
|
|
@@ -18,6 +18,7 @@ interface Exchange {
|
|
|
18
18
|
privateGetAccountBalance(params?: {}): Promise<implicitReturnType>;
|
|
19
19
|
privateGetAccountPositions(params?: {}): Promise<implicitReturnType>;
|
|
20
20
|
privateGetAccountLeverageInfo(params?: {}): Promise<implicitReturnType>;
|
|
21
|
+
privateGetAccountBatchLeverageInfo(params?: {}): Promise<implicitReturnType>;
|
|
21
22
|
privateGetTradeOrdersTpslPending(params?: {}): Promise<implicitReturnType>;
|
|
22
23
|
privateGetTradeOrdersHistory(params?: {}): Promise<implicitReturnType>;
|
|
23
24
|
privateGetTradeOrdersTpslHistory(params?: {}): Promise<implicitReturnType>;
|
|
@@ -17,6 +17,11 @@ interface Exchange {
|
|
|
17
17
|
privateGetOpenOrders(params?: {}): Promise<implicitReturnType>;
|
|
18
18
|
privateGetOrder(params?: {}): Promise<implicitReturnType>;
|
|
19
19
|
privateGetMyTrades(params?: {}): Promise<implicitReturnType>;
|
|
20
|
+
privateGetCoins(params?: {}): Promise<implicitReturnType>;
|
|
21
|
+
privateGetCryptoWithdraws(params?: {}): Promise<implicitReturnType>;
|
|
22
|
+
privateGetCryptoDepositsAddress(params?: {}): Promise<implicitReturnType>;
|
|
23
|
+
privateGetSubAccountFundTransferHistory(params?: {}): Promise<implicitReturnType>;
|
|
24
|
+
privateGetSubAccountAccounts(params?: {}): Promise<implicitReturnType>;
|
|
20
25
|
privatePostOrder(params?: {}): Promise<implicitReturnType>;
|
|
21
26
|
privatePostOrderTest(params?: {}): Promise<implicitReturnType>;
|
|
22
27
|
privatePostCreateAuthToken(params?: {}): Promise<implicitReturnType>;
|
package/js/src/ascendex.d.ts
CHANGED
|
@@ -107,8 +107,8 @@ export default class ascendex extends Exchange {
|
|
|
107
107
|
parseTransfer(transfer: any, currency?: Currency): {
|
|
108
108
|
info: any;
|
|
109
109
|
id: any;
|
|
110
|
-
timestamp:
|
|
111
|
-
datetime:
|
|
110
|
+
timestamp: any;
|
|
111
|
+
datetime: any;
|
|
112
112
|
currency: string;
|
|
113
113
|
amount: any;
|
|
114
114
|
fromAccount: any;
|
package/js/src/ascendex.js
CHANGED
|
@@ -757,11 +757,10 @@ export default class ascendex extends Exchange {
|
|
|
757
757
|
];
|
|
758
758
|
}
|
|
759
759
|
parseBalance(response) {
|
|
760
|
-
const timestamp = this.milliseconds();
|
|
761
760
|
const result = {
|
|
762
761
|
'info': response,
|
|
763
|
-
'timestamp':
|
|
764
|
-
'datetime':
|
|
762
|
+
'timestamp': undefined,
|
|
763
|
+
'datetime': undefined,
|
|
765
764
|
};
|
|
766
765
|
const balances = this.safeValue(response, 'data', []);
|
|
767
766
|
for (let i = 0; i < balances.length; i++) {
|
|
@@ -775,11 +774,10 @@ export default class ascendex extends Exchange {
|
|
|
775
774
|
return this.safeBalance(result);
|
|
776
775
|
}
|
|
777
776
|
parseMarginBalance(response) {
|
|
778
|
-
const timestamp = this.milliseconds();
|
|
779
777
|
const result = {
|
|
780
778
|
'info': response,
|
|
781
|
-
'timestamp':
|
|
782
|
-
'datetime':
|
|
779
|
+
'timestamp': undefined,
|
|
780
|
+
'datetime': undefined,
|
|
783
781
|
};
|
|
784
782
|
const balances = this.safeValue(response, 'data', []);
|
|
785
783
|
for (let i = 0; i < balances.length; i++) {
|
|
@@ -796,11 +794,10 @@ export default class ascendex extends Exchange {
|
|
|
796
794
|
return this.safeBalance(result);
|
|
797
795
|
}
|
|
798
796
|
parseSwapBalance(response) {
|
|
799
|
-
const timestamp = this.milliseconds();
|
|
800
797
|
const result = {
|
|
801
798
|
'info': response,
|
|
802
|
-
'timestamp':
|
|
803
|
-
'datetime':
|
|
799
|
+
'timestamp': undefined,
|
|
800
|
+
'datetime': undefined,
|
|
804
801
|
};
|
|
805
802
|
const data = this.safeValue(response, 'data', {});
|
|
806
803
|
const collaterals = this.safeValue(data, 'collaterals', []);
|
|
@@ -822,6 +819,8 @@ export default class ascendex extends Exchange {
|
|
|
822
819
|
* @see https://ascendex.github.io/ascendex-pro-api/#margin-account-balance
|
|
823
820
|
* @see https://ascendex.github.io/ascendex-futures-pro-api-v2/#position
|
|
824
821
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
822
|
+
* @param {string} [params.type] wallet type, 'spot', 'margin', or 'swap'
|
|
823
|
+
* @param {string} [params.marginMode] 'cross' or undefined, for spot margin trading, value of 'isolated' is invalid
|
|
825
824
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
826
825
|
*/
|
|
827
826
|
await this.loadMarkets();
|
|
@@ -3184,12 +3183,11 @@ export default class ascendex extends Exchange {
|
|
|
3184
3183
|
//
|
|
3185
3184
|
const status = this.safeInteger(transfer, 'code');
|
|
3186
3185
|
const currencyCode = this.safeCurrencyCode(undefined, currency);
|
|
3187
|
-
const timestamp = this.milliseconds();
|
|
3188
3186
|
return {
|
|
3189
3187
|
'info': transfer,
|
|
3190
3188
|
'id': undefined,
|
|
3191
|
-
'timestamp':
|
|
3192
|
-
'datetime':
|
|
3189
|
+
'timestamp': undefined,
|
|
3190
|
+
'datetime': undefined,
|
|
3193
3191
|
'currency': currencyCode,
|
|
3194
3192
|
'amount': undefined,
|
|
3195
3193
|
'fromAccount': undefined,
|
package/js/src/bingx.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Exchange from './abstract/bingx.js';
|
|
2
|
-
import type { TransferEntry, Int, OrderSide, OHLCV, FundingRateHistory, Order, OrderType, OrderRequest, Str, Trade, Balances, Transaction, Ticker, OrderBook, Tickers, Market, Strings, Currency, Position, Dict, Leverage } from './base/types.js';
|
|
2
|
+
import type { TransferEntry, Int, OrderSide, OHLCV, FundingRateHistory, Order, OrderType, OrderRequest, Str, Trade, Balances, Transaction, Ticker, OrderBook, Tickers, Market, Strings, Currency, Position, Dict, Leverage, MarginMode } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class bingx
|
|
5
5
|
* @augments Exchange
|
|
@@ -139,6 +139,8 @@ export default class bingx extends Exchange {
|
|
|
139
139
|
}>;
|
|
140
140
|
setPositionMode(hedged: boolean, symbol?: Str, params?: {}): Promise<any>;
|
|
141
141
|
editOrder(id: string, symbol: string, type: OrderType, side: OrderSide, amount?: number, price?: number, params?: {}): Promise<Order>;
|
|
142
|
+
fetchMarginMode(symbol: string, params?: {}): Promise<MarginMode>;
|
|
143
|
+
parseMarginMode(marginMode: any, market?: any): MarginMode;
|
|
142
144
|
sign(path: any, section?: string, method?: string, params?: {}, headers?: any, body?: any): {
|
|
143
145
|
url: any;
|
|
144
146
|
method: string;
|
package/js/src/bingx.js
CHANGED
|
@@ -62,6 +62,7 @@ export default class bingx extends Exchange {
|
|
|
62
62
|
'fetchFundingRates': true,
|
|
63
63
|
'fetchLeverage': true,
|
|
64
64
|
'fetchLiquidations': false,
|
|
65
|
+
'fetchMarginMode': true,
|
|
65
66
|
'fetchMarkets': true,
|
|
66
67
|
'fetchMarkOHLCV': true,
|
|
67
68
|
'fetchMyLiquidations': true,
|
|
@@ -4169,6 +4170,43 @@ export default class bingx extends Exchange {
|
|
|
4169
4170
|
const data = this.safeDict(response, 'data');
|
|
4170
4171
|
return this.parseOrder(data, market);
|
|
4171
4172
|
}
|
|
4173
|
+
async fetchMarginMode(symbol, params = {}) {
|
|
4174
|
+
/**
|
|
4175
|
+
* @method
|
|
4176
|
+
* @name bingx#fetchMarginMode
|
|
4177
|
+
* @description fetches the margin mode of the trading pair
|
|
4178
|
+
* @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Query%20Margin%20Mode
|
|
4179
|
+
* @param {string} symbol unified symbol of the market to fetch the margin mode for
|
|
4180
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4181
|
+
* @returns {object} Struct of MarginMode
|
|
4182
|
+
*/
|
|
4183
|
+
await this.loadMarkets();
|
|
4184
|
+
const market = this.market(symbol);
|
|
4185
|
+
const request = {
|
|
4186
|
+
'symbol': market['id'],
|
|
4187
|
+
};
|
|
4188
|
+
const response = await this.swapV2PrivateGetTradeMarginType(this.extend(request, params));
|
|
4189
|
+
//
|
|
4190
|
+
// {
|
|
4191
|
+
// "code": 0,
|
|
4192
|
+
// "msg": "",
|
|
4193
|
+
// "data": {
|
|
4194
|
+
// "marginType": "CROSSED"
|
|
4195
|
+
// }
|
|
4196
|
+
// }
|
|
4197
|
+
//
|
|
4198
|
+
const data = this.safeDict(response, 'data', {});
|
|
4199
|
+
return this.parseMarginMode(data, market);
|
|
4200
|
+
}
|
|
4201
|
+
parseMarginMode(marginMode, market = undefined) {
|
|
4202
|
+
let marginType = this.safeStringLower(marginMode, 'marginType');
|
|
4203
|
+
marginType = (marginType === 'crossed') ? 'cross' : marginType;
|
|
4204
|
+
return {
|
|
4205
|
+
'info': marginMode,
|
|
4206
|
+
'symbol': market['symbol'],
|
|
4207
|
+
'marginMode': marginType,
|
|
4208
|
+
};
|
|
4209
|
+
}
|
|
4172
4210
|
sign(path, section = 'public', method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
4173
4211
|
const type = section[0];
|
|
4174
4212
|
const version = section[1];
|