ccxt 4.2.44 → 4.2.46
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 +3099 -8415
- package/README.md +4 -4
- package/change.sh +4 -2
- package/dist/ccxt.browser.js +1242 -195
- package/dist/ccxt.browser.min.js +7 -7
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +48 -0
- package/dist/cjs/src/base/ws/Cache.js +13 -5
- package/dist/cjs/src/base/ws/OrderBook.js +2 -2
- package/dist/cjs/src/binance.js +407 -21
- package/dist/cjs/src/bingx.js +43 -5
- package/dist/cjs/src/bitfinex2.js +1 -0
- package/dist/cjs/src/bithumb.js +5 -0
- package/dist/cjs/src/bitstamp.js +1 -1
- package/dist/cjs/src/btcturk.js +11 -0
- package/dist/cjs/src/bybit.js +96 -43
- package/dist/cjs/src/coinbase.js +228 -38
- package/dist/cjs/src/coincheck.js +11 -0
- package/dist/cjs/src/coinmate.js +114 -1
- package/dist/cjs/src/coinspot.js +7 -0
- package/dist/cjs/src/cryptocom.js +2 -2
- package/dist/cjs/src/deribit.js +1 -1
- package/dist/cjs/src/hitbtc.js +2 -0
- package/dist/cjs/src/idex.js +60 -1
- package/dist/cjs/src/latoken.js +3 -0
- package/dist/cjs/src/mercado.js +3 -0
- package/dist/cjs/src/oceanex.js +3 -0
- package/dist/cjs/src/okx.js +1 -0
- package/dist/cjs/src/pro/bitget.js +12 -8
- package/dist/cjs/src/pro/bitmart.js +11 -11
- package/dist/cjs/src/pro/bitmex.js +4 -4
- package/dist/cjs/src/pro/cex.js +2 -2
- package/dist/cjs/src/pro/gate.js +76 -42
- package/dist/cjs/src/pro/gemini.js +4 -3
- package/dist/cjs/src/pro/hitbtc.js +1 -0
- package/dist/cjs/src/probit.js +3 -3
- package/dist/cjs/src/timex.js +65 -0
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/bequant.d.ts +2 -0
- package/js/src/abstract/bitcoincom.d.ts +2 -0
- package/js/src/abstract/bithumb.d.ts +5 -0
- package/js/src/abstract/coinbase.d.ts +1 -0
- package/js/src/abstract/coinmate.d.ts +12 -0
- package/js/src/abstract/fmfwio.d.ts +2 -0
- package/js/src/abstract/hitbtc.d.ts +2 -0
- package/js/src/abstract/hitbtc3.d.ts +2 -0
- package/js/src/abstract/okx.d.ts +1 -0
- package/js/src/base/Exchange.d.ts +12 -6
- package/js/src/base/Exchange.js +48 -0
- package/js/src/base/ws/Cache.d.ts +5 -1
- package/js/src/base/ws/Cache.js +13 -5
- package/js/src/base/ws/OrderBook.d.ts +5 -1
- package/js/src/base/ws/OrderBook.js +3 -3
- package/js/src/binance.d.ts +2 -1
- package/js/src/binance.js +407 -21
- package/js/src/bingx.d.ts +2 -1
- package/js/src/bingx.js +43 -5
- package/js/src/bitfinex2.js +1 -0
- package/js/src/bithumb.js +5 -0
- package/js/src/bitstamp.js +1 -1
- package/js/src/btcturk.js +11 -0
- package/js/src/bybit.d.ts +4 -1
- package/js/src/bybit.js +96 -43
- package/js/src/coinbase.d.ts +10 -4
- package/js/src/coinbase.js +228 -38
- package/js/src/coincheck.js +11 -0
- package/js/src/coinmate.d.ts +3 -1
- package/js/src/coinmate.js +114 -1
- package/js/src/coinspot.js +7 -0
- package/js/src/cryptocom.js +2 -2
- package/js/src/deribit.js +1 -1
- package/js/src/hitbtc.js +2 -0
- package/js/src/idex.d.ts +14 -0
- package/js/src/idex.js +60 -1
- package/js/src/latoken.js +3 -0
- package/js/src/mercado.js +3 -0
- package/js/src/oceanex.js +3 -0
- package/js/src/okx.js +1 -0
- package/js/src/pro/bitget.js +12 -8
- package/js/src/pro/bitmart.js +11 -11
- package/js/src/pro/bitmex.js +4 -4
- package/js/src/pro/cex.js +2 -2
- package/js/src/pro/gate.d.ts +4 -0
- package/js/src/pro/gate.js +76 -42
- package/js/src/pro/gemini.js +4 -3
- package/js/src/pro/hitbtc.js +1 -0
- package/js/src/probit.js +3 -3
- package/js/src/timex.d.ts +14 -0
- package/js/src/timex.js +65 -0
- package/package.json +1 -1
- package/skip-tests.json +4 -0
package/js/src/bingx.js
CHANGED
|
@@ -53,6 +53,7 @@ export default class bingx extends Exchange {
|
|
|
53
53
|
'fetchClosedOrders': true,
|
|
54
54
|
'fetchCurrencies': true,
|
|
55
55
|
'fetchDepositAddress': true,
|
|
56
|
+
'fetchDepositAddressesByNetwork': true,
|
|
56
57
|
'fetchDeposits': true,
|
|
57
58
|
'fetchDepositWithdrawFee': 'emulated',
|
|
58
59
|
'fetchDepositWithdrawFees': true,
|
|
@@ -405,6 +406,13 @@ export default class bingx extends Exchange {
|
|
|
405
406
|
},
|
|
406
407
|
'recvWindow': 5 * 1000,
|
|
407
408
|
'broker': 'CCXT',
|
|
409
|
+
'defaultNetworks': {
|
|
410
|
+
'ETH': 'ETH',
|
|
411
|
+
'USDT': 'ERC20',
|
|
412
|
+
'USDC': 'ERC20',
|
|
413
|
+
'BTC': 'BTC',
|
|
414
|
+
'LTC': 'LTC',
|
|
415
|
+
},
|
|
408
416
|
},
|
|
409
417
|
});
|
|
410
418
|
}
|
|
@@ -3088,15 +3096,15 @@ export default class bingx extends Exchange {
|
|
|
3088
3096
|
'status': status,
|
|
3089
3097
|
};
|
|
3090
3098
|
}
|
|
3091
|
-
async
|
|
3099
|
+
async fetchDepositAddressesByNetwork(code, params = {}) {
|
|
3092
3100
|
/**
|
|
3093
3101
|
* @method
|
|
3094
|
-
* @name bingx#
|
|
3095
|
-
* @description fetch the deposit
|
|
3096
|
-
* @see https://bingx-api.github.io/docs/#/common/
|
|
3102
|
+
* @name bingx#fetchDepositAddressesByNetwork
|
|
3103
|
+
* @description fetch the deposit addresses for a currency associated with this account
|
|
3104
|
+
* @see https://bingx-api.github.io/docs/#/en-us/common/wallet-api.html#Query%20Main%20Account%20Deposit%20Address
|
|
3097
3105
|
* @param {string} code unified currency code
|
|
3098
3106
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3099
|
-
* @returns {object}
|
|
3107
|
+
* @returns {object} a dictionary [address structures]{@link https://docs.ccxt.com/#/?id=address-structure}, indexed by the network
|
|
3100
3108
|
*/
|
|
3101
3109
|
await this.loadMarkets();
|
|
3102
3110
|
const currency = this.currency(code);
|
|
@@ -3131,6 +3139,36 @@ export default class bingx extends Exchange {
|
|
|
3131
3139
|
const parsed = this.parseDepositAddresses(data, [currency['code']], false);
|
|
3132
3140
|
return this.indexBy(parsed, 'network');
|
|
3133
3141
|
}
|
|
3142
|
+
async fetchDepositAddress(code, params = {}) {
|
|
3143
|
+
/**
|
|
3144
|
+
* @method
|
|
3145
|
+
* @name bingx#fetchDepositAddress
|
|
3146
|
+
* @description fetch the deposit address for a currency associated with this account
|
|
3147
|
+
* @see https://bingx-api.github.io/docs/#/en-us/common/wallet-api.html#Query%20Main%20Account%20Deposit%20Address
|
|
3148
|
+
* @param {string} code unified currency code
|
|
3149
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3150
|
+
* @param {string} [params.network] The chain of currency. This only apply for multi-chain currency, and there is no need for single chain currency
|
|
3151
|
+
* @returns {object} an [address structure]{@link https://docs.ccxt.com/#/?id=address-structure}
|
|
3152
|
+
*/
|
|
3153
|
+
const network = this.safeString(params, 'network');
|
|
3154
|
+
params = this.omit(params, ['network']);
|
|
3155
|
+
const addressStructures = await this.fetchDepositAddressesByNetwork(code, params);
|
|
3156
|
+
if (network !== undefined) {
|
|
3157
|
+
return this.safeDict(addressStructures, network);
|
|
3158
|
+
}
|
|
3159
|
+
else {
|
|
3160
|
+
const options = this.safeDict(this.options, 'defaultNetworks');
|
|
3161
|
+
const defaultNetworkForCurrency = this.safeString(options, code);
|
|
3162
|
+
if (defaultNetworkForCurrency !== undefined) {
|
|
3163
|
+
return this.safeDict(addressStructures, defaultNetworkForCurrency);
|
|
3164
|
+
}
|
|
3165
|
+
else {
|
|
3166
|
+
const keys = Object.keys(addressStructures);
|
|
3167
|
+
const key = this.safeString(keys, 0);
|
|
3168
|
+
return this.safeDict(addressStructures, key);
|
|
3169
|
+
}
|
|
3170
|
+
}
|
|
3171
|
+
}
|
|
3134
3172
|
parseDepositAddress(depositAddress, currency = undefined) {
|
|
3135
3173
|
//
|
|
3136
3174
|
// {
|
package/js/src/bitfinex2.js
CHANGED
package/js/src/bithumb.js
CHANGED
|
@@ -91,6 +91,11 @@ export default class bithumb extends Exchange {
|
|
|
91
91
|
'orderbook/ALL_{quoteId}',
|
|
92
92
|
'orderbook/{baseId}_{quoteId}',
|
|
93
93
|
'transaction_history/{baseId}_{quoteId}',
|
|
94
|
+
'network-info',
|
|
95
|
+
'assetsstatus/multichain/ALL',
|
|
96
|
+
'assetsstatus/multichain/{currency}',
|
|
97
|
+
'withdraw/minimum/ALL',
|
|
98
|
+
'withdraw/minimum/{currency}',
|
|
94
99
|
'assetsstatus/ALL',
|
|
95
100
|
'assetsstatus/{baseId}',
|
|
96
101
|
'candlestick/{baseId}_{quoteId}/{interval}',
|
package/js/src/bitstamp.js
CHANGED
|
@@ -821,7 +821,7 @@ export default class bitstamp extends Exchange {
|
|
|
821
821
|
for (let i = 0; i < ids.length; i++) {
|
|
822
822
|
const id = ids[i];
|
|
823
823
|
if (id.indexOf('_') < 0) {
|
|
824
|
-
const value = this.
|
|
824
|
+
const value = this.safeInteger(transaction, id);
|
|
825
825
|
if ((value !== undefined) && (value !== 0)) {
|
|
826
826
|
return id;
|
|
827
827
|
}
|
package/js/src/btcturk.js
CHANGED
|
@@ -147,6 +147,7 @@ export default class btcturk extends Exchange {
|
|
|
147
147
|
* @method
|
|
148
148
|
* @name btcturk#fetchMarkets
|
|
149
149
|
* @description retrieves data on all markets for btcturk
|
|
150
|
+
* @see https://docs.btcturk.com/public-endpoints/exchange-info
|
|
150
151
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
151
152
|
* @returns {object[]} an array of objects representing market data
|
|
152
153
|
*/
|
|
@@ -296,6 +297,7 @@ export default class btcturk extends Exchange {
|
|
|
296
297
|
* @method
|
|
297
298
|
* @name btcturk#fetchBalance
|
|
298
299
|
* @description query for balance and get the amount of funds available for trading or funds locked in orders
|
|
300
|
+
* @see https://docs.btcturk.com/private-endpoints/account-balance
|
|
299
301
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
300
302
|
* @returns {object} a [balance structure]{@link https://docs.ccxt.com/#/?id=balance-structure}
|
|
301
303
|
*/
|
|
@@ -324,6 +326,7 @@ export default class btcturk extends Exchange {
|
|
|
324
326
|
* @method
|
|
325
327
|
* @name btcturk#fetchOrderBook
|
|
326
328
|
* @description fetches information on open orders with bid (buy) and ask (sell) prices, volumes and other data
|
|
329
|
+
* @see https://docs.btcturk.com/public-endpoints/orderbook
|
|
327
330
|
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
328
331
|
* @param {int} [limit] the maximum amount of order book entries to return
|
|
329
332
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -404,6 +407,7 @@ export default class btcturk extends Exchange {
|
|
|
404
407
|
* @method
|
|
405
408
|
* @name btcturk#fetchTickers
|
|
406
409
|
* @description fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market
|
|
410
|
+
* @see https://docs.btcturk.com/public-endpoints/ticker
|
|
407
411
|
* @param {string[]|undefined} symbols unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
|
|
408
412
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
409
413
|
* @returns {object} a dictionary of [ticker structures]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -418,6 +422,7 @@ export default class btcturk extends Exchange {
|
|
|
418
422
|
* @method
|
|
419
423
|
* @name btcturk#fetchTicker
|
|
420
424
|
* @description fetches a price ticker, a statistical calculation with the information calculated over the past 24 hours for a specific market
|
|
425
|
+
* @see https://docs.btcturk.com/public-endpoints/ticker
|
|
421
426
|
* @param {string} symbol unified symbol of the market to fetch the ticker for
|
|
422
427
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
423
428
|
* @returns {object} a [ticker structure]{@link https://docs.ccxt.com/#/?id=ticker-structure}
|
|
@@ -493,6 +498,7 @@ export default class btcturk extends Exchange {
|
|
|
493
498
|
* @method
|
|
494
499
|
* @name btcturk#fetchTrades
|
|
495
500
|
* @description get the list of most recent trades for a particular symbol
|
|
501
|
+
* @see https://docs.btcturk.com/public-endpoints/trades
|
|
496
502
|
* @param {string} symbol unified symbol of the market to fetch trades for
|
|
497
503
|
* @param {int} [since] timestamp in ms of the earliest trade to fetch
|
|
498
504
|
* @param {int} [limit] the maximum amount of trades to fetch
|
|
@@ -656,6 +662,7 @@ export default class btcturk extends Exchange {
|
|
|
656
662
|
* @method
|
|
657
663
|
* @name btcturk#createOrder
|
|
658
664
|
* @description create a trade order
|
|
665
|
+
* @see https://docs.btcturk.com/private-endpoints/submit-order
|
|
659
666
|
* @param {string} symbol unified symbol of the market to create an order in
|
|
660
667
|
* @param {string} type 'market' or 'limit'
|
|
661
668
|
* @param {string} side 'buy' or 'sell'
|
|
@@ -690,6 +697,7 @@ export default class btcturk extends Exchange {
|
|
|
690
697
|
* @method
|
|
691
698
|
* @name btcturk#cancelOrder
|
|
692
699
|
* @description cancels an open order
|
|
700
|
+
* @see https://docs.btcturk.com/private-endpoints/cancel-order
|
|
693
701
|
* @param {string} id order id
|
|
694
702
|
* @param {string} symbol not used by btcturk cancelOrder ()
|
|
695
703
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
@@ -705,6 +713,7 @@ export default class btcturk extends Exchange {
|
|
|
705
713
|
* @method
|
|
706
714
|
* @name btcturk#fetchOpenOrders
|
|
707
715
|
* @description fetch all unfilled currently open orders
|
|
716
|
+
* @see https://docs.btcturk.com/private-endpoints/open-orders
|
|
708
717
|
* @param {string} symbol unified market symbol
|
|
709
718
|
* @param {int} [since] the earliest time in ms to fetch open orders for
|
|
710
719
|
* @param {int} [limit] the maximum number of open orders structures to retrieve
|
|
@@ -729,6 +738,7 @@ export default class btcturk extends Exchange {
|
|
|
729
738
|
* @method
|
|
730
739
|
* @name btcturk#fetchOrders
|
|
731
740
|
* @description fetches information on multiple orders made by the user
|
|
741
|
+
* @see https://docs.btcturk.com/private-endpoints/all-orders
|
|
732
742
|
* @param {string} symbol unified market symbol of the market orders were made in
|
|
733
743
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
734
744
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
@@ -851,6 +861,7 @@ export default class btcturk extends Exchange {
|
|
|
851
861
|
* @method
|
|
852
862
|
* @name btcturk#fetchMyTrades
|
|
853
863
|
* @description fetch all trades made by the user
|
|
864
|
+
* @see https://docs.btcturk.com/private-endpoints/user-transactions
|
|
854
865
|
* @param {string} symbol unified market symbol
|
|
855
866
|
* @param {int} [since] the earliest time in ms to fetch trades for
|
|
856
867
|
* @param {int} [limit] the maximum number of trades structures to retrieve
|
package/js/src/bybit.d.ts
CHANGED
|
@@ -56,7 +56,6 @@ export default class bybit extends Exchange {
|
|
|
56
56
|
parseOrderStatus(status: any): string;
|
|
57
57
|
parseTimeInForce(timeInForce: any): string;
|
|
58
58
|
parseOrder(order: any, market?: Market): Order;
|
|
59
|
-
fetchOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
|
|
60
59
|
createMarketBuyOrderWithCost(symbol: string, cost: number, params?: {}): Promise<Order>;
|
|
61
60
|
createMarketSellOrderWithCost(symbol: string, cost: number, params?: {}): Promise<Order>;
|
|
62
61
|
createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: number, params?: {}): Promise<Order>;
|
|
@@ -70,7 +69,11 @@ export default class bybit extends Exchange {
|
|
|
70
69
|
cancelAllUsdcOrders(symbol?: Str, params?: {}): Promise<any>;
|
|
71
70
|
cancelAllOrders(symbol?: Str, params?: {}): Promise<any>;
|
|
72
71
|
fetchUsdcOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
72
|
+
fetchOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
|
|
73
73
|
fetchOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
74
|
+
fetchClosedOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
|
|
75
|
+
fetchOpenOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
|
|
76
|
+
fetchCanceledAndClosedOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
74
77
|
fetchClosedOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
75
78
|
fetchCanceledOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
76
79
|
fetchUsdcOpenOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
package/js/src/bybit.js
CHANGED
|
@@ -59,7 +59,9 @@ export default class bybit extends Exchange {
|
|
|
59
59
|
'fetchBorrowInterest': false,
|
|
60
60
|
'fetchBorrowRateHistories': false,
|
|
61
61
|
'fetchBorrowRateHistory': false,
|
|
62
|
+
'fetchCanceledAndClosedOrders': true,
|
|
62
63
|
'fetchCanceledOrders': true,
|
|
64
|
+
'fetchClosedOrder': true,
|
|
63
65
|
'fetchClosedOrders': true,
|
|
64
66
|
'fetchCrossBorrowRate': true,
|
|
65
67
|
'fetchCrossBorrowRates': false,
|
|
@@ -87,10 +89,11 @@ export default class bybit extends Exchange {
|
|
|
87
89
|
'fetchOHLCV': true,
|
|
88
90
|
'fetchOpenInterest': true,
|
|
89
91
|
'fetchOpenInterestHistory': true,
|
|
92
|
+
'fetchOpenOrder': true,
|
|
90
93
|
'fetchOpenOrders': true,
|
|
91
|
-
'fetchOrder':
|
|
94
|
+
'fetchOrder': false,
|
|
92
95
|
'fetchOrderBook': true,
|
|
93
|
-
'fetchOrders':
|
|
96
|
+
'fetchOrders': false,
|
|
94
97
|
'fetchOrderTrades': true,
|
|
95
98
|
'fetchPosition': true,
|
|
96
99
|
'fetchPositions': true,
|
|
@@ -3444,35 +3447,6 @@ export default class bybit extends Exchange {
|
|
|
3444
3447
|
'trades': undefined,
|
|
3445
3448
|
}, market);
|
|
3446
3449
|
}
|
|
3447
|
-
async fetchOrder(id, symbol = undefined, params = {}) {
|
|
3448
|
-
/**
|
|
3449
|
-
* @method
|
|
3450
|
-
* @name bybit#fetchOrder
|
|
3451
|
-
* @description fetches information on an order made by the user
|
|
3452
|
-
* @see https://bybit-exchange.github.io/docs/v5/order/order-list
|
|
3453
|
-
* @param {string} symbol unified symbol of the market the order was made in
|
|
3454
|
-
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3455
|
-
* @returns {object} An [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
3456
|
-
*/
|
|
3457
|
-
if (symbol === undefined) {
|
|
3458
|
-
throw new ArgumentsRequired(this.id + ' fetchOrder() requires a symbol argument');
|
|
3459
|
-
}
|
|
3460
|
-
await this.loadMarkets();
|
|
3461
|
-
const request = {
|
|
3462
|
-
'orderId': id,
|
|
3463
|
-
};
|
|
3464
|
-
const result = await this.fetchOrders(symbol, undefined, undefined, this.extend(request, params));
|
|
3465
|
-
const length = result.length;
|
|
3466
|
-
if (length === 0) {
|
|
3467
|
-
const isTrigger = this.safeBoolN(params, ['trigger', 'stop'], false);
|
|
3468
|
-
const extra = isTrigger ? '' : 'If you are trying to fetch SL/TP conditional order, you might try setting params["trigger"] = true';
|
|
3469
|
-
throw new OrderNotFound('Order ' + id.toString() + ' was not found.' + extra);
|
|
3470
|
-
}
|
|
3471
|
-
if (length > 1) {
|
|
3472
|
-
throw new InvalidOrder(this.id + ' returned more than one order');
|
|
3473
|
-
}
|
|
3474
|
-
return this.safeValue(result, 0);
|
|
3475
|
-
}
|
|
3476
3450
|
async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
|
|
3477
3451
|
/**
|
|
3478
3452
|
* @method
|
|
@@ -4508,29 +4482,99 @@ export default class bybit extends Exchange {
|
|
|
4508
4482
|
const data = this.safeValue(result, 'dataList', []);
|
|
4509
4483
|
return this.parseOrders(data, market, since, limit);
|
|
4510
4484
|
}
|
|
4485
|
+
async fetchOrder(id, symbol = undefined, params = {}) {
|
|
4486
|
+
throw new NotSupported(this.id + ' fetchOrder() is not supported after the 5/02 update, please use fetchOpenOrder or fetchClosedOrder');
|
|
4487
|
+
}
|
|
4511
4488
|
async fetchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
4489
|
+
throw new NotSupported(this.id + ' fetchOrders() is not supported after the 5/02 update, please use fetchOpenOrders, fetchClosedOrders or fetchCanceledOrders');
|
|
4490
|
+
}
|
|
4491
|
+
async fetchClosedOrder(id, symbol = undefined, params = {}) {
|
|
4492
|
+
/**
|
|
4493
|
+
* @method
|
|
4494
|
+
* @name bybit#fetchClosedOrder
|
|
4495
|
+
* @description fetches information on a closed order made by the user
|
|
4496
|
+
* @see https://bybit-exchange.github.io/docs/v5/order/order-list
|
|
4497
|
+
* @param {string} id order id
|
|
4498
|
+
* @param {string} [symbol] unified symbol of the market the order was made in
|
|
4499
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4500
|
+
* @param {boolean} [params.stop] set to true for fetching a closed stop order
|
|
4501
|
+
* @param {string} [params.type] market type, ['swap', 'option', 'spot']
|
|
4502
|
+
* @param {string} [params.subType] market subType, ['linear', 'inverse']
|
|
4503
|
+
* @param {string} [params.orderFilter] 'Order' or 'StopOrder' or 'tpslOrder'
|
|
4504
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4505
|
+
*/
|
|
4506
|
+
await this.loadMarkets();
|
|
4507
|
+
const request = {
|
|
4508
|
+
'orderId': id,
|
|
4509
|
+
};
|
|
4510
|
+
const result = await this.fetchClosedOrders(symbol, undefined, undefined, this.extend(request, params));
|
|
4511
|
+
const length = result.length;
|
|
4512
|
+
if (length === 0) {
|
|
4513
|
+
const isTrigger = this.safeBoolN(params, ['trigger', 'stop'], false);
|
|
4514
|
+
const extra = isTrigger ? '' : 'If you are trying to fetch SL/TP conditional order, you might try setting params["trigger"] = true';
|
|
4515
|
+
throw new OrderNotFound('Order ' + id.toString() + ' was not found.' + extra);
|
|
4516
|
+
}
|
|
4517
|
+
if (length > 1) {
|
|
4518
|
+
throw new InvalidOrder(this.id + ' returned more than one order');
|
|
4519
|
+
}
|
|
4520
|
+
return this.safeValue(result, 0);
|
|
4521
|
+
}
|
|
4522
|
+
async fetchOpenOrder(id, symbol = undefined, params = {}) {
|
|
4523
|
+
/**
|
|
4524
|
+
* @method
|
|
4525
|
+
* @name bybit#fetchOpenOrder
|
|
4526
|
+
* @description fetches information on an open order made by the user
|
|
4527
|
+
* @see https://bybit-exchange.github.io/docs/v5/order/open-order
|
|
4528
|
+
* @param {string} id order id
|
|
4529
|
+
* @param {string} [symbol] unified symbol of the market the order was made in
|
|
4530
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4531
|
+
* @param {boolean} [params.stop] set to true for fetching an open stop order
|
|
4532
|
+
* @param {string} [params.type] market type, ['swap', 'option', 'spot']
|
|
4533
|
+
* @param {string} [params.subType] market subType, ['linear', 'inverse']
|
|
4534
|
+
* @param {string} [params.baseCoin] Base coin. Supports linear, inverse & option
|
|
4535
|
+
* @param {string} [params.settleCoin] Settle coin. Supports linear, inverse & option
|
|
4536
|
+
* @param {string} [params.orderFilter] 'Order' or 'StopOrder' or 'tpslOrder'
|
|
4537
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4538
|
+
*/
|
|
4539
|
+
await this.loadMarkets();
|
|
4540
|
+
const request = {
|
|
4541
|
+
'orderId': id,
|
|
4542
|
+
};
|
|
4543
|
+
const result = await this.fetchOpenOrders(symbol, undefined, undefined, this.extend(request, params));
|
|
4544
|
+
const length = result.length;
|
|
4545
|
+
if (length === 0) {
|
|
4546
|
+
const isTrigger = this.safeBoolN(params, ['trigger', 'stop'], false);
|
|
4547
|
+
const extra = isTrigger ? '' : 'If you are trying to fetch SL/TP conditional order, you might try setting params["trigger"] = true';
|
|
4548
|
+
throw new OrderNotFound('Order ' + id.toString() + ' was not found.' + extra);
|
|
4549
|
+
}
|
|
4550
|
+
if (length > 1) {
|
|
4551
|
+
throw new InvalidOrder(this.id + ' returned more than one order');
|
|
4552
|
+
}
|
|
4553
|
+
return this.safeValue(result, 0);
|
|
4554
|
+
}
|
|
4555
|
+
async fetchCanceledAndClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
4512
4556
|
/**
|
|
4513
4557
|
* @method
|
|
4514
|
-
* @name bybit#
|
|
4515
|
-
* @description fetches information on multiple orders made by the user
|
|
4558
|
+
* @name bybit#fetchCanceledAndClosedOrders
|
|
4559
|
+
* @description fetches information on multiple canceled and closed orders made by the user
|
|
4516
4560
|
* @see https://bybit-exchange.github.io/docs/v5/order/order-list
|
|
4517
|
-
* @param {string} symbol unified market symbol of the market orders were made in
|
|
4561
|
+
* @param {string} [symbol] unified market symbol of the market orders were made in
|
|
4518
4562
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
4519
4563
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
4520
4564
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4521
|
-
* @param {boolean} [params.stop] true
|
|
4565
|
+
* @param {boolean} [params.stop] set to true for fetching stop orders
|
|
4522
4566
|
* @param {string} [params.type] market type, ['swap', 'option', 'spot']
|
|
4523
4567
|
* @param {string} [params.subType] market subType, ['linear', 'inverse']
|
|
4524
4568
|
* @param {string} [params.orderFilter] 'Order' or 'StopOrder' or 'tpslOrder'
|
|
4525
4569
|
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
4526
|
-
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [
|
|
4570
|
+
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
4527
4571
|
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4528
4572
|
*/
|
|
4529
4573
|
await this.loadMarkets();
|
|
4530
4574
|
let paginate = false;
|
|
4531
|
-
[paginate, params] = this.handleOptionAndParams(params, '
|
|
4575
|
+
[paginate, params] = this.handleOptionAndParams(params, 'fetchCanceledAndClosedOrders', 'paginate');
|
|
4532
4576
|
if (paginate) {
|
|
4533
|
-
return await this.fetchPaginatedCallCursor('
|
|
4577
|
+
return await this.fetchPaginatedCallCursor('fetchCanceledAndClosedOrders', symbol, since, limit, params, 'nextPageCursor', 'nextPageCursor', undefined, 50);
|
|
4534
4578
|
}
|
|
4535
4579
|
const [enableUnifiedMargin, enableUnifiedAccount] = await this.isUnifiedEnabled();
|
|
4536
4580
|
const isUnifiedAccount = (enableUnifiedMargin || enableUnifiedAccount);
|
|
@@ -4543,7 +4587,7 @@ export default class bybit extends Exchange {
|
|
|
4543
4587
|
request['symbol'] = market['id'];
|
|
4544
4588
|
}
|
|
4545
4589
|
let type = undefined;
|
|
4546
|
-
[type, params] = this.getBybitType('
|
|
4590
|
+
[type, params] = this.getBybitType('fetchCanceledAndClosedOrders', market, params);
|
|
4547
4591
|
if (((type === 'option') || isUsdcSettled) && !isUnifiedAccount) {
|
|
4548
4592
|
return await this.fetchUsdcOrders(symbol, since, limit, params);
|
|
4549
4593
|
}
|
|
@@ -4625,17 +4669,23 @@ export default class bybit extends Exchange {
|
|
|
4625
4669
|
* @name bybit#fetchClosedOrders
|
|
4626
4670
|
* @description fetches information on multiple closed orders made by the user
|
|
4627
4671
|
* @see https://bybit-exchange.github.io/docs/v5/order/order-list
|
|
4628
|
-
* @param {string} symbol unified market symbol of the market orders were made in
|
|
4672
|
+
* @param {string} [symbol] unified market symbol of the market orders were made in
|
|
4629
4673
|
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
4630
4674
|
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
4631
4675
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4676
|
+
* @param {boolean} [params.stop] set to true for fetching closed stop orders
|
|
4677
|
+
* @param {string} [params.type] market type, ['swap', 'option', 'spot']
|
|
4678
|
+
* @param {string} [params.subType] market subType, ['linear', 'inverse']
|
|
4679
|
+
* @param {string} [params.orderFilter] 'Order' or 'StopOrder' or 'tpslOrder'
|
|
4680
|
+
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
4681
|
+
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
4632
4682
|
* @returns {Order[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4633
4683
|
*/
|
|
4634
4684
|
await this.loadMarkets();
|
|
4635
4685
|
const request = {
|
|
4636
4686
|
'orderStatus': 'Filled',
|
|
4637
4687
|
};
|
|
4638
|
-
return await this.
|
|
4688
|
+
return await this.fetchCanceledAndClosedOrders(symbol, since, limit, this.extend(request, params));
|
|
4639
4689
|
}
|
|
4640
4690
|
async fetchCanceledOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
4641
4691
|
/**
|
|
@@ -4643,20 +4693,23 @@ export default class bybit extends Exchange {
|
|
|
4643
4693
|
* @name bybit#fetchCanceledOrders
|
|
4644
4694
|
* @description fetches information on multiple canceled orders made by the user
|
|
4645
4695
|
* @see https://bybit-exchange.github.io/docs/v5/order/order-list
|
|
4646
|
-
* @param {string} symbol unified market symbol of the market orders were made in
|
|
4696
|
+
* @param {string} [symbol] unified market symbol of the market orders were made in
|
|
4647
4697
|
* @param {int} [since] timestamp in ms of the earliest order, default is undefined
|
|
4648
4698
|
* @param {int} [limit] max number of orders to return, default is undefined
|
|
4649
4699
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
4650
4700
|
* @param {boolean} [params.stop] true if stop order
|
|
4651
4701
|
* @param {string} [params.type] market type, ['swap', 'option', 'spot']
|
|
4652
4702
|
* @param {string} [params.subType] market subType, ['linear', 'inverse']
|
|
4703
|
+
* @param {string} [params.orderFilter] 'Order' or 'StopOrder' or 'tpslOrder'
|
|
4704
|
+
* @param {int} [params.until] the latest time in ms to fetch entries for
|
|
4705
|
+
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [available parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
4653
4706
|
* @returns {object} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
4654
4707
|
*/
|
|
4655
4708
|
await this.loadMarkets();
|
|
4656
4709
|
const request = {
|
|
4657
4710
|
'orderStatus': 'Cancelled',
|
|
4658
4711
|
};
|
|
4659
|
-
return await this.
|
|
4712
|
+
return await this.fetchCanceledAndClosedOrders(symbol, since, limit, this.extend(request, params));
|
|
4660
4713
|
}
|
|
4661
4714
|
async fetchUsdcOpenOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
4662
4715
|
await this.loadMarkets();
|
package/js/src/coinbase.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ export default class coinbase extends Exchange {
|
|
|
33
33
|
fetchMarkets(params?: {}): Promise<any>;
|
|
34
34
|
fetchMarketsV2(params?: {}): Promise<any[]>;
|
|
35
35
|
fetchMarketsV3(params?: {}): Promise<any[]>;
|
|
36
|
-
fetchCurrenciesFromCache(params?: {}): Promise<any
|
|
36
|
+
fetchCurrenciesFromCache(params?: {}): Promise<import("./base/types.js").Dictionary<any>>;
|
|
37
37
|
fetchCurrencies(params?: {}): Promise<{}>;
|
|
38
38
|
fetchTickers(symbols?: Strings, params?: {}): Promise<Tickers>;
|
|
39
39
|
fetchTickersV2(symbols?: Strings, params?: {}): Promise<import("./base/types.js").Dictionary<Ticker>>;
|
|
@@ -68,9 +68,7 @@ export default class coinbase extends Exchange {
|
|
|
68
68
|
prepareAccountRequest(limit?: Int, params?: {}): {
|
|
69
69
|
account_id: string;
|
|
70
70
|
};
|
|
71
|
-
prepareAccountRequestWithCurrencyCode(code?: Str, limit?: Int, params?: {}): Promise<{
|
|
72
|
-
account_id: string;
|
|
73
|
-
}>;
|
|
71
|
+
prepareAccountRequestWithCurrencyCode(code?: Str, limit?: Int, params?: {}): Promise<{}[]>;
|
|
74
72
|
createMarketBuyOrderWithCost(symbol: string, cost: number, params?: {}): Promise<Order>;
|
|
75
73
|
createOrder(symbol: string, type: OrderType, side: OrderSide, amount: number, price?: number, params?: {}): Promise<Order>;
|
|
76
74
|
parseOrder(order: any, market?: Market): Order;
|
|
@@ -93,6 +91,14 @@ export default class coinbase extends Exchange {
|
|
|
93
91
|
fetchOrderBook(symbol: string, limit?: Int, params?: {}): Promise<OrderBook>;
|
|
94
92
|
fetchBidsAsks(symbols?: Strings, params?: {}): Promise<import("./base/types.js").Dictionary<Ticker>>;
|
|
95
93
|
withdraw(code: string, amount: number, address: any, tag?: any, params?: {}): Promise<Transaction>;
|
|
94
|
+
fetchDepositAddressesByNetwork(code: string, params?: {}): Promise<{}>;
|
|
95
|
+
parseDepositAddress(depositAddress: any, currency?: Currency): {
|
|
96
|
+
info: any;
|
|
97
|
+
currency: string;
|
|
98
|
+
address: string;
|
|
99
|
+
tag: string;
|
|
100
|
+
network: string;
|
|
101
|
+
};
|
|
96
102
|
sign(path: any, api?: any[], method?: string, params?: {}, headers?: any, body?: any): {
|
|
97
103
|
url: string;
|
|
98
104
|
method: string;
|