ccxt 4.4.40 → 4.4.42
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 +4 -4
- package/dist/ccxt.browser.min.js +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/ace.js +1 -1
- package/dist/cjs/src/alpaca.js +0 -1
- package/dist/cjs/src/ascendex.js +0 -1
- package/dist/cjs/src/base/Exchange.js +41 -19
- package/dist/cjs/src/bigone.js +0 -1
- package/dist/cjs/src/binance.js +27 -24
- package/dist/cjs/src/bingx.js +6 -1
- package/dist/cjs/src/bitfinex.js +124 -1
- package/dist/cjs/src/bitget.js +1 -0
- package/dist/cjs/src/bitmart.js +254 -1
- package/dist/cjs/src/blofin.js +16 -7
- package/dist/cjs/src/bybit.js +8 -8
- package/dist/cjs/src/cex.js +1 -1
- package/dist/cjs/src/coinbase.js +8 -9
- package/dist/cjs/src/coinbaseexchange.js +5 -6
- package/dist/cjs/src/coinbaseinternational.js +7 -8
- package/dist/cjs/src/coincatch.js +0 -1
- package/dist/cjs/src/coincheck.js +0 -1
- package/dist/cjs/src/coinex.js +91 -6
- package/dist/cjs/src/coinlist.js +3 -4
- package/dist/cjs/src/coinmate.js +1 -3
- package/dist/cjs/src/coinmetro.js +4 -5
- package/dist/cjs/src/coinone.js +0 -1
- package/dist/cjs/src/coinsph.js +7 -8
- package/dist/cjs/src/cryptocom.js +3 -0
- package/dist/cjs/src/currencycom.js +3 -4
- package/dist/cjs/src/defx.js +6 -7
- package/dist/cjs/src/deribit.js +1 -3
- package/dist/cjs/src/digifinex.js +0 -1
- package/dist/cjs/src/ellipx.js +0 -2
- package/dist/cjs/src/exmo.js +63 -6
- package/dist/cjs/src/gate.js +2 -3
- package/dist/cjs/src/gemini.js +4 -5
- package/dist/cjs/src/hashkey.js +79 -83
- package/dist/cjs/src/hitbtc.js +49 -5
- package/dist/cjs/src/hollaex.js +4 -6
- package/dist/cjs/src/htx.js +2 -4
- package/dist/cjs/src/huobijp.js +0 -1
- package/dist/cjs/src/hyperliquid.js +65 -1
- package/dist/cjs/src/idex.js +8 -8
- package/dist/cjs/src/independentreserve.js +0 -1
- package/dist/cjs/src/indodax.js +0 -1
- package/dist/cjs/src/kraken.js +192 -29
- package/dist/cjs/src/krakenfutures.js +75 -3
- package/dist/cjs/src/kucoin.js +7 -4
- package/dist/cjs/src/kucoinfutures.js +10 -9
- package/dist/cjs/src/kuna.js +1 -3
- package/dist/cjs/src/latoken.js +1 -3
- package/dist/cjs/src/lbank.js +0 -1
- package/dist/cjs/src/luno.js +0 -1
- package/dist/cjs/src/lykke.js +0 -1
- package/dist/cjs/src/mercado.js +0 -1
- package/dist/cjs/src/mexc.js +6 -7
- package/dist/cjs/src/ndax.js +1 -1
- package/dist/cjs/src/novadax.js +4 -6
- package/dist/cjs/src/oceanex.js +0 -1
- package/dist/cjs/src/okcoin.js +1 -3
- package/dist/cjs/src/okx.js +7 -4
- package/dist/cjs/src/onetrading.js +1 -3
- package/dist/cjs/src/p2b.js +1 -1
- package/dist/cjs/src/paradex.js +5 -7
- package/dist/cjs/src/phemex.js +8 -10
- package/dist/cjs/src/poloniex.js +1 -3
- package/dist/cjs/src/poloniexfutures.js +6 -6
- package/dist/cjs/src/probit.js +0 -1
- package/dist/cjs/src/timex.js +0 -1
- package/dist/cjs/src/tokocrypto.js +11 -14
- package/dist/cjs/src/tradeogre.js +1 -1
- package/dist/cjs/src/upbit.js +0 -1
- package/dist/cjs/src/wavesexchange.js +4 -5
- package/dist/cjs/src/whitebit.js +8 -9
- package/dist/cjs/src/woo.js +99 -13
- package/dist/cjs/src/woofipro.js +96 -15
- package/dist/cjs/src/xt.js +8 -4
- package/dist/cjs/src/yobit.js +0 -1
- package/dist/cjs/src/zaif.js +0 -1
- package/dist/cjs/src/zonda.js +1 -2
- package/js/ccxt.d.ts +3 -3
- package/js/ccxt.js +1 -1
- package/js/src/abstract/binance.d.ts +3 -0
- package/js/src/abstract/binancecoinm.d.ts +3 -0
- package/js/src/abstract/binanceus.d.ts +3 -0
- package/js/src/abstract/binanceusdm.d.ts +3 -0
- package/js/src/abstract/bitmart.d.ts +2 -0
- package/js/src/abstract/okx.d.ts +5 -0
- package/js/src/ace.js +1 -1
- package/js/src/alpaca.js +0 -1
- package/js/src/ascendex.js +0 -1
- package/js/src/base/Exchange.d.ts +12 -9
- package/js/src/base/Exchange.js +41 -19
- package/js/src/base/types.d.ts +2 -0
- package/js/src/bigone.js +0 -1
- package/js/src/binance.js +27 -24
- package/js/src/bingx.js +6 -1
- package/js/src/bitfinex.d.ts +11 -1
- package/js/src/bitfinex.js +124 -1
- package/js/src/bitget.js +1 -0
- package/js/src/bitmart.d.ts +52 -1
- package/js/src/bitmart.js +254 -1
- package/js/src/blofin.d.ts +1 -1
- package/js/src/blofin.js +16 -7
- package/js/src/bybit.js +8 -8
- package/js/src/cex.js +1 -1
- package/js/src/coinbase.js +8 -9
- package/js/src/coinbaseexchange.js +5 -6
- package/js/src/coinbaseinternational.d.ts +1 -1
- package/js/src/coinbaseinternational.js +7 -8
- package/js/src/coincatch.js +0 -1
- package/js/src/coincheck.js +0 -1
- package/js/src/coinex.js +91 -6
- package/js/src/coinlist.js +3 -4
- package/js/src/coinmate.js +1 -3
- package/js/src/coinmetro.js +4 -5
- package/js/src/coinone.js +0 -1
- package/js/src/coinsph.js +7 -8
- package/js/src/cryptocom.js +3 -0
- package/js/src/currencycom.js +3 -4
- package/js/src/defx.js +6 -7
- package/js/src/deribit.js +1 -3
- package/js/src/digifinex.js +0 -1
- package/js/src/ellipx.js +0 -2
- package/js/src/exmo.d.ts +36 -1
- package/js/src/exmo.js +63 -6
- package/js/src/gate.d.ts +1 -1
- package/js/src/gate.js +2 -3
- package/js/src/gemini.js +4 -5
- package/js/src/hashkey.js +79 -83
- package/js/src/hitbtc.d.ts +11 -1
- package/js/src/hitbtc.js +49 -5
- package/js/src/hollaex.js +4 -6
- package/js/src/htx.js +2 -4
- package/js/src/huobijp.js +0 -1
- package/js/src/hyperliquid.d.ts +20 -1
- package/js/src/hyperliquid.js +65 -1
- package/js/src/idex.js +8 -8
- package/js/src/independentreserve.js +0 -1
- package/js/src/indodax.js +0 -1
- package/js/src/kraken.d.ts +15 -9
- package/js/src/kraken.js +192 -29
- package/js/src/krakenfutures.d.ts +2 -2
- package/js/src/krakenfutures.js +75 -3
- package/js/src/kucoin.js +7 -4
- package/js/src/kucoinfutures.d.ts +5 -4
- package/js/src/kucoinfutures.js +10 -9
- package/js/src/kuna.js +1 -3
- package/js/src/latoken.js +1 -3
- package/js/src/lbank.js +0 -1
- package/js/src/luno.js +0 -1
- package/js/src/lykke.js +0 -1
- package/js/src/mercado.js +0 -1
- package/js/src/mexc.js +6 -7
- package/js/src/ndax.js +1 -1
- package/js/src/novadax.js +4 -6
- package/js/src/oceanex.js +0 -1
- package/js/src/okcoin.js +1 -3
- package/js/src/okx.js +7 -4
- package/js/src/onetrading.js +1 -3
- package/js/src/p2b.js +1 -1
- package/js/src/paradex.d.ts +1 -1
- package/js/src/paradex.js +5 -7
- package/js/src/phemex.js +8 -10
- package/js/src/poloniex.js +1 -3
- package/js/src/poloniexfutures.js +6 -6
- package/js/src/probit.js +0 -1
- package/js/src/timex.js +0 -1
- package/js/src/tokocrypto.js +11 -14
- package/js/src/tradeogre.js +1 -1
- package/js/src/upbit.js +0 -1
- package/js/src/wavesexchange.d.ts +1 -1
- package/js/src/wavesexchange.js +4 -5
- package/js/src/whitebit.js +8 -9
- package/js/src/woo.d.ts +1 -1
- package/js/src/woo.js +99 -13
- package/js/src/woofipro.js +96 -15
- package/js/src/xt.d.ts +2 -1
- package/js/src/xt.js +8 -4
- package/js/src/yobit.js +0 -1
- package/js/src/zaif.js +0 -1
- package/js/src/zonda.js +1 -2
- package/package.json +2 -2
package/js/src/hyperliquid.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Exchange from './abstract/hyperliquid.js';
|
|
2
|
-
import type { Market, TransferEntry, Balances, Int, OrderBook, OHLCV, Str, FundingRateHistory, Order, OrderType, OrderSide, Trade, Strings, Position, OrderRequest, Dict, Num, MarginModification, Currencies, CancellationRequest, int, Transaction, Currency, TradingFeeInterface, Ticker, Tickers, LedgerEntry, FundingRates, FundingRate } from './base/types.js';
|
|
2
|
+
import type { Market, TransferEntry, Balances, Int, OrderBook, OHLCV, Str, FundingRateHistory, Order, OrderType, OrderSide, Trade, Strings, Position, OrderRequest, Dict, Num, MarginModification, Currencies, CancellationRequest, int, Transaction, Currency, TradingFeeInterface, Ticker, Tickers, LedgerEntry, FundingRates, FundingRate, OpenInterests } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class hyperliquid
|
|
5
5
|
* @augments Exchange
|
|
@@ -530,6 +530,25 @@ export default class hyperliquid extends Exchange {
|
|
|
530
530
|
* @returns {object[]} a list of [transaction structures]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
531
531
|
*/
|
|
532
532
|
fetchWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
|
|
533
|
+
/**
|
|
534
|
+
* @method
|
|
535
|
+
* @name hyperliquid#fetchOpenInterests
|
|
536
|
+
* @description Retrieves the open interest for a list of symbols
|
|
537
|
+
* @param {string[]} [symbols] Unified CCXT market symbol
|
|
538
|
+
* @param {object} [params] exchange specific parameters
|
|
539
|
+
* @returns {object} an open interest structure{@link https://docs.ccxt.com/#/?id=open-interest-structure}
|
|
540
|
+
*/
|
|
541
|
+
fetchOpenInterests(symbols?: Strings, params?: {}): Promise<OpenInterests>;
|
|
542
|
+
/**
|
|
543
|
+
* @method
|
|
544
|
+
* @name hyperliquid#fetchOpenInterest
|
|
545
|
+
* @description retrieves the open interest of a contract trading pair
|
|
546
|
+
* @param {string} symbol unified CCXT market symbol
|
|
547
|
+
* @param {object} [params] exchange specific parameters
|
|
548
|
+
* @returns {object} an [open interest structure]{@link https://docs.ccxt.com/#/?id=open-interest-structure}
|
|
549
|
+
*/
|
|
550
|
+
fetchOpenInterest(symbol: string, params?: {}): Promise<import("./base/types.js").OpenInterest>;
|
|
551
|
+
parseOpenInterest(interest: any, market?: Market): import("./base/types.js").OpenInterest;
|
|
533
552
|
extractTypeFromDelta(data?: any[]): any[];
|
|
534
553
|
formatVaultAddress(address?: Str): string;
|
|
535
554
|
handlePublicAddress(methodName: string, params: Dict): any[];
|
package/js/src/hyperliquid.js
CHANGED
|
@@ -88,8 +88,9 @@ export default class hyperliquid extends Exchange {
|
|
|
88
88
|
'fetchMyLiquidations': false,
|
|
89
89
|
'fetchMyTrades': true,
|
|
90
90
|
'fetchOHLCV': true,
|
|
91
|
-
'fetchOpenInterest':
|
|
91
|
+
'fetchOpenInterest': true,
|
|
92
92
|
'fetchOpenInterestHistory': false,
|
|
93
|
+
'fetchOpenInterests': true,
|
|
93
94
|
'fetchOpenOrders': true,
|
|
94
95
|
'fetchOrder': true,
|
|
95
96
|
'fetchOrderBook': true,
|
|
@@ -3255,6 +3256,69 @@ export default class hyperliquid extends Exchange {
|
|
|
3255
3256
|
const withdrawals = this.filterByArray(records, 'type', ['withdraw'], false);
|
|
3256
3257
|
return this.parseTransactions(withdrawals, undefined, since, limit);
|
|
3257
3258
|
}
|
|
3259
|
+
/**
|
|
3260
|
+
* @method
|
|
3261
|
+
* @name hyperliquid#fetchOpenInterests
|
|
3262
|
+
* @description Retrieves the open interest for a list of symbols
|
|
3263
|
+
* @param {string[]} [symbols] Unified CCXT market symbol
|
|
3264
|
+
* @param {object} [params] exchange specific parameters
|
|
3265
|
+
* @returns {object} an open interest structure{@link https://docs.ccxt.com/#/?id=open-interest-structure}
|
|
3266
|
+
*/
|
|
3267
|
+
async fetchOpenInterests(symbols = undefined, params = {}) {
|
|
3268
|
+
await this.loadMarkets();
|
|
3269
|
+
symbols = this.marketSymbols(symbols);
|
|
3270
|
+
const swapMarkets = await this.fetchSwapMarkets();
|
|
3271
|
+
const result = this.parseOpenInterests(swapMarkets);
|
|
3272
|
+
return this.filterByArray(result, 'symbol', symbols);
|
|
3273
|
+
}
|
|
3274
|
+
/**
|
|
3275
|
+
* @method
|
|
3276
|
+
* @name hyperliquid#fetchOpenInterest
|
|
3277
|
+
* @description retrieves the open interest of a contract trading pair
|
|
3278
|
+
* @param {string} symbol unified CCXT market symbol
|
|
3279
|
+
* @param {object} [params] exchange specific parameters
|
|
3280
|
+
* @returns {object} an [open interest structure]{@link https://docs.ccxt.com/#/?id=open-interest-structure}
|
|
3281
|
+
*/
|
|
3282
|
+
async fetchOpenInterest(symbol, params = {}) {
|
|
3283
|
+
symbol = this.symbol(symbol);
|
|
3284
|
+
await this.loadMarkets();
|
|
3285
|
+
const ois = await this.fetchOpenInterests([symbol], params);
|
|
3286
|
+
return ois[symbol];
|
|
3287
|
+
}
|
|
3288
|
+
parseOpenInterest(interest, market = undefined) {
|
|
3289
|
+
//
|
|
3290
|
+
// {
|
|
3291
|
+
// szDecimals: '2',
|
|
3292
|
+
// name: 'HYPE',
|
|
3293
|
+
// maxLeverage: '3',
|
|
3294
|
+
// funding: '0.00014735',
|
|
3295
|
+
// openInterest: '14677900.74',
|
|
3296
|
+
// prevDayPx: '26.145',
|
|
3297
|
+
// dayNtlVlm: '299643445.12560016',
|
|
3298
|
+
// premium: '0.00081613',
|
|
3299
|
+
// oraclePx: '27.569',
|
|
3300
|
+
// markPx: '27.63',
|
|
3301
|
+
// midPx: '27.599',
|
|
3302
|
+
// impactPxs: [ '27.5915', '27.6319' ],
|
|
3303
|
+
// dayBaseVlm: '10790652.83',
|
|
3304
|
+
// baseId: 159
|
|
3305
|
+
// }
|
|
3306
|
+
//
|
|
3307
|
+
interest = this.safeDict(interest, 'info', {});
|
|
3308
|
+
const coin = this.safeString(interest, 'name');
|
|
3309
|
+
let marketId = undefined;
|
|
3310
|
+
if (coin !== undefined) {
|
|
3311
|
+
marketId = this.coinToMarketId(coin);
|
|
3312
|
+
}
|
|
3313
|
+
return this.safeOpenInterest({
|
|
3314
|
+
'symbol': this.safeSymbol(marketId),
|
|
3315
|
+
'openInterestAmount': this.safeNumber(interest, 'openInterest'),
|
|
3316
|
+
'openInterestValue': undefined,
|
|
3317
|
+
'timestamp': undefined,
|
|
3318
|
+
'datetime': undefined,
|
|
3319
|
+
'info': interest,
|
|
3320
|
+
}, market);
|
|
3321
|
+
}
|
|
3258
3322
|
extractTypeFromDelta(data = []) {
|
|
3259
3323
|
const records = [];
|
|
3260
3324
|
for (let i = 0; i < data.length; i++) {
|
package/js/src/idex.js
CHANGED
|
@@ -1123,7 +1123,6 @@ export default class idex extends Exchange {
|
|
|
1123
1123
|
'postOnly': undefined,
|
|
1124
1124
|
'side': side,
|
|
1125
1125
|
'price': price,
|
|
1126
|
-
'stopPrice': undefined,
|
|
1127
1126
|
'triggerPrice': undefined,
|
|
1128
1127
|
'amount': amount,
|
|
1129
1128
|
'cost': undefined,
|
|
@@ -1188,12 +1187,13 @@ export default class idex extends Exchange {
|
|
|
1188
1187
|
'takeProfit': 5,
|
|
1189
1188
|
'takeProfitLimit': 6,
|
|
1190
1189
|
};
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1190
|
+
const triggerPrice = this.safeString(params, 'triggerPrice', 'stopPrice');
|
|
1191
|
+
let triggerPriceString = undefined;
|
|
1192
|
+
if ((type === 'stopLossLimit') || (type === 'takeProfitLimit')) {
|
|
1193
|
+
if (triggerPrice === undefined) {
|
|
1194
|
+
throw new BadRequest(this.id + ' createOrder() triggerPrice is a required parameter for ' + type + 'orders');
|
|
1195
1195
|
}
|
|
1196
|
-
|
|
1196
|
+
triggerPriceString = this.priceToPrecision(symbol, triggerPrice);
|
|
1197
1197
|
}
|
|
1198
1198
|
const limitTypeEnums = {
|
|
1199
1199
|
'limit': 1,
|
|
@@ -1283,7 +1283,7 @@ export default class idex extends Exchange {
|
|
|
1283
1283
|
byteArray.push(encodedPrice);
|
|
1284
1284
|
}
|
|
1285
1285
|
if (type in stopLossTypeEnums) {
|
|
1286
|
-
const encodedPrice = this.encode(
|
|
1286
|
+
const encodedPrice = this.encode(triggerPriceString || priceString);
|
|
1287
1287
|
byteArray.push(encodedPrice);
|
|
1288
1288
|
}
|
|
1289
1289
|
const clientOrderId = this.safeString(params, 'clientOrderId');
|
|
@@ -1317,7 +1317,7 @@ export default class idex extends Exchange {
|
|
|
1317
1317
|
request['parameters']['price'] = priceString;
|
|
1318
1318
|
}
|
|
1319
1319
|
if (type in stopLossTypeEnums) {
|
|
1320
|
-
request['parameters']['stopPrice'] =
|
|
1320
|
+
request['parameters']['stopPrice'] = triggerPriceString || priceString;
|
|
1321
1321
|
}
|
|
1322
1322
|
if (amountEnum === 0) {
|
|
1323
1323
|
request['parameters']['quantity'] = amountString;
|
|
@@ -457,7 +457,6 @@ export default class independentreserve extends Exchange {
|
|
|
457
457
|
'postOnly': undefined,
|
|
458
458
|
'side': side,
|
|
459
459
|
'price': this.safeString(order, 'Price'),
|
|
460
|
-
'stopPrice': undefined,
|
|
461
460
|
'triggerPrice': undefined,
|
|
462
461
|
'cost': this.safeString(order, 'Value'),
|
|
463
462
|
'average': this.safeString(order, 'AvgPrice'),
|
package/js/src/indodax.js
CHANGED
package/js/src/kraken.d.ts
CHANGED
|
@@ -99,7 +99,7 @@ export default class kraken extends Exchange {
|
|
|
99
99
|
* @method
|
|
100
100
|
* @name kraken#fetchOHLCV
|
|
101
101
|
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
102
|
-
* @see https://docs.kraken.com/rest
|
|
102
|
+
* @see https://docs.kraken.com/api/docs/rest-api/get-ohlc-data
|
|
103
103
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
104
104
|
* @param {string} timeframe the length of time each candle represents
|
|
105
105
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
@@ -266,7 +266,7 @@ export default class kraken extends Exchange {
|
|
|
266
266
|
* @method
|
|
267
267
|
* @name kraken#fetchMyTrades
|
|
268
268
|
* @description fetch all trades made by the user
|
|
269
|
-
* @see https://docs.kraken.com/rest
|
|
269
|
+
* @see https://docs.kraken.com/api/docs/rest-api/get-trade-history
|
|
270
270
|
* @param {string} symbol unified market symbol
|
|
271
271
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
272
272
|
* @param {int} [limit] the maximum number of trades structures to retrieve
|
|
@@ -280,11 +280,13 @@ export default class kraken extends Exchange {
|
|
|
280
280
|
* @method
|
|
281
281
|
* @name kraken#cancelOrder
|
|
282
282
|
* @description cancels an open order
|
|
283
|
-
* @see https://docs.kraken.com/rest
|
|
283
|
+
* @see https://docs.kraken.com/api/docs/rest-api/cancel-order
|
|
284
284
|
* @param {string} id order id
|
|
285
|
-
* @param {string} symbol unified symbol of the market the order was made in
|
|
285
|
+
* @param {string} [symbol] unified symbol of the market the order was made in
|
|
286
286
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
287
|
-
* @
|
|
287
|
+
* @param {string} [params.clientOrderId] the orders client order id
|
|
288
|
+
* @param {int} [params.userref] the orders user reference id
|
|
289
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
288
290
|
*/
|
|
289
291
|
cancelOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
|
|
290
292
|
/**
|
|
@@ -322,11 +324,13 @@ export default class kraken extends Exchange {
|
|
|
322
324
|
* @method
|
|
323
325
|
* @name kraken#fetchOpenOrders
|
|
324
326
|
* @description fetch all unfilled currently open orders
|
|
325
|
-
* @see https://docs.kraken.com/rest
|
|
326
|
-
* @param {string} symbol unified market symbol
|
|
327
|
+
* @see https://docs.kraken.com/api/docs/rest-api/get-open-orders
|
|
328
|
+
* @param {string} [symbol] unified market symbol
|
|
327
329
|
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
328
330
|
* @param {int} [limit] the maximum number of open orders structures to retrieve
|
|
329
331
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
332
|
+
* @param {string} [params.clientOrderId] the orders client order id
|
|
333
|
+
* @param {int} [params.userref] the orders user reference id
|
|
330
334
|
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
331
335
|
*/
|
|
332
336
|
fetchOpenOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
@@ -334,12 +338,14 @@ export default class kraken extends Exchange {
|
|
|
334
338
|
* @method
|
|
335
339
|
* @name kraken#fetchClosedOrders
|
|
336
340
|
* @description fetches information on multiple closed orders made by the user
|
|
337
|
-
* @see https://docs.kraken.com/rest
|
|
338
|
-
* @param {string} symbol unified market symbol of the market orders were made in
|
|
341
|
+
* @see https://docs.kraken.com/api/docs/rest-api/get-closed-orders
|
|
342
|
+
* @param {string} [symbol] unified market symbol of the market orders were made in
|
|
339
343
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
340
344
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
341
345
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
342
346
|
* @param {int} [params.until] timestamp in ms of the latest entry
|
|
347
|
+
* @param {string} [params.clientOrderId] the orders client order id
|
|
348
|
+
* @param {int} [params.userref] the orders user reference id
|
|
343
349
|
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
344
350
|
*/
|
|
345
351
|
fetchClosedOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
package/js/src/kraken.js
CHANGED
|
@@ -430,6 +430,67 @@ export default class kraken extends Exchange {
|
|
|
430
430
|
'Celestia': 'TIA',
|
|
431
431
|
},
|
|
432
432
|
},
|
|
433
|
+
'features': {
|
|
434
|
+
'spot': {
|
|
435
|
+
'sandbox': false,
|
|
436
|
+
'createOrder': {
|
|
437
|
+
'marginMode': false,
|
|
438
|
+
'triggerPrice': false,
|
|
439
|
+
'triggerPriceType': undefined,
|
|
440
|
+
'triggerDirection': false,
|
|
441
|
+
'stopLossPrice': true,
|
|
442
|
+
'takeProfitPrice': true,
|
|
443
|
+
'attachedStopLossTakeProfit': undefined,
|
|
444
|
+
'timeInForce': {
|
|
445
|
+
'IOC': true,
|
|
446
|
+
'FOK': true,
|
|
447
|
+
'PO': true,
|
|
448
|
+
'GTD': false,
|
|
449
|
+
},
|
|
450
|
+
'hedged': false,
|
|
451
|
+
'trailing': true,
|
|
452
|
+
},
|
|
453
|
+
'createOrders': undefined,
|
|
454
|
+
'fetchMyTrades': {
|
|
455
|
+
'marginMode': false,
|
|
456
|
+
'limit': undefined,
|
|
457
|
+
'daysBack': undefined,
|
|
458
|
+
'untilDays': undefined,
|
|
459
|
+
},
|
|
460
|
+
'fetchOrder': {
|
|
461
|
+
'marginMode': false,
|
|
462
|
+
'trigger': false,
|
|
463
|
+
'trailing': false,
|
|
464
|
+
},
|
|
465
|
+
'fetchOpenOrders': {
|
|
466
|
+
'marginMode': false,
|
|
467
|
+
'limit': undefined,
|
|
468
|
+
'trigger': false,
|
|
469
|
+
'trailing': false,
|
|
470
|
+
},
|
|
471
|
+
'fetchOrders': undefined,
|
|
472
|
+
'fetchClosedOrders': {
|
|
473
|
+
'marginMode': false,
|
|
474
|
+
'limit': undefined,
|
|
475
|
+
'daysBackClosed': undefined,
|
|
476
|
+
'daysBackCanceled': undefined,
|
|
477
|
+
'untilDays': 100000,
|
|
478
|
+
'trigger': false,
|
|
479
|
+
'trailing': false,
|
|
480
|
+
},
|
|
481
|
+
'fetchOHLCV': {
|
|
482
|
+
'limit': 720,
|
|
483
|
+
},
|
|
484
|
+
},
|
|
485
|
+
'swap': {
|
|
486
|
+
'linear': undefined,
|
|
487
|
+
'inverse': undefined,
|
|
488
|
+
},
|
|
489
|
+
'future': {
|
|
490
|
+
'linear': undefined,
|
|
491
|
+
'inverse': undefined,
|
|
492
|
+
},
|
|
493
|
+
},
|
|
433
494
|
'precisionMode': TICK_SIZE,
|
|
434
495
|
'exceptions': {
|
|
435
496
|
'exact': {
|
|
@@ -1011,7 +1072,7 @@ export default class kraken extends Exchange {
|
|
|
1011
1072
|
* @method
|
|
1012
1073
|
* @name kraken#fetchOHLCV
|
|
1013
1074
|
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
1014
|
-
* @see https://docs.kraken.com/rest
|
|
1075
|
+
* @see https://docs.kraken.com/api/docs/rest-api/get-ohlc-data
|
|
1015
1076
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
1016
1077
|
* @param {string} timeframe the length of time each candle represents
|
|
1017
1078
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
@@ -1655,6 +1716,37 @@ export default class kraken extends Exchange {
|
|
|
1655
1716
|
// }
|
|
1656
1717
|
// }
|
|
1657
1718
|
//
|
|
1719
|
+
// fetchOpenOrders
|
|
1720
|
+
//
|
|
1721
|
+
// {
|
|
1722
|
+
// "refid": null,
|
|
1723
|
+
// "userref": null,
|
|
1724
|
+
// "cl_ord_id": "1234",
|
|
1725
|
+
// "status": "open",
|
|
1726
|
+
// "opentm": 1733815269.370054,
|
|
1727
|
+
// "starttm": 0,
|
|
1728
|
+
// "expiretm": 0,
|
|
1729
|
+
// "descr": {
|
|
1730
|
+
// "pair": "XBTUSD",
|
|
1731
|
+
// "type": "buy",
|
|
1732
|
+
// "ordertype": "limit",
|
|
1733
|
+
// "price": "70000.0",
|
|
1734
|
+
// "price2": "0",
|
|
1735
|
+
// "leverage": "none",
|
|
1736
|
+
// "order": "buy 0.00010000 XBTUSD @ limit 70000.0",
|
|
1737
|
+
// "close": ""
|
|
1738
|
+
// },
|
|
1739
|
+
// "vol": "0.00010000",
|
|
1740
|
+
// "vol_exec": "0.00000000",
|
|
1741
|
+
// "cost": "0.00000",
|
|
1742
|
+
// "fee": "0.00000",
|
|
1743
|
+
// "price": "0.00000",
|
|
1744
|
+
// "stopprice": "0.00000",
|
|
1745
|
+
// "limitprice": "0.00000",
|
|
1746
|
+
// "misc": "",
|
|
1747
|
+
// "oflags": "fciq"
|
|
1748
|
+
// }
|
|
1749
|
+
//
|
|
1658
1750
|
const description = this.safeDict(order, 'descr', {});
|
|
1659
1751
|
const orderDescriptionObj = this.safeDict(order, 'descr'); // can be null
|
|
1660
1752
|
let orderDescription = undefined;
|
|
@@ -1745,7 +1837,8 @@ export default class kraken extends Exchange {
|
|
|
1745
1837
|
const txid = this.safeList(order, 'txid');
|
|
1746
1838
|
id = this.safeString(txid, 0);
|
|
1747
1839
|
}
|
|
1748
|
-
const
|
|
1840
|
+
const userref = this.safeString(order, 'userref');
|
|
1841
|
+
const clientOrderId = this.safeString(order, 'cl_ord_id', userref);
|
|
1749
1842
|
const rawTrades = this.safeValue(order, 'trades', []);
|
|
1750
1843
|
const trades = [];
|
|
1751
1844
|
for (let i = 0; i < rawTrades.length; i++) {
|
|
@@ -1804,7 +1897,6 @@ export default class kraken extends Exchange {
|
|
|
1804
1897
|
'postOnly': isPostOnly,
|
|
1805
1898
|
'side': side,
|
|
1806
1899
|
'price': price,
|
|
1807
|
-
'stopPrice': triggerPrice,
|
|
1808
1900
|
'triggerPrice': triggerPrice,
|
|
1809
1901
|
'takeProfitPrice': takeProfitPrice,
|
|
1810
1902
|
'stopLossPrice': stopLossPrice,
|
|
@@ -1980,10 +2072,10 @@ export default class kraken extends Exchange {
|
|
|
1980
2072
|
let request = {
|
|
1981
2073
|
'txid': id,
|
|
1982
2074
|
};
|
|
1983
|
-
const clientOrderId = this.
|
|
2075
|
+
const clientOrderId = this.safeString2(params, 'clientOrderId', 'cl_ord_id');
|
|
1984
2076
|
if (clientOrderId !== undefined) {
|
|
1985
2077
|
request['cl_ord_id'] = clientOrderId;
|
|
1986
|
-
params = this.omit(params, 'clientOrderId');
|
|
2078
|
+
params = this.omit(params, ['clientOrderId', 'cl_ord_id']);
|
|
1987
2079
|
request = this.omit(request, 'txid');
|
|
1988
2080
|
}
|
|
1989
2081
|
const isMarket = (type === 'market');
|
|
@@ -2203,7 +2295,7 @@ export default class kraken extends Exchange {
|
|
|
2203
2295
|
* @method
|
|
2204
2296
|
* @name kraken#fetchMyTrades
|
|
2205
2297
|
* @description fetch all trades made by the user
|
|
2206
|
-
* @see https://docs.kraken.com/rest
|
|
2298
|
+
* @see https://docs.kraken.com/api/docs/rest-api/get-trade-history
|
|
2207
2299
|
* @param {string} symbol unified market symbol
|
|
2208
2300
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
2209
2301
|
* @param {int} [limit] the maximum number of trades structures to retrieve
|
|
@@ -2274,20 +2366,28 @@ export default class kraken extends Exchange {
|
|
|
2274
2366
|
* @method
|
|
2275
2367
|
* @name kraken#cancelOrder
|
|
2276
2368
|
* @description cancels an open order
|
|
2277
|
-
* @see https://docs.kraken.com/rest
|
|
2369
|
+
* @see https://docs.kraken.com/api/docs/rest-api/cancel-order
|
|
2278
2370
|
* @param {string} id order id
|
|
2279
|
-
* @param {string} symbol unified symbol of the market the order was made in
|
|
2371
|
+
* @param {string} [symbol] unified symbol of the market the order was made in
|
|
2280
2372
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2281
|
-
* @
|
|
2373
|
+
* @param {string} [params.clientOrderId] the orders client order id
|
|
2374
|
+
* @param {int} [params.userref] the orders user reference id
|
|
2375
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
2282
2376
|
*/
|
|
2283
2377
|
async cancelOrder(id, symbol = undefined, params = {}) {
|
|
2284
2378
|
await this.loadMarkets();
|
|
2285
2379
|
let response = undefined;
|
|
2286
|
-
const
|
|
2287
|
-
|
|
2288
|
-
|
|
2380
|
+
const requestId = this.safeValue(params, 'userref', id); // string or integer
|
|
2381
|
+
params = this.omit(params, 'userref');
|
|
2382
|
+
let request = {
|
|
2383
|
+
'txid': requestId, // order id or userref
|
|
2289
2384
|
};
|
|
2290
|
-
|
|
2385
|
+
const clientOrderId = this.safeString2(params, 'clientOrderId', 'cl_ord_id');
|
|
2386
|
+
if (clientOrderId !== undefined) {
|
|
2387
|
+
request['cl_ord_id'] = clientOrderId;
|
|
2388
|
+
params = this.omit(params, ['clientOrderId', 'cl_ord_id']);
|
|
2389
|
+
request = this.omit(request, 'txid');
|
|
2390
|
+
}
|
|
2291
2391
|
try {
|
|
2292
2392
|
response = await this.privatePostCancelOrder(this.extend(request, params));
|
|
2293
2393
|
//
|
|
@@ -2399,11 +2499,13 @@ export default class kraken extends Exchange {
|
|
|
2399
2499
|
* @method
|
|
2400
2500
|
* @name kraken#fetchOpenOrders
|
|
2401
2501
|
* @description fetch all unfilled currently open orders
|
|
2402
|
-
* @see https://docs.kraken.com/rest
|
|
2403
|
-
* @param {string} symbol unified market symbol
|
|
2502
|
+
* @see https://docs.kraken.com/api/docs/rest-api/get-open-orders
|
|
2503
|
+
* @param {string} [symbol] unified market symbol
|
|
2404
2504
|
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
2405
2505
|
* @param {int} [limit] the maximum number of open orders structures to retrieve
|
|
2406
2506
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2507
|
+
* @param {string} [params.clientOrderId] the orders client order id
|
|
2508
|
+
* @param {int} [params.userref] the orders user reference id
|
|
2407
2509
|
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
2408
2510
|
*/
|
|
2409
2511
|
async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
@@ -2412,31 +2514,81 @@ export default class kraken extends Exchange {
|
|
|
2412
2514
|
if (since !== undefined) {
|
|
2413
2515
|
request['start'] = this.parseToInt(since / 1000);
|
|
2414
2516
|
}
|
|
2415
|
-
|
|
2416
|
-
|
|
2517
|
+
const userref = this.safeInteger(params, 'userref');
|
|
2518
|
+
if (userref !== undefined) {
|
|
2519
|
+
request['userref'] = userref;
|
|
2520
|
+
params = this.omit(params, 'userref');
|
|
2521
|
+
}
|
|
2522
|
+
const clientOrderId = this.safeString(params, 'clientOrderId');
|
|
2417
2523
|
if (clientOrderId !== undefined) {
|
|
2418
|
-
request['
|
|
2419
|
-
|
|
2524
|
+
request['cl_ord_id'] = clientOrderId;
|
|
2525
|
+
params = this.omit(params, 'clientOrderId');
|
|
2420
2526
|
}
|
|
2421
|
-
const response = await this.privatePostOpenOrders(this.extend(request,
|
|
2527
|
+
const response = await this.privatePostOpenOrders(this.extend(request, params));
|
|
2528
|
+
//
|
|
2529
|
+
// {
|
|
2530
|
+
// "error": [],
|
|
2531
|
+
// "result": {
|
|
2532
|
+
// "open": {
|
|
2533
|
+
// "O45M52-BFD5S-YXKQOU": {
|
|
2534
|
+
// "refid": null,
|
|
2535
|
+
// "userref": null,
|
|
2536
|
+
// "cl_ord_id": "1234",
|
|
2537
|
+
// "status": "open",
|
|
2538
|
+
// "opentm": 1733815269.370054,
|
|
2539
|
+
// "starttm": 0,
|
|
2540
|
+
// "expiretm": 0,
|
|
2541
|
+
// "descr": {
|
|
2542
|
+
// "pair": "XBTUSD",
|
|
2543
|
+
// "type": "buy",
|
|
2544
|
+
// "ordertype": "limit",
|
|
2545
|
+
// "price": "70000.0",
|
|
2546
|
+
// "price2": "0",
|
|
2547
|
+
// "leverage": "none",
|
|
2548
|
+
// "order": "buy 0.00010000 XBTUSD @ limit 70000.0",
|
|
2549
|
+
// "close": ""
|
|
2550
|
+
// },
|
|
2551
|
+
// "vol": "0.00010000",
|
|
2552
|
+
// "vol_exec": "0.00000000",
|
|
2553
|
+
// "cost": "0.00000",
|
|
2554
|
+
// "fee": "0.00000",
|
|
2555
|
+
// "price": "0.00000",
|
|
2556
|
+
// "stopprice": "0.00000",
|
|
2557
|
+
// "limitprice": "0.00000",
|
|
2558
|
+
// "misc": "",
|
|
2559
|
+
// "oflags": "fciq"
|
|
2560
|
+
// }
|
|
2561
|
+
// }
|
|
2562
|
+
// }
|
|
2563
|
+
// }
|
|
2564
|
+
//
|
|
2422
2565
|
let market = undefined;
|
|
2423
2566
|
if (symbol !== undefined) {
|
|
2424
2567
|
market = this.market(symbol);
|
|
2425
2568
|
}
|
|
2426
2569
|
const result = this.safeDict(response, 'result', {});
|
|
2427
|
-
const
|
|
2570
|
+
const open = this.safeDict(result, 'open', {});
|
|
2571
|
+
const orders = [];
|
|
2572
|
+
const orderIds = Object.keys(open);
|
|
2573
|
+
for (let i = 0; i < orderIds.length; i++) {
|
|
2574
|
+
const id = orderIds[i];
|
|
2575
|
+
const item = open[id];
|
|
2576
|
+
orders.push(this.extend({ 'id': id }, item));
|
|
2577
|
+
}
|
|
2428
2578
|
return this.parseOrders(orders, market, since, limit);
|
|
2429
2579
|
}
|
|
2430
2580
|
/**
|
|
2431
2581
|
* @method
|
|
2432
2582
|
* @name kraken#fetchClosedOrders
|
|
2433
2583
|
* @description fetches information on multiple closed orders made by the user
|
|
2434
|
-
* @see https://docs.kraken.com/rest
|
|
2435
|
-
* @param {string} symbol unified market symbol of the market orders were made in
|
|
2584
|
+
* @see https://docs.kraken.com/api/docs/rest-api/get-closed-orders
|
|
2585
|
+
* @param {string} [symbol] unified market symbol of the market orders were made in
|
|
2436
2586
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
2437
2587
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
2438
2588
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2439
2589
|
* @param {int} [params.until] timestamp in ms of the latest entry
|
|
2590
|
+
* @param {string} [params.clientOrderId] the orders client order id
|
|
2591
|
+
* @param {int} [params.userref] the orders user reference id
|
|
2440
2592
|
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
2441
2593
|
*/
|
|
2442
2594
|
async fetchClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
@@ -2445,14 +2597,18 @@ export default class kraken extends Exchange {
|
|
|
2445
2597
|
if (since !== undefined) {
|
|
2446
2598
|
request['start'] = this.parseToInt(since / 1000);
|
|
2447
2599
|
}
|
|
2448
|
-
|
|
2449
|
-
|
|
2600
|
+
const userref = this.safeInteger(params, 'userref');
|
|
2601
|
+
if (userref !== undefined) {
|
|
2602
|
+
request['userref'] = userref;
|
|
2603
|
+
params = this.omit(params, 'userref');
|
|
2604
|
+
}
|
|
2605
|
+
const clientOrderId = this.safeString(params, 'clientOrderId');
|
|
2450
2606
|
if (clientOrderId !== undefined) {
|
|
2451
|
-
request['
|
|
2452
|
-
|
|
2607
|
+
request['cl_ord_id'] = clientOrderId;
|
|
2608
|
+
params = this.omit(params, 'clientOrderId');
|
|
2453
2609
|
}
|
|
2454
2610
|
[request, params] = this.handleUntilOption('end', request, params);
|
|
2455
|
-
const response = await this.privatePostClosedOrders(this.extend(request,
|
|
2611
|
+
const response = await this.privatePostClosedOrders(this.extend(request, params));
|
|
2456
2612
|
//
|
|
2457
2613
|
// {
|
|
2458
2614
|
// "error":[],
|
|
@@ -2497,7 +2653,14 @@ export default class kraken extends Exchange {
|
|
|
2497
2653
|
market = this.market(symbol);
|
|
2498
2654
|
}
|
|
2499
2655
|
const result = this.safeDict(response, 'result', {});
|
|
2500
|
-
const
|
|
2656
|
+
const closed = this.safeDict(result, 'closed', {});
|
|
2657
|
+
const orders = [];
|
|
2658
|
+
const orderIds = Object.keys(closed);
|
|
2659
|
+
for (let i = 0; i < orderIds.length; i++) {
|
|
2660
|
+
const id = orderIds[i];
|
|
2661
|
+
const item = closed[id];
|
|
2662
|
+
orders.push(this.extend({ 'id': id }, item));
|
|
2663
|
+
}
|
|
2501
2664
|
return this.parseOrders(orders, market, since, limit);
|
|
2502
2665
|
}
|
|
2503
2666
|
parseTransactionStatus(status) {
|
|
@@ -74,7 +74,7 @@ export default class krakenfutures extends Exchange {
|
|
|
74
74
|
* @method
|
|
75
75
|
* @name krakenfutures#createOrder
|
|
76
76
|
* @description Create an order on the exchange
|
|
77
|
-
* @see https://docs.
|
|
77
|
+
* @see https://docs.kraken.com/api/docs/futures-api/trading/send-order
|
|
78
78
|
* @param {string} symbol unified market symbol
|
|
79
79
|
* @param {string} type 'limit' or 'market'
|
|
80
80
|
* @param {string} side 'buy' or 'sell'
|
|
@@ -95,7 +95,7 @@ export default class krakenfutures extends Exchange {
|
|
|
95
95
|
* @method
|
|
96
96
|
* @name krakenfutures#createOrders
|
|
97
97
|
* @description create a list of trade orders
|
|
98
|
-
* @see https://docs.
|
|
98
|
+
* @see https://docs.kraken.com/api/docs/futures-api/trading/send-batch-order
|
|
99
99
|
* @param {Array} orders list of orders to create, each object should contain the parameters required by createOrder, namely symbol, type, side, amount, price and params
|
|
100
100
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
101
101
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|