ccxt 4.2.43 → 4.2.44
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/ccxt.browser.js +627 -325
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +6 -0
- package/dist/cjs/src/binance.js +254 -42
- package/dist/cjs/src/bingx.js +3 -1
- package/dist/cjs/src/blofin.js +2 -1
- package/dist/cjs/src/coinbase.js +1 -7
- package/dist/cjs/src/krakenfutures.js +3 -2
- package/dist/cjs/src/kucoin.js +9 -5
- package/dist/cjs/src/mexc.js +348 -266
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/base/Exchange.js +6 -0
- package/js/src/binance.js +254 -42
- package/js/src/bingx.js +3 -1
- package/js/src/blofin.js +2 -1
- package/js/src/coinbase.js +1 -7
- package/js/src/coinbasepro.d.ts +1 -1
- package/js/src/krakenfutures.js +3 -2
- package/js/src/kucoin.js +9 -5
- package/js/src/mexc.d.ts +4 -5
- package/js/src/mexc.js +348 -266
- package/js/src/static_dependencies/jsencrypt/lib/jsbn/jsbn.d.ts +1 -1
- package/package.json +1 -1
- package/skip-tests.json +2 -0
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 } 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.43";
|
|
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.44';
|
|
42
42
|
Exchange.ccxtVersion = version;
|
|
43
43
|
//-----------------------------------------------------------------------------
|
|
44
44
|
import ace from './src/ace.js';
|
package/js/src/base/Exchange.js
CHANGED
|
@@ -3136,6 +3136,9 @@ export default class Exchange {
|
|
|
3136
3136
|
* @param {string} currencyCode unified currency code, but this argument is not required by default, unless there is an exchange (like huobi) that needs an override of the method to be able to pass currencyCode argument additionally
|
|
3137
3137
|
* @returns {string|undefined} exchange-specific network id
|
|
3138
3138
|
*/
|
|
3139
|
+
if (networkCode === undefined) {
|
|
3140
|
+
return undefined;
|
|
3141
|
+
}
|
|
3139
3142
|
const networkIdsByCodes = this.safeValue(this.options, 'networks', {});
|
|
3140
3143
|
let networkId = this.safeString(networkIdsByCodes, networkCode);
|
|
3141
3144
|
// for example, if 'ETH' is passed for networkCode, but 'ETH' key not defined in `options->networks` object
|
|
@@ -3179,6 +3182,9 @@ export default class Exchange {
|
|
|
3179
3182
|
* @param {string|undefined} currencyCode unified currency code, but this argument is not required by default, unless there is an exchange (like huobi) that needs an override of the method to be able to pass currencyCode argument additionally
|
|
3180
3183
|
* @returns {string|undefined} unified network code
|
|
3181
3184
|
*/
|
|
3185
|
+
if (networkId === undefined) {
|
|
3186
|
+
return undefined;
|
|
3187
|
+
}
|
|
3182
3188
|
const networkCodesByIds = this.safeDict(this.options, 'networksById', {});
|
|
3183
3189
|
let networkCode = this.safeString(networkCodesByIds, networkId, networkId);
|
|
3184
3190
|
// replace mainnet network-codes (i.e. ERC20->ETH)
|
package/js/src/binance.js
CHANGED
|
@@ -2655,9 +2655,11 @@ export default class binance extends Exchange {
|
|
|
2655
2655
|
const networkList = this.safeList(entry, 'networkList', []);
|
|
2656
2656
|
const fees = {};
|
|
2657
2657
|
let fee = undefined;
|
|
2658
|
+
const networks = {};
|
|
2658
2659
|
for (let j = 0; j < networkList.length; j++) {
|
|
2659
2660
|
const networkItem = networkList[j];
|
|
2660
2661
|
const network = this.safeString(networkItem, 'network');
|
|
2662
|
+
const networkCode = this.networkIdToCode(network);
|
|
2661
2663
|
// const name = this.safeString (networkItem, 'name');
|
|
2662
2664
|
const withdrawFee = this.safeNumber(networkItem, 'withdrawFee');
|
|
2663
2665
|
const depositEnable = this.safeBool(networkItem, 'depositEnable');
|
|
@@ -2675,6 +2677,26 @@ export default class binance extends Exchange {
|
|
|
2675
2677
|
if (!Precise.stringEq(precisionTick, '0')) {
|
|
2676
2678
|
minPrecision = (minPrecision === undefined) ? precisionTick : Precise.stringMin(minPrecision, precisionTick);
|
|
2677
2679
|
}
|
|
2680
|
+
networks[networkCode] = {
|
|
2681
|
+
'info': networkItem,
|
|
2682
|
+
'id': network,
|
|
2683
|
+
'network': networkCode,
|
|
2684
|
+
'active': depositEnable && withdrawEnable,
|
|
2685
|
+
'deposit': depositEnable,
|
|
2686
|
+
'withdraw': withdrawEnable,
|
|
2687
|
+
'fee': this.parseNumber(fee),
|
|
2688
|
+
'precision': minPrecision,
|
|
2689
|
+
'limits': {
|
|
2690
|
+
'withdraw': {
|
|
2691
|
+
'min': this.safeNumber(networkItem, 'withdrawMin'),
|
|
2692
|
+
'max': this.safeNumber(networkItem, 'withdrawMax'),
|
|
2693
|
+
},
|
|
2694
|
+
'deposit': {
|
|
2695
|
+
'min': undefined,
|
|
2696
|
+
'max': undefined,
|
|
2697
|
+
},
|
|
2698
|
+
},
|
|
2699
|
+
};
|
|
2678
2700
|
}
|
|
2679
2701
|
const trading = this.safeBool(entry, 'trading');
|
|
2680
2702
|
const active = (isWithdrawEnabled && isDepositEnabled && trading);
|
|
@@ -2691,7 +2713,7 @@ export default class binance extends Exchange {
|
|
|
2691
2713
|
'active': active,
|
|
2692
2714
|
'deposit': isDepositEnabled,
|
|
2693
2715
|
'withdraw': isWithdrawEnabled,
|
|
2694
|
-
'networks':
|
|
2716
|
+
'networks': networks,
|
|
2695
2717
|
'fee': fee,
|
|
2696
2718
|
'fees': fees,
|
|
2697
2719
|
'limits': this.limits,
|
|
@@ -5104,7 +5126,7 @@ export default class binance extends Exchange {
|
|
|
5104
5126
|
// "msg": "Quantity greater than max quantity."
|
|
5105
5127
|
// }
|
|
5106
5128
|
//
|
|
5107
|
-
// createOrder, fetchOpenOrders, fetchOrder, cancelOrder: portfolio margin linear swap and future
|
|
5129
|
+
// createOrder, fetchOpenOrders, fetchOrder, cancelOrder, fetchOrders: portfolio margin linear swap and future
|
|
5108
5130
|
//
|
|
5109
5131
|
// {
|
|
5110
5132
|
// "symbol": "BTCUSDT",
|
|
@@ -5127,7 +5149,7 @@ export default class binance extends Exchange {
|
|
|
5127
5149
|
// "status": "NEW"
|
|
5128
5150
|
// }
|
|
5129
5151
|
//
|
|
5130
|
-
// createOrder, fetchOpenOrders, fetchOrder, cancelOrder: portfolio margin inverse swap and future
|
|
5152
|
+
// createOrder, fetchOpenOrders, fetchOrder, cancelOrder, fetchOrders: portfolio margin inverse swap and future
|
|
5131
5153
|
//
|
|
5132
5154
|
// {
|
|
5133
5155
|
// "symbol": "ETHUSD_PERP",
|
|
@@ -5212,7 +5234,7 @@ export default class binance extends Exchange {
|
|
|
5212
5234
|
// "type": "LIMIT"
|
|
5213
5235
|
// }
|
|
5214
5236
|
//
|
|
5215
|
-
// fetchOpenOrders, fetchOrder: portfolio margin spot margin
|
|
5237
|
+
// fetchOpenOrders, fetchOrder, fetchOrders: portfolio margin spot margin
|
|
5216
5238
|
//
|
|
5217
5239
|
// {
|
|
5218
5240
|
// "symbol": "BTCUSDT",
|
|
@@ -5262,6 +5284,32 @@ export default class binance extends Exchange {
|
|
|
5262
5284
|
// "selfTradePreventionMode": "NONE"
|
|
5263
5285
|
// }
|
|
5264
5286
|
//
|
|
5287
|
+
// fetchOrders: portfolio margin linear and inverse swap conditional
|
|
5288
|
+
//
|
|
5289
|
+
// {
|
|
5290
|
+
// "newClientStrategyId": "x-xcKtGhcuaf166172ed504cd1bc0396",
|
|
5291
|
+
// "strategyId": 3733211,
|
|
5292
|
+
// "strategyStatus": "CANCELLED",
|
|
5293
|
+
// "strategyType": "STOP",
|
|
5294
|
+
// "origQty": "0.010",
|
|
5295
|
+
// "price": "35000",
|
|
5296
|
+
// "orderId": 0,
|
|
5297
|
+
// "reduceOnly": false,
|
|
5298
|
+
// "side": "BUY",
|
|
5299
|
+
// "positionSide": "BOTH",
|
|
5300
|
+
// "stopPrice": "50000",
|
|
5301
|
+
// "symbol": "BTCUSDT",
|
|
5302
|
+
// "type": "LIMIT",
|
|
5303
|
+
// "bookTime": 1707270098774,
|
|
5304
|
+
// "updateTime": 1707270119261,
|
|
5305
|
+
// "timeInForce": "GTC",
|
|
5306
|
+
// "triggerTime": 0,
|
|
5307
|
+
// "workingType": "CONTRACT_PRICE",
|
|
5308
|
+
// "priceProtect": false,
|
|
5309
|
+
// "goodTillDate": 0,
|
|
5310
|
+
// "selfTradePreventionMode": "NONE"
|
|
5311
|
+
// }
|
|
5312
|
+
//
|
|
5265
5313
|
const code = this.safeString(order, 'code');
|
|
5266
5314
|
if (code !== undefined) {
|
|
5267
5315
|
// cancelOrders/createOrders might have a partial success
|
|
@@ -5320,7 +5368,7 @@ export default class binance extends Exchange {
|
|
|
5320
5368
|
}
|
|
5321
5369
|
return this.safeOrder({
|
|
5322
5370
|
'info': order,
|
|
5323
|
-
'id': this.safeString2(order, '
|
|
5371
|
+
'id': this.safeString2(order, 'strategyId', 'orderId'),
|
|
5324
5372
|
'clientOrderId': this.safeString2(order, 'clientOrderId', 'newClientStrategyId'),
|
|
5325
5373
|
'timestamp': timestamp,
|
|
5326
5374
|
'datetime': this.iso8601(timestamp),
|
|
@@ -5955,13 +6003,20 @@ export default class binance extends Exchange {
|
|
|
5955
6003
|
* @see https://binance-docs.github.io/apidocs/delivery/en/#all-orders-user_data
|
|
5956
6004
|
* @see https://binance-docs.github.io/apidocs/voptions/en/#query-option-order-history-trade
|
|
5957
6005
|
* @see https://binance-docs.github.io/apidocs/spot/en/#query-margin-account-39-s-all-orders-user_data
|
|
6006
|
+
* @see https://binance-docs.github.io/apidocs/pm/en/#query-all-um-orders-user_data
|
|
6007
|
+
* @see https://binance-docs.github.io/apidocs/pm/en/#query-all-cm-orders-user_data
|
|
6008
|
+
* @see https://binance-docs.github.io/apidocs/pm/en/#query-all-um-conditional-orders-user_data
|
|
6009
|
+
* @see https://binance-docs.github.io/apidocs/pm/en/#query-all-cm-conditional-orders-user_data
|
|
6010
|
+
* @see https://binance-docs.github.io/apidocs/pm/en/#query-all-margin-account-orders-user_data
|
|
5958
6011
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
5959
6012
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
5960
6013
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
5961
6014
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
5962
6015
|
* @param {string} [params.marginMode] 'cross' or 'isolated', for spot margin trading
|
|
5963
6016
|
* @param {int} [params.until] the latest time in ms to fetch orders for
|
|
5964
|
-
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [
|
|
6017
|
+
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
6018
|
+
* @param {boolean} [params.portfolioMargin] set to true if you would like to fetch orders in a portfolio margin account
|
|
6019
|
+
* @param {boolean} [params.stop] set to true if you would like to fetch portfolio margin account stop or conditional orders
|
|
5965
6020
|
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
5966
6021
|
*/
|
|
5967
6022
|
if (symbol === undefined) {
|
|
@@ -5974,17 +6029,18 @@ export default class binance extends Exchange {
|
|
|
5974
6029
|
return await this.fetchPaginatedCallDynamic('fetchOrders', symbol, since, limit, params);
|
|
5975
6030
|
}
|
|
5976
6031
|
const market = this.market(symbol);
|
|
5977
|
-
const defaultType = this.safeString2(this.options, 'fetchOrders', 'defaultType', '
|
|
6032
|
+
const defaultType = this.safeString2(this.options, 'fetchOrders', 'defaultType', market['type']);
|
|
5978
6033
|
const type = this.safeString(params, 'type', defaultType);
|
|
5979
|
-
|
|
5980
|
-
|
|
6034
|
+
let marginMode = undefined;
|
|
6035
|
+
[marginMode, params] = this.handleMarginModeAndParams('fetchOrders', params);
|
|
6036
|
+
let isPortfolioMargin = undefined;
|
|
6037
|
+
[isPortfolioMargin, params] = this.handleOptionAndParams2(params, 'fetchOrders', 'papi', 'portfolioMargin', false);
|
|
6038
|
+
const isConditional = this.safeBool2(params, 'stop', 'conditional');
|
|
6039
|
+
params = this.omit(params, ['stop', 'conditional', 'type']);
|
|
6040
|
+
let request = {
|
|
5981
6041
|
'symbol': market['id'],
|
|
5982
6042
|
};
|
|
5983
|
-
|
|
5984
|
-
if (until !== undefined) {
|
|
5985
|
-
params = this.omit(params, 'until');
|
|
5986
|
-
request['endTime'] = until;
|
|
5987
|
-
}
|
|
6043
|
+
[request, params] = this.handleUntilOption('endTime', request, params);
|
|
5988
6044
|
if (since !== undefined) {
|
|
5989
6045
|
request['startTime'] = since;
|
|
5990
6046
|
}
|
|
@@ -5993,22 +6049,47 @@ export default class binance extends Exchange {
|
|
|
5993
6049
|
}
|
|
5994
6050
|
let response = undefined;
|
|
5995
6051
|
if (market['option']) {
|
|
5996
|
-
response = await this.eapiPrivateGetHistoryOrders(this.extend(request,
|
|
6052
|
+
response = await this.eapiPrivateGetHistoryOrders(this.extend(request, params));
|
|
5997
6053
|
}
|
|
5998
6054
|
else if (market['linear']) {
|
|
5999
|
-
|
|
6055
|
+
if (isPortfolioMargin) {
|
|
6056
|
+
if (isConditional) {
|
|
6057
|
+
response = await this.papiGetUmConditionalAllOrders(this.extend(request, params));
|
|
6058
|
+
}
|
|
6059
|
+
else {
|
|
6060
|
+
response = await this.papiGetUmAllOrders(this.extend(request, params));
|
|
6061
|
+
}
|
|
6062
|
+
}
|
|
6063
|
+
else {
|
|
6064
|
+
response = await this.fapiPrivateGetAllOrders(this.extend(request, params));
|
|
6065
|
+
}
|
|
6000
6066
|
}
|
|
6001
6067
|
else if (market['inverse']) {
|
|
6002
|
-
|
|
6003
|
-
|
|
6004
|
-
|
|
6005
|
-
|
|
6006
|
-
|
|
6068
|
+
if (isPortfolioMargin) {
|
|
6069
|
+
if (isConditional) {
|
|
6070
|
+
response = await this.papiGetCmConditionalAllOrders(this.extend(request, params));
|
|
6071
|
+
}
|
|
6072
|
+
else {
|
|
6073
|
+
response = await this.papiGetCmAllOrders(this.extend(request, params));
|
|
6074
|
+
}
|
|
6075
|
+
}
|
|
6076
|
+
else {
|
|
6077
|
+
response = await this.dapiPrivateGetAllOrders(this.extend(request, params));
|
|
6007
6078
|
}
|
|
6008
|
-
response = await this.sapiGetMarginAllOrders(this.extend(request, query));
|
|
6009
6079
|
}
|
|
6010
6080
|
else {
|
|
6011
|
-
|
|
6081
|
+
if (isPortfolioMargin) {
|
|
6082
|
+
response = await this.papiGetMarginAllOrders(this.extend(request, params));
|
|
6083
|
+
}
|
|
6084
|
+
else if (type === 'margin' || marginMode !== undefined) {
|
|
6085
|
+
if (marginMode === 'isolated') {
|
|
6086
|
+
request['isIsolated'] = true;
|
|
6087
|
+
}
|
|
6088
|
+
response = await this.sapiGetMarginAllOrders(this.extend(request, params));
|
|
6089
|
+
}
|
|
6090
|
+
else {
|
|
6091
|
+
response = await this.privateGetAllOrders(this.extend(request, params));
|
|
6092
|
+
}
|
|
6012
6093
|
}
|
|
6013
6094
|
//
|
|
6014
6095
|
// spot
|
|
@@ -6084,6 +6165,112 @@ export default class binance extends Exchange {
|
|
|
6084
6165
|
// }
|
|
6085
6166
|
// ]
|
|
6086
6167
|
//
|
|
6168
|
+
// inverse portfolio margin
|
|
6169
|
+
//
|
|
6170
|
+
// [
|
|
6171
|
+
// {
|
|
6172
|
+
// "orderId": 71328442983,
|
|
6173
|
+
// "symbol": "ETHUSD_PERP",
|
|
6174
|
+
// "pair": "ETHUSD",
|
|
6175
|
+
// "status": "CANCELED",
|
|
6176
|
+
// "clientOrderId": "x-xcKtGhcu4b3e3d8515dd4dc5ba9ccc",
|
|
6177
|
+
// "price": "2000",
|
|
6178
|
+
// "avgPrice": "0.00",
|
|
6179
|
+
// "origQty": "1",
|
|
6180
|
+
// "executedQty": "0",
|
|
6181
|
+
// "cumBase": "0",
|
|
6182
|
+
// "timeInForce": "GTC",
|
|
6183
|
+
// "type": "LIMIT",
|
|
6184
|
+
// "reduceOnly": false,
|
|
6185
|
+
// "side": "BUY",
|
|
6186
|
+
// "origType": "LIMIT",
|
|
6187
|
+
// "time": 1707197843046,
|
|
6188
|
+
// "updateTime": 1707197941373,
|
|
6189
|
+
// "positionSide": "BOTH"
|
|
6190
|
+
// },
|
|
6191
|
+
// ]
|
|
6192
|
+
//
|
|
6193
|
+
// linear portfolio margin
|
|
6194
|
+
//
|
|
6195
|
+
// [
|
|
6196
|
+
// {
|
|
6197
|
+
// "orderId": 259235347005,
|
|
6198
|
+
// "symbol": "BTCUSDT",
|
|
6199
|
+
// "status": "CANCELED",
|
|
6200
|
+
// "clientOrderId": "x-xcKtGhcu402881c9103f42bdb4183b",
|
|
6201
|
+
// "price": "35000",
|
|
6202
|
+
// "avgPrice": "0.00000",
|
|
6203
|
+
// "origQty": "0.010",
|
|
6204
|
+
// "executedQty": "0",
|
|
6205
|
+
// "cumQuote": "0",
|
|
6206
|
+
// "timeInForce": "GTC",
|
|
6207
|
+
// "type": "LIMIT",
|
|
6208
|
+
// "reduceOnly": false,
|
|
6209
|
+
// "side": "BUY",
|
|
6210
|
+
// "origType": "LIMIT",
|
|
6211
|
+
// "time": 1707194702167,
|
|
6212
|
+
// "updateTime": 1707197804748,
|
|
6213
|
+
// "positionSide": "BOTH",
|
|
6214
|
+
// "selfTradePreventionMode": "NONE",
|
|
6215
|
+
// "goodTillDate": 0
|
|
6216
|
+
// },
|
|
6217
|
+
// ]
|
|
6218
|
+
//
|
|
6219
|
+
// conditional portfolio margin
|
|
6220
|
+
//
|
|
6221
|
+
// [
|
|
6222
|
+
// {
|
|
6223
|
+
// "newClientStrategyId": "x-xcKtGhcuaf166172ed504cd1bc0396",
|
|
6224
|
+
// "strategyId": 3733211,
|
|
6225
|
+
// "strategyStatus": "CANCELLED",
|
|
6226
|
+
// "strategyType": "STOP",
|
|
6227
|
+
// "origQty": "0.010",
|
|
6228
|
+
// "price": "35000",
|
|
6229
|
+
// "orderId": 0,
|
|
6230
|
+
// "reduceOnly": false,
|
|
6231
|
+
// "side": "BUY",
|
|
6232
|
+
// "positionSide": "BOTH",
|
|
6233
|
+
// "stopPrice": "50000",
|
|
6234
|
+
// "symbol": "BTCUSDT",
|
|
6235
|
+
// "type": "LIMIT",
|
|
6236
|
+
// "bookTime": 1707270098774,
|
|
6237
|
+
// "updateTime": 1707270119261,
|
|
6238
|
+
// "timeInForce": "GTC",
|
|
6239
|
+
// "triggerTime": 0,
|
|
6240
|
+
// "workingType": "CONTRACT_PRICE",
|
|
6241
|
+
// "priceProtect": false,
|
|
6242
|
+
// "goodTillDate": 0,
|
|
6243
|
+
// "selfTradePreventionMode": "NONE"
|
|
6244
|
+
// },
|
|
6245
|
+
// ]
|
|
6246
|
+
//
|
|
6247
|
+
// spot margin portfolio margin
|
|
6248
|
+
//
|
|
6249
|
+
// [
|
|
6250
|
+
// {
|
|
6251
|
+
// "symbol": "BTCUSDT",
|
|
6252
|
+
// "orderId": 24684460474,
|
|
6253
|
+
// "clientOrderId": "x-R4BD3S82e9ef29d8346440f0b28b86",
|
|
6254
|
+
// "price": "35000.00000000",
|
|
6255
|
+
// "origQty": "0.00100000",
|
|
6256
|
+
// "executedQty": "0.00000000",
|
|
6257
|
+
// "cummulativeQuoteQty": "0.00000000",
|
|
6258
|
+
// "status": "CANCELED",
|
|
6259
|
+
// "timeInForce": "GTC",
|
|
6260
|
+
// "type": "LIMIT",
|
|
6261
|
+
// "side": "BUY",
|
|
6262
|
+
// "stopPrice": "0.00000000",
|
|
6263
|
+
// "icebergQty": "0.00000000",
|
|
6264
|
+
// "time": 1707113538870,
|
|
6265
|
+
// "updateTime": 1707113797688,
|
|
6266
|
+
// "isWorking": true,
|
|
6267
|
+
// "accountId": 200180970,
|
|
6268
|
+
// "selfTradePreventionMode": "EXPIRE_MAKER",
|
|
6269
|
+
// "preventedMatchId": null,
|
|
6270
|
+
// "preventedQuantity": null
|
|
6271
|
+
// },
|
|
6272
|
+
// ]
|
|
6273
|
+
//
|
|
6087
6274
|
return this.parseOrders(response, market, since, limit);
|
|
6088
6275
|
}
|
|
6089
6276
|
async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
@@ -6208,13 +6395,23 @@ export default class binance extends Exchange {
|
|
|
6208
6395
|
* @see https://binance-docs.github.io/apidocs/delivery/en/#all-orders-user_data
|
|
6209
6396
|
* @see https://binance-docs.github.io/apidocs/voptions/en/#query-option-order-history-trade
|
|
6210
6397
|
* @see https://binance-docs.github.io/apidocs/spot/en/#query-margin-account-39-s-all-orders-user_data
|
|
6398
|
+
* @see https://binance-docs.github.io/apidocs/pm/en/#query-all-um-orders-user_data
|
|
6399
|
+
* @see https://binance-docs.github.io/apidocs/pm/en/#query-all-cm-orders-user_data
|
|
6400
|
+
* @see https://binance-docs.github.io/apidocs/pm/en/#query-all-um-conditional-orders-user_data
|
|
6401
|
+
* @see https://binance-docs.github.io/apidocs/pm/en/#query-all-cm-conditional-orders-user_data
|
|
6402
|
+
* @see https://binance-docs.github.io/apidocs/pm/en/#query-all-margin-account-orders-user_data
|
|
6211
6403
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
6212
6404
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
6213
6405
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
6214
6406
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6215
|
-
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [
|
|
6407
|
+
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
6408
|
+
* @param {boolean} [params.portfolioMargin] set to true if you would like to fetch orders in a portfolio margin account
|
|
6409
|
+
* @param {boolean} [params.stop] set to true if you would like to fetch portfolio margin account stop or conditional orders
|
|
6216
6410
|
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
6217
6411
|
*/
|
|
6412
|
+
if (symbol === undefined) {
|
|
6413
|
+
throw new ArgumentsRequired(this.id + ' fetchClosedOrders() requires a symbol argument');
|
|
6414
|
+
}
|
|
6218
6415
|
const orders = await this.fetchOrders(symbol, since, undefined, params);
|
|
6219
6416
|
const filteredOrders = this.filterBy(orders, 'status', 'closed');
|
|
6220
6417
|
return this.filterBySinceLimit(filteredOrders, since, limit);
|
|
@@ -6227,22 +6424,23 @@ export default class binance extends Exchange {
|
|
|
6227
6424
|
* @see https://binance-docs.github.io/apidocs/spot/en/#all-orders-user_data
|
|
6228
6425
|
* @see https://binance-docs.github.io/apidocs/spot/en/#query-margin-account-39-s-all-orders-user_data
|
|
6229
6426
|
* @see https://binance-docs.github.io/apidocs/voptions/en/#query-option-order-history-trade
|
|
6427
|
+
* @see https://binance-docs.github.io/apidocs/pm/en/#query-all-um-orders-user_data
|
|
6428
|
+
* @see https://binance-docs.github.io/apidocs/pm/en/#query-all-cm-orders-user_data
|
|
6429
|
+
* @see https://binance-docs.github.io/apidocs/pm/en/#query-all-um-conditional-orders-user_data
|
|
6430
|
+
* @see https://binance-docs.github.io/apidocs/pm/en/#query-all-cm-conditional-orders-user_data
|
|
6431
|
+
* @see https://binance-docs.github.io/apidocs/pm/en/#query-all-margin-account-orders-user_data
|
|
6230
6432
|
* @param {string} symbol unified market symbol of the market the orders were made in
|
|
6231
6433
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
6232
6434
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
6233
6435
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6234
|
-
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [
|
|
6436
|
+
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
6437
|
+
* @param {boolean} [params.portfolioMargin] set to true if you would like to fetch orders in a portfolio margin account
|
|
6438
|
+
* @param {boolean} [params.stop] set to true if you would like to fetch portfolio margin account stop or conditional orders
|
|
6235
6439
|
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
6236
6440
|
*/
|
|
6237
6441
|
if (symbol === undefined) {
|
|
6238
6442
|
throw new ArgumentsRequired(this.id + ' fetchCanceledOrders() requires a symbol argument');
|
|
6239
6443
|
}
|
|
6240
|
-
await this.loadMarkets();
|
|
6241
|
-
const market = this.market(symbol);
|
|
6242
|
-
if (market['swap'] || market['future']) {
|
|
6243
|
-
throw new NotSupported(this.id + ' fetchCanceledOrders() supports spot, margin and option markets only');
|
|
6244
|
-
}
|
|
6245
|
-
params = this.omit(params, 'type');
|
|
6246
6444
|
const orders = await this.fetchOrders(symbol, since, undefined, params);
|
|
6247
6445
|
const filteredOrders = this.filterBy(orders, 'status', 'canceled');
|
|
6248
6446
|
return this.filterBySinceLimit(filteredOrders, since, limit);
|
|
@@ -7991,35 +8189,48 @@ export default class binance extends Exchange {
|
|
|
7991
8189
|
* @see https://binance-docs.github.io/apidocs/spot/en/#trade-fee-user_data
|
|
7992
8190
|
* @see https://binance-docs.github.io/apidocs/futures/en/#user-commission-rate-user_data
|
|
7993
8191
|
* @see https://binance-docs.github.io/apidocs/delivery/en/#user-commission-rate-user_data
|
|
8192
|
+
* @see https://binance-docs.github.io/apidocs/pm/en/#get-user-commission-rate-for-um-user_data
|
|
8193
|
+
* @see https://binance-docs.github.io/apidocs/pm/en/#get-user-commission-rate-for-cm-user_data
|
|
7994
8194
|
* @param {string} symbol unified market symbol
|
|
7995
8195
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
8196
|
+
* @param {boolean} [params.portfolioMargin] set to true if you would like to fetch trading fees in a portfolio margin account
|
|
7996
8197
|
* @returns {object} a [fee structure]{@link https://docs.ccxt.com/#/?id=fee-structure}
|
|
7997
8198
|
*/
|
|
7998
8199
|
await this.loadMarkets();
|
|
7999
8200
|
const market = this.market(symbol);
|
|
8000
|
-
const
|
|
8001
|
-
const type = this.safeString(params, 'type', defaultType);
|
|
8002
|
-
params = this.omit(params, 'type');
|
|
8201
|
+
const type = market['type'];
|
|
8003
8202
|
let subType = undefined;
|
|
8004
8203
|
[subType, params] = this.handleSubTypeAndParams('fetchTradingFee', market, params);
|
|
8005
|
-
|
|
8204
|
+
let isPortfolioMargin = undefined;
|
|
8205
|
+
[isPortfolioMargin, params] = this.handleOptionAndParams2(params, 'fetchTradingFee', 'papi', 'portfolioMargin', false);
|
|
8006
8206
|
const isLinear = this.isLinear(type, subType);
|
|
8007
8207
|
const isInverse = this.isInverse(type, subType);
|
|
8008
8208
|
const request = {
|
|
8009
8209
|
'symbol': market['id'],
|
|
8010
8210
|
};
|
|
8011
8211
|
let response = undefined;
|
|
8012
|
-
if (
|
|
8013
|
-
|
|
8014
|
-
|
|
8015
|
-
|
|
8016
|
-
|
|
8212
|
+
if (isLinear) {
|
|
8213
|
+
if (isPortfolioMargin) {
|
|
8214
|
+
response = await this.papiGetUmCommissionRate(this.extend(request, params));
|
|
8215
|
+
}
|
|
8216
|
+
else {
|
|
8217
|
+
response = await this.fapiPrivateGetCommissionRate(this.extend(request, params));
|
|
8218
|
+
}
|
|
8017
8219
|
}
|
|
8018
8220
|
else if (isInverse) {
|
|
8019
|
-
|
|
8221
|
+
if (isPortfolioMargin) {
|
|
8222
|
+
response = await this.papiGetCmCommissionRate(this.extend(request, params));
|
|
8223
|
+
}
|
|
8224
|
+
else {
|
|
8225
|
+
response = await this.dapiPrivateGetCommissionRate(this.extend(request, params));
|
|
8226
|
+
}
|
|
8227
|
+
}
|
|
8228
|
+
else {
|
|
8229
|
+
response = await this.sapiGetAssetTradeFee(this.extend(request, params));
|
|
8020
8230
|
}
|
|
8021
8231
|
//
|
|
8022
8232
|
// spot
|
|
8233
|
+
//
|
|
8023
8234
|
// [
|
|
8024
8235
|
// {
|
|
8025
8236
|
// "symbol": "BTCUSDT",
|
|
@@ -8029,6 +8240,7 @@ export default class binance extends Exchange {
|
|
|
8029
8240
|
// ]
|
|
8030
8241
|
//
|
|
8031
8242
|
// swap
|
|
8243
|
+
//
|
|
8032
8244
|
// {
|
|
8033
8245
|
// "symbol": "BTCUSD_PERP",
|
|
8034
8246
|
// "makerCommissionRate": "0.00015", // 0.015%
|
|
@@ -8039,7 +8251,7 @@ export default class binance extends Exchange {
|
|
|
8039
8251
|
if (Array.isArray(data)) {
|
|
8040
8252
|
data = this.safeDict(data, 0, {});
|
|
8041
8253
|
}
|
|
8042
|
-
return this.parseTradingFee(data);
|
|
8254
|
+
return this.parseTradingFee(data, market);
|
|
8043
8255
|
}
|
|
8044
8256
|
async fetchTradingFees(params = {}) {
|
|
8045
8257
|
/**
|
package/js/src/bingx.js
CHANGED
|
@@ -388,7 +388,9 @@ export default class bingx extends Exchange {
|
|
|
388
388
|
},
|
|
389
389
|
'broad': {},
|
|
390
390
|
},
|
|
391
|
-
'commonCurrencies': {
|
|
391
|
+
'commonCurrencies': {
|
|
392
|
+
'SNOW': 'Snowman', // Snowman vs SnowSwap conflict
|
|
393
|
+
},
|
|
392
394
|
'options': {
|
|
393
395
|
'defaultType': 'spot',
|
|
394
396
|
'accountsByType': {
|
package/js/src/blofin.js
CHANGED
|
@@ -958,7 +958,8 @@ export default class blofin extends Exchange {
|
|
|
958
958
|
const request = {};
|
|
959
959
|
let response = undefined;
|
|
960
960
|
if (accountType !== undefined) {
|
|
961
|
-
const
|
|
961
|
+
const options = this.safeDict(this.options, 'accountsByType', {});
|
|
962
|
+
const parsedAccountType = this.safeString(options, accountType, accountType);
|
|
962
963
|
request['accountType'] = parsedAccountType;
|
|
963
964
|
response = await this.privateGetAssetBalances(this.extend(request, params));
|
|
964
965
|
}
|
package/js/src/coinbase.js
CHANGED
|
@@ -3391,13 +3391,7 @@ export default class coinbase extends Exchange {
|
|
|
3391
3391
|
payload = body;
|
|
3392
3392
|
}
|
|
3393
3393
|
}
|
|
3394
|
-
|
|
3395
|
-
if (version === 'v3') {
|
|
3396
|
-
auth = nonce + method + savedPath + payload;
|
|
3397
|
-
}
|
|
3398
|
-
else {
|
|
3399
|
-
auth = nonce + method + fullPath + payload;
|
|
3400
|
-
}
|
|
3394
|
+
const auth = nonce + method + savedPath + payload;
|
|
3401
3395
|
const signature = this.hmac(this.encode(auth), this.encode(this.secret), sha256);
|
|
3402
3396
|
headers = {
|
|
3403
3397
|
'CB-ACCESS-KEY': this.apiKey,
|
package/js/src/coinbasepro.d.ts
CHANGED
|
@@ -62,7 +62,7 @@ export default class coinbasepro extends Exchange {
|
|
|
62
62
|
fetchDepositsWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
|
|
63
63
|
fetchDeposits(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
|
|
64
64
|
fetchWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
|
|
65
|
-
parseTransactionStatus(transaction: any): "ok" | "
|
|
65
|
+
parseTransactionStatus(transaction: any): "ok" | "canceled" | "failed" | "pending";
|
|
66
66
|
parseTransaction(transaction: any, currency?: Currency): Transaction;
|
|
67
67
|
createDepositAddress(code: string, params?: {}): Promise<{
|
|
68
68
|
currency: string;
|
package/js/src/krakenfutures.js
CHANGED
|
@@ -864,6 +864,7 @@ export default class krakenfutures extends Exchange {
|
|
|
864
864
|
}
|
|
865
865
|
createOrderRequest(symbol, type, side, amount, price = undefined, params = {}) {
|
|
866
866
|
const market = this.market(symbol);
|
|
867
|
+
symbol = market['symbol'];
|
|
867
868
|
type = this.safeString(params, 'orderType', type);
|
|
868
869
|
const timeInForce = this.safeString(params, 'timeInForce');
|
|
869
870
|
let postOnly = false;
|
|
@@ -883,7 +884,7 @@ export default class krakenfutures extends Exchange {
|
|
|
883
884
|
const request = {
|
|
884
885
|
'symbol': market['id'],
|
|
885
886
|
'side': side,
|
|
886
|
-
'size': amount,
|
|
887
|
+
'size': this.amountToPrecision(symbol, amount),
|
|
887
888
|
};
|
|
888
889
|
const clientOrderId = this.safeString2(params, 'clientOrderId', 'cliOrdId');
|
|
889
890
|
if (clientOrderId !== undefined) {
|
|
@@ -921,7 +922,7 @@ export default class krakenfutures extends Exchange {
|
|
|
921
922
|
}
|
|
922
923
|
request['orderType'] = type;
|
|
923
924
|
if (price !== undefined) {
|
|
924
|
-
request['limitPrice'] = price;
|
|
925
|
+
request['limitPrice'] = this.priceToPrecision(symbol, price);
|
|
925
926
|
}
|
|
926
927
|
params = this.omit(params, ['clientOrderId', 'timeInForce', 'triggerPrice', 'stopLossPrice', 'takeProfitPrice']);
|
|
927
928
|
return this.extend(request, params);
|
package/js/src/kucoin.js
CHANGED
|
@@ -3860,11 +3860,11 @@ export default class kucoin extends Exchange {
|
|
|
3860
3860
|
}
|
|
3861
3861
|
}
|
|
3862
3862
|
let fee = undefined;
|
|
3863
|
-
const feeCost = this.
|
|
3863
|
+
const feeCost = this.safeString(item, 'fee');
|
|
3864
3864
|
let feeCurrency = undefined;
|
|
3865
|
-
if (feeCost !== 0) {
|
|
3865
|
+
if (feeCost !== '0') {
|
|
3866
3866
|
feeCurrency = code;
|
|
3867
|
-
fee = { 'cost': feeCost, 'currency': feeCurrency };
|
|
3867
|
+
fee = { 'cost': this.parseNumber(feeCost), 'currency': feeCurrency };
|
|
3868
3868
|
}
|
|
3869
3869
|
return {
|
|
3870
3870
|
'id': id,
|
|
@@ -3978,8 +3978,12 @@ export default class kucoin extends Exchange {
|
|
|
3978
3978
|
// }
|
|
3979
3979
|
// }
|
|
3980
3980
|
//
|
|
3981
|
-
const
|
|
3982
|
-
|
|
3981
|
+
const dataList = this.safeList(response, 'data');
|
|
3982
|
+
if (dataList !== undefined) {
|
|
3983
|
+
return this.parseLedger(dataList, currency, since, limit);
|
|
3984
|
+
}
|
|
3985
|
+
const data = this.safeDict(response, 'data');
|
|
3986
|
+
const items = this.safeList(data, 'items', []);
|
|
3983
3987
|
return this.parseLedger(items, currency, since, limit);
|
|
3984
3988
|
}
|
|
3985
3989
|
calculateRateLimiterCost(api, method, path, params, config = {}) {
|
package/js/src/mexc.d.ts
CHANGED
|
@@ -15,7 +15,6 @@ export default class mexc extends Exchange {
|
|
|
15
15
|
}>;
|
|
16
16
|
fetchTime(params?: {}): Promise<number>;
|
|
17
17
|
fetchCurrencies(params?: {}): Promise<{}>;
|
|
18
|
-
safeNetwork(networkId: any): string;
|
|
19
18
|
fetchMarkets(params?: {}): Promise<any>;
|
|
20
19
|
fetchSpotMarkets(params?: {}): Promise<any[]>;
|
|
21
20
|
fetchSwapMarkets(params?: {}): Promise<any[]>;
|
|
@@ -108,17 +107,17 @@ export default class mexc extends Exchange {
|
|
|
108
107
|
parseDepositAddress(depositAddress: any, currency?: Currency): {
|
|
109
108
|
currency: string;
|
|
110
109
|
address: string;
|
|
111
|
-
tag:
|
|
110
|
+
tag: string;
|
|
112
111
|
network: string;
|
|
113
112
|
info: any;
|
|
114
113
|
};
|
|
115
|
-
fetchDepositAddressesByNetwork(code: string, params?: {}): Promise<
|
|
114
|
+
fetchDepositAddressesByNetwork(code: string, params?: {}): Promise<{}>;
|
|
116
115
|
createDepositAddress(code: string, params?: {}): Promise<{
|
|
117
|
-
info: any;
|
|
118
116
|
currency: string;
|
|
119
|
-
network: string;
|
|
120
117
|
address: string;
|
|
121
118
|
tag: string;
|
|
119
|
+
network: string;
|
|
120
|
+
info: any;
|
|
122
121
|
}>;
|
|
123
122
|
fetchDepositAddress(code: string, params?: {}): Promise<any>;
|
|
124
123
|
fetchDeposits(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
|