ccxt 4.3.5 → 4.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/ace.js +5 -0
- package/dist/cjs/src/alpaca.js +6 -0
- package/dist/cjs/src/base/Exchange.js +37 -0
- package/dist/cjs/src/binance.js +4 -0
- package/dist/cjs/src/bingx.js +47 -0
- package/dist/cjs/src/bitbank.js +3 -0
- package/dist/cjs/src/bitget.js +74 -1
- package/dist/cjs/src/bithumb.js +4 -0
- package/dist/cjs/src/bitmex.js +26 -0
- package/dist/cjs/src/bitopro.js +5 -0
- package/dist/cjs/src/bitso.js +3 -0
- package/dist/cjs/src/bitstamp.js +3 -0
- package/dist/cjs/src/bitteam.js +4 -0
- package/dist/cjs/src/bitvavo.js +3 -0
- package/dist/cjs/src/bl3p.js +3 -0
- package/dist/cjs/src/btcalpha.js +3 -0
- package/dist/cjs/src/btcbox.js +3 -0
- package/dist/cjs/src/btcmarkets.js +3 -0
- package/dist/cjs/src/btcturk.js +3 -0
- package/dist/cjs/src/bybit.js +209 -12
- package/dist/cjs/src/cex.js +6 -0
- package/dist/cjs/src/coinbase.js +100 -21
- package/dist/cjs/src/coinbaseinternational.js +2 -0
- package/dist/cjs/src/coinbasepro.js +6 -0
- package/dist/cjs/src/coincheck.js +3 -0
- package/dist/cjs/src/coinex.js +180 -75
- package/dist/cjs/src/coinlist.js +4 -0
- package/dist/cjs/src/coinmate.js +3 -0
- package/dist/cjs/src/coinone.js +3 -0
- package/dist/cjs/src/coinsph.js +4 -0
- package/dist/cjs/src/coinspot.js +3 -0
- package/dist/cjs/src/cryptocom.js +34 -0
- package/dist/cjs/src/exmo.js +5 -0
- package/dist/cjs/src/gate.js +124 -22
- package/dist/cjs/src/hitbtc.js +4 -3
- package/dist/cjs/src/htx.js +30 -0
- package/dist/cjs/src/hyperliquid.js +40 -0
- package/dist/cjs/src/idex.js +3 -0
- package/dist/cjs/src/independentreserve.js +3 -0
- package/dist/cjs/src/indodax.js +3 -0
- package/dist/cjs/src/kraken.js +30 -0
- package/dist/cjs/src/krakenfutures.js +28 -0
- package/dist/cjs/src/kucoin.js +2 -0
- package/dist/cjs/src/kucoinfutures.js +4 -2
- package/dist/cjs/src/latoken.js +6 -0
- package/dist/cjs/src/luno.js +3 -0
- package/dist/cjs/src/lykke.js +5 -0
- package/dist/cjs/src/mercado.js +3 -0
- package/dist/cjs/src/mexc.js +111 -0
- package/dist/cjs/src/ndax.js +4 -0
- package/dist/cjs/src/novadax.js +4 -0
- package/dist/cjs/src/okx.js +196 -0
- package/dist/cjs/src/onetrading.js +3 -0
- package/dist/cjs/src/p2b.js +3 -0
- package/dist/cjs/src/pro/bitget.js +1 -1
- package/dist/cjs/src/pro/bybit.js +1 -1
- package/dist/cjs/src/pro/coinbase.js +30 -29
- package/dist/cjs/src/probit.js +3 -0
- package/dist/cjs/src/timex.js +3 -0
- package/dist/cjs/src/tradeogre.js +3 -0
- package/dist/cjs/src/wavesexchange.js +3 -0
- package/dist/cjs/src/wazirx.js +3 -0
- package/dist/cjs/src/whitebit.js +42 -0
- package/dist/cjs/src/woo.js +31 -0
- package/dist/cjs/src/yobit.js +3 -0
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/binance.d.ts +1 -0
- package/js/src/abstract/binancecoinm.d.ts +1 -0
- package/js/src/abstract/binanceus.d.ts +1 -0
- package/js/src/abstract/binanceusdm.d.ts +1 -0
- package/js/src/abstract/bingx.d.ts +1 -0
- package/js/src/abstract/coinbase.d.ts +5 -0
- package/js/src/abstract/woo.d.ts +1 -0
- package/js/src/ace.js +5 -0
- package/js/src/alpaca.js +6 -0
- package/js/src/ascendex.d.ts +2 -2
- package/js/src/base/Exchange.d.ts +5 -0
- package/js/src/base/Exchange.js +37 -0
- package/js/src/bigone.d.ts +1 -1
- package/js/src/binance.d.ts +3 -3
- package/js/src/binance.js +4 -0
- package/js/src/bingx.d.ts +2 -1
- package/js/src/bingx.js +47 -0
- package/js/src/bitbank.d.ts +1 -1
- package/js/src/bitbank.js +3 -0
- package/js/src/bitfinex.d.ts +1 -1
- package/js/src/bitfinex2.d.ts +1 -1
- package/js/src/bitflyer.d.ts +1 -1
- package/js/src/bitget.d.ts +4 -3
- package/js/src/bitget.js +74 -1
- package/js/src/bithumb.d.ts +1 -1
- package/js/src/bithumb.js +4 -0
- package/js/src/bitmart.d.ts +1 -1
- package/js/src/bitmex.d.ts +2 -1
- package/js/src/bitmex.js +26 -0
- package/js/src/bitopro.d.ts +1 -1
- package/js/src/bitopro.js +5 -0
- package/js/src/bitrue.d.ts +1 -1
- package/js/src/bitso.d.ts +1 -1
- package/js/src/bitso.js +3 -0
- package/js/src/bitstamp.d.ts +1 -1
- package/js/src/bitstamp.js +3 -0
- package/js/src/bitteam.js +4 -0
- package/js/src/bitvavo.d.ts +1 -1
- package/js/src/bitvavo.js +3 -0
- package/js/src/bl3p.js +3 -0
- package/js/src/blockchaincom.d.ts +1 -1
- package/js/src/btcalpha.js +3 -0
- package/js/src/btcbox.js +3 -0
- package/js/src/btcmarkets.d.ts +1 -1
- package/js/src/btcmarkets.js +3 -0
- package/js/src/btcturk.js +3 -0
- package/js/src/bybit.d.ts +8 -6
- package/js/src/bybit.js +209 -12
- package/js/src/cex.js +6 -0
- package/js/src/coinbase.d.ts +1 -1
- package/js/src/coinbase.js +100 -21
- package/js/src/coinbaseinternational.d.ts +1 -1
- package/js/src/coinbaseinternational.js +2 -0
- package/js/src/coinbasepro.d.ts +1 -1
- package/js/src/coinbasepro.js +6 -0
- package/js/src/coincheck.js +3 -0
- package/js/src/coinex.d.ts +8 -7
- package/js/src/coinex.js +180 -75
- package/js/src/coinlist.d.ts +1 -1
- package/js/src/coinlist.js +4 -0
- package/js/src/coinmate.d.ts +1 -1
- package/js/src/coinmate.js +3 -0
- package/js/src/coinone.js +3 -0
- package/js/src/coinsph.d.ts +1 -1
- package/js/src/coinsph.js +4 -0
- package/js/src/coinspot.js +3 -0
- package/js/src/cryptocom.d.ts +3 -2
- package/js/src/cryptocom.js +34 -0
- package/js/src/delta.d.ts +2 -2
- package/js/src/deribit.d.ts +1 -1
- package/js/src/digifinex.d.ts +3 -3
- package/js/src/exmo.d.ts +3 -3
- package/js/src/exmo.js +5 -0
- package/js/src/gate.d.ts +8 -7
- package/js/src/gate.js +124 -22
- package/js/src/gemini.d.ts +1 -1
- package/js/src/hitbtc.d.ts +3 -3
- package/js/src/hitbtc.js +4 -3
- package/js/src/hollaex.d.ts +1 -1
- package/js/src/htx.d.ts +2 -1
- package/js/src/htx.js +30 -0
- package/js/src/huobijp.d.ts +1 -1
- package/js/src/hyperliquid.d.ts +3 -2
- package/js/src/hyperliquid.js +40 -0
- package/js/src/idex.d.ts +1 -1
- package/js/src/idex.js +3 -0
- package/js/src/independentreserve.js +3 -0
- package/js/src/indodax.d.ts +1 -1
- package/js/src/indodax.js +3 -0
- package/js/src/kraken.d.ts +2 -1
- package/js/src/kraken.js +30 -0
- package/js/src/krakenfutures.d.ts +1 -0
- package/js/src/krakenfutures.js +28 -0
- package/js/src/kucoin.d.ts +1 -1
- package/js/src/kucoin.js +2 -0
- package/js/src/kucoinfutures.d.ts +1 -1
- package/js/src/kucoinfutures.js +4 -2
- package/js/src/kuna.d.ts +1 -1
- package/js/src/latoken.js +6 -0
- package/js/src/lbank.d.ts +1 -1
- package/js/src/luno.js +3 -0
- package/js/src/lykke.d.ts +1 -1
- package/js/src/lykke.js +5 -0
- package/js/src/mercado.d.ts +1 -1
- package/js/src/mercado.js +3 -0
- package/js/src/mexc.d.ts +4 -3
- package/js/src/mexc.js +111 -0
- package/js/src/ndax.d.ts +1 -1
- package/js/src/ndax.js +4 -0
- package/js/src/novadax.d.ts +1 -1
- package/js/src/novadax.js +4 -0
- package/js/src/okcoin.d.ts +1 -1
- package/js/src/okx.d.ts +11 -8
- package/js/src/okx.js +196 -0
- package/js/src/onetrading.d.ts +1 -1
- package/js/src/onetrading.js +3 -0
- package/js/src/p2b.js +3 -0
- package/js/src/phemex.d.ts +1 -1
- package/js/src/poloniex.d.ts +1 -1
- package/js/src/pro/bitget.d.ts +1 -1
- package/js/src/pro/bitget.js +1 -1
- package/js/src/pro/bybit.js +1 -1
- package/js/src/pro/coinbase.d.ts +2 -2
- package/js/src/pro/coinbase.js +30 -29
- package/js/src/probit.d.ts +1 -1
- package/js/src/probit.js +3 -0
- package/js/src/timex.js +3 -0
- package/js/src/tokocrypto.d.ts +1 -1
- package/js/src/tradeogre.js +3 -0
- package/js/src/upbit.d.ts +1 -1
- package/js/src/wavesexchange.d.ts +1 -1
- package/js/src/wavesexchange.js +3 -0
- package/js/src/wazirx.js +3 -0
- package/js/src/whitebit.d.ts +2 -1
- package/js/src/whitebit.js +42 -0
- package/js/src/woo.d.ts +3 -2
- package/js/src/woo.js +31 -0
- package/js/src/yobit.d.ts +1 -1
- package/js/src/yobit.js +3 -0
- package/js/src/zaif.d.ts +1 -1
- package/js/src/zonda.d.ts +1 -1
- package/package.json +1 -1
package/js/src/exmo.d.ts
CHANGED
|
@@ -8,8 +8,8 @@ export default class exmo extends Exchange {
|
|
|
8
8
|
describe(): any;
|
|
9
9
|
modifyMarginHelper(symbol: string, amount: any, type: any, params?: {}): Promise<MarginModification>;
|
|
10
10
|
parseMarginModification(data: any, market?: Market): MarginModification;
|
|
11
|
-
reduceMargin(symbol: string, amount:
|
|
12
|
-
addMargin(symbol: string, amount:
|
|
11
|
+
reduceMargin(symbol: string, amount: number, params?: {}): Promise<MarginModification>;
|
|
12
|
+
addMargin(symbol: string, amount: number, params?: {}): Promise<MarginModification>;
|
|
13
13
|
fetchTradingFees(params?: {}): Promise<TradingFees>;
|
|
14
14
|
fetchPrivateTradingFees(params?: {}): Promise<{}>;
|
|
15
15
|
fetchPublicTradingFees(params?: {}): Promise<{}>;
|
|
@@ -49,7 +49,7 @@ export default class exmo extends Exchange {
|
|
|
49
49
|
info: any;
|
|
50
50
|
}>;
|
|
51
51
|
getMarketFromTrades(trades: any): any;
|
|
52
|
-
withdraw(code: string, amount: number, address:
|
|
52
|
+
withdraw(code: string, amount: number, address: string, tag?: any, params?: {}): Promise<Transaction>;
|
|
53
53
|
parseTransactionStatus(status: any): string;
|
|
54
54
|
parseTransaction(transaction: any, currency?: Currency): Transaction;
|
|
55
55
|
fetchDepositsWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
|
package/js/src/exmo.js
CHANGED
|
@@ -65,7 +65,12 @@ export default class exmo extends Exchange {
|
|
|
65
65
|
'fetchOrderBook': true,
|
|
66
66
|
'fetchOrderBooks': true,
|
|
67
67
|
'fetchOrderTrades': true,
|
|
68
|
+
'fetchPosition': false,
|
|
69
|
+
'fetchPositionHistory': false,
|
|
68
70
|
'fetchPositionMode': false,
|
|
71
|
+
'fetchPositions': false,
|
|
72
|
+
'fetchPositionsHistory': false,
|
|
73
|
+
'fetchPositionsRisk': false,
|
|
69
74
|
'fetchPremiumIndexOHLCV': false,
|
|
70
75
|
'fetchTicker': true,
|
|
71
76
|
'fetchTickers': true,
|
package/js/src/gate.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Exchange from './abstract/gate.js';
|
|
2
|
-
import type { Int, OrderSide, OrderType, OHLCV, Trade, FundingRateHistory, OpenInterest, Order, Balances, OrderRequest, FundingHistory, Str, Transaction, Ticker, OrderBook, Tickers, Greeks, Strings, Market, Currency, MarketInterface, TransferEntry, Leverage, Leverages, Num, OptionChain, Option, MarginModification, TradingFeeInterface, Currencies, TradingFees } from './base/types.js';
|
|
2
|
+
import type { Int, OrderSide, OrderType, OHLCV, Trade, FundingRateHistory, OpenInterest, Order, Balances, OrderRequest, FundingHistory, Str, Transaction, Ticker, OrderBook, Tickers, Greeks, Strings, Market, Currency, MarketInterface, TransferEntry, Leverage, Leverages, Num, OptionChain, Option, MarginModification, TradingFeeInterface, Currencies, TradingFees, Position } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class gate
|
|
5
5
|
* @augments Exchange
|
|
@@ -171,7 +171,7 @@ export default class gate extends Exchange {
|
|
|
171
171
|
parseTrade(trade: any, market?: Market): Trade;
|
|
172
172
|
fetchDeposits(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
|
|
173
173
|
fetchWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
|
|
174
|
-
withdraw(code: string, amount: number, address:
|
|
174
|
+
withdraw(code: string, amount: number, address: string, tag?: any, params?: {}): Promise<Transaction>;
|
|
175
175
|
parseTransactionStatus(status: any): string;
|
|
176
176
|
parseTransactionType(type: any): string;
|
|
177
177
|
parseTransaction(transaction: any, currency?: Currency): Transaction;
|
|
@@ -201,9 +201,9 @@ export default class gate extends Exchange {
|
|
|
201
201
|
info: any;
|
|
202
202
|
};
|
|
203
203
|
setLeverage(leverage: Int, symbol?: Str, params?: {}): Promise<any>;
|
|
204
|
-
parsePosition(position: any, market?: Market):
|
|
205
|
-
fetchPosition(symbol: string, params?: {}): Promise<
|
|
206
|
-
fetchPositions(symbols?: Strings, params?: {}): Promise<
|
|
204
|
+
parsePosition(position: any, market?: Market): Position;
|
|
205
|
+
fetchPosition(symbol: string, params?: {}): Promise<Position>;
|
|
206
|
+
fetchPositions(symbols?: Strings, params?: {}): Promise<Position[]>;
|
|
207
207
|
fetchLeverageTiers(symbols?: Strings, params?: {}): Promise<{}>;
|
|
208
208
|
fetchMarketLeverageTiers(symbol: string, params?: {}): Promise<any[]>;
|
|
209
209
|
parseEmulatedLeverageTiers(info: any, market?: any): any[];
|
|
@@ -261,8 +261,8 @@ export default class gate extends Exchange {
|
|
|
261
261
|
};
|
|
262
262
|
modifyMarginHelper(symbol: string, amount: any, params?: {}): Promise<MarginModification>;
|
|
263
263
|
parseMarginModification(data: any, market?: Market): MarginModification;
|
|
264
|
-
reduceMargin(symbol: string, amount:
|
|
265
|
-
addMargin(symbol: string, amount:
|
|
264
|
+
reduceMargin(symbol: string, amount: number, params?: {}): Promise<MarginModification>;
|
|
265
|
+
addMargin(symbol: string, amount: number, params?: {}): Promise<MarginModification>;
|
|
266
266
|
fetchOpenInterestHistory(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OpenInterest[]>;
|
|
267
267
|
parseOpenInterest(interest: any, market?: Market): {
|
|
268
268
|
symbol: string;
|
|
@@ -353,5 +353,6 @@ export default class gate extends Exchange {
|
|
|
353
353
|
baseVolume: any;
|
|
354
354
|
quoteVolume: any;
|
|
355
355
|
};
|
|
356
|
+
fetchPositionsHistory(symbols?: Strings, since?: Int, limit?: Int, params?: {}): Promise<Position[]>;
|
|
356
357
|
handleErrors(code: any, reason: any, url: any, method: any, headers: any, body: any, response: any, requestHeaders: any, requestBody: any): any;
|
|
357
358
|
}
|
package/js/src/gate.js
CHANGED
|
@@ -141,8 +141,10 @@ export default class gate extends Exchange {
|
|
|
141
141
|
'fetchOrder': true,
|
|
142
142
|
'fetchOrderBook': true,
|
|
143
143
|
'fetchPosition': true,
|
|
144
|
+
'fetchPositionHistory': 'emulated',
|
|
144
145
|
'fetchPositionMode': false,
|
|
145
146
|
'fetchPositions': true,
|
|
147
|
+
'fetchPositionsHistory': true,
|
|
146
148
|
'fetchPremiumIndexOHLCV': false,
|
|
147
149
|
'fetchSettlementHistory': true,
|
|
148
150
|
'fetchTicker': true,
|
|
@@ -657,7 +659,6 @@ export default class gate extends Exchange {
|
|
|
657
659
|
'option': 'options',
|
|
658
660
|
'options': 'options',
|
|
659
661
|
},
|
|
660
|
-
'defaultType': 'spot',
|
|
661
662
|
'swap': {
|
|
662
663
|
'fetchMarkets': {
|
|
663
664
|
'settlementCurrencies': ['usdt', 'btc'],
|
|
@@ -5323,41 +5324,69 @@ export default class gate extends Exchange {
|
|
|
5323
5324
|
// "pending_orders": 0
|
|
5324
5325
|
// }
|
|
5325
5326
|
//
|
|
5327
|
+
// fetchPositionsHistory (swap and future)
|
|
5328
|
+
//
|
|
5329
|
+
// {
|
|
5330
|
+
// "contract": "SLERF_USDT", // Futures contract
|
|
5331
|
+
// "text": "web", // Text of close order
|
|
5332
|
+
// "long_price": "0.766306", // When 'side' is 'long,' it indicates the opening average price; when 'side' is 'short,' it indicates the closing average price.
|
|
5333
|
+
// "pnl": "-23.41702352", // PNL
|
|
5334
|
+
// "pnl_pnl": "-22.7187", // Position P/L
|
|
5335
|
+
// "pnl_fee": "-0.06527125", // Transaction Fees
|
|
5336
|
+
// "pnl_fund": "-0.63305227", // Funding Fees
|
|
5337
|
+
// "accum_size": "100",
|
|
5338
|
+
// "time": 1711279263, // Position close time
|
|
5339
|
+
// "short_price": "0.539119", // When 'side' is 'long,' it indicates the opening average price; when 'side' is 'short,' it indicates the closing average price
|
|
5340
|
+
// "side": "long", // Position side, long or short
|
|
5341
|
+
// "max_size": "100", // Max Trade Size
|
|
5342
|
+
// "first_open_time": 1711037985 // First Open Time
|
|
5343
|
+
// }
|
|
5344
|
+
//
|
|
5326
5345
|
const contract = this.safeString(position, 'contract');
|
|
5327
5346
|
market = this.safeMarket(contract, market, '_', 'contract');
|
|
5328
|
-
const size = this.
|
|
5329
|
-
let side =
|
|
5330
|
-
if (
|
|
5331
|
-
|
|
5332
|
-
|
|
5333
|
-
|
|
5334
|
-
|
|
5347
|
+
const size = this.safeString2(position, 'size', 'accum_size');
|
|
5348
|
+
let side = this.safeString(position, 'side');
|
|
5349
|
+
if (side === undefined) {
|
|
5350
|
+
if (Precise.stringGt(size, '0')) {
|
|
5351
|
+
side = 'long';
|
|
5352
|
+
}
|
|
5353
|
+
else if (Precise.stringLt(size, '0')) {
|
|
5354
|
+
side = 'short';
|
|
5355
|
+
}
|
|
5335
5356
|
}
|
|
5336
5357
|
const maintenanceRate = this.safeString(position, 'maintenance_rate');
|
|
5337
5358
|
const notional = this.safeString(position, 'value');
|
|
5338
5359
|
const leverage = this.safeString(position, 'leverage');
|
|
5339
5360
|
let marginMode = undefined;
|
|
5340
|
-
if (leverage
|
|
5341
|
-
|
|
5342
|
-
|
|
5343
|
-
|
|
5344
|
-
|
|
5361
|
+
if (leverage !== undefined) {
|
|
5362
|
+
if (leverage === '0') {
|
|
5363
|
+
marginMode = 'cross';
|
|
5364
|
+
}
|
|
5365
|
+
else {
|
|
5366
|
+
marginMode = 'isolated';
|
|
5367
|
+
}
|
|
5345
5368
|
}
|
|
5346
|
-
const unrealisedPnl = this.safeString(position, 'unrealised_pnl');
|
|
5347
5369
|
// Initial Position Margin = ( Position Value / Leverage ) + Close Position Fee
|
|
5348
5370
|
// *The default leverage under the full position is the highest leverage in the market.
|
|
5349
5371
|
// *Trading fee is charged as Taker Fee Rate (0.075%).
|
|
5350
|
-
|
|
5351
|
-
|
|
5352
|
-
|
|
5353
|
-
|
|
5372
|
+
let feePaid = this.safeString(position, 'pnl_fee');
|
|
5373
|
+
let initialMarginString = undefined;
|
|
5374
|
+
if (feePaid === undefined) {
|
|
5375
|
+
const takerFee = '0.00075';
|
|
5376
|
+
feePaid = Precise.stringMul(takerFee, notional);
|
|
5377
|
+
initialMarginString = Precise.stringAdd(Precise.stringDiv(notional, leverage), feePaid);
|
|
5378
|
+
}
|
|
5379
|
+
let timestamp = this.safeTimestamp2(position, 'open_time', 'first_open_time');
|
|
5380
|
+
if (timestamp === 0) {
|
|
5381
|
+
timestamp = undefined;
|
|
5382
|
+
}
|
|
5354
5383
|
return this.safePosition({
|
|
5355
5384
|
'info': position,
|
|
5356
5385
|
'id': undefined,
|
|
5357
5386
|
'symbol': this.safeString(market, 'symbol'),
|
|
5358
5387
|
'timestamp': timestamp,
|
|
5359
5388
|
'datetime': this.iso8601(timestamp),
|
|
5360
|
-
'lastUpdateTimestamp': this.
|
|
5389
|
+
'lastUpdateTimestamp': this.safeTimestamp2(position, 'update_time', 'time'),
|
|
5361
5390
|
'initialMargin': this.parseNumber(initialMarginString),
|
|
5362
5391
|
'initialMarginPercentage': this.parseNumber(Precise.stringDiv(initialMarginString, notional)),
|
|
5363
5392
|
'maintenanceMargin': this.parseNumber(Precise.stringMul(maintenanceRate, notional)),
|
|
@@ -5365,11 +5394,10 @@ export default class gate extends Exchange {
|
|
|
5365
5394
|
'entryPrice': this.safeNumber(position, 'entry_price'),
|
|
5366
5395
|
'notional': this.parseNumber(notional),
|
|
5367
5396
|
'leverage': this.safeNumber(position, 'leverage'),
|
|
5368
|
-
'unrealizedPnl': this.
|
|
5369
|
-
'realizedPnl': this.
|
|
5397
|
+
'unrealizedPnl': this.safeNumber(position, 'unrealised_pnl'),
|
|
5398
|
+
'realizedPnl': this.safeNumber2(position, 'realised_pnl', 'pnl'),
|
|
5370
5399
|
'contracts': this.parseNumber(Precise.stringAbs(size)),
|
|
5371
5400
|
'contractSize': this.safeNumber(market, 'contractSize'),
|
|
5372
|
-
// 'realisedPnl': position['realised_pnl'],
|
|
5373
5401
|
'marginRatio': undefined,
|
|
5374
5402
|
'liquidationPrice': this.safeNumber(position, 'liq_price'),
|
|
5375
5403
|
'markPrice': this.safeNumber(position, 'mark_price'),
|
|
@@ -7390,6 +7418,80 @@ export default class gate extends Exchange {
|
|
|
7390
7418
|
'quoteVolume': undefined,
|
|
7391
7419
|
};
|
|
7392
7420
|
}
|
|
7421
|
+
async fetchPositionsHistory(symbols = undefined, since = undefined, limit = undefined, params = {}) {
|
|
7422
|
+
/**
|
|
7423
|
+
* @method
|
|
7424
|
+
* @name gate#fetchPositionsHistory
|
|
7425
|
+
* @description fetches historical positions
|
|
7426
|
+
* @see https://www.gate.io/docs/developers/apiv4/#list-position-close-history
|
|
7427
|
+
* @see https://www.gate.io/docs/developers/apiv4/#list-position-close-history-2
|
|
7428
|
+
* @param {string[]} symbols unified conract symbols, must all have the same settle currency and the same market type
|
|
7429
|
+
* @param {int} [since] the earliest time in ms to fetch positions for
|
|
7430
|
+
* @param {int} [limit] the maximum amount of records to fetch, default=1000
|
|
7431
|
+
* @param {object} params extra parameters specific to the exchange api endpoint
|
|
7432
|
+
* @param {int} [params.until] the latest time in ms to fetch positions for
|
|
7433
|
+
*
|
|
7434
|
+
* EXCHANGE SPECIFIC PARAMETERS
|
|
7435
|
+
* @param {int} offset list offset, starting from 0
|
|
7436
|
+
* @param {string} side long or short
|
|
7437
|
+
* @param {string} pnl query profit or loss
|
|
7438
|
+
* @returns {object[]} a list of [position structures]{@link https://docs.ccxt.com/#/?id=position-structure}
|
|
7439
|
+
*/
|
|
7440
|
+
await this.loadMarkets();
|
|
7441
|
+
let market = undefined;
|
|
7442
|
+
if (symbols !== undefined) {
|
|
7443
|
+
const symbolsLength = symbols.length;
|
|
7444
|
+
if (symbolsLength === 1) {
|
|
7445
|
+
market = this.market(symbols[0]);
|
|
7446
|
+
}
|
|
7447
|
+
}
|
|
7448
|
+
let marketType = undefined;
|
|
7449
|
+
[marketType, params] = this.handleMarketTypeAndParams('fetchPositionsHistory', market, params, 'swap');
|
|
7450
|
+
const until = this.safeInteger(params, 'until');
|
|
7451
|
+
params = this.omit(params, 'until');
|
|
7452
|
+
let request = {};
|
|
7453
|
+
[request, params] = this.prepareRequest(market, marketType, params);
|
|
7454
|
+
if (limit !== undefined) {
|
|
7455
|
+
request['limit'] = limit;
|
|
7456
|
+
}
|
|
7457
|
+
if (since !== undefined) {
|
|
7458
|
+
request['from'] = this.parseToInt(since / 1000);
|
|
7459
|
+
}
|
|
7460
|
+
if (until !== undefined) {
|
|
7461
|
+
request['to'] = this.parseToInt(until / 1000);
|
|
7462
|
+
}
|
|
7463
|
+
let response = undefined;
|
|
7464
|
+
if (marketType === 'swap') {
|
|
7465
|
+
response = await this.privateFuturesGetSettlePositionClose(this.extend(request, params));
|
|
7466
|
+
}
|
|
7467
|
+
else if (marketType === 'future') {
|
|
7468
|
+
response = await this.privateDeliveryGetSettlePositionClose(this.extend(request, params));
|
|
7469
|
+
}
|
|
7470
|
+
else {
|
|
7471
|
+
throw new NotSupported(this.id + ' fetchPositionsHistory() does not support markets of type ' + marketType);
|
|
7472
|
+
}
|
|
7473
|
+
//
|
|
7474
|
+
// [
|
|
7475
|
+
// {
|
|
7476
|
+
// "contract": "SLERF_USDT",
|
|
7477
|
+
// "text": "web",
|
|
7478
|
+
// "long_price": "0.766306",
|
|
7479
|
+
// "pnl": "-23.41702352",
|
|
7480
|
+
// "pnl_pnl": "-22.7187",
|
|
7481
|
+
// "pnl_fee": "-0.06527125",
|
|
7482
|
+
// "pnl_fund": "-0.63305227",
|
|
7483
|
+
// "accum_size": "100",
|
|
7484
|
+
// "time": 1711279263,
|
|
7485
|
+
// "short_price": "0.539119",
|
|
7486
|
+
// "side": "long",
|
|
7487
|
+
// "max_size": "100",
|
|
7488
|
+
// "first_open_time": 1711037985
|
|
7489
|
+
// },
|
|
7490
|
+
// ...
|
|
7491
|
+
// ]
|
|
7492
|
+
//
|
|
7493
|
+
return this.parsePositions(response, symbols, params);
|
|
7494
|
+
}
|
|
7393
7495
|
handleErrors(code, reason, url, method, headers, body, response, requestHeaders, requestBody) {
|
|
7394
7496
|
if (response === undefined) {
|
|
7395
7497
|
return undefined;
|
package/js/src/gemini.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ export default class gemini extends Exchange {
|
|
|
32
32
|
createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
|
|
33
33
|
cancelOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
|
|
34
34
|
fetchMyTrades(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
35
|
-
withdraw(code: string, amount: number, address:
|
|
35
|
+
withdraw(code: string, amount: number, address: string, tag?: any, params?: {}): Promise<Transaction>;
|
|
36
36
|
nonce(): number;
|
|
37
37
|
fetchDepositsWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
|
|
38
38
|
parseTransaction(transaction: any, currency?: Currency): Transaction;
|
package/js/src/hitbtc.d.ts
CHANGED
|
@@ -76,7 +76,7 @@ export default class hitbtc extends Exchange {
|
|
|
76
76
|
convertCurrencyNetwork(code: string, amount: any, fromNetwork: any, toNetwork: any, params: any): Promise<{
|
|
77
77
|
info: any;
|
|
78
78
|
}>;
|
|
79
|
-
withdraw(code: string, amount: number, address:
|
|
79
|
+
withdraw(code: string, amount: number, address: string, tag?: any, params?: {}): Promise<Transaction>;
|
|
80
80
|
fetchFundingRates(symbols?: Strings, params?: {}): Promise<any>;
|
|
81
81
|
fetchFundingRateHistory(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<FundingRateHistory[]>;
|
|
82
82
|
fetchPositions(symbols?: Strings, params?: {}): Promise<Position[]>;
|
|
@@ -124,8 +124,8 @@ export default class hitbtc extends Exchange {
|
|
|
124
124
|
};
|
|
125
125
|
modifyMarginHelper(symbol: string, amount: any, type: any, params?: {}): Promise<MarginModification>;
|
|
126
126
|
parseMarginModification(data: any, market?: Market): MarginModification;
|
|
127
|
-
reduceMargin(symbol: string, amount:
|
|
128
|
-
addMargin(symbol: string, amount:
|
|
127
|
+
reduceMargin(symbol: string, amount: number, params?: {}): Promise<MarginModification>;
|
|
128
|
+
addMargin(symbol: string, amount: number, params?: {}): Promise<MarginModification>;
|
|
129
129
|
fetchLeverage(symbol: string, params?: {}): Promise<Leverage>;
|
|
130
130
|
parseLeverage(leverage: any, market?: any): Leverage;
|
|
131
131
|
setLeverage(leverage: Int, symbol?: Str, params?: {}): Promise<any>;
|
package/js/src/hitbtc.js
CHANGED
|
@@ -3244,8 +3244,9 @@ export default class hitbtc extends Exchange {
|
|
|
3244
3244
|
throw new ArgumentsRequired(this.id + ' modifyMarginHelper() requires a leverage parameter for swap markets');
|
|
3245
3245
|
}
|
|
3246
3246
|
}
|
|
3247
|
-
|
|
3248
|
-
|
|
3247
|
+
const stringAmount = this.numberToString(amount);
|
|
3248
|
+
if (stringAmount !== '0') {
|
|
3249
|
+
amount = this.amountToPrecision(symbol, stringAmount);
|
|
3249
3250
|
}
|
|
3250
3251
|
else {
|
|
3251
3252
|
amount = '0';
|
|
@@ -3347,7 +3348,7 @@ export default class hitbtc extends Exchange {
|
|
|
3347
3348
|
* @param {bool} [params.margin] true for reducing spot-margin
|
|
3348
3349
|
* @returns {object} a [margin structure]{@link https://docs.ccxt.com/#/?id=reduce-margin-structure}
|
|
3349
3350
|
*/
|
|
3350
|
-
if (amount !== 0) {
|
|
3351
|
+
if (this.numberToString(amount) !== '0') {
|
|
3351
3352
|
throw new BadRequest(this.id + ' reduceMargin() on hitbtc requires the amount to be 0 and that will remove the entire margin amount');
|
|
3352
3353
|
}
|
|
3353
3354
|
return await this.modifyMarginHelper(symbol, amount, 'reduce', params);
|
package/js/src/hollaex.d.ts
CHANGED
|
@@ -44,7 +44,7 @@ export default class hollaex extends Exchange {
|
|
|
44
44
|
fetchWithdrawal(id: string, code?: Str, params?: {}): Promise<Transaction>;
|
|
45
45
|
fetchWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
|
|
46
46
|
parseTransaction(transaction: any, currency?: Currency): Transaction;
|
|
47
|
-
withdraw(code: string, amount: number, address:
|
|
47
|
+
withdraw(code: string, amount: number, address: string, tag?: any, params?: {}): Promise<Transaction>;
|
|
48
48
|
parseDepositWithdrawFee(fee: any, currency?: Currency): {
|
|
49
49
|
info: any;
|
|
50
50
|
withdraw: {
|
package/js/src/htx.d.ts
CHANGED
|
@@ -92,6 +92,7 @@ export default class htx extends Exchange {
|
|
|
92
92
|
cancelOrder(id: string, symbol?: Str, params?: {}): Promise<any>;
|
|
93
93
|
cancelOrders(ids: any, symbol?: Str, params?: {}): Promise<any>;
|
|
94
94
|
cancelAllOrders(symbol?: Str, params?: {}): Promise<any>;
|
|
95
|
+
cancelAllOrdersAfter(timeout: Int, params?: {}): Promise<any>;
|
|
95
96
|
parseDepositAddress(depositAddress: any, currency?: Currency): {
|
|
96
97
|
currency: string;
|
|
97
98
|
address: string;
|
|
@@ -107,7 +108,7 @@ export default class htx extends Exchange {
|
|
|
107
108
|
fetchWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
|
|
108
109
|
parseTransaction(transaction: any, currency?: Currency): Transaction;
|
|
109
110
|
parseTransactionStatus(status: any): string;
|
|
110
|
-
withdraw(code: string, amount: number, address:
|
|
111
|
+
withdraw(code: string, amount: number, address: string, tag?: any, params?: {}): Promise<Transaction>;
|
|
111
112
|
parseTransfer(transfer: any, currency?: Currency): {
|
|
112
113
|
info: any;
|
|
113
114
|
id: string;
|
package/js/src/htx.js
CHANGED
|
@@ -38,6 +38,7 @@ export default class htx extends Exchange {
|
|
|
38
38
|
'borrowCrossMargin': true,
|
|
39
39
|
'borrowIsolatedMargin': true,
|
|
40
40
|
'cancelAllOrders': true,
|
|
41
|
+
'cancelAllOrdersAfter': true,
|
|
41
42
|
'cancelOrder': true,
|
|
42
43
|
'cancelOrders': true,
|
|
43
44
|
'createDepositAddress': undefined,
|
|
@@ -104,7 +105,9 @@ export default class htx extends Exchange {
|
|
|
104
105
|
'fetchOrders': true,
|
|
105
106
|
'fetchOrderTrades': true,
|
|
106
107
|
'fetchPosition': true,
|
|
108
|
+
'fetchPositionHistory': 'emulated',
|
|
107
109
|
'fetchPositions': true,
|
|
110
|
+
'fetchPositionsHistory': false,
|
|
108
111
|
'fetchPositionsRisk': false,
|
|
109
112
|
'fetchPremiumIndexOHLCV': true,
|
|
110
113
|
'fetchSettlementHistory': true,
|
|
@@ -6166,6 +6169,33 @@ export default class htx extends Exchange {
|
|
|
6166
6169
|
//
|
|
6167
6170
|
return response;
|
|
6168
6171
|
}
|
|
6172
|
+
async cancelAllOrdersAfter(timeout, params = {}) {
|
|
6173
|
+
/**
|
|
6174
|
+
* @method
|
|
6175
|
+
* @name huobi#cancelAllOrdersAfter
|
|
6176
|
+
* @description dead man's switch, cancel all orders after the given timeout
|
|
6177
|
+
* @see https://huobiapi.github.io/docs/spot/v1/en/#dead-man-s-switch
|
|
6178
|
+
* @param {number} timeout time in milliseconds, 0 represents cancel the timer
|
|
6179
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6180
|
+
* @returns {object} the api result
|
|
6181
|
+
*/
|
|
6182
|
+
await this.loadMarkets();
|
|
6183
|
+
const request = {
|
|
6184
|
+
'timeout': (timeout > 0) ? this.parseToInt(timeout / 1000) : 0,
|
|
6185
|
+
};
|
|
6186
|
+
const response = await this.v2PrivatePostAlgoOrdersCancelAllAfter(this.extend(request, params));
|
|
6187
|
+
//
|
|
6188
|
+
// {
|
|
6189
|
+
// "code": 200,
|
|
6190
|
+
// "message": "success",
|
|
6191
|
+
// "data": {
|
|
6192
|
+
// "currentTime": 1630491627230,
|
|
6193
|
+
// "triggerTime": 1630491637230
|
|
6194
|
+
// }
|
|
6195
|
+
// }
|
|
6196
|
+
//
|
|
6197
|
+
return response;
|
|
6198
|
+
}
|
|
6169
6199
|
parseDepositAddress(depositAddress, currency = undefined) {
|
|
6170
6200
|
//
|
|
6171
6201
|
// {
|
package/js/src/huobijp.d.ts
CHANGED
|
@@ -69,7 +69,7 @@ export default class huobijp extends Exchange {
|
|
|
69
69
|
fetchWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
|
|
70
70
|
parseTransaction(transaction: any, currency?: Currency): Transaction;
|
|
71
71
|
parseTransactionStatus(status: any): string;
|
|
72
|
-
withdraw(code: string, amount: number, address:
|
|
72
|
+
withdraw(code: string, amount: number, address: string, tag?: any, params?: {}): Promise<Transaction>;
|
|
73
73
|
sign(path: any, api?: string, method?: string, params?: {}, headers?: any, body?: any): {
|
|
74
74
|
url: string;
|
|
75
75
|
method: string;
|
package/js/src/hyperliquid.d.ts
CHANGED
|
@@ -56,6 +56,7 @@ export default class hyperliquid extends Exchange {
|
|
|
56
56
|
cancelOrder(id: string, symbol?: Str, params?: {}): Promise<any>;
|
|
57
57
|
cancelOrders(ids: string[], symbol?: Str, params?: {}): Promise<any>;
|
|
58
58
|
cancelOrdersForSymbols(orders: CancellationRequest[], params?: {}): Promise<any>;
|
|
59
|
+
cancelAllOrdersAfter(timeout: Int, params?: {}): Promise<any>;
|
|
59
60
|
editOrder(id: string, symbol: string, type: string, side: string, amount?: Num, price?: Num, params?: {}): Promise<Order>;
|
|
60
61
|
fetchFundingRateHistory(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<FundingRateHistory[]>;
|
|
61
62
|
fetchOpenOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
@@ -71,8 +72,8 @@ export default class hyperliquid extends Exchange {
|
|
|
71
72
|
parsePosition(position: any, market?: Market): Position;
|
|
72
73
|
setMarginMode(marginMode: string, symbol?: Str, params?: {}): Promise<any>;
|
|
73
74
|
setLeverage(leverage: Int, symbol?: Str, params?: {}): Promise<any>;
|
|
74
|
-
addMargin(symbol: string, amount:
|
|
75
|
-
reduceMargin(symbol: string, amount:
|
|
75
|
+
addMargin(symbol: string, amount: number, params?: {}): Promise<MarginModification>;
|
|
76
|
+
reduceMargin(symbol: string, amount: number, params?: {}): Promise<MarginModification>;
|
|
76
77
|
modifyMarginHelper(symbol: string, amount: any, type: any, params?: {}): Promise<MarginModification>;
|
|
77
78
|
parseMarginModification(data: any, market?: Market): MarginModification;
|
|
78
79
|
transfer(code: string, amount: number, fromAccount: string, toAccount: string, params?: {}): Promise<TransferEntry>;
|
package/js/src/hyperliquid.js
CHANGED
|
@@ -38,6 +38,7 @@ export default class hyperliquid extends Exchange {
|
|
|
38
38
|
'borrowCrossMargin': false,
|
|
39
39
|
'borrowIsolatedMargin': false,
|
|
40
40
|
'cancelAllOrders': false,
|
|
41
|
+
'cancelAllOrdersAfter': true,
|
|
41
42
|
'cancelOrder': true,
|
|
42
43
|
'cancelOrders': true,
|
|
43
44
|
'cancelOrdersForSymbols': true,
|
|
@@ -1364,6 +1365,45 @@ export default class hyperliquid extends Exchange {
|
|
|
1364
1365
|
//
|
|
1365
1366
|
return response;
|
|
1366
1367
|
}
|
|
1368
|
+
async cancelAllOrdersAfter(timeout, params = {}) {
|
|
1369
|
+
/**
|
|
1370
|
+
* @method
|
|
1371
|
+
* @name hyperliquid#cancelAllOrdersAfter
|
|
1372
|
+
* @description dead man's switch, cancel all orders after the given timeout
|
|
1373
|
+
* @param {number} timeout time in milliseconds, 0 represents cancel the timer
|
|
1374
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
1375
|
+
* @param {string} [params.vaultAddress] the vault address
|
|
1376
|
+
* @returns {object} the api result
|
|
1377
|
+
*/
|
|
1378
|
+
this.checkRequiredCredentials();
|
|
1379
|
+
await this.loadMarkets();
|
|
1380
|
+
params = this.omit(params, ['clientOrderId', 'client_id']);
|
|
1381
|
+
const nonce = this.milliseconds();
|
|
1382
|
+
const request = {
|
|
1383
|
+
'nonce': nonce,
|
|
1384
|
+
// 'vaultAddress': vaultAddress,
|
|
1385
|
+
};
|
|
1386
|
+
const cancelAction = {
|
|
1387
|
+
'type': 'scheduleCancel',
|
|
1388
|
+
'time': nonce + timeout,
|
|
1389
|
+
};
|
|
1390
|
+
const vaultAddress = this.formatVaultAddress(this.safeString(params, 'vaultAddress'));
|
|
1391
|
+
const signature = this.signL1Action(cancelAction, nonce, vaultAddress);
|
|
1392
|
+
request['action'] = cancelAction;
|
|
1393
|
+
request['signature'] = signature;
|
|
1394
|
+
if (vaultAddress !== undefined) {
|
|
1395
|
+
params = this.omit(params, 'vaultAddress');
|
|
1396
|
+
request['vaultAddress'] = vaultAddress;
|
|
1397
|
+
}
|
|
1398
|
+
const response = await this.privatePostExchange(this.extend(request, params));
|
|
1399
|
+
//
|
|
1400
|
+
// {
|
|
1401
|
+
// "status":"err",
|
|
1402
|
+
// "response":"Cannot set scheduled cancel time until enough volume traded. Required: $1000000. Traded: $373.47205."
|
|
1403
|
+
// }
|
|
1404
|
+
//
|
|
1405
|
+
return response;
|
|
1406
|
+
}
|
|
1367
1407
|
async editOrder(id, symbol, type, side, amount = undefined, price = undefined, params = {}) {
|
|
1368
1408
|
/**
|
|
1369
1409
|
* @method
|
package/js/src/idex.d.ts
CHANGED
|
@@ -30,7 +30,7 @@ export default class idex extends Exchange {
|
|
|
30
30
|
parseOrder(order: any, market?: Market): Order;
|
|
31
31
|
associateWallet(walletAddress: any, params?: {}): Promise<any>;
|
|
32
32
|
createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: Num, params?: {}): Promise<Order>;
|
|
33
|
-
withdraw(code: string, amount: number, address:
|
|
33
|
+
withdraw(code: string, amount: number, address: string, tag?: any, params?: {}): Promise<Transaction>;
|
|
34
34
|
cancelAllOrders(symbol?: Str, params?: {}): Promise<Order[]>;
|
|
35
35
|
cancelOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
|
|
36
36
|
handleErrors(code: any, reason: any, url: any, method: any, headers: any, body: any, response: any, requestHeaders: any, requestBody: any): any;
|
package/js/src/idex.js
CHANGED
|
@@ -80,8 +80,11 @@ export default class idex extends Exchange {
|
|
|
80
80
|
'fetchOrderBook': true,
|
|
81
81
|
'fetchOrders': false,
|
|
82
82
|
'fetchPosition': false,
|
|
83
|
+
'fetchPositionHistory': false,
|
|
83
84
|
'fetchPositionMode': false,
|
|
84
85
|
'fetchPositions': false,
|
|
86
|
+
'fetchPositionsForSymbol': false,
|
|
87
|
+
'fetchPositionsHistory': false,
|
|
85
88
|
'fetchPositionsRisk': false,
|
|
86
89
|
'fetchPremiumIndexOHLCV': false,
|
|
87
90
|
'fetchStatus': true,
|
|
@@ -65,8 +65,11 @@ export default class independentreserve extends Exchange {
|
|
|
65
65
|
'fetchOrder': true,
|
|
66
66
|
'fetchOrderBook': true,
|
|
67
67
|
'fetchPosition': false,
|
|
68
|
+
'fetchPositionHistory': false,
|
|
68
69
|
'fetchPositionMode': false,
|
|
69
70
|
'fetchPositions': false,
|
|
71
|
+
'fetchPositionsForSymbol': false,
|
|
72
|
+
'fetchPositionsHistory': false,
|
|
70
73
|
'fetchPositionsRisk': false,
|
|
71
74
|
'fetchPremiumIndexOHLCV': false,
|
|
72
75
|
'fetchTicker': true,
|
package/js/src/indodax.d.ts
CHANGED
|
@@ -32,7 +32,7 @@ export default class indodax extends Exchange {
|
|
|
32
32
|
currency: string;
|
|
33
33
|
}>;
|
|
34
34
|
fetchDepositsWithdrawals(code?: Str, since?: Int, limit?: Int, params?: {}): Promise<Transaction[]>;
|
|
35
|
-
withdraw(code: string, amount: number, address:
|
|
35
|
+
withdraw(code: string, amount: number, address: string, tag?: any, params?: {}): Promise<Transaction>;
|
|
36
36
|
parseTransaction(transaction: any, currency?: Currency): Transaction;
|
|
37
37
|
parseTransactionStatus(status: any): string;
|
|
38
38
|
fetchDepositAddresses(codes?: string[], params?: {}): Promise<{
|
package/js/src/indodax.js
CHANGED
|
@@ -72,8 +72,11 @@ export default class indodax extends Exchange {
|
|
|
72
72
|
'fetchOrderBook': true,
|
|
73
73
|
'fetchOrders': false,
|
|
74
74
|
'fetchPosition': false,
|
|
75
|
+
'fetchPositionHistory': false,
|
|
75
76
|
'fetchPositionMode': false,
|
|
76
77
|
'fetchPositions': false,
|
|
78
|
+
'fetchPositionsForSymbol': false,
|
|
79
|
+
'fetchPositionsHistory': false,
|
|
77
80
|
'fetchPositionsRisk': false,
|
|
78
81
|
'fetchPremiumIndexOHLCV': false,
|
|
79
82
|
'fetchTicker': true,
|
package/js/src/kraken.d.ts
CHANGED
|
@@ -71,6 +71,7 @@ export default class kraken extends Exchange {
|
|
|
71
71
|
cancelOrder(id: string, symbol?: Str, params?: {}): Promise<any>;
|
|
72
72
|
cancelOrders(ids: any, symbol?: Str, params?: {}): Promise<any>;
|
|
73
73
|
cancelAllOrders(symbol?: Str, params?: {}): Promise<any>;
|
|
74
|
+
cancelAllOrdersAfter(timeout: Int, params?: {}): Promise<any>;
|
|
74
75
|
fetchOpenOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
75
76
|
fetchClosedOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
76
77
|
parseTransactionStatus(status: any): string;
|
|
@@ -103,7 +104,7 @@ export default class kraken extends Exchange {
|
|
|
103
104
|
network: any;
|
|
104
105
|
info: any;
|
|
105
106
|
};
|
|
106
|
-
withdraw(code: string, amount: number, address:
|
|
107
|
+
withdraw(code: string, amount: number, address: string, tag?: any, params?: {}): Promise<Transaction>;
|
|
107
108
|
fetchPositions(symbols?: Strings, params?: {}): Promise<import("./base/types.js").Position[]>;
|
|
108
109
|
parsePosition(position: any, market?: Market): import("./base/types.js").Position;
|
|
109
110
|
parseAccountType(account: any): string;
|
package/js/src/kraken.js
CHANGED
|
@@ -39,6 +39,7 @@ export default class kraken extends Exchange {
|
|
|
39
39
|
'option': false,
|
|
40
40
|
'addMargin': false,
|
|
41
41
|
'cancelAllOrders': true,
|
|
42
|
+
'cancelAllOrdersAfter': true,
|
|
42
43
|
'cancelOrder': true,
|
|
43
44
|
'cancelOrders': true,
|
|
44
45
|
'createDepositAddress': true,
|
|
@@ -2139,6 +2140,35 @@ export default class kraken extends Exchange {
|
|
|
2139
2140
|
await this.loadMarkets();
|
|
2140
2141
|
return await this.privatePostCancelAll(params);
|
|
2141
2142
|
}
|
|
2143
|
+
async cancelAllOrdersAfter(timeout, params = {}) {
|
|
2144
|
+
/**
|
|
2145
|
+
* @method
|
|
2146
|
+
* @name kraken#cancelAllOrdersAfter
|
|
2147
|
+
* @description dead man's switch, cancel all orders after the given timeout
|
|
2148
|
+
* @see https://docs.kraken.com/rest/#tag/Spot-Trading/operation/cancelAllOrdersAfter
|
|
2149
|
+
* @param {number} timeout time in milliseconds, 0 represents cancel the timer
|
|
2150
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
2151
|
+
* @returns {object} the api result
|
|
2152
|
+
*/
|
|
2153
|
+
if (timeout > 86400000) {
|
|
2154
|
+
throw new BadRequest(this.id + 'cancelAllOrdersAfter timeout should be less than 86400000 milliseconds');
|
|
2155
|
+
}
|
|
2156
|
+
await this.loadMarkets();
|
|
2157
|
+
const request = {
|
|
2158
|
+
'timeout': (timeout > 0) ? (this.parseToInt(timeout / 1000)) : 0,
|
|
2159
|
+
};
|
|
2160
|
+
const response = await this.privatePostCancelAllOrdersAfter(this.extend(request, params));
|
|
2161
|
+
//
|
|
2162
|
+
// {
|
|
2163
|
+
// "error": [ ],
|
|
2164
|
+
// "result": {
|
|
2165
|
+
// "currentTime": "2023-03-24T17:41:56Z",
|
|
2166
|
+
// "triggerTime": "2023-03-24T17:42:56Z"
|
|
2167
|
+
// }
|
|
2168
|
+
// }
|
|
2169
|
+
//
|
|
2170
|
+
return response;
|
|
2171
|
+
}
|
|
2142
2172
|
async fetchOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
2143
2173
|
/**
|
|
2144
2174
|
* @method
|
|
@@ -21,6 +21,7 @@ export default class krakenfutures extends Exchange {
|
|
|
21
21
|
cancelOrder(id: string, symbol?: Str, params?: {}): Promise<any>;
|
|
22
22
|
cancelOrders(ids: string[], symbol?: Str, params?: {}): Promise<Order[]>;
|
|
23
23
|
cancelAllOrders(symbol?: Str, params?: {}): Promise<any>;
|
|
24
|
+
cancelAllOrdersAfter(timeout: Int, params?: {}): Promise<any>;
|
|
24
25
|
fetchOpenOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
25
26
|
fetchClosedOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
26
27
|
fetchCanceledOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|