ccxt 4.1.30 → 4.1.31
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 +186 -0
- package/README.md +3 -3
- package/dist/ccxt.browser.js +220 -81
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/ascendex.js +89 -12
- package/dist/cjs/src/base/Exchange.js +6 -0
- package/dist/cjs/src/bitget.js +43 -27
- package/dist/cjs/src/bitvavo.js +43 -7
- package/dist/cjs/src/bybit.js +0 -3
- package/dist/cjs/src/coinex.js +2 -1
- package/dist/cjs/src/gemini.js +1 -2
- package/dist/cjs/src/hitbtc.js +32 -22
- package/dist/cjs/src/mexc.js +2 -6
- package/dist/cjs/src/okx.js +1 -0
- package/js/ccxt.d.ts +3 -3
- package/js/ccxt.js +1 -1
- package/js/src/ascendex.d.ts +11 -1
- package/js/src/ascendex.js +89 -12
- package/js/src/base/Exchange.d.ts +5 -3
- package/js/src/base/Exchange.js +6 -0
- package/js/src/base/types.d.ts +9 -0
- package/js/src/binance.d.ts +1 -1
- package/js/src/bitget.d.ts +3 -3
- package/js/src/bitget.js +43 -27
- package/js/src/bitvavo.d.ts +13 -13
- package/js/src/bitvavo.js +43 -7
- package/js/src/bybit.js +0 -3
- package/js/src/coinex.d.ts +2 -2
- package/js/src/coinex.js +2 -1
- package/js/src/gate.d.ts +3 -3
- package/js/src/gemini.js +1 -2
- package/js/src/hitbtc.js +33 -23
- package/js/src/huobi.d.ts +1 -1
- package/js/src/kucoinfutures.d.ts +2 -2
- package/js/src/mexc.d.ts +2 -2
- package/js/src/mexc.js +2 -6
- package/js/src/okx.d.ts +2 -2
- package/js/src/okx.js +1 -0
- package/js/src/phemex.d.ts +2 -2
- package/js/src/poloniexfutures.d.ts +2 -2
- package/js/src/woo.d.ts +1 -1
- package/package.json +2 -2
package/js/src/bitvavo.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Exchange from './abstract/bitvavo.js';
|
|
2
|
-
import { Int, OrderSide, OrderType } from './base/types.js';
|
|
2
|
+
import { Int, OHLCV, Order, OrderSide, OrderType, Trade } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class bitvavo
|
|
5
5
|
* @extends Exchange
|
|
@@ -15,12 +15,12 @@ export default class bitvavo extends Exchange {
|
|
|
15
15
|
fetchTicker(symbol: string, params?: {}): Promise<import("./base/types.js").Ticker>;
|
|
16
16
|
parseTicker(ticker: any, market?: any): import("./base/types.js").Ticker;
|
|
17
17
|
fetchTickers(symbols?: string[], params?: {}): Promise<import("./base/types.js").Dictionary<import("./base/types.js").Ticker>>;
|
|
18
|
-
fetchTrades(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<
|
|
19
|
-
parseTrade(trade: any, market?: any):
|
|
18
|
+
fetchTrades(symbol: string, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
19
|
+
parseTrade(trade: any, market?: any): Trade;
|
|
20
20
|
fetchTradingFees(params?: {}): Promise<{}>;
|
|
21
21
|
fetchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<import("./base/types.js").OrderBook>;
|
|
22
22
|
parseOHLCV(ohlcv: any, market?: any): number[];
|
|
23
|
-
fetchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<
|
|
23
|
+
fetchOHLCV(symbol: string, timeframe?: string, since?: Int, limit?: Int, params?: {}): Promise<OHLCV[]>;
|
|
24
24
|
parseBalance(response: any): import("./base/types.js").Balances;
|
|
25
25
|
fetchBalance(params?: {}): Promise<import("./base/types.js").Balances>;
|
|
26
26
|
fetchDepositAddress(code: string, params?: {}): Promise<{
|
|
@@ -30,16 +30,16 @@ export default class bitvavo extends Exchange {
|
|
|
30
30
|
network: any;
|
|
31
31
|
info: any;
|
|
32
32
|
}>;
|
|
33
|
-
createOrder(symbol: string, type: OrderType, side: OrderSide, amount: any, price?: any, params?: {}): Promise<
|
|
34
|
-
editOrder(id: string, symbol: any, type: any, side: any, amount?: any, price?: any, params?: {}): Promise<
|
|
35
|
-
cancelOrder(id: string, symbol?: string, params?: {}): Promise<
|
|
36
|
-
cancelAllOrders(symbol?: string, params?: {}): Promise<
|
|
37
|
-
fetchOrder(id: string, symbol?: string, params?: {}): Promise<
|
|
38
|
-
fetchOrders(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<
|
|
39
|
-
fetchOpenOrders(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<
|
|
33
|
+
createOrder(symbol: string, type: OrderType, side: OrderSide, amount: any, price?: any, params?: {}): Promise<Order>;
|
|
34
|
+
editOrder(id: string, symbol: any, type: any, side: any, amount?: any, price?: any, params?: {}): Promise<Order>;
|
|
35
|
+
cancelOrder(id: string, symbol?: string, params?: {}): Promise<Order>;
|
|
36
|
+
cancelAllOrders(symbol?: string, params?: {}): Promise<Order[]>;
|
|
37
|
+
fetchOrder(id: string, symbol?: string, params?: {}): Promise<Order>;
|
|
38
|
+
fetchOrders(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
39
|
+
fetchOpenOrders(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
40
40
|
parseOrderStatus(status: any): string;
|
|
41
|
-
parseOrder(order: any, market?: any):
|
|
42
|
-
fetchMyTrades(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<
|
|
41
|
+
parseOrder(order: any, market?: any): Order;
|
|
42
|
+
fetchMyTrades(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<Trade[]>;
|
|
43
43
|
withdraw(code: string, amount: any, address: any, tag?: any, params?: {}): Promise<{
|
|
44
44
|
info: any;
|
|
45
45
|
id: any;
|
package/js/src/bitvavo.js
CHANGED
|
@@ -504,6 +504,7 @@ export default class bitvavo extends Exchange {
|
|
|
504
504
|
/**
|
|
505
505
|
* @method
|
|
506
506
|
* @name bitvavo#fetchTicker
|
|
507
|
+
* @see https://docs.bitvavo.com/#tag/Market-Data/paths/~1ticker~124h/get
|
|
507
508
|
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
508
509
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
509
510
|
* @param {object} [params] extra parameters specific to the bitvavo api endpoint
|
|
@@ -617,16 +618,24 @@ export default class bitvavo extends Exchange {
|
|
|
617
618
|
/**
|
|
618
619
|
* @method
|
|
619
620
|
* @name bitvavo#fetchTrades
|
|
621
|
+
* @see https://docs.bitvavo.com/#tag/Market-Data/paths/~1{market}~1trades/get
|
|
620
622
|
* @description get the list of most recent trades for a particular symbol
|
|
621
623
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
622
624
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
623
625
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
624
626
|
* @param {object} [params] extra parameters specific to the bitvavo api endpoint
|
|
627
|
+
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
628
|
+
* @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)
|
|
625
629
|
* @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#public-trades}
|
|
626
630
|
*/
|
|
627
631
|
await this.loadMarkets();
|
|
628
632
|
const market = this.market(symbol);
|
|
629
|
-
|
|
633
|
+
let paginate = false;
|
|
634
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchTrades', 'paginate');
|
|
635
|
+
if (paginate) {
|
|
636
|
+
return await this.fetchPaginatedCallDynamic('fetchTrades', symbol, since, limit, params);
|
|
637
|
+
}
|
|
638
|
+
let request = {
|
|
630
639
|
'market': market['id'],
|
|
631
640
|
// 'limit': 500, // default 500, max 1000
|
|
632
641
|
// 'start': since,
|
|
@@ -640,6 +649,7 @@ export default class bitvavo extends Exchange {
|
|
|
640
649
|
if (since !== undefined) {
|
|
641
650
|
request['start'] = since;
|
|
642
651
|
}
|
|
652
|
+
[request, params] = this.handleUntilOption('end', request, params);
|
|
643
653
|
const response = await this.publicGetMarketTrades(this.extend(request, params));
|
|
644
654
|
//
|
|
645
655
|
// [
|
|
@@ -790,6 +800,7 @@ export default class bitvavo extends Exchange {
|
|
|
790
800
|
/**
|
|
791
801
|
* @method
|
|
792
802
|
* @name bitvavo#fetchOrderBook
|
|
803
|
+
* @see https://docs.bitvavo.com/#tag/Market-Data/paths/~1{market}~1book/get
|
|
793
804
|
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
794
805
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
795
806
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
@@ -849,17 +860,25 @@ export default class bitvavo extends Exchange {
|
|
|
849
860
|
/**
|
|
850
861
|
* @method
|
|
851
862
|
* @name bitvavo#fetchOHLCV
|
|
863
|
+
* @see https://docs.bitvavo.com/#tag/Market-Data/paths/~1{market}~1candles/get
|
|
852
864
|
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
853
865
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
854
866
|
* @param {string} timeframe the length of time each candle represents
|
|
855
867
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
856
868
|
* @param {int} [limit] the maximum amount of candles to fetch
|
|
857
869
|
* @param {object} [params] extra parameters specific to the bitvavo api endpoint
|
|
870
|
+
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
871
|
+
* @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)
|
|
858
872
|
* @returns {int[][]} A list of candles ordered as timestamp, open, high, low, close, volume
|
|
859
873
|
*/
|
|
860
874
|
await this.loadMarkets();
|
|
861
875
|
const market = this.market(symbol);
|
|
862
|
-
|
|
876
|
+
let paginate = false;
|
|
877
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchOHLCV', 'paginate');
|
|
878
|
+
if (paginate) {
|
|
879
|
+
return await this.fetchPaginatedCallDeterministic('fetchOHLCV', symbol, since, limit, timeframe, params, 1440);
|
|
880
|
+
}
|
|
881
|
+
let request = {
|
|
863
882
|
'market': market['id'],
|
|
864
883
|
'interval': this.safeString(this.timeframes, timeframe, timeframe),
|
|
865
884
|
// 'limit': 1440, // default 1440, max 1440
|
|
@@ -875,6 +894,7 @@ export default class bitvavo extends Exchange {
|
|
|
875
894
|
}
|
|
876
895
|
request['end'] = this.sum(since, limit * duration * 1000);
|
|
877
896
|
}
|
|
897
|
+
[request, params] = this.handleUntilOption('end', request, params);
|
|
878
898
|
if (limit !== undefined) {
|
|
879
899
|
request['limit'] = limit; // default 1440, max 1440
|
|
880
900
|
}
|
|
@@ -1228,19 +1248,25 @@ export default class bitvavo extends Exchange {
|
|
|
1228
1248
|
/**
|
|
1229
1249
|
* @method
|
|
1230
1250
|
* @name bitvavo#fetchOrders
|
|
1251
|
+
* @see https://docs.bitvavo.com/#tag/Orders/paths/~1orders/get
|
|
1231
1252
|
* @description fetches information on multiple orders made by the user
|
|
1232
1253
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
1233
1254
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
1234
1255
|
* @param {int} [limit] the maximum number of orde structures to retrieve
|
|
1235
1256
|
* @param {object} [params] extra parameters specific to the bitvavo api endpoint
|
|
1257
|
+
* @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)
|
|
1258
|
+
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
1236
1259
|
* @returns {Order[]} a list of [order structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
1237
1260
|
*/
|
|
1238
|
-
|
|
1239
|
-
throw new ArgumentsRequired(this.id + ' fetchOrders() requires a symbol argument');
|
|
1240
|
-
}
|
|
1261
|
+
this.checkRequiredSymbol('fetchOrders', symbol);
|
|
1241
1262
|
await this.loadMarkets();
|
|
1263
|
+
let paginate = false;
|
|
1264
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchOrders', 'paginate');
|
|
1265
|
+
if (paginate) {
|
|
1266
|
+
return await this.fetchPaginatedCallDynamic('fetchOrders', symbol, since, limit, params);
|
|
1267
|
+
}
|
|
1242
1268
|
const market = this.market(symbol);
|
|
1243
|
-
|
|
1269
|
+
let request = {
|
|
1244
1270
|
'market': market['id'],
|
|
1245
1271
|
// 'limit': 500,
|
|
1246
1272
|
// 'start': since,
|
|
@@ -1254,6 +1280,7 @@ export default class bitvavo extends Exchange {
|
|
|
1254
1280
|
if (limit !== undefined) {
|
|
1255
1281
|
request['limit'] = limit; // default 500, max 1000
|
|
1256
1282
|
}
|
|
1283
|
+
[request, params] = this.handleUntilOption('end', request, params);
|
|
1257
1284
|
const response = await this.privateGetOrders(this.extend(request, params));
|
|
1258
1285
|
//
|
|
1259
1286
|
// [
|
|
@@ -1478,19 +1505,27 @@ export default class bitvavo extends Exchange {
|
|
|
1478
1505
|
/**
|
|
1479
1506
|
* @method
|
|
1480
1507
|
* @name bitvavo#fetchMyTrades
|
|
1508
|
+
* @see https://docs.bitvavo.com/#tag/Trades/paths/~1trades/get
|
|
1481
1509
|
* @description fetch all trades made by the user
|
|
1482
1510
|
* @param {string} symbol unified market symbol
|
|
1483
1511
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
1484
1512
|
* @param {int} [limit] the maximum number of trades structures to retrieve
|
|
1485
1513
|
* @param {object} [params] extra parameters specific to the bitvavo api endpoint
|
|
1514
|
+
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
1515
|
+
* @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)
|
|
1486
1516
|
* @returns {Trade[]} a list of [trade structures]{@link https://github.com/ccxt/ccxt/wiki/Manual#trade-structure}
|
|
1487
1517
|
*/
|
|
1488
1518
|
if (symbol === undefined) {
|
|
1489
1519
|
throw new ArgumentsRequired(this.id + ' fetchMyTrades() requires a symbol argument');
|
|
1490
1520
|
}
|
|
1491
1521
|
await this.loadMarkets();
|
|
1522
|
+
let paginate = false;
|
|
1523
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchMyTrades', 'paginate');
|
|
1524
|
+
if (paginate) {
|
|
1525
|
+
return await this.fetchPaginatedCallDynamic('fetchMyTrades', symbol, since, limit, params);
|
|
1526
|
+
}
|
|
1492
1527
|
const market = this.market(symbol);
|
|
1493
|
-
|
|
1528
|
+
let request = {
|
|
1494
1529
|
'market': market['id'],
|
|
1495
1530
|
// 'limit': 500,
|
|
1496
1531
|
// 'start': since,
|
|
@@ -1504,6 +1539,7 @@ export default class bitvavo extends Exchange {
|
|
|
1504
1539
|
if (limit !== undefined) {
|
|
1505
1540
|
request['limit'] = limit; // default 500, max 1000
|
|
1506
1541
|
}
|
|
1542
|
+
[request, params] = this.handleUntilOption('end', request, params);
|
|
1507
1543
|
const response = await this.privateGetTrades(this.extend(request, params));
|
|
1508
1544
|
//
|
|
1509
1545
|
// [
|
package/js/src/bybit.js
CHANGED
package/js/src/coinex.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Exchange from './abstract/coinex.js';
|
|
2
|
-
import { FundingRateHistory, Int, OrderSide, OrderType } from './base/types.js';
|
|
2
|
+
import { FundingHistory, FundingRateHistory, Int, OrderSide, OrderType } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class coinex
|
|
5
5
|
* @extends Exchange
|
|
@@ -94,7 +94,7 @@ export default class coinex extends Exchange {
|
|
|
94
94
|
};
|
|
95
95
|
addMargin(symbol: string, amount: any, params?: {}): Promise<any>;
|
|
96
96
|
reduceMargin(symbol: string, amount: any, params?: {}): Promise<any>;
|
|
97
|
-
fetchFundingHistory(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<
|
|
97
|
+
fetchFundingHistory(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<FundingHistory[]>;
|
|
98
98
|
fetchFundingRate(symbol: string, params?: {}): Promise<{
|
|
99
99
|
info: any;
|
|
100
100
|
symbol: any;
|
package/js/src/coinex.js
CHANGED
|
@@ -1754,7 +1754,8 @@ export default class coinex extends Exchange {
|
|
|
1754
1754
|
const remainingString = this.safeString(order, 'left');
|
|
1755
1755
|
const marketId = this.safeString(order, 'market');
|
|
1756
1756
|
const defaultType = this.safeString(this.options, 'defaultType');
|
|
1757
|
-
|
|
1757
|
+
const orderType = ('source' in order) ? 'swap' : defaultType;
|
|
1758
|
+
market = this.safeMarket(marketId, market, undefined, orderType);
|
|
1758
1759
|
const feeCurrencyId = this.safeString(order, 'fee_asset');
|
|
1759
1760
|
let feeCurrency = this.safeCurrencyCode(feeCurrencyId);
|
|
1760
1761
|
if (feeCurrency === undefined) {
|
package/js/src/gate.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Exchange from './abstract/gate.js';
|
|
2
|
-
import { Int, OrderSide, OrderType, OHLCV, Trade, FundingRateHistory, OpenInterest, Order, Balances, OrderRequest } from './base/types.js';
|
|
2
|
+
import { Int, OrderSide, OrderType, OHLCV, Trade, FundingRateHistory, OpenInterest, Order, Balances, OrderRequest, FundingHistory } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class gate
|
|
5
5
|
* @extends Exchange
|
|
@@ -192,8 +192,8 @@ export default class gate extends Exchange {
|
|
|
192
192
|
};
|
|
193
193
|
networks: {};
|
|
194
194
|
};
|
|
195
|
-
fetchFundingHistory(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<
|
|
196
|
-
parseFundingHistories(response: any, symbol: any, since: any, limit: any):
|
|
195
|
+
fetchFundingHistory(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<FundingHistory[]>;
|
|
196
|
+
parseFundingHistories(response: any, symbol: any, since: any, limit: any): FundingHistory[];
|
|
197
197
|
parseFundingHistory(info: any, market?: any): {
|
|
198
198
|
info: any;
|
|
199
199
|
symbol: string;
|
package/js/src/gemini.js
CHANGED
|
@@ -560,11 +560,10 @@ export default class gemini extends Exchange {
|
|
|
560
560
|
}
|
|
561
561
|
for (let i = 0; i < marketIds.length; i++) {
|
|
562
562
|
const marketId = marketIds[i];
|
|
563
|
-
const method = 'publicGetV1SymbolsDetailsSymbol';
|
|
564
563
|
const request = {
|
|
565
564
|
'symbol': marketId,
|
|
566
565
|
};
|
|
567
|
-
promises.push(this
|
|
566
|
+
promises.push(this.publicGetV1SymbolsDetailsSymbol(this.extend(request, params)));
|
|
568
567
|
//
|
|
569
568
|
// {
|
|
570
569
|
// "symbol": "BTCUSD",
|
package/js/src/hitbtc.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import Exchange from './abstract/hitbtc.js';
|
|
8
8
|
import { TICK_SIZE } from './base/functions/number.js';
|
|
9
9
|
import { Precise } from './base/Precise.js';
|
|
10
|
-
import { BadSymbol, BadRequest, OnMaintenance, AccountSuspended, PermissionDenied, ExchangeError, RateLimitExceeded, ExchangeNotAvailable, OrderNotFound, InsufficientFunds, InvalidOrder, AuthenticationError, ArgumentsRequired
|
|
10
|
+
import { BadSymbol, BadRequest, OnMaintenance, AccountSuspended, PermissionDenied, ExchangeError, RateLimitExceeded, ExchangeNotAvailable, OrderNotFound, InsufficientFunds, InvalidOrder, AuthenticationError, ArgumentsRequired } from './base/errors.js';
|
|
11
11
|
import { sha256 } from './static_dependencies/noble-hashes/sha256.js';
|
|
12
12
|
/**
|
|
13
13
|
* @class hitbtc
|
|
@@ -36,6 +36,7 @@ export default class hitbtc extends Exchange {
|
|
|
36
36
|
'cancelOrder': true,
|
|
37
37
|
'createDepositAddress': true,
|
|
38
38
|
'createOrder': true,
|
|
39
|
+
'createPostOnlyOrder': true,
|
|
39
40
|
'createReduceOnlyOrder': true,
|
|
40
41
|
'createStopLimitOrder': true,
|
|
41
42
|
'createStopMarketOrder': true,
|
|
@@ -2050,14 +2051,24 @@ export default class hitbtc extends Exchange {
|
|
|
2050
2051
|
* @param {float} amount how much of currency you want to trade in units of base currency
|
|
2051
2052
|
* @param {float} [price] the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
|
|
2052
2053
|
* @param {object} [params] extra parameters specific to the hitbtc api endpoint
|
|
2053
|
-
* @param {string} [params.marginMode] 'cross' or 'isolated' only 'isolated' is supported
|
|
2054
|
+
* @param {string} [params.marginMode] 'cross' or 'isolated' only 'isolated' is supported for spot-margin, swap supports both
|
|
2054
2055
|
* @param {bool} [params.margin] true for creating a margin order
|
|
2055
2056
|
* @param {float} [params.triggerPrice] The price at which a trigger order is triggered at
|
|
2057
|
+
* @param {bool} [params.postOnly] if true, the order will only be posted to the order book and not executed immediately
|
|
2058
|
+
* @param {string} [params.timeInForce] "GTC", "IOC", "FOK", "Day", "GTD"
|
|
2056
2059
|
* @returns {object} an [order structure]{@link https://github.com/ccxt/ccxt/wiki/Manual#order-structure}
|
|
2057
2060
|
*/
|
|
2058
2061
|
await this.loadMarkets();
|
|
2059
2062
|
const market = this.market(symbol);
|
|
2060
2063
|
const isLimit = (type === 'limit');
|
|
2064
|
+
const reduceOnly = this.safeValue(params, 'reduceOnly');
|
|
2065
|
+
const timeInForce = this.safeString(params, 'timeInForce');
|
|
2066
|
+
const triggerPrice = this.safeNumberN(params, ['triggerPrice', 'stopPrice', 'stop_price']);
|
|
2067
|
+
let marketType = undefined;
|
|
2068
|
+
[marketType, params] = this.handleMarketTypeAndParams('createOrder', market, params);
|
|
2069
|
+
let marginMode = undefined;
|
|
2070
|
+
[marginMode, params] = this.handleMarginModeAndParams('createOrder', params);
|
|
2071
|
+
const isPostOnly = this.isPostOnly(type === 'market', undefined, params);
|
|
2061
2072
|
const request = {
|
|
2062
2073
|
'type': type,
|
|
2063
2074
|
'side': side,
|
|
@@ -2075,7 +2086,6 @@ export default class hitbtc extends Exchange {
|
|
|
2075
2086
|
// 'take_rate': 0.001, // Optional
|
|
2076
2087
|
// 'make_rate': 0.001, // Optional
|
|
2077
2088
|
};
|
|
2078
|
-
const reduceOnly = this.safeValue(params, 'reduceOnly');
|
|
2079
2089
|
if (reduceOnly !== undefined) {
|
|
2080
2090
|
if ((market['type'] !== 'swap') && (market['type'] !== 'margin')) {
|
|
2081
2091
|
throw new InvalidOrder(this.id + ' createOrder() does not support reduce_only for ' + market['type'] + ' orders, reduce_only orders are supported for swap and margin markets only');
|
|
@@ -2084,8 +2094,12 @@ export default class hitbtc extends Exchange {
|
|
|
2084
2094
|
if (reduceOnly === true) {
|
|
2085
2095
|
request['reduce_only'] = reduceOnly;
|
|
2086
2096
|
}
|
|
2087
|
-
|
|
2088
|
-
|
|
2097
|
+
if (isPostOnly) {
|
|
2098
|
+
request['post_only'] = true;
|
|
2099
|
+
}
|
|
2100
|
+
if (timeInForce !== undefined) {
|
|
2101
|
+
request['time_in_force'] = timeInForce;
|
|
2102
|
+
}
|
|
2089
2103
|
if (isLimit || (type === 'stopLimit') || (type === 'takeProfitLimit')) {
|
|
2090
2104
|
if (price === undefined) {
|
|
2091
2105
|
throw new ExchangeError(this.id + ' createOrder() requires a price argument for limit orders');
|
|
@@ -2110,19 +2124,20 @@ export default class hitbtc extends Exchange {
|
|
|
2110
2124
|
else if ((type === 'stopLimit') || (type === 'stopMarket') || (type === 'takeProfitLimit') || (type === 'takeProfitMarket')) {
|
|
2111
2125
|
throw new ExchangeError(this.id + ' createOrder() requires a stopPrice parameter for stop-loss and take-profit orders');
|
|
2112
2126
|
}
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
if (marginMode !== undefined) {
|
|
2122
|
-
|
|
2127
|
+
params = this.omit(params, ['triggerPrice', 'timeInForce', 'stopPrice', 'stop_price', 'reduceOnly', 'postOnly']);
|
|
2128
|
+
if ((marketType === 'swap') && (marginMode !== undefined)) {
|
|
2129
|
+
request['margin_mode'] = marginMode;
|
|
2130
|
+
}
|
|
2131
|
+
let response = undefined;
|
|
2132
|
+
if (marketType === 'swap') {
|
|
2133
|
+
response = await this.privatePostFuturesOrder(this.extend(request, params));
|
|
2134
|
+
}
|
|
2135
|
+
else if ((marketType === 'margin') || (marginMode !== undefined)) {
|
|
2136
|
+
response = await this.privatePostMarginOrder(this.extend(request, params));
|
|
2137
|
+
}
|
|
2138
|
+
else {
|
|
2139
|
+
response = await this.privatePostSpotOrder(this.extend(request, params));
|
|
2123
2140
|
}
|
|
2124
|
-
params = this.omit(params, ['triggerPrice', 'timeInForce', 'time_in_force', 'stopPrice', 'stop_price', 'reduceOnly']);
|
|
2125
|
-
const response = await this[method](this.extend(request, query));
|
|
2126
2141
|
return this.parseOrder(response, market);
|
|
2127
2142
|
}
|
|
2128
2143
|
parseOrderStatus(status) {
|
|
@@ -3045,12 +3060,7 @@ export default class hitbtc extends Exchange {
|
|
|
3045
3060
|
const isMargin = this.safeValue(params, 'margin', false);
|
|
3046
3061
|
let marginMode = undefined;
|
|
3047
3062
|
[marginMode, params] = super.handleMarginModeAndParams(methodName, params, defaultValue);
|
|
3048
|
-
if (marginMode
|
|
3049
|
-
if (marginMode !== 'isolated') {
|
|
3050
|
-
throw new NotSupported(this.id + ' only isolated margin is supported');
|
|
3051
|
-
}
|
|
3052
|
-
}
|
|
3053
|
-
else {
|
|
3063
|
+
if (marginMode === undefined) {
|
|
3054
3064
|
if ((defaultType === 'margin') || (isMargin === true)) {
|
|
3055
3065
|
marginMode = 'isolated';
|
|
3056
3066
|
}
|
package/js/src/huobi.d.ts
CHANGED
|
@@ -237,7 +237,7 @@ export default class huobi extends Exchange {
|
|
|
237
237
|
headers: any;
|
|
238
238
|
};
|
|
239
239
|
handleErrors(httpCode: any, reason: any, url: any, method: any, headers: any, body: any, response: any, requestHeaders: any, requestBody: any): any;
|
|
240
|
-
fetchFundingHistory(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<
|
|
240
|
+
fetchFundingHistory(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").FundingHistory[]>;
|
|
241
241
|
setLeverage(leverage: any, symbol?: string, params?: {}): Promise<any>;
|
|
242
242
|
parseIncome(income: any, market?: any): {
|
|
243
243
|
info: any;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import kucoin from './abstract/kucoinfutures.js';
|
|
2
|
-
import { Dictionary, Int, OrderSide, Ticker, OrderType, OHLCV, Order, Trade, FundingRateHistory } from './base/types.js';
|
|
2
|
+
import { Dictionary, Int, OrderSide, Ticker, OrderType, OHLCV, Order, Trade, FundingRateHistory, FundingHistory } from './base/types.js';
|
|
3
3
|
export default class kucoinfutures extends kucoin {
|
|
4
4
|
describe(): any;
|
|
5
5
|
fetchStatus(params?: {}): Promise<{
|
|
@@ -25,7 +25,7 @@ export default class kucoinfutures extends kucoin {
|
|
|
25
25
|
fetchTicker(symbol: string, params?: {}): Promise<Ticker>;
|
|
26
26
|
fetchTickers(symbols?: string[], params?: {}): Promise<Dictionary<Ticker>>;
|
|
27
27
|
parseTicker(ticker: any, market?: any): Ticker;
|
|
28
|
-
fetchFundingHistory(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<
|
|
28
|
+
fetchFundingHistory(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<FundingHistory[]>;
|
|
29
29
|
fetchPosition(symbol: string, params?: {}): Promise<import("./base/types.js").Position>;
|
|
30
30
|
fetchPositions(symbols?: string[], params?: {}): Promise<import("./base/types.js").Position[]>;
|
|
31
31
|
parsePosition(position: any, market?: any): import("./base/types.js").Position;
|
package/js/src/mexc.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Exchange from './abstract/mexc.js';
|
|
2
|
-
import { IndexType, Int, OrderSide, Balances, OrderType, OHLCV, FundingRateHistory, Position, OrderBook, OrderRequest } from './base/types.js';
|
|
2
|
+
import { IndexType, Int, OrderSide, Balances, OrderType, OHLCV, FundingRateHistory, Position, OrderBook, OrderRequest, FundingHistory } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class mexc
|
|
5
5
|
* @extends Exchange
|
|
@@ -62,7 +62,7 @@ export default class mexc extends Exchange {
|
|
|
62
62
|
reduceMargin(symbol: string, amount: any, params?: {}): Promise<any>;
|
|
63
63
|
addMargin(symbol: string, amount: any, params?: {}): Promise<any>;
|
|
64
64
|
setLeverage(leverage: any, symbol?: string, params?: {}): Promise<any>;
|
|
65
|
-
fetchFundingHistory(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<
|
|
65
|
+
fetchFundingHistory(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<FundingHistory[]>;
|
|
66
66
|
parseFundingRate(contract: any, market?: any): {
|
|
67
67
|
info: any;
|
|
68
68
|
symbol: any;
|
package/js/src/mexc.js
CHANGED
|
@@ -30,8 +30,8 @@ export default class mexc extends Exchange {
|
|
|
30
30
|
'spot': true,
|
|
31
31
|
'margin': true,
|
|
32
32
|
'swap': true,
|
|
33
|
-
'future':
|
|
34
|
-
'option':
|
|
33
|
+
'future': false,
|
|
34
|
+
'option': false,
|
|
35
35
|
'addMargin': true,
|
|
36
36
|
'borrowMargin': true,
|
|
37
37
|
'cancelAllOrders': true,
|
|
@@ -399,10 +399,6 @@ export default class mexc extends Exchange {
|
|
|
399
399
|
'fetchMarkets': {
|
|
400
400
|
'types': {
|
|
401
401
|
'spot': true,
|
|
402
|
-
'future': {
|
|
403
|
-
'linear': false,
|
|
404
|
-
'inverse': false,
|
|
405
|
-
},
|
|
406
402
|
'swap': {
|
|
407
403
|
'linear': true,
|
|
408
404
|
'inverse': false,
|
package/js/src/okx.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Exchange from './abstract/okx.js';
|
|
2
|
-
import { Int, OrderSide, OrderType, Trade, OHLCV, Order, FundingRateHistory, OrderRequest } from './base/types.js';
|
|
2
|
+
import { Int, OrderSide, OrderType, Trade, OHLCV, Order, FundingRateHistory, OrderRequest, FundingHistory } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class okx
|
|
5
5
|
* @extends Exchange
|
|
@@ -318,7 +318,7 @@ export default class okx extends Exchange {
|
|
|
318
318
|
previousFundingTimestamp: any;
|
|
319
319
|
previousFundingDatetime: any;
|
|
320
320
|
}>;
|
|
321
|
-
fetchFundingHistory(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<
|
|
321
|
+
fetchFundingHistory(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<FundingHistory[]>;
|
|
322
322
|
setLeverage(leverage: any, symbol?: string, params?: {}): Promise<any>;
|
|
323
323
|
setPositionMode(hedged: any, symbol?: string, params?: {}): Promise<any>;
|
|
324
324
|
setMarginMode(marginMode: any, symbol?: string, params?: {}): Promise<any>;
|
package/js/src/okx.js
CHANGED
package/js/src/phemex.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Exchange from './abstract/phemex.js';
|
|
2
|
-
import { FundingRateHistory, Int, OrderBook, OrderSide, OrderType } from './base/types.js';
|
|
2
|
+
import { FundingHistory, FundingRateHistory, Int, OrderBook, OrderSide, OrderType } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class phemex
|
|
5
5
|
* @extends Exchange
|
|
@@ -185,7 +185,7 @@ export default class phemex extends Exchange {
|
|
|
185
185
|
};
|
|
186
186
|
fetchPositions(symbols?: string[], params?: {}): Promise<import("./base/types.js").Position[]>;
|
|
187
187
|
parsePosition(position: any, market?: any): import("./base/types.js").Position;
|
|
188
|
-
fetchFundingHistory(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<
|
|
188
|
+
fetchFundingHistory(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<FundingHistory[]>;
|
|
189
189
|
fetchFundingRate(symbol: string, params?: {}): Promise<{
|
|
190
190
|
info: any;
|
|
191
191
|
symbol: any;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import Exchange from './abstract/poloniexfutures.js';
|
|
2
|
-
import { Int, OrderBook, OrderSide, OrderType } from './base/types.js';
|
|
2
|
+
import { FundingHistory, Int, OrderBook, OrderSide, OrderType } from './base/types.js';
|
|
3
3
|
/**
|
|
4
4
|
* @class poloniexfutures
|
|
5
5
|
* @extends Exchange
|
|
@@ -47,7 +47,7 @@ export default class poloniexfutures extends Exchange {
|
|
|
47
47
|
stopLossPrice: any;
|
|
48
48
|
takeProfitPrice: any;
|
|
49
49
|
};
|
|
50
|
-
fetchFundingHistory(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<
|
|
50
|
+
fetchFundingHistory(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<FundingHistory[]>;
|
|
51
51
|
cancelAllOrders(symbol?: string, params?: {}): Promise<any[]>;
|
|
52
52
|
fetchOrdersByStatus(status: any, symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").Order[]>;
|
|
53
53
|
fetchOpenOrders(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").Order[]>;
|
package/js/src/woo.d.ts
CHANGED
|
@@ -160,7 +160,7 @@ export default class woo extends Exchange {
|
|
|
160
160
|
amount: number;
|
|
161
161
|
rate: number;
|
|
162
162
|
};
|
|
163
|
-
fetchFundingHistory(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<
|
|
163
|
+
fetchFundingHistory(symbol?: string, since?: Int, limit?: Int, params?: {}): Promise<import("./base/types.js").FundingHistory[]>;
|
|
164
164
|
parseFundingRate(fundingRate: any, market?: any): {
|
|
165
165
|
info: any;
|
|
166
166
|
symbol: any;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ccxt",
|
|
3
|
-
"version": "4.1.
|
|
3
|
+
"version": "4.1.31",
|
|
4
4
|
"description": "A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading library with support for 130+ exchanges",
|
|
5
5
|
"unpkg": "dist/ccxt.browser.js",
|
|
6
6
|
"type": "module",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"fast-test": "npm run commonjs-test && node run-tests --js",
|
|
40
40
|
"commonjs-test": "node test-commonjs.cjs",
|
|
41
41
|
"fast-test-ws": "node run-tests-ws --js",
|
|
42
|
-
"test-js": "npm run commonjs-test && node run-tests --js",
|
|
42
|
+
"test-js": "npm run commonjs-test && node js/src/test/static/test.ids && node run-tests --js",
|
|
43
43
|
"test-js-ws": "node run-tests-ws --js",
|
|
44
44
|
"test-py": "node run-tests --python",
|
|
45
45
|
"test-py-ws": "node run-tests-ws --python",
|