ccxt 4.1.13 → 4.1.16
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/CHANGELOG.md +219 -0
- package/CONTRIBUTING.md +1 -0
- package/README.md +3 -3
- package/dist/ccxt.browser.js +539 -189
- package/dist/ccxt.browser.min.js +9 -9
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/ascendex.js +1 -0
- package/dist/cjs/src/base/Exchange.js +3 -0
- package/dist/cjs/src/binance.js +6 -2
- package/dist/cjs/src/bingx.js +5 -3
- package/dist/cjs/src/bitget.js +357 -64
- package/dist/cjs/src/bitmart.js +2 -0
- package/dist/cjs/src/bitmex.js +6 -3
- package/dist/cjs/src/bittrex.js +7 -0
- package/dist/cjs/src/btcalpha.js +2 -1
- package/dist/cjs/src/btcturk.js +3 -0
- package/dist/cjs/src/cex.js +1 -0
- package/dist/cjs/src/coinbase.js +1 -0
- package/dist/cjs/src/coinbasepro.js +1 -0
- package/dist/cjs/src/coinex.js +2 -0
- package/dist/cjs/src/coinfalcon.js +1 -0
- package/dist/cjs/src/coinmate.js +1 -0
- package/dist/cjs/src/coinone.js +15 -5
- package/dist/cjs/src/cryptocom.js +25 -87
- package/dist/cjs/src/currencycom.js +1 -0
- package/dist/cjs/src/delta.js +1 -0
- package/dist/cjs/src/deribit.js +1 -0
- package/dist/cjs/src/digifinex.js +10 -8
- package/dist/cjs/src/exmo.js +1 -0
- package/dist/cjs/src/gate.js +3 -0
- package/dist/cjs/src/gemini.js +1 -0
- package/dist/cjs/src/hitbtc.js +1 -0
- package/dist/cjs/src/hollaex.js +1 -0
- package/dist/cjs/src/huobi.js +8 -0
- package/dist/cjs/src/huobijp.js +1 -0
- package/dist/cjs/src/idex.js +1 -0
- package/dist/cjs/src/independentreserve.js +1 -0
- package/dist/cjs/src/indodax.js +1 -0
- package/dist/cjs/src/kraken.js +10 -0
- package/dist/cjs/src/krakenfutures.js +1 -0
- package/dist/cjs/src/kucoin.js +1 -0
- package/dist/cjs/src/kucoinfutures.js +1 -0
- package/dist/cjs/src/kuna.js +1 -0
- package/dist/cjs/src/latoken.js +1 -0
- package/dist/cjs/src/lbank.js +1 -0
- package/dist/cjs/src/lbank2.js +2 -0
- package/dist/cjs/src/luno.js +1 -0
- package/dist/cjs/src/lykke.js +2 -1
- package/dist/cjs/src/mercado.js +1 -0
- package/dist/cjs/src/mexc.js +4 -1
- package/dist/cjs/src/ndax.js +1 -0
- package/dist/cjs/src/novadax.js +1 -0
- package/dist/cjs/src/oceanex.js +1 -0
- package/dist/cjs/src/phemex.js +2 -0
- package/dist/cjs/src/poloniex.js +1 -0
- package/dist/cjs/src/poloniexfutures.js +8 -2
- package/dist/cjs/src/pro/krakenfutures.js +14 -10
- package/dist/cjs/src/probit.js +1 -0
- package/dist/cjs/src/tidex.js +1 -0
- package/dist/cjs/src/timex.js +1 -0
- package/dist/cjs/src/tokocrypto.js +1 -0
- package/dist/cjs/src/upbit.js +1 -0
- package/dist/cjs/src/wavesexchange.js +1 -0
- package/dist/cjs/src/wazirx.js +2 -1
- package/dist/cjs/src/whitebit.js +1 -0
- package/dist/cjs/src/woo.js +1 -0
- package/dist/cjs/src/yobit.js +1 -0
- package/dist/cjs/src/zaif.js +1 -0
- package/dist/cjs/src/zonda.js +1 -0
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/binance.d.ts +4 -0
- package/js/src/abstract/binancecoinm.d.ts +4 -0
- package/js/src/abstract/binanceus.d.ts +4 -0
- package/js/src/abstract/binanceusdm.d.ts +4 -0
- package/js/src/abstract/btcturk.d.ts +3 -0
- package/js/src/abstract/kraken.d.ts +8 -0
- package/js/src/abstract/poloniexfutures.d.ts +6 -1
- package/js/src/ascendex.js +1 -0
- package/js/src/base/Exchange.d.ts +1 -0
- package/js/src/base/Exchange.js +3 -0
- package/js/src/binance.js +6 -2
- package/js/src/bingx.js +5 -3
- package/js/src/bitget.d.ts +28 -0
- package/js/src/bitget.js +357 -64
- package/js/src/bitmart.js +2 -0
- package/js/src/bitmex.js +6 -3
- package/js/src/bittrex.d.ts +2 -2
- package/js/src/bittrex.js +7 -0
- package/js/src/btcalpha.js +2 -1
- package/js/src/btcturk.js +3 -0
- package/js/src/cex.js +1 -0
- package/js/src/coinbase.js +1 -0
- package/js/src/coinbasepro.js +1 -0
- package/js/src/coinex.js +2 -0
- package/js/src/coinfalcon.js +1 -0
- package/js/src/coinmate.js +1 -0
- package/js/src/coinone.js +15 -5
- package/js/src/cryptocom.d.ts +0 -2
- package/js/src/cryptocom.js +25 -87
- package/js/src/currencycom.js +1 -0
- package/js/src/delta.js +1 -0
- package/js/src/deribit.js +1 -0
- package/js/src/digifinex.d.ts +3 -28
- package/js/src/digifinex.js +10 -8
- package/js/src/exmo.js +1 -0
- package/js/src/gate.d.ts +1 -0
- package/js/src/gate.js +3 -0
- package/js/src/gemini.d.ts +1 -0
- package/js/src/gemini.js +1 -0
- package/js/src/hitbtc.js +1 -0
- package/js/src/hollaex.js +1 -0
- package/js/src/huobi.js +8 -0
- package/js/src/huobijp.js +1 -0
- package/js/src/idex.js +1 -0
- package/js/src/independentreserve.js +1 -0
- package/js/src/indodax.js +1 -0
- package/js/src/kraken.js +10 -0
- package/js/src/krakenfutures.js +1 -0
- package/js/src/kucoin.js +1 -0
- package/js/src/kucoinfutures.js +1 -0
- package/js/src/kuna.js +1 -0
- package/js/src/latoken.js +1 -0
- package/js/src/lbank.js +1 -0
- package/js/src/lbank2.js +2 -0
- package/js/src/luno.js +1 -0
- package/js/src/lykke.js +2 -1
- package/js/src/mercado.js +1 -0
- package/js/src/mexc.js +4 -1
- package/js/src/ndax.js +1 -0
- package/js/src/novadax.js +1 -0
- package/js/src/oceanex.js +1 -0
- package/js/src/phemex.d.ts +2 -0
- package/js/src/phemex.js +2 -0
- package/js/src/poloniex.js +1 -0
- package/js/src/poloniexfutures.js +8 -2
- package/js/src/pro/krakenfutures.js +14 -10
- package/js/src/probit.js +1 -0
- package/js/src/tidex.js +1 -0
- package/js/src/timex.d.ts +1 -0
- package/js/src/timex.js +1 -0
- package/js/src/tokocrypto.js +1 -0
- package/js/src/upbit.js +1 -0
- package/js/src/wavesexchange.js +1 -0
- package/js/src/wazirx.js +2 -1
- package/js/src/whitebit.js +1 -0
- package/js/src/woo.js +1 -0
- package/js/src/yobit.js +1 -0
- package/js/src/zaif.js +1 -0
- package/js/src/zonda.js +1 -0
- package/package.json +1 -1
- package/skip-tests.json +141 -12
package/js/src/bittrex.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Exchange from './abstract/bittrex.js';
|
|
2
|
-
import { Int, OrderSide, OrderType } from './base/types.js';
|
|
2
|
+
import { Int, OrderSide, OrderType, OHLCV } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class bittrex
|
|
5
5
|
* @extends Exchange
|
|
@@ -38,7 +38,7 @@ export default class bittrex extends Exchange {
|
|
|
38
38
|
info: any;
|
|
39
39
|
};
|
|
40
40
|
parseOHLCV(ohlcv: any, market?: any): number[];
|
|
41
|
-
fetchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<
|
|
41
|
+
fetchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>;
|
|
42
42
|
fetchOpenOrders(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").Order[]>;
|
|
43
43
|
fetchOrderTrades(id: string, symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").Trade[]>;
|
|
44
44
|
createOrder(symbol: string, type: OrderType, side: OrderSide, amount: any, price?: any, params?: {}): Promise<import("./base/types.js").Order>;
|
package/js/src/bittrex.js
CHANGED
|
@@ -369,6 +369,7 @@ export default class bittrex extends Exchange {
|
|
|
369
369
|
'max': undefined,
|
|
370
370
|
},
|
|
371
371
|
},
|
|
372
|
+
'created': this.parse8601(this.safeString(market, 'createdAt')),
|
|
372
373
|
'info': market,
|
|
373
374
|
});
|
|
374
375
|
}
|
|
@@ -908,8 +909,14 @@ export default class bittrex extends Exchange {
|
|
|
908
909
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
909
910
|
* @param {int} [limit] the maximum amount of candles to fetch
|
|
910
911
|
* @param {object} [params] extra parameters specific to the bittrex api endpoint
|
|
912
|
+
* @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)
|
|
911
913
|
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
912
914
|
*/
|
|
915
|
+
let paginate = false;
|
|
916
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchOHLCV', 'paginate', false);
|
|
917
|
+
if (paginate) {
|
|
918
|
+
return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 1440);
|
|
919
|
+
}
|
|
913
920
|
await this.loadMarkets();
|
|
914
921
|
const market = this.market(symbol);
|
|
915
922
|
const reverseId = market['baseId'] + '-' + market['quoteId'];
|
package/js/src/btcalpha.js
CHANGED
|
@@ -310,7 +310,8 @@ export default class btcalpha extends Exchange {
|
|
|
310
310
|
// sell: '22521.11'
|
|
311
311
|
// }
|
|
312
312
|
//
|
|
313
|
-
const
|
|
313
|
+
const timestampStr = this.safeString(ticker, 'timestamp');
|
|
314
|
+
const timestamp = parseInt(Precise.stringMul(timestampStr, '1000000'));
|
|
314
315
|
const marketId = this.safeString(ticker, 'pair');
|
|
315
316
|
market = this.safeMarket(marketId, market, '_');
|
|
316
317
|
const last = this.safeString(ticker, 'last');
|
package/js/src/btcturk.js
CHANGED
|
@@ -95,6 +95,7 @@ export default class btcturk extends Exchange {
|
|
|
95
95
|
'orderbook': 1,
|
|
96
96
|
'ticker': 0.1,
|
|
97
97
|
'trades': 1,
|
|
98
|
+
'ohlc': 1,
|
|
98
99
|
'server/exchangeinfo': 1,
|
|
99
100
|
},
|
|
100
101
|
},
|
|
@@ -106,6 +107,8 @@ export default class btcturk extends Exchange {
|
|
|
106
107
|
'users/transactions/trade': 1,
|
|
107
108
|
},
|
|
108
109
|
'post': {
|
|
110
|
+
'users/transactions/crypto': 1,
|
|
111
|
+
'users/transactions/fiat': 1,
|
|
109
112
|
'order': 1,
|
|
110
113
|
'cancelOrder': 1,
|
|
111
114
|
},
|
package/js/src/cex.js
CHANGED
package/js/src/coinbase.js
CHANGED
package/js/src/coinbasepro.js
CHANGED
package/js/src/coinex.js
CHANGED
|
@@ -536,6 +536,7 @@ export default class coinex extends Exchange {
|
|
|
536
536
|
'max': undefined,
|
|
537
537
|
},
|
|
538
538
|
},
|
|
539
|
+
'created': undefined,
|
|
539
540
|
'info': market,
|
|
540
541
|
});
|
|
541
542
|
}
|
|
@@ -632,6 +633,7 @@ export default class coinex extends Exchange {
|
|
|
632
633
|
'max': undefined,
|
|
633
634
|
},
|
|
634
635
|
},
|
|
636
|
+
'created': undefined,
|
|
635
637
|
'info': entry,
|
|
636
638
|
});
|
|
637
639
|
}
|
package/js/src/coinfalcon.js
CHANGED
package/js/src/coinmate.js
CHANGED
package/js/src/coinone.js
CHANGED
|
@@ -232,6 +232,7 @@ export default class coinone extends Exchange {
|
|
|
232
232
|
'max': undefined,
|
|
233
233
|
},
|
|
234
234
|
},
|
|
235
|
+
'created': undefined,
|
|
235
236
|
'info': ticker,
|
|
236
237
|
});
|
|
237
238
|
}
|
|
@@ -626,10 +627,19 @@ export default class coinone extends Exchange {
|
|
|
626
627
|
const id = this.safeString(order, 'orderId');
|
|
627
628
|
const baseId = this.safeString(order, 'baseCurrency');
|
|
628
629
|
const quoteId = this.safeString(order, 'targetCurrency');
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
630
|
+
let base = undefined;
|
|
631
|
+
let quote = undefined;
|
|
632
|
+
if (baseId !== undefined) {
|
|
633
|
+
base = this.safeCurrencyCode(baseId, this.safeString(market, 'base'));
|
|
634
|
+
}
|
|
635
|
+
if (quoteId !== undefined) {
|
|
636
|
+
quote = this.safeCurrencyCode(quoteId, this.safeString(market, 'quote'));
|
|
637
|
+
}
|
|
638
|
+
let symbol = undefined;
|
|
639
|
+
if ((base !== undefined) && (quote !== undefined)) {
|
|
640
|
+
symbol = base + '/' + quote;
|
|
641
|
+
market = this.safeMarket(symbol, market, '/');
|
|
642
|
+
}
|
|
633
643
|
const timestamp = this.safeTimestamp2(order, 'timestamp', 'updatedAt');
|
|
634
644
|
let side = this.safeString2(order, 'type', 'side');
|
|
635
645
|
if (side === 'ask') {
|
|
@@ -889,7 +899,7 @@ export default class coinone extends Exchange {
|
|
|
889
899
|
const payload = this.stringToBase64(json);
|
|
890
900
|
body = payload;
|
|
891
901
|
const secret = this.secret.toUpperCase();
|
|
892
|
-
const signature = this.hmac(payload, this.encode(secret), sha512);
|
|
902
|
+
const signature = this.hmac(this.encode(payload), this.encode(secret), sha512);
|
|
893
903
|
headers = {
|
|
894
904
|
'Content-Type': 'application/json',
|
|
895
905
|
'X-COINONE-PAYLOAD': payload,
|
package/js/src/cryptocom.d.ts
CHANGED
|
@@ -113,7 +113,6 @@ export default class cryptocom extends Exchange {
|
|
|
113
113
|
datetime: any;
|
|
114
114
|
info: any;
|
|
115
115
|
};
|
|
116
|
-
fetchBorrowInterest(code?: string, symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<any>;
|
|
117
116
|
parseBorrowInterest(info: any, market?: any): {
|
|
118
117
|
symbol: any;
|
|
119
118
|
marginMode: any;
|
|
@@ -125,7 +124,6 @@ export default class cryptocom extends Exchange {
|
|
|
125
124
|
datetime: string;
|
|
126
125
|
info: any;
|
|
127
126
|
};
|
|
128
|
-
fetchBorrowRates(params?: {}): Promise<any[]>;
|
|
129
127
|
parseBorrowRates(info: any, codeKey: any): any[];
|
|
130
128
|
customHandleMarginModeAndParams(methodName: any, params?: {}): any[];
|
|
131
129
|
parseDepositWithdrawFee(fee: any, currency?: any): {
|
package/js/src/cryptocom.js
CHANGED
|
@@ -39,11 +39,11 @@ export default class cryptocom extends Exchange {
|
|
|
39
39
|
'fetchAccounts': true,
|
|
40
40
|
'fetchBalance': true,
|
|
41
41
|
'fetchBidsAsks': false,
|
|
42
|
-
'fetchBorrowInterest':
|
|
42
|
+
'fetchBorrowInterest': false,
|
|
43
43
|
'fetchBorrowRate': false,
|
|
44
44
|
'fetchBorrowRateHistories': false,
|
|
45
45
|
'fetchBorrowRateHistory': false,
|
|
46
|
-
'fetchBorrowRates':
|
|
46
|
+
'fetchBorrowRates': false,
|
|
47
47
|
'fetchClosedOrders': 'emulated',
|
|
48
48
|
'fetchCurrencies': false,
|
|
49
49
|
'fetchDepositAddress': true,
|
|
@@ -337,6 +337,7 @@ export default class cryptocom extends Exchange {
|
|
|
337
337
|
'precisionMode': TICK_SIZE,
|
|
338
338
|
'exceptions': {
|
|
339
339
|
'exact': {
|
|
340
|
+
'219': InvalidOrder,
|
|
340
341
|
'10001': ExchangeError,
|
|
341
342
|
'10002': PermissionDenied,
|
|
342
343
|
'10003': PermissionDenied,
|
|
@@ -566,6 +567,7 @@ export default class cryptocom extends Exchange {
|
|
|
566
567
|
'max': undefined,
|
|
567
568
|
},
|
|
568
569
|
},
|
|
570
|
+
'created': undefined,
|
|
569
571
|
'info': market,
|
|
570
572
|
});
|
|
571
573
|
}
|
|
@@ -1058,7 +1060,7 @@ export default class cryptocom extends Exchange {
|
|
|
1058
1060
|
}
|
|
1059
1061
|
const postOnly = this.safeValue(params, 'postOnly', false);
|
|
1060
1062
|
if ((postOnly) || (timeInForce === 'PO')) {
|
|
1061
|
-
request['exec_inst'] = 'POST_ONLY';
|
|
1063
|
+
request['exec_inst'] = ['POST_ONLY'];
|
|
1062
1064
|
request['time_in_force'] = 'GOOD_TILL_CANCEL';
|
|
1063
1065
|
}
|
|
1064
1066
|
const triggerPrice = this.safeStringN(params, ['stopPrice', 'triggerPrice', 'ref_price']);
|
|
@@ -1866,8 +1868,8 @@ export default class cryptocom extends Exchange {
|
|
|
1866
1868
|
'close': last,
|
|
1867
1869
|
'last': last,
|
|
1868
1870
|
'previousClose': undefined,
|
|
1869
|
-
'change':
|
|
1870
|
-
'percentage':
|
|
1871
|
+
'change': undefined,
|
|
1872
|
+
'percentage': this.safeString(ticker, 'c'),
|
|
1871
1873
|
'average': undefined,
|
|
1872
1874
|
'baseVolume': this.safeString(ticker, 'v'),
|
|
1873
1875
|
'quoteVolume': this.safeString(ticker, 'vv'),
|
|
@@ -2011,10 +2013,16 @@ export default class cryptocom extends Exchange {
|
|
|
2011
2013
|
const created = this.safeInteger(order, 'create_time');
|
|
2012
2014
|
const marketId = this.safeString(order, 'instrument_name');
|
|
2013
2015
|
const symbol = this.safeSymbol(marketId, market);
|
|
2014
|
-
const execInst = this.
|
|
2015
|
-
let postOnly =
|
|
2016
|
+
const execInst = this.safeValue(order, 'exec_inst');
|
|
2017
|
+
let postOnly = false;
|
|
2016
2018
|
if (execInst !== undefined) {
|
|
2017
|
-
|
|
2019
|
+
for (let i = 0; i < execInst.length; i++) {
|
|
2020
|
+
const inst = execInst[i];
|
|
2021
|
+
if (inst === 'POST_ONLY') {
|
|
2022
|
+
postOnly = true;
|
|
2023
|
+
break;
|
|
2024
|
+
}
|
|
2025
|
+
}
|
|
2018
2026
|
}
|
|
2019
2027
|
const feeCurrency = this.safeString(order, 'fee_instrument_name');
|
|
2020
2028
|
return this.safeOrder({
|
|
@@ -2247,52 +2255,6 @@ export default class cryptocom extends Exchange {
|
|
|
2247
2255
|
'info': info,
|
|
2248
2256
|
};
|
|
2249
2257
|
}
|
|
2250
|
-
async fetchBorrowInterest(code = undefined, symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
2251
|
-
await this.loadMarkets();
|
|
2252
|
-
const request = {};
|
|
2253
|
-
let market = undefined;
|
|
2254
|
-
let currency = undefined;
|
|
2255
|
-
if (symbol !== undefined) {
|
|
2256
|
-
market = this.market(symbol);
|
|
2257
|
-
}
|
|
2258
|
-
if (code !== undefined) {
|
|
2259
|
-
currency = this.currency(code);
|
|
2260
|
-
request['currency'] = currency['id'];
|
|
2261
|
-
}
|
|
2262
|
-
if (since !== undefined) {
|
|
2263
|
-
request['start_ts'] = since;
|
|
2264
|
-
}
|
|
2265
|
-
if (limit !== undefined) {
|
|
2266
|
-
request['page_size'] = limit;
|
|
2267
|
-
}
|
|
2268
|
-
const response = await this.v2PrivatePostPrivateMarginGetInterestHistory(this.extend(request, params));
|
|
2269
|
-
//
|
|
2270
|
-
// {
|
|
2271
|
-
// "id": 1656705829020,
|
|
2272
|
-
// "method": "private/margin/get-interest-history",
|
|
2273
|
-
// "code": 0,
|
|
2274
|
-
// "result": {
|
|
2275
|
-
// "list": [
|
|
2276
|
-
// {
|
|
2277
|
-
// "loan_id": "2643528867803765921",
|
|
2278
|
-
// "currency": "USDT",
|
|
2279
|
-
// "interest": 0.00000004,
|
|
2280
|
-
// "time": 1656702899559,
|
|
2281
|
-
// "stake_amount": 6,
|
|
2282
|
-
// "interest_rate": 0.000025
|
|
2283
|
-
// },
|
|
2284
|
-
// ]
|
|
2285
|
-
// }
|
|
2286
|
-
// }
|
|
2287
|
-
//
|
|
2288
|
-
const data = this.safeValue(response, 'result', {});
|
|
2289
|
-
const rows = this.safeValue(data, 'list', []);
|
|
2290
|
-
let interest = undefined;
|
|
2291
|
-
for (let i = 0; i < rows.length; i++) {
|
|
2292
|
-
interest = this.parseBorrowInterests(rows, market);
|
|
2293
|
-
}
|
|
2294
|
-
return this.filterByCurrencySinceLimit(interest, code, since, limit);
|
|
2295
|
-
}
|
|
2296
2258
|
parseBorrowInterest(info, market = undefined) {
|
|
2297
2259
|
//
|
|
2298
2260
|
// {
|
|
@@ -2321,38 +2283,6 @@ export default class cryptocom extends Exchange {
|
|
|
2321
2283
|
'info': info,
|
|
2322
2284
|
};
|
|
2323
2285
|
}
|
|
2324
|
-
async fetchBorrowRates(params = {}) {
|
|
2325
|
-
/**
|
|
2326
|
-
* @method
|
|
2327
|
-
* @name cryptocom#fetchBorrowRates
|
|
2328
|
-
* @description fetch the borrow interest rates of all currencies
|
|
2329
|
-
* @param {object} [params] extra parameters specific to the cryptocom api endpoint
|
|
2330
|
-
* @returns {object} a list of [borrow rate structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#borrow-rate-structure}
|
|
2331
|
-
*/
|
|
2332
|
-
await this.loadMarkets();
|
|
2333
|
-
const response = await this.v2PrivatePostPrivateMarginGetUserConfig(params);
|
|
2334
|
-
//
|
|
2335
|
-
// {
|
|
2336
|
-
// "id": 1656707947456,
|
|
2337
|
-
// "method": "private/margin/get-user-config",
|
|
2338
|
-
// "code": 0,
|
|
2339
|
-
// "result": {
|
|
2340
|
-
// "stake_amount": 6,
|
|
2341
|
-
// "currency_configs": [
|
|
2342
|
-
// {
|
|
2343
|
-
// "currency": "AGLD",
|
|
2344
|
-
// "hourly_rate": 0.00003334,
|
|
2345
|
-
// "max_borrow_limit": 342.4032393,
|
|
2346
|
-
// "min_borrow_limit": 30
|
|
2347
|
-
// },
|
|
2348
|
-
// ]
|
|
2349
|
-
// }
|
|
2350
|
-
// }
|
|
2351
|
-
//
|
|
2352
|
-
const data = this.safeValue(response, 'result', {});
|
|
2353
|
-
const rates = this.safeValue(data, 'currency_configs', []);
|
|
2354
|
-
return this.parseBorrowRates(rates, 'currency');
|
|
2355
|
-
}
|
|
2356
2286
|
parseBorrowRates(info, codeKey) {
|
|
2357
2287
|
//
|
|
2358
2288
|
// {
|
|
@@ -3025,7 +2955,15 @@ export default class cryptocom extends Exchange {
|
|
|
3025
2955
|
const paramsKeys = Object.keys(keysorted);
|
|
3026
2956
|
let strSortKey = '';
|
|
3027
2957
|
for (let i = 0; i < paramsKeys.length; i++) {
|
|
3028
|
-
|
|
2958
|
+
const key = paramsKeys[i].toString();
|
|
2959
|
+
let value = requestParams[paramsKeys[i]];
|
|
2960
|
+
if (Array.isArray(value)) {
|
|
2961
|
+
value = value.join(',');
|
|
2962
|
+
}
|
|
2963
|
+
else {
|
|
2964
|
+
value = value.toString();
|
|
2965
|
+
}
|
|
2966
|
+
strSortKey = strSortKey + key + value;
|
|
3029
2967
|
}
|
|
3030
2968
|
const payload = path + nonce + this.apiKey + strSortKey + nonce;
|
|
3031
2969
|
const signature = this.hmac(this.encode(payload), this.encode(this.secret), sha256);
|
package/js/src/currencycom.js
CHANGED
package/js/src/delta.js
CHANGED
package/js/src/deribit.js
CHANGED
package/js/src/digifinex.d.ts
CHANGED
|
@@ -134,6 +134,7 @@ export default class digifinex extends Exchange {
|
|
|
134
134
|
fetchBorrowInterest(code?: string, symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<any>;
|
|
135
135
|
parseBorrowInterest(info: any, market?: any): {
|
|
136
136
|
account: any;
|
|
137
|
+
symbol: any;
|
|
137
138
|
currency: any;
|
|
138
139
|
interest: any;
|
|
139
140
|
interestRate: number;
|
|
@@ -212,34 +213,8 @@ export default class digifinex extends Exchange {
|
|
|
212
213
|
taker: number;
|
|
213
214
|
};
|
|
214
215
|
fetchPositions(symbols?: string[], params?: {}): Promise<import("./base/types.js").Position[]>;
|
|
215
|
-
fetchPosition(symbol: string, params?: {}): Promise<
|
|
216
|
-
parsePosition(position: any, market?: any):
|
|
217
|
-
info: any;
|
|
218
|
-
id: any;
|
|
219
|
-
symbol: any;
|
|
220
|
-
notional: number;
|
|
221
|
-
marginMode: string;
|
|
222
|
-
liquidationPrice: number;
|
|
223
|
-
entryPrice: number;
|
|
224
|
-
unrealizedPnl: number;
|
|
225
|
-
contracts: number;
|
|
226
|
-
contractSize: number;
|
|
227
|
-
markPrice: number;
|
|
228
|
-
side: string;
|
|
229
|
-
hedged: any;
|
|
230
|
-
timestamp: number;
|
|
231
|
-
datetime: string;
|
|
232
|
-
maintenanceMargin: number;
|
|
233
|
-
maintenanceMarginPercentage: number;
|
|
234
|
-
collateral: any;
|
|
235
|
-
initialMargin: any;
|
|
236
|
-
initialMarginPercentage: any;
|
|
237
|
-
leverage: number;
|
|
238
|
-
marginRatio: number;
|
|
239
|
-
percentage: any;
|
|
240
|
-
stopLossPrice: any;
|
|
241
|
-
takeProfitPrice: any;
|
|
242
|
-
};
|
|
216
|
+
fetchPosition(symbol: string, params?: {}): Promise<import("./base/types.js").Position>;
|
|
217
|
+
parsePosition(position: any, market?: any): import("./base/types.js").Position;
|
|
243
218
|
setLeverage(leverage: any, symbol?: string, params?: {}): Promise<any>;
|
|
244
219
|
fetchTransfers(code?: string, since?: Int, limit?: Int, params?: {}): Promise<any>;
|
|
245
220
|
fetchLeverageTiers(symbols?: string[], params?: {}): Promise<{}>;
|
package/js/src/digifinex.js
CHANGED
|
@@ -656,6 +656,7 @@ export default class digifinex extends Exchange {
|
|
|
656
656
|
'max': undefined,
|
|
657
657
|
},
|
|
658
658
|
},
|
|
659
|
+
'created': undefined,
|
|
659
660
|
'info': market,
|
|
660
661
|
});
|
|
661
662
|
}
|
|
@@ -2810,14 +2811,16 @@ export default class digifinex extends Exchange {
|
|
|
2810
2811
|
// "leverage_ratio": 3
|
|
2811
2812
|
// }
|
|
2812
2813
|
//
|
|
2813
|
-
const
|
|
2814
|
+
const marketId = this.safeString(info, 'symbol');
|
|
2814
2815
|
const amountString = this.safeString(info, 'amount');
|
|
2815
2816
|
const leverageString = this.safeString(info, 'leverage_ratio');
|
|
2816
2817
|
const amountInvested = Precise.stringDiv(amountString, leverageString);
|
|
2817
2818
|
const amountBorrowed = Precise.stringSub(amountString, amountInvested);
|
|
2818
2819
|
const currency = (market === undefined) ? undefined : market['base'];
|
|
2820
|
+
const symbol = this.safeSymbol(marketId, market);
|
|
2819
2821
|
return {
|
|
2820
|
-
'account':
|
|
2822
|
+
'account': symbol,
|
|
2823
|
+
'symbol': symbol,
|
|
2821
2824
|
'currency': currency,
|
|
2822
2825
|
'interest': undefined,
|
|
2823
2826
|
'interestRate': 0.001,
|
|
@@ -3297,10 +3300,9 @@ export default class digifinex extends Exchange {
|
|
|
3297
3300
|
return position;
|
|
3298
3301
|
}
|
|
3299
3302
|
else {
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
});
|
|
3303
|
+
position['collateral'] = this.safeNumber(response, 'margin');
|
|
3304
|
+
position['marginRatio'] = this.safeNumber(response, 'margin_rate');
|
|
3305
|
+
return position;
|
|
3304
3306
|
}
|
|
3305
3307
|
}
|
|
3306
3308
|
parsePosition(position, market = undefined) {
|
|
@@ -3360,7 +3362,7 @@ export default class digifinex extends Exchange {
|
|
|
3360
3362
|
else if (side === 'go_short') {
|
|
3361
3363
|
side = 'short';
|
|
3362
3364
|
}
|
|
3363
|
-
return {
|
|
3365
|
+
return this.safePosition({
|
|
3364
3366
|
'info': position,
|
|
3365
3367
|
'id': undefined,
|
|
3366
3368
|
'symbol': symbol,
|
|
@@ -3386,7 +3388,7 @@ export default class digifinex extends Exchange {
|
|
|
3386
3388
|
'percentage': undefined,
|
|
3387
3389
|
'stopLossPrice': undefined,
|
|
3388
3390
|
'takeProfitPrice': undefined,
|
|
3389
|
-
};
|
|
3391
|
+
});
|
|
3390
3392
|
}
|
|
3391
3393
|
async setLeverage(leverage, symbol = undefined, params = {}) {
|
|
3392
3394
|
/**
|
package/js/src/exmo.js
CHANGED
package/js/src/gate.d.ts
CHANGED
package/js/src/gate.js
CHANGED
|
@@ -1098,6 +1098,7 @@ export default class gate extends Exchange {
|
|
|
1098
1098
|
'max': margin ? this.safeNumber(market, 'max_quote_amount') : undefined,
|
|
1099
1099
|
},
|
|
1100
1100
|
},
|
|
1101
|
+
'created': undefined,
|
|
1101
1102
|
'info': market,
|
|
1102
1103
|
});
|
|
1103
1104
|
}
|
|
@@ -1295,6 +1296,7 @@ export default class gate extends Exchange {
|
|
|
1295
1296
|
'max': undefined,
|
|
1296
1297
|
},
|
|
1297
1298
|
},
|
|
1299
|
+
'created': undefined,
|
|
1298
1300
|
'info': market,
|
|
1299
1301
|
};
|
|
1300
1302
|
}
|
|
@@ -1415,6 +1417,7 @@ export default class gate extends Exchange {
|
|
|
1415
1417
|
'max': undefined,
|
|
1416
1418
|
},
|
|
1417
1419
|
},
|
|
1420
|
+
'created': this.safeIntegerProduct(market, 'create_time', 1000),
|
|
1418
1421
|
'info': market,
|
|
1419
1422
|
});
|
|
1420
1423
|
}
|
package/js/src/gemini.d.ts
CHANGED
package/js/src/gemini.js
CHANGED
package/js/src/hitbtc.js
CHANGED
package/js/src/hollaex.js
CHANGED
package/js/src/huobi.js
CHANGED
|
@@ -1707,6 +1707,13 @@ export default class huobi extends Exchange {
|
|
|
1707
1707
|
// 7 Settlement Completed
|
|
1708
1708
|
// 8 Delivered
|
|
1709
1709
|
// 9 Suspending of Trade
|
|
1710
|
+
let created = undefined;
|
|
1711
|
+
let createdDate = this.safeString(market, 'create_date'); // i.e 20230101
|
|
1712
|
+
if (createdDate !== undefined) {
|
|
1713
|
+
const createdArray = this.stringToCharsArray(createdDate);
|
|
1714
|
+
createdDate = createdArray[0] + createdArray[1] + createdArray[2] + createdArray[3] + '-' + createdArray[4] + createdArray[5] + '-' + createdArray[6] + createdArray[7] + ' 00:00:00';
|
|
1715
|
+
created = this.parse8601(createdDate);
|
|
1716
|
+
}
|
|
1710
1717
|
result.push({
|
|
1711
1718
|
'id': id,
|
|
1712
1719
|
'lowercaseId': lowercaseId,
|
|
@@ -1759,6 +1766,7 @@ export default class huobi extends Exchange {
|
|
|
1759
1766
|
'max': undefined,
|
|
1760
1767
|
},
|
|
1761
1768
|
},
|
|
1769
|
+
'created': created,
|
|
1762
1770
|
'info': market,
|
|
1763
1771
|
});
|
|
1764
1772
|
}
|
package/js/src/huobijp.js
CHANGED
package/js/src/idex.js
CHANGED