ccxt 4.2.89 → 4.2.90
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 +829 -114
- package/dist/ccxt.browser.min.js +6 -4
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/ascendex.js +1 -0
- package/dist/cjs/src/base/Exchange.js +38 -0
- package/dist/cjs/src/base/functions/crypto.js +37 -0
- package/dist/cjs/src/base/functions/rsa.js +19 -4
- package/dist/cjs/src/binance.js +90 -9
- package/dist/cjs/src/bingx.js +101 -1
- package/dist/cjs/src/bitfinex2.js +1 -0
- package/dist/cjs/src/bitget.js +2 -0
- package/dist/cjs/src/bitmex.js +1 -0
- package/dist/cjs/src/bitrue.js +1 -0
- package/dist/cjs/src/bybit.js +61 -0
- package/dist/cjs/src/coinbase.js +48 -24
- package/dist/cjs/src/coinbaseinternational.js +1 -0
- package/dist/cjs/src/coinex.js +102 -8
- package/dist/cjs/src/cryptocom.js +1 -0
- package/dist/cjs/src/delta.js +1 -0
- package/dist/cjs/src/digifinex.js +1 -0
- package/dist/cjs/src/exmo.js +1 -0
- package/dist/cjs/src/gate.js +2 -0
- package/dist/cjs/src/gemini.js +10 -9
- package/dist/cjs/src/hitbtc.js +1 -0
- package/dist/cjs/src/htx.js +1 -0
- package/dist/cjs/src/hyperliquid.js +1 -0
- package/dist/cjs/src/kucoin.js +1 -0
- package/dist/cjs/src/kucoinfutures.js +34 -3
- package/dist/cjs/src/mexc.js +1 -0
- package/dist/cjs/src/okx.js +157 -8
- package/dist/cjs/src/phemex.js +1 -0
- package/dist/cjs/src/static_dependencies/noble-curves/p256.js +48 -0
- package/dist/cjs/src/woo.js +1 -0
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/bingx.d.ts +2 -0
- package/js/src/abstract/bybit.d.ts +2 -0
- package/js/src/ascendex.js +1 -0
- package/js/src/base/Exchange.d.ts +5 -0
- package/js/src/base/Exchange.js +38 -0
- package/js/src/base/functions/crypto.js +37 -0
- package/js/src/base/functions/rsa.d.ts +1 -1
- package/js/src/base/functions/rsa.js +21 -5
- package/js/src/base/types.d.ts +1 -0
- package/js/src/binance.d.ts +1 -0
- package/js/src/binance.js +90 -9
- package/js/src/bingx.d.ts +1 -0
- package/js/src/bingx.js +101 -1
- package/js/src/bitfinex2.js +1 -0
- package/js/src/bitget.js +2 -0
- package/js/src/bitmex.js +1 -0
- package/js/src/bitrue.js +1 -0
- package/js/src/bybit.d.ts +2 -0
- package/js/src/bybit.js +61 -0
- package/js/src/coinbase.js +48 -24
- package/js/src/coinbaseinternational.js +1 -0
- package/js/src/coinex.d.ts +2 -0
- package/js/src/coinex.js +102 -8
- package/js/src/cryptocom.js +1 -0
- package/js/src/delta.js +1 -0
- package/js/src/digifinex.js +1 -0
- package/js/src/exmo.js +1 -0
- package/js/src/gate.js +2 -0
- package/js/src/gemini.js +10 -9
- package/js/src/hitbtc.js +1 -0
- package/js/src/htx.js +1 -0
- package/js/src/hyperliquid.js +1 -0
- package/js/src/kucoin.js +1 -0
- package/js/src/kucoinfutures.d.ts +2 -9
- package/js/src/kucoinfutures.js +34 -3
- package/js/src/mexc.js +1 -0
- package/js/src/okx.d.ts +1 -0
- package/js/src/okx.js +157 -8
- package/js/src/phemex.js +1 -0
- package/js/src/woo.js +1 -0
- package/package.json +1 -1
package/js/src/coinex.js
CHANGED
|
@@ -83,6 +83,7 @@ export default class coinex extends Exchange {
|
|
|
83
83
|
'fetchLeverage': 'emulated',
|
|
84
84
|
'fetchLeverages': true,
|
|
85
85
|
'fetchLeverageTiers': true,
|
|
86
|
+
'fetchMarginAdjustmentHistory': true,
|
|
86
87
|
'fetchMarketLeverageTiers': 'emulated',
|
|
87
88
|
'fetchMarkets': true,
|
|
88
89
|
'fetchMarkOHLCV': false,
|
|
@@ -4242,11 +4243,10 @@ export default class coinex extends Exchange {
|
|
|
4242
4243
|
// "message":"OK"
|
|
4243
4244
|
// }
|
|
4244
4245
|
//
|
|
4246
|
+
const data = this.safeDict(response, 'data');
|
|
4245
4247
|
const status = this.safeString(response, 'message');
|
|
4246
|
-
|
|
4247
|
-
return this.extend(this.parseMarginModification(response, market), {
|
|
4248
|
+
return this.extend(this.parseMarginModification(data, market), {
|
|
4248
4249
|
'amount': this.parseNumber(amount),
|
|
4249
|
-
'type': type,
|
|
4250
4250
|
'status': status,
|
|
4251
4251
|
});
|
|
4252
4252
|
}
|
|
@@ -4306,13 +4306,34 @@ export default class coinex extends Exchange {
|
|
|
4306
4306
|
// "user_id": 3620173
|
|
4307
4307
|
// }
|
|
4308
4308
|
//
|
|
4309
|
-
|
|
4309
|
+
// fetchMarginAdjustmentHistory
|
|
4310
|
+
//
|
|
4311
|
+
// {
|
|
4312
|
+
// bkr_price: '0',
|
|
4313
|
+
// leverage: '3',
|
|
4314
|
+
// liq_price: '0',
|
|
4315
|
+
// margin_amount: '5.33236666666666666666',
|
|
4316
|
+
// margin_change: '3',
|
|
4317
|
+
// market: 'XRPUSDT',
|
|
4318
|
+
// position_amount: '11',
|
|
4319
|
+
// position_id: '297155652',
|
|
4320
|
+
// position_type: '2',
|
|
4321
|
+
// settle_price: '0.6361',
|
|
4322
|
+
// time: '1711050906.382891',
|
|
4323
|
+
// type: '1',
|
|
4324
|
+
// user_id: '3685860'
|
|
4325
|
+
// }
|
|
4326
|
+
//
|
|
4327
|
+
const marketId = this.safeString(data, 'market');
|
|
4328
|
+
const type = this.safeString(data, 'type');
|
|
4329
|
+
const timestamp = this.safeIntegerProduct2(data, 'time', 'update_time', 1000);
|
|
4310
4330
|
return {
|
|
4311
4331
|
'info': data,
|
|
4312
|
-
'symbol': this.safeSymbol(undefined,
|
|
4313
|
-
'type':
|
|
4314
|
-
'
|
|
4315
|
-
'
|
|
4332
|
+
'symbol': this.safeSymbol(marketId, market, undefined, 'swap'),
|
|
4333
|
+
'type': (type === '1') ? 'add' : 'reduce',
|
|
4334
|
+
'marginMode': 'isolated',
|
|
4335
|
+
'amount': this.safeNumber(data, 'margin_change'),
|
|
4336
|
+
'total': this.safeNumber(data, 'position_amount'),
|
|
4316
4337
|
'code': market['quote'],
|
|
4317
4338
|
'status': undefined,
|
|
4318
4339
|
'timestamp': timestamp,
|
|
@@ -4963,6 +4984,7 @@ export default class coinex extends Exchange {
|
|
|
4963
4984
|
const currencyId = this.safeString(transfer, 'asset');
|
|
4964
4985
|
const currencyCode = this.safeCurrencyCode(currencyId, currency);
|
|
4965
4986
|
return {
|
|
4987
|
+
'info': transfer,
|
|
4966
4988
|
'id': this.safeInteger(transfer, 'id'),
|
|
4967
4989
|
'timestamp': timestamp,
|
|
4968
4990
|
'datetime': this.iso8601(timestamp),
|
|
@@ -5795,4 +5817,76 @@ export default class coinex extends Exchange {
|
|
|
5795
5817
|
}
|
|
5796
5818
|
return undefined;
|
|
5797
5819
|
}
|
|
5820
|
+
async fetchMarginAdjustmentHistory(symbol = undefined, type = undefined, since = undefined, limit = undefined, params = {}) {
|
|
5821
|
+
/**
|
|
5822
|
+
* @method
|
|
5823
|
+
* @name coinex#fetchMarginAdjustmentHistory
|
|
5824
|
+
* @description fetches the history of margin added or reduced from contract isolated positions
|
|
5825
|
+
* @see https://viabtc.github.io/coinex_api_en_doc/futures/#docsfutures001_http046_position_margin_history
|
|
5826
|
+
* @param {string} [symbol] unified market symbol
|
|
5827
|
+
* @param {string} [type] not used by coinex fetchMarginAdjustmentHistory
|
|
5828
|
+
* @param {int} [since] timestamp in ms of the earliest change to fetch
|
|
5829
|
+
* @param {int} [limit] the maximum amount of changes to fetch, default=100, max=100
|
|
5830
|
+
* @param {object} params extra parameters specific to the exchange api endpoint
|
|
5831
|
+
* @param {int} [params.until] timestamp in ms of the latest change to fetch
|
|
5832
|
+
*
|
|
5833
|
+
* EXCHANGE SPECIFIC PARAMETERS
|
|
5834
|
+
* @param {int} [params.offset] offset
|
|
5835
|
+
* @returns {object[]} a list of [margin structures]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
5836
|
+
*/
|
|
5837
|
+
await this.loadMarkets();
|
|
5838
|
+
const until = this.safeInteger(params, 'until');
|
|
5839
|
+
params = this.omit(params, 'until');
|
|
5840
|
+
if (limit === undefined) {
|
|
5841
|
+
limit = 100;
|
|
5842
|
+
}
|
|
5843
|
+
const request = {
|
|
5844
|
+
'market': '',
|
|
5845
|
+
'position_id': 0,
|
|
5846
|
+
'offset': 0,
|
|
5847
|
+
'limit': limit,
|
|
5848
|
+
};
|
|
5849
|
+
if (symbol !== undefined) {
|
|
5850
|
+
const market = this.market(symbol);
|
|
5851
|
+
request['market'] = market['id'];
|
|
5852
|
+
}
|
|
5853
|
+
if (since !== undefined) {
|
|
5854
|
+
request['start_time'] = since;
|
|
5855
|
+
}
|
|
5856
|
+
if (until !== undefined) {
|
|
5857
|
+
request['end_time'] = until;
|
|
5858
|
+
}
|
|
5859
|
+
const response = await this.v1PerpetualPrivateGetPositionMarginHistory(this.extend(request, params));
|
|
5860
|
+
//
|
|
5861
|
+
// {
|
|
5862
|
+
// code: '0',
|
|
5863
|
+
// data: {
|
|
5864
|
+
// limit: '100',
|
|
5865
|
+
// offset: '0',
|
|
5866
|
+
// records: [
|
|
5867
|
+
// {
|
|
5868
|
+
// bkr_price: '0',
|
|
5869
|
+
// leverage: '3',
|
|
5870
|
+
// liq_price: '0',
|
|
5871
|
+
// margin_amount: '5.33236666666666666666',
|
|
5872
|
+
// margin_change: '3',
|
|
5873
|
+
// market: 'XRPUSDT',
|
|
5874
|
+
// position_amount: '11',
|
|
5875
|
+
// position_id: '297155652',
|
|
5876
|
+
// position_type: '2',
|
|
5877
|
+
// settle_price: '0.6361',
|
|
5878
|
+
// time: '1711050906.382891',
|
|
5879
|
+
// type: '1',
|
|
5880
|
+
// user_id: '3685860'
|
|
5881
|
+
// }
|
|
5882
|
+
// ]
|
|
5883
|
+
// },
|
|
5884
|
+
// message: 'OK'
|
|
5885
|
+
// }
|
|
5886
|
+
//
|
|
5887
|
+
const data = this.safeDict(response, 'data', {});
|
|
5888
|
+
const records = this.safeList(data, 'records', []);
|
|
5889
|
+
const modifications = this.parseMarginModifications(records, undefined, 'market', 'swap');
|
|
5890
|
+
return this.filterBySymbolSinceLimit(modifications, symbol, since, limit);
|
|
5891
|
+
}
|
|
5798
5892
|
}
|
package/js/src/cryptocom.js
CHANGED
|
@@ -69,6 +69,7 @@ export default class cryptocom extends Exchange {
|
|
|
69
69
|
'fetchLedger': true,
|
|
70
70
|
'fetchLeverage': false,
|
|
71
71
|
'fetchLeverageTiers': false,
|
|
72
|
+
'fetchMarginAdjustmentHistory': false,
|
|
72
73
|
'fetchMarginMode': false,
|
|
73
74
|
'fetchMarketLeverageTiers': false,
|
|
74
75
|
'fetchMarkets': true,
|
package/js/src/delta.js
CHANGED
|
@@ -2668,6 +2668,7 @@ export default class delta extends Exchange {
|
|
|
2668
2668
|
'info': data,
|
|
2669
2669
|
'symbol': market['symbol'],
|
|
2670
2670
|
'type': undefined,
|
|
2671
|
+
'marginMode': 'isolated',
|
|
2671
2672
|
'amount': undefined,
|
|
2672
2673
|
'total': this.safeNumber(data, 'margin'),
|
|
2673
2674
|
'code': undefined,
|
package/js/src/digifinex.js
CHANGED
|
@@ -4165,6 +4165,7 @@ export default class digifinex extends Exchange {
|
|
|
4165
4165
|
'info': data,
|
|
4166
4166
|
'symbol': this.safeSymbol(marketId, market, undefined, 'swap'),
|
|
4167
4167
|
'type': (rawType === 1) ? 'add' : 'reduce',
|
|
4168
|
+
'marginMode': 'isolated',
|
|
4168
4169
|
'amount': this.safeNumber(data, 'amount'),
|
|
4169
4170
|
'total': undefined,
|
|
4170
4171
|
'code': market['settle'],
|
package/js/src/exmo.js
CHANGED
|
@@ -267,6 +267,7 @@ export default class exmo extends Exchange {
|
|
|
267
267
|
'info': data,
|
|
268
268
|
'symbol': this.safeSymbol(undefined, market),
|
|
269
269
|
'type': undefined,
|
|
270
|
+
'marginMode': 'isolated',
|
|
270
271
|
'amount': undefined,
|
|
271
272
|
'total': undefined,
|
|
272
273
|
'code': this.safeValue(market, 'quote'),
|
package/js/src/gate.js
CHANGED
|
@@ -123,6 +123,7 @@ export default class gate extends Exchange {
|
|
|
123
123
|
'fetchLeverages': true,
|
|
124
124
|
'fetchLeverageTiers': true,
|
|
125
125
|
'fetchLiquidations': true,
|
|
126
|
+
'fetchMarginAdjustmentHistory': false,
|
|
126
127
|
'fetchMarginMode': false,
|
|
127
128
|
'fetchMarketLeverageTiers': true,
|
|
128
129
|
'fetchMarkets': true,
|
|
@@ -6122,6 +6123,7 @@ export default class gate extends Exchange {
|
|
|
6122
6123
|
'info': data,
|
|
6123
6124
|
'symbol': market['symbol'],
|
|
6124
6125
|
'type': undefined,
|
|
6126
|
+
'marginMode': 'isolated',
|
|
6125
6127
|
'amount': undefined,
|
|
6126
6128
|
'total': total,
|
|
6127
6129
|
'code': this.safeValue(market, 'quote'),
|
package/js/src/gemini.js
CHANGED
|
@@ -110,6 +110,7 @@ export default class gemini extends Exchange {
|
|
|
110
110
|
// https://github.com/ccxt/ccxt/issues/7874
|
|
111
111
|
// https://github.com/ccxt/ccxt/issues/7894
|
|
112
112
|
'web': 'https://docs.gemini.com',
|
|
113
|
+
'webExchange': 'https://exchange.gemini.com',
|
|
113
114
|
},
|
|
114
115
|
'fees': [
|
|
115
116
|
'https://gemini.com/api-fee-schedule',
|
|
@@ -647,7 +648,7 @@ export default class gemini extends Exchange {
|
|
|
647
648
|
let quoteId = undefined;
|
|
648
649
|
let settleId = undefined;
|
|
649
650
|
let tickSize = undefined;
|
|
650
|
-
let
|
|
651
|
+
let amountPrecision = undefined;
|
|
651
652
|
let minSize = undefined;
|
|
652
653
|
let status = undefined;
|
|
653
654
|
let swap = false;
|
|
@@ -658,9 +659,9 @@ export default class gemini extends Exchange {
|
|
|
658
659
|
const isArray = (Array.isArray(response));
|
|
659
660
|
if (!isString && !isArray) {
|
|
660
661
|
marketId = this.safeStringLower(response, 'symbol');
|
|
662
|
+
amountPrecision = this.safeNumber(response, 'tick_size'); // right, exchange has an imperfect naming and this turns out to be an amount-precision
|
|
663
|
+
tickSize = this.safeNumber(response, 'quote_increment'); // this is tick-size actually
|
|
661
664
|
minSize = this.safeNumber(response, 'min_order_size');
|
|
662
|
-
tickSize = this.safeNumber(response, 'tick_size');
|
|
663
|
-
increment = this.safeNumber(response, 'quote_increment');
|
|
664
665
|
status = this.parseMarketActive(this.safeString(response, 'status'));
|
|
665
666
|
baseId = this.safeString(response, 'base_currency');
|
|
666
667
|
quoteId = this.safeString(response, 'quote_currency');
|
|
@@ -673,9 +674,9 @@ export default class gemini extends Exchange {
|
|
|
673
674
|
}
|
|
674
675
|
else {
|
|
675
676
|
marketId = this.safeStringLower(response, 0);
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
677
|
+
tickSize = this.parseNumber(this.parsePrecision(this.safeString(response, 1))); // priceTickDecimalPlaces
|
|
678
|
+
amountPrecision = this.parseNumber(this.parsePrecision(this.safeString(response, 2))); // quantityTickDecimalPlaces
|
|
679
|
+
minSize = this.safeNumber(response, 3); // quantityMinimum
|
|
679
680
|
}
|
|
680
681
|
const marketIdUpper = marketId.toUpperCase();
|
|
681
682
|
const isPerp = (marketIdUpper.indexOf('PERP') >= 0);
|
|
@@ -730,8 +731,8 @@ export default class gemini extends Exchange {
|
|
|
730
731
|
'strike': undefined,
|
|
731
732
|
'optionType': undefined,
|
|
732
733
|
'precision': {
|
|
733
|
-
'price':
|
|
734
|
-
'amount':
|
|
734
|
+
'price': tickSize,
|
|
735
|
+
'amount': amountPrecision,
|
|
735
736
|
},
|
|
736
737
|
'limits': {
|
|
737
738
|
'leverage': {
|
|
@@ -1805,7 +1806,7 @@ export default class gemini extends Exchange {
|
|
|
1805
1806
|
if (apiKey.indexOf('account') < 0) {
|
|
1806
1807
|
throw new AuthenticationError(this.id + ' sign() requires an account-key, master-keys are not-supported');
|
|
1807
1808
|
}
|
|
1808
|
-
const nonce = this.nonce();
|
|
1809
|
+
const nonce = this.nonce().toString();
|
|
1809
1810
|
const request = this.extend({
|
|
1810
1811
|
'request': url,
|
|
1811
1812
|
'nonce': nonce,
|
package/js/src/hitbtc.js
CHANGED
|
@@ -3324,6 +3324,7 @@ export default class hitbtc extends Exchange {
|
|
|
3324
3324
|
'info': data,
|
|
3325
3325
|
'symbol': market['symbol'],
|
|
3326
3326
|
'type': undefined,
|
|
3327
|
+
'marginMode': 'isolated',
|
|
3327
3328
|
'amount': undefined,
|
|
3328
3329
|
'total': undefined,
|
|
3329
3330
|
'code': this.safeString(currencyInfo, 'code'),
|
package/js/src/htx.js
CHANGED
|
@@ -87,6 +87,7 @@ export default class htx extends Exchange {
|
|
|
87
87
|
'fetchLeverage': false,
|
|
88
88
|
'fetchLeverageTiers': true,
|
|
89
89
|
'fetchLiquidations': true,
|
|
90
|
+
'fetchMarginAdjustmentHistory': false,
|
|
90
91
|
'fetchMarketLeverageTiers': true,
|
|
91
92
|
'fetchMarkets': true,
|
|
92
93
|
'fetchMarkOHLCV': true,
|
package/js/src/hyperliquid.js
CHANGED
|
@@ -2140,6 +2140,7 @@ export default class hyperliquid extends Exchange {
|
|
|
2140
2140
|
'info': data,
|
|
2141
2141
|
'symbol': this.safeSymbol(undefined, market),
|
|
2142
2142
|
'type': undefined,
|
|
2143
|
+
'marginMode': 'isolated',
|
|
2143
2144
|
'amount': undefined,
|
|
2144
2145
|
'total': undefined,
|
|
2145
2146
|
'code': this.safeString(market, 'settle'),
|
package/js/src/kucoin.js
CHANGED
|
@@ -76,6 +76,7 @@ export default class kucoin extends Exchange {
|
|
|
76
76
|
'fetchL3OrderBook': true,
|
|
77
77
|
'fetchLedger': true,
|
|
78
78
|
'fetchLeverageTiers': false,
|
|
79
|
+
'fetchMarginAdjustmentHistory': false,
|
|
79
80
|
'fetchMarginMode': false,
|
|
80
81
|
'fetchMarketLeverageTiers': false,
|
|
81
82
|
'fetchMarkets': true,
|
|
@@ -38,17 +38,10 @@ export default class kucoinfutures extends kucoin {
|
|
|
38
38
|
cancelOrder(id: string, symbol?: Str, params?: {}): Promise<any>;
|
|
39
39
|
cancelAllOrders(symbol?: Str, params?: {}): Promise<any>;
|
|
40
40
|
addMargin(symbol: string, amount: any, params?: {}): Promise<MarginModification>;
|
|
41
|
-
parseMarginModification(info: any, market?: Market):
|
|
42
|
-
info: any;
|
|
43
|
-
direction: any;
|
|
44
|
-
mode: string;
|
|
45
|
-
amount: any;
|
|
46
|
-
code: string;
|
|
47
|
-
symbol: string;
|
|
48
|
-
status: any;
|
|
49
|
-
};
|
|
41
|
+
parseMarginModification(info: any, market?: Market): MarginModification;
|
|
50
42
|
fetchOrdersByStatus(status: any, symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
51
43
|
fetchClosedOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
44
|
+
fetchOpenOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
52
45
|
fetchOrder(id?: Str, symbol?: Str, params?: {}): Promise<Order>;
|
|
53
46
|
parseOrder(order: any, market?: Market): Order;
|
|
54
47
|
fetchFundingRate(symbol: string, params?: {}): Promise<{
|
package/js/src/kucoinfutures.js
CHANGED
|
@@ -70,6 +70,7 @@ export default class kucoinfutures extends kucoin {
|
|
|
70
70
|
'fetchL3OrderBook': true,
|
|
71
71
|
'fetchLedger': true,
|
|
72
72
|
'fetchLeverageTiers': false,
|
|
73
|
+
'fetchMarginAdjustmentHistory': false,
|
|
73
74
|
'fetchMarginMode': false,
|
|
74
75
|
'fetchMarketLeverageTiers': true,
|
|
75
76
|
'fetchMarkets': true,
|
|
@@ -1616,14 +1617,18 @@ export default class kucoinfutures extends kucoin {
|
|
|
1616
1617
|
const crossMode = this.safeValue(info, 'crossMode');
|
|
1617
1618
|
const mode = crossMode ? 'cross' : 'isolated';
|
|
1618
1619
|
const marketId = this.safeString(market, 'symbol');
|
|
1620
|
+
const timestamp = this.safeInteger(info, 'currentTimestamp');
|
|
1619
1621
|
return {
|
|
1620
1622
|
'info': info,
|
|
1621
|
-
'
|
|
1622
|
-
'
|
|
1623
|
+
'symbol': this.safeSymbol(marketId, market),
|
|
1624
|
+
'type': undefined,
|
|
1625
|
+
'marginMode': mode,
|
|
1623
1626
|
'amount': undefined,
|
|
1627
|
+
'total': undefined,
|
|
1624
1628
|
'code': this.safeCurrencyCode(currencyId),
|
|
1625
|
-
'symbol': this.safeSymbol(marketId, market),
|
|
1626
1629
|
'status': undefined,
|
|
1630
|
+
'timestamp': timestamp,
|
|
1631
|
+
'datetime': this.iso8601(timestamp),
|
|
1627
1632
|
};
|
|
1628
1633
|
}
|
|
1629
1634
|
async fetchOrdersByStatus(status, symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
@@ -1764,6 +1769,32 @@ export default class kucoinfutures extends kucoin {
|
|
|
1764
1769
|
}
|
|
1765
1770
|
return await this.fetchOrdersByStatus('done', symbol, since, limit, params);
|
|
1766
1771
|
}
|
|
1772
|
+
async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
1773
|
+
/**
|
|
1774
|
+
* @method
|
|
1775
|
+
* @name kucoinfutures#fetchOpenOrders
|
|
1776
|
+
* @description fetches information on multiple open orders made by the user
|
|
1777
|
+
* @see https://docs.kucoin.com/futures/#get-order-list
|
|
1778
|
+
* @see https://docs.kucoin.com/futures/#get-untriggered-stop-order-list
|
|
1779
|
+
* @param {string} symbol unified market symbol of the market orders were made in
|
|
1780
|
+
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
1781
|
+
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
1782
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1783
|
+
* @param {int} [params.till] end time in ms
|
|
1784
|
+
* @param {string} [params.side] buy or sell
|
|
1785
|
+
* @param {string} [params.type] limit, or market
|
|
1786
|
+
* @param {boolean} [params.trigger] set to true to retrieve untriggered stop orders
|
|
1787
|
+
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
1788
|
+
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
1789
|
+
*/
|
|
1790
|
+
await this.loadMarkets();
|
|
1791
|
+
let paginate = false;
|
|
1792
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchOpenOrders', 'paginate');
|
|
1793
|
+
if (paginate) {
|
|
1794
|
+
return await this.fetchPaginatedCallDynamic('fetchOpenOrders', symbol, since, limit, params);
|
|
1795
|
+
}
|
|
1796
|
+
return await this.fetchOrdersByStatus('open', symbol, since, limit, params);
|
|
1797
|
+
}
|
|
1767
1798
|
async fetchOrder(id = undefined, symbol = undefined, params = {}) {
|
|
1768
1799
|
/**
|
|
1769
1800
|
* @method
|
package/js/src/mexc.js
CHANGED
|
@@ -78,6 +78,7 @@ export default class mexc extends Exchange {
|
|
|
78
78
|
'fetchLeverage': true,
|
|
79
79
|
'fetchLeverages': false,
|
|
80
80
|
'fetchLeverageTiers': true,
|
|
81
|
+
'fetchMarginAdjustmentHistory': false,
|
|
81
82
|
'fetchMarginMode': false,
|
|
82
83
|
'fetchMarketLeverageTiers': undefined,
|
|
83
84
|
'fetchMarkets': true,
|
package/js/src/okx.d.ts
CHANGED
|
@@ -298,4 +298,5 @@ export default class okx extends Exchange {
|
|
|
298
298
|
quoteVolume: any;
|
|
299
299
|
};
|
|
300
300
|
handleErrors(httpCode: any, reason: any, url: any, method: any, headers: any, body: any, response: any, requestHeaders: any, requestBody: any): any;
|
|
301
|
+
fetchMarginAdjustmentHistory(symbol?: Str, type?: Str, since?: Num, limit?: Num, params?: {}): Promise<MarginModification[]>;
|
|
301
302
|
}
|
package/js/src/okx.js
CHANGED
|
@@ -87,6 +87,7 @@ export default class okx extends Exchange {
|
|
|
87
87
|
'fetchLedgerEntry': undefined,
|
|
88
88
|
'fetchLeverage': true,
|
|
89
89
|
'fetchLeverageTiers': false,
|
|
90
|
+
'fetchMarginAdjustmentHistory': true,
|
|
90
91
|
'fetchMarketLeverageTiers': true,
|
|
91
92
|
'fetchMarkets': true,
|
|
92
93
|
'fetchMarkOHLCV': true,
|
|
@@ -6466,9 +6467,9 @@ export default class okx extends Exchange {
|
|
|
6466
6467
|
// }
|
|
6467
6468
|
//
|
|
6468
6469
|
const data = this.safeList(response, 'data', []);
|
|
6470
|
+
const entry = this.safeDict(data, 0, {});
|
|
6469
6471
|
const errorCode = this.safeString(response, 'code');
|
|
6470
|
-
|
|
6471
|
-
return this.extend(this.parseMarginModification(item, market), {
|
|
6472
|
+
return this.extend(this.parseMarginModification(entry, market), {
|
|
6472
6473
|
'status': (errorCode === '0') ? 'ok' : 'failed',
|
|
6473
6474
|
});
|
|
6474
6475
|
}
|
|
@@ -6483,22 +6484,68 @@ export default class okx extends Exchange {
|
|
|
6483
6484
|
// "type": "reduce"
|
|
6484
6485
|
// }
|
|
6485
6486
|
//
|
|
6486
|
-
|
|
6487
|
+
// fetchMarginAdjustmentHistory
|
|
6488
|
+
//
|
|
6489
|
+
// {
|
|
6490
|
+
// bal: '67621.4325135010619812',
|
|
6491
|
+
// balChg: '-10.0000000000000000',
|
|
6492
|
+
// billId: '691293628710342659',
|
|
6493
|
+
// ccy: 'USDT',
|
|
6494
|
+
// clOrdId: '',
|
|
6495
|
+
// execType: '',
|
|
6496
|
+
// fee: '0',
|
|
6497
|
+
// fillFwdPx: '',
|
|
6498
|
+
// fillIdxPx: '',
|
|
6499
|
+
// fillMarkPx: '',
|
|
6500
|
+
// fillMarkVol: '',
|
|
6501
|
+
// fillPxUsd: '',
|
|
6502
|
+
// fillPxVol: '',
|
|
6503
|
+
// fillTime: '1711089244850',
|
|
6504
|
+
// from: '',
|
|
6505
|
+
// instId: 'XRP-USDT-SWAP',
|
|
6506
|
+
// instType: 'SWAP',
|
|
6507
|
+
// interest: '0',
|
|
6508
|
+
// mgnMode: 'isolated',
|
|
6509
|
+
// notes: '',
|
|
6510
|
+
// ordId: '',
|
|
6511
|
+
// pnl: '0',
|
|
6512
|
+
// posBal: '73.12',
|
|
6513
|
+
// posBalChg: '10.00',
|
|
6514
|
+
// px: '',
|
|
6515
|
+
// subType: '160',
|
|
6516
|
+
// sz: '10',
|
|
6517
|
+
// tag: '',
|
|
6518
|
+
// to: '',
|
|
6519
|
+
// tradeId: '0',
|
|
6520
|
+
// ts: '1711089244699',
|
|
6521
|
+
// type: '6'
|
|
6522
|
+
// }
|
|
6523
|
+
//
|
|
6524
|
+
const amountRaw = this.safeString2(data, 'amt', 'posBalChg');
|
|
6487
6525
|
const typeRaw = this.safeString(data, 'type');
|
|
6488
|
-
|
|
6526
|
+
let type = undefined;
|
|
6527
|
+
if (typeRaw === '6') {
|
|
6528
|
+
type = Precise.stringGt(amountRaw, '0') ? 'add' : 'reduce';
|
|
6529
|
+
}
|
|
6530
|
+
else {
|
|
6531
|
+
type = typeRaw;
|
|
6532
|
+
}
|
|
6533
|
+
const amount = Precise.stringAbs(amountRaw);
|
|
6489
6534
|
const marketId = this.safeString(data, 'instId');
|
|
6490
6535
|
const responseMarket = this.safeMarket(marketId, market);
|
|
6491
6536
|
const code = responseMarket['inverse'] ? responseMarket['base'] : responseMarket['quote'];
|
|
6537
|
+
const timestamp = this.safeInteger(data, 'ts');
|
|
6492
6538
|
return {
|
|
6493
6539
|
'info': data,
|
|
6494
6540
|
'symbol': responseMarket['symbol'],
|
|
6495
6541
|
'type': type,
|
|
6496
|
-
'
|
|
6497
|
-
'
|
|
6542
|
+
'marginMode': 'isolated',
|
|
6543
|
+
'amount': this.parseNumber(amount),
|
|
6498
6544
|
'code': code,
|
|
6545
|
+
'total': undefined,
|
|
6499
6546
|
'status': undefined,
|
|
6500
|
-
'timestamp':
|
|
6501
|
-
'datetime':
|
|
6547
|
+
'timestamp': timestamp,
|
|
6548
|
+
'datetime': this.iso8601(timestamp),
|
|
6502
6549
|
};
|
|
6503
6550
|
}
|
|
6504
6551
|
async reduceMargin(symbol, amount, params = {}) {
|
|
@@ -7600,4 +7647,106 @@ export default class okx extends Exchange {
|
|
|
7600
7647
|
}
|
|
7601
7648
|
return undefined;
|
|
7602
7649
|
}
|
|
7650
|
+
async fetchMarginAdjustmentHistory(symbol = undefined, type = undefined, since = undefined, limit = undefined, params = {}) {
|
|
7651
|
+
/**
|
|
7652
|
+
* @method
|
|
7653
|
+
* @name okx#fetchMarginAdjustmentHistory
|
|
7654
|
+
* @description fetches the history of margin added or reduced from contract isolated positions
|
|
7655
|
+
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-bills-details-last-7-days
|
|
7656
|
+
* @see https://www.okx.com/docs-v5/en/#trading-account-rest-api-get-bills-details-last-3-months
|
|
7657
|
+
* @param {string} [symbol] not used by okx fetchMarginAdjustmentHistory
|
|
7658
|
+
* @param {string} [type] "add" or "reduce"
|
|
7659
|
+
* @param {object} params extra parameters specific to the exchange api endpoint
|
|
7660
|
+
* @param {boolean} [params.auto] true if fetching auto margin increases
|
|
7661
|
+
* @returns {object[]} a list of [margin structures]{@link https://docs.ccxt.com/#/?id=margin-loan-structure}
|
|
7662
|
+
*/
|
|
7663
|
+
await this.loadMarkets();
|
|
7664
|
+
const auto = this.safeBool(params, 'auto');
|
|
7665
|
+
if (type === undefined) {
|
|
7666
|
+
throw new ArgumentsRequired(this.id + ' fetchMarginAdjustmentHistory () requires a type argument');
|
|
7667
|
+
}
|
|
7668
|
+
const isAdd = type === 'add';
|
|
7669
|
+
let subType = isAdd ? '160' : '161';
|
|
7670
|
+
if (auto) {
|
|
7671
|
+
if (isAdd) {
|
|
7672
|
+
subType = '162';
|
|
7673
|
+
}
|
|
7674
|
+
else {
|
|
7675
|
+
throw new BadRequest(this.id + ' cannot fetch margin adjustments for type ' + type);
|
|
7676
|
+
}
|
|
7677
|
+
}
|
|
7678
|
+
const request = {
|
|
7679
|
+
'subType': subType,
|
|
7680
|
+
'mgnMode': 'isolated',
|
|
7681
|
+
};
|
|
7682
|
+
const until = this.safeInteger(params, 'until');
|
|
7683
|
+
params = this.omit(params, 'until');
|
|
7684
|
+
if (since !== undefined) {
|
|
7685
|
+
request['startTime'] = since;
|
|
7686
|
+
}
|
|
7687
|
+
if (limit !== undefined) {
|
|
7688
|
+
request['limit'] = limit;
|
|
7689
|
+
}
|
|
7690
|
+
if (until !== undefined) {
|
|
7691
|
+
request['endTime'] = until;
|
|
7692
|
+
}
|
|
7693
|
+
let response = undefined;
|
|
7694
|
+
const now = this.milliseconds();
|
|
7695
|
+
const oneWeekAgo = now - 604800000;
|
|
7696
|
+
const threeMonthsAgo = now - 7776000000;
|
|
7697
|
+
if ((since === undefined) || (since > oneWeekAgo)) {
|
|
7698
|
+
response = await this.privateGetAccountBills(this.extend(request, params));
|
|
7699
|
+
}
|
|
7700
|
+
else if (since > threeMonthsAgo) {
|
|
7701
|
+
response = await this.privateGetAccountBillsArchive(this.extend(request, params));
|
|
7702
|
+
}
|
|
7703
|
+
else {
|
|
7704
|
+
throw new BadRequest(this.id + ' fetchMarginAdjustmentHistory () cannot fetch margin adjustments older than 3 months');
|
|
7705
|
+
}
|
|
7706
|
+
//
|
|
7707
|
+
// {
|
|
7708
|
+
// code: '0',
|
|
7709
|
+
// data: [
|
|
7710
|
+
// {
|
|
7711
|
+
// bal: '67621.4325135010619812',
|
|
7712
|
+
// balChg: '-10.0000000000000000',
|
|
7713
|
+
// billId: '691293628710342659',
|
|
7714
|
+
// ccy: 'USDT',
|
|
7715
|
+
// clOrdId: '',
|
|
7716
|
+
// execType: '',
|
|
7717
|
+
// fee: '0',
|
|
7718
|
+
// fillFwdPx: '',
|
|
7719
|
+
// fillIdxPx: '',
|
|
7720
|
+
// fillMarkPx: '',
|
|
7721
|
+
// fillMarkVol: '',
|
|
7722
|
+
// fillPxUsd: '',
|
|
7723
|
+
// fillPxVol: '',
|
|
7724
|
+
// fillTime: '1711089244850',
|
|
7725
|
+
// from: '',
|
|
7726
|
+
// instId: 'XRP-USDT-SWAP',
|
|
7727
|
+
// instType: 'SWAP',
|
|
7728
|
+
// interest: '0',
|
|
7729
|
+
// mgnMode: 'isolated',
|
|
7730
|
+
// notes: '',
|
|
7731
|
+
// ordId: '',
|
|
7732
|
+
// pnl: '0',
|
|
7733
|
+
// posBal: '73.12',
|
|
7734
|
+
// posBalChg: '10.00',
|
|
7735
|
+
// px: '',
|
|
7736
|
+
// subType: '160',
|
|
7737
|
+
// sz: '10',
|
|
7738
|
+
// tag: '',
|
|
7739
|
+
// to: '',
|
|
7740
|
+
// tradeId: '0',
|
|
7741
|
+
// ts: '1711089244699',
|
|
7742
|
+
// type: '6'
|
|
7743
|
+
// }
|
|
7744
|
+
// ],
|
|
7745
|
+
// msg: ''
|
|
7746
|
+
// }
|
|
7747
|
+
//
|
|
7748
|
+
const data = this.safeList(response, 'data');
|
|
7749
|
+
const modifications = this.parseMarginModifications(data);
|
|
7750
|
+
return this.filterBySymbolSinceLimit(modifications, symbol, since, limit);
|
|
7751
|
+
}
|
|
7603
7752
|
}
|
package/js/src/phemex.js
CHANGED
|
@@ -4065,6 +4065,7 @@ export default class phemex extends Exchange {
|
|
|
4065
4065
|
'info': data,
|
|
4066
4066
|
'symbol': this.safeSymbol(undefined, market),
|
|
4067
4067
|
'type': 'set',
|
|
4068
|
+
'marginMode': 'isolated',
|
|
4068
4069
|
'amount': undefined,
|
|
4069
4070
|
'total': undefined,
|
|
4070
4071
|
'code': market[codeCurrency],
|
package/js/src/woo.js
CHANGED
package/package.json
CHANGED