ccxt 4.2.52 → 4.2.53
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/build.sh +1 -1
- package/dist/ccxt.browser.js +310 -56
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/binance.js +50 -4
- package/dist/cjs/src/bingx.js +32 -1
- package/dist/cjs/src/bitget.js +1 -0
- package/dist/cjs/src/bitvavo.js +1 -1
- package/dist/cjs/src/coinbase.js +186 -12
- package/dist/cjs/src/htx.js +10 -4
- package/dist/cjs/src/pro/bitvavo.js +1 -1
- package/dist/cjs/src/pro/blockchaincom.js +7 -25
- package/dist/cjs/src/pro/deribit.js +2 -2
- package/dist/cjs/src/pro/gemini.js +1 -1
- package/dist/cjs/src/pro/okx.js +18 -4
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/abstract/coinbase.d.ts +1 -1
- package/js/src/binance.d.ts +2 -0
- package/js/src/binance.js +50 -4
- package/js/src/bingx.d.ts +4 -0
- package/js/src/bingx.js +32 -1
- package/js/src/bitget.js +1 -0
- package/js/src/bitvavo.js +1 -1
- package/js/src/coinbase.d.ts +2 -0
- package/js/src/coinbase.js +186 -12
- package/js/src/htx.js +10 -4
- package/js/src/pro/bitvavo.js +1 -1
- package/js/src/pro/blockchaincom.d.ts +0 -1
- package/js/src/pro/blockchaincom.js +7 -25
- package/js/src/pro/deribit.js +2 -2
- package/js/src/pro/gemini.js +1 -1
- package/js/src/pro/okx.js +18 -4
- package/package.json +2 -1
- package/skip-tests.json +25 -8
package/js/ccxt.js
CHANGED
|
@@ -38,7 +38,7 @@ import * as errors from './src/base/errors.js';
|
|
|
38
38
|
import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
|
|
39
39
|
//-----------------------------------------------------------------------------
|
|
40
40
|
// this is updated by vss.js when building
|
|
41
|
-
const version = '4.2.
|
|
41
|
+
const version = '4.2.53';
|
|
42
42
|
Exchange.ccxtVersion = version;
|
|
43
43
|
//-----------------------------------------------------------------------------
|
|
44
44
|
import ace from './src/ace.js';
|
|
@@ -46,6 +46,7 @@ interface Exchange {
|
|
|
46
46
|
v2PrivatePutUser(params?: {}): Promise<implicitReturnType>;
|
|
47
47
|
v2PrivateDeleteAccountsId(params?: {}): Promise<implicitReturnType>;
|
|
48
48
|
v2PrivateDeleteAccountsAccountIdTransactionsTransactionId(params?: {}): Promise<implicitReturnType>;
|
|
49
|
+
v3PublicGetBrokerageTime(params?: {}): Promise<implicitReturnType>;
|
|
49
50
|
v3PrivateGetBrokerageAccounts(params?: {}): Promise<implicitReturnType>;
|
|
50
51
|
v3PrivateGetBrokerageAccountsAccountUuid(params?: {}): Promise<implicitReturnType>;
|
|
51
52
|
v3PrivateGetBrokerageOrdersHistoricalBatch(params?: {}): Promise<implicitReturnType>;
|
|
@@ -61,7 +62,6 @@ interface Exchange {
|
|
|
61
62
|
v3PrivateGetBrokerageProductBook(params?: {}): Promise<implicitReturnType>;
|
|
62
63
|
v3PrivateGetBrokerageBestBidAsk(params?: {}): Promise<implicitReturnType>;
|
|
63
64
|
v3PrivateGetBrokerageConvertTradeTradeId(params?: {}): Promise<implicitReturnType>;
|
|
64
|
-
v3PrivateGetBrokerageTime(params?: {}): Promise<implicitReturnType>;
|
|
65
65
|
v3PrivateGetBrokerageCfmBalanceSummary(params?: {}): Promise<implicitReturnType>;
|
|
66
66
|
v3PrivateGetBrokerageCfmPositions(params?: {}): Promise<implicitReturnType>;
|
|
67
67
|
v3PrivateGetBrokerageCfmPositionsProductId(params?: {}): Promise<implicitReturnType>;
|
package/js/src/binance.d.ts
CHANGED
|
@@ -66,6 +66,7 @@ export default class binance extends Exchange {
|
|
|
66
66
|
fetchOpenOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
|
|
67
67
|
fetchClosedOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
68
68
|
fetchCanceledOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<any>;
|
|
69
|
+
fetchCanceledAndClosedOrders(symbol?: Str, since?: Int, limit?: Int, params?: {}): Promise<Order[]>;
|
|
69
70
|
cancelOrder(id: string, symbol?: Str, params?: {}): Promise<Order>;
|
|
70
71
|
cancelAllOrders(symbol?: Str, params?: {}): Promise<any>;
|
|
71
72
|
cancelOrders(ids: string[], symbol?: Str, params?: {}): Promise<Order[]>;
|
|
@@ -425,6 +426,7 @@ export default class binance extends Exchange {
|
|
|
425
426
|
underlyingPrice: any;
|
|
426
427
|
info: any;
|
|
427
428
|
};
|
|
429
|
+
fetchTradingLimits(symbols?: Strings, params?: {}): Promise<{}>;
|
|
428
430
|
fetchPositionMode(symbol?: Str, params?: {}): Promise<{
|
|
429
431
|
info: any;
|
|
430
432
|
hedged: boolean;
|
package/js/src/binance.js
CHANGED
|
@@ -44,13 +44,13 @@ export default class binance extends Exchange {
|
|
|
44
44
|
'closeAllPositions': false,
|
|
45
45
|
'closePosition': false,
|
|
46
46
|
'createDepositAddress': false,
|
|
47
|
-
'createMarketBuyOrderWithCost': true,
|
|
48
|
-
'createMarketOrderWithCost': true,
|
|
49
|
-
'createMarketSellOrderWithCost': true,
|
|
50
47
|
'createLimitBuyOrder': true,
|
|
51
48
|
'createLimitSellOrder': true,
|
|
52
49
|
'createMarketBuyOrder': true,
|
|
50
|
+
'createMarketBuyOrderWithCost': true,
|
|
51
|
+
'createMarketOrderWithCost': true,
|
|
53
52
|
'createMarketSellOrder': true,
|
|
53
|
+
'createMarketSellOrderWithCost': true,
|
|
54
54
|
'createOrder': true,
|
|
55
55
|
'createOrders': true,
|
|
56
56
|
'createOrderWithTakeProfitAndStopLoss': true,
|
|
@@ -70,6 +70,7 @@ export default class binance extends Exchange {
|
|
|
70
70
|
'fetchBorrowInterest': true,
|
|
71
71
|
'fetchBorrowRateHistories': false,
|
|
72
72
|
'fetchBorrowRateHistory': true,
|
|
73
|
+
'fetchCanceledAndClosedOrders': 'emulated',
|
|
73
74
|
'fetchCanceledOrders': 'emulated',
|
|
74
75
|
'fetchClosedOrder': false,
|
|
75
76
|
'fetchClosedOrders': 'emulated',
|
|
@@ -127,7 +128,7 @@ export default class binance extends Exchange {
|
|
|
127
128
|
'fetchTrades': true,
|
|
128
129
|
'fetchTradingFee': true,
|
|
129
130
|
'fetchTradingFees': true,
|
|
130
|
-
'fetchTradingLimits':
|
|
131
|
+
'fetchTradingLimits': 'emulated',
|
|
131
132
|
'fetchTransactionFee': 'emulated',
|
|
132
133
|
'fetchTransactionFees': true,
|
|
133
134
|
'fetchTransactions': false,
|
|
@@ -6826,6 +6827,38 @@ export default class binance extends Exchange {
|
|
|
6826
6827
|
const filteredOrders = this.filterBy(orders, 'status', 'canceled');
|
|
6827
6828
|
return this.filterBySinceLimit(filteredOrders, since, limit);
|
|
6828
6829
|
}
|
|
6830
|
+
async fetchCanceledAndClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
6831
|
+
/**
|
|
6832
|
+
* @method
|
|
6833
|
+
* @name binance#fetchCanceledAndClosedOrders
|
|
6834
|
+
* @description fetches information on multiple canceled orders made by the user
|
|
6835
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#all-orders-user_data
|
|
6836
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#query-margin-account-39-s-all-orders-user_data
|
|
6837
|
+
* @see https://binance-docs.github.io/apidocs/voptions/en/#query-option-order-history-trade
|
|
6838
|
+
* @see https://binance-docs.github.io/apidocs/pm/en/#query-all-um-orders-user_data
|
|
6839
|
+
* @see https://binance-docs.github.io/apidocs/pm/en/#query-all-cm-orders-user_data
|
|
6840
|
+
* @see https://binance-docs.github.io/apidocs/pm/en/#query-all-um-conditional-orders-user_data
|
|
6841
|
+
* @see https://binance-docs.github.io/apidocs/pm/en/#query-all-cm-conditional-orders-user_data
|
|
6842
|
+
* @see https://binance-docs.github.io/apidocs/pm/en/#query-all-margin-account-orders-user_data
|
|
6843
|
+
* @param {string} symbol unified market symbol of the market the orders were made in
|
|
6844
|
+
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
6845
|
+
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
6846
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
6847
|
+
* @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)
|
|
6848
|
+
* @param {boolean} [params.portfolioMargin] set to true if you would like to fetch orders in a portfolio margin account
|
|
6849
|
+
* @param {boolean} [params.stop] set to true if you would like to fetch portfolio margin account stop or conditional orders
|
|
6850
|
+
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
6851
|
+
*/
|
|
6852
|
+
if (symbol === undefined) {
|
|
6853
|
+
throw new ArgumentsRequired(this.id + ' fetchCanceledAndClosedOrders() requires a symbol argument');
|
|
6854
|
+
}
|
|
6855
|
+
const orders = await this.fetchOrders(symbol, since, undefined, params);
|
|
6856
|
+
const canceledOrders = this.filterBy(orders, 'status', 'canceled');
|
|
6857
|
+
const closedOrders = this.filterBy(orders, 'status', 'closed');
|
|
6858
|
+
const filteredOrders = this.arrayConcat(canceledOrders, closedOrders);
|
|
6859
|
+
const sortedOrders = this.sortBy(filteredOrders, 'timestamp');
|
|
6860
|
+
return this.filterBySinceLimit(sortedOrders, since, limit);
|
|
6861
|
+
}
|
|
6829
6862
|
async cancelOrder(id, symbol = undefined, params = {}) {
|
|
6830
6863
|
/**
|
|
6831
6864
|
* @method
|
|
@@ -11997,6 +12030,19 @@ export default class binance extends Exchange {
|
|
|
11997
12030
|
'info': greeks,
|
|
11998
12031
|
};
|
|
11999
12032
|
}
|
|
12033
|
+
async fetchTradingLimits(symbols = undefined, params = {}) {
|
|
12034
|
+
// this method should not be called directly, use loadTradingLimits () instead
|
|
12035
|
+
const markets = await this.fetchMarkets();
|
|
12036
|
+
const tradingLimits = {};
|
|
12037
|
+
for (let i = 0; i < markets.length; i++) {
|
|
12038
|
+
const market = markets[i];
|
|
12039
|
+
const symbol = market['symbol'];
|
|
12040
|
+
if ((symbols === undefined) || (this.inArray(symbol, symbols))) {
|
|
12041
|
+
tradingLimits[symbol] = market['limits']['amount'];
|
|
12042
|
+
}
|
|
12043
|
+
}
|
|
12044
|
+
return tradingLimits;
|
|
12045
|
+
}
|
|
12000
12046
|
async fetchPositionMode(symbol = undefined, params = {}) {
|
|
12001
12047
|
/**
|
|
12002
12048
|
* @method
|
package/js/src/bingx.d.ts
CHANGED
|
@@ -132,6 +132,10 @@ export default class bingx extends Exchange {
|
|
|
132
132
|
parseLiquidation(liquidation: any, market?: Market): import("./base/types.js").Liquidation;
|
|
133
133
|
closePosition(symbol: string, side?: OrderSide, params?: {}): Promise<Order>;
|
|
134
134
|
closeAllPositions(params?: {}): Promise<Position[]>;
|
|
135
|
+
fetchPositionMode(symbol?: Str, params?: {}): Promise<{
|
|
136
|
+
info: any;
|
|
137
|
+
hedged: boolean;
|
|
138
|
+
}>;
|
|
135
139
|
setPositionMode(hedged: boolean, symbol?: Str, params?: {}): Promise<any>;
|
|
136
140
|
editOrder(id: string, symbol: string, type: OrderType, side: OrderSide, amount?: number, price?: number, params?: {}): Promise<Order>;
|
|
137
141
|
sign(path: any, section?: string, method?: string, params?: {}, headers?: any, body?: any): {
|
package/js/src/bingx.js
CHANGED
|
@@ -70,6 +70,7 @@ export default class bingx extends Exchange {
|
|
|
70
70
|
'fetchOpenOrders': true,
|
|
71
71
|
'fetchOrder': true,
|
|
72
72
|
'fetchOrderBook': true,
|
|
73
|
+
'fetchPositionMode': true,
|
|
73
74
|
'fetchPositions': true,
|
|
74
75
|
'fetchTicker': true,
|
|
75
76
|
'fetchTickers': true,
|
|
@@ -80,6 +81,7 @@ export default class bingx extends Exchange {
|
|
|
80
81
|
'setLeverage': true,
|
|
81
82
|
'setMargin': true,
|
|
82
83
|
'setMarginMode': true,
|
|
84
|
+
'setPositionMode': true,
|
|
83
85
|
'transfer': true,
|
|
84
86
|
},
|
|
85
87
|
'hostname': 'bingx.com',
|
|
@@ -3506,13 +3508,14 @@ export default class bingx extends Exchange {
|
|
|
3506
3508
|
* @param {float} leverage the rate of leverage
|
|
3507
3509
|
* @param {string} symbol unified market symbol
|
|
3508
3510
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3511
|
+
* @param {string} [params.side] hedged: ['long' or 'short']. one way: ['both']
|
|
3509
3512
|
* @returns {object} response from the exchange
|
|
3510
3513
|
*/
|
|
3511
3514
|
if (symbol === undefined) {
|
|
3512
3515
|
throw new ArgumentsRequired(this.id + ' setLeverage() requires a symbol argument');
|
|
3513
3516
|
}
|
|
3514
3517
|
const side = this.safeStringUpper(params, 'side');
|
|
3515
|
-
this.checkRequiredArgument('setLeverage', side, 'side', ['LONG', 'SHORT']);
|
|
3518
|
+
this.checkRequiredArgument('setLeverage', side, 'side', ['LONG', 'SHORT', 'BOTH']);
|
|
3516
3519
|
await this.loadMarkets();
|
|
3517
3520
|
const market = this.market(symbol);
|
|
3518
3521
|
const request = {
|
|
@@ -3956,6 +3959,34 @@ export default class bingx extends Exchange {
|
|
|
3956
3959
|
}
|
|
3957
3960
|
return positions;
|
|
3958
3961
|
}
|
|
3962
|
+
async fetchPositionMode(symbol = undefined, params = {}) {
|
|
3963
|
+
/**
|
|
3964
|
+
* @method
|
|
3965
|
+
* @name bingx#fetchPositionMode
|
|
3966
|
+
* @description fetchs the position mode, hedged or one way, hedged for binance is set identically for all linear markets or all inverse markets
|
|
3967
|
+
* @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Get%20Position%20Mode
|
|
3968
|
+
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
3969
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3970
|
+
* @returns {object} an object detailing whether the market is in hedged or one-way mode
|
|
3971
|
+
*/
|
|
3972
|
+
const response = await this.swapV1PrivateGetPositionSideDual(params);
|
|
3973
|
+
//
|
|
3974
|
+
// {
|
|
3975
|
+
// "code": "0",
|
|
3976
|
+
// "msg": "",
|
|
3977
|
+
// "timeStamp": "1709002057516",
|
|
3978
|
+
// "data": {
|
|
3979
|
+
// "dualSidePosition": "false"
|
|
3980
|
+
// }
|
|
3981
|
+
// }
|
|
3982
|
+
//
|
|
3983
|
+
const data = this.safeDict(response, 'data', {});
|
|
3984
|
+
const dualSidePosition = this.safeString(data, 'dualSidePosition');
|
|
3985
|
+
return {
|
|
3986
|
+
'info': response,
|
|
3987
|
+
'hedged': (dualSidePosition === 'true'),
|
|
3988
|
+
};
|
|
3989
|
+
}
|
|
3959
3990
|
async setPositionMode(hedged, symbol = undefined, params = {}) {
|
|
3960
3991
|
/**
|
|
3961
3992
|
* @method
|
package/js/src/bitget.js
CHANGED
|
@@ -3595,6 +3595,7 @@ export default class bitget extends Exchange {
|
|
|
3595
3595
|
'not_trigger': 'open',
|
|
3596
3596
|
'partial_fill': 'open',
|
|
3597
3597
|
'partially_fill': 'open',
|
|
3598
|
+
'partially_filled': 'open',
|
|
3598
3599
|
'triggered': 'closed',
|
|
3599
3600
|
'full_fill': 'closed',
|
|
3600
3601
|
'filled': 'closed',
|
package/js/src/bitvavo.js
CHANGED
|
@@ -571,7 +571,7 @@ export default class bitvavo extends Exchange {
|
|
|
571
571
|
// "market":"ETH-BTC",
|
|
572
572
|
// "open":"0.022578",
|
|
573
573
|
// "high":"0.023019",
|
|
574
|
-
// "low":"0.
|
|
574
|
+
// "low":"0.022572",
|
|
575
575
|
// "last":"0.023019",
|
|
576
576
|
// "volume":"25.16366324",
|
|
577
577
|
// "volumeQuote":"0.57333305",
|
package/js/src/coinbase.d.ts
CHANGED
|
@@ -99,6 +99,8 @@ export default class coinbase extends Exchange {
|
|
|
99
99
|
tag: string;
|
|
100
100
|
network: string;
|
|
101
101
|
};
|
|
102
|
+
deposit(code: string, amount: number, id: string, params?: {}): Promise<Transaction>;
|
|
103
|
+
fetchDeposit(id: string, code?: Str, params?: {}): Promise<Transaction>;
|
|
102
104
|
sign(path: any, api?: any[], method?: string, params?: {}, headers?: any, body?: any): {
|
|
103
105
|
url: string;
|
|
104
106
|
method: string;
|
package/js/src/coinbase.js
CHANGED
|
@@ -54,6 +54,7 @@ export default class coinbase extends Exchange {
|
|
|
54
54
|
'createStopLimitOrder': true,
|
|
55
55
|
'createStopMarketOrder': false,
|
|
56
56
|
'createStopOrder': true,
|
|
57
|
+
'deposit': true,
|
|
57
58
|
'editOrder': true,
|
|
58
59
|
'fetchAccounts': true,
|
|
59
60
|
'fetchBalance': true,
|
|
@@ -65,6 +66,7 @@ export default class coinbase extends Exchange {
|
|
|
65
66
|
'fetchCrossBorrowRate': false,
|
|
66
67
|
'fetchCrossBorrowRates': false,
|
|
67
68
|
'fetchCurrencies': true,
|
|
69
|
+
'fetchDeposit': true,
|
|
68
70
|
'fetchDepositAddress': 'emulated',
|
|
69
71
|
'fetchDepositAddresses': false,
|
|
70
72
|
'fetchDepositAddressesByNetwork': true,
|
|
@@ -193,6 +195,11 @@ export default class coinbase extends Exchange {
|
|
|
193
195
|
},
|
|
194
196
|
},
|
|
195
197
|
'v3': {
|
|
198
|
+
'public': {
|
|
199
|
+
'get': [
|
|
200
|
+
'brokerage/time',
|
|
201
|
+
],
|
|
202
|
+
},
|
|
196
203
|
'private': {
|
|
197
204
|
'get': [
|
|
198
205
|
'brokerage/accounts',
|
|
@@ -210,7 +217,6 @@ export default class coinbase extends Exchange {
|
|
|
210
217
|
'brokerage/product_book',
|
|
211
218
|
'brokerage/best_bid_ask',
|
|
212
219
|
'brokerage/convert/trade/{trade_id}',
|
|
213
|
-
'brokerage/time',
|
|
214
220
|
'brokerage/cfm/balance_summary',
|
|
215
221
|
'brokerage/cfm/positions',
|
|
216
222
|
'brokerage/cfm/positions/{product_id}',
|
|
@@ -341,6 +347,7 @@ export default class coinbase extends Exchange {
|
|
|
341
347
|
'fetchTickers': 'fetchTickersV3',
|
|
342
348
|
'fetchAccounts': 'fetchAccountsV3',
|
|
343
349
|
'fetchBalance': 'v2PrivateGetAccounts',
|
|
350
|
+
'fetchTime': 'v2PublicGetTime',
|
|
344
351
|
'user_native_currency': 'USD', // needed to get fees for v3
|
|
345
352
|
},
|
|
346
353
|
});
|
|
@@ -352,19 +359,36 @@ export default class coinbase extends Exchange {
|
|
|
352
359
|
* @description fetches the current integer timestamp in milliseconds from the exchange server
|
|
353
360
|
* @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-time#http-request
|
|
354
361
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
362
|
+
* @param {string} [params.method] 'v2PublicGetTime' or 'v3PublicGetBrokerageTime' default is 'v2PublicGetTime'
|
|
355
363
|
* @returns {int} the current integer timestamp in milliseconds from the exchange server
|
|
356
364
|
*/
|
|
357
|
-
const
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
365
|
+
const defaultMethod = this.safeString(this.options, 'fetchTime', 'v2PublicGetTime');
|
|
366
|
+
const method = this.safeString(params, 'method', defaultMethod);
|
|
367
|
+
params = this.omit(params, 'method');
|
|
368
|
+
let response = undefined;
|
|
369
|
+
if (method === 'v2PublicGetTime') {
|
|
370
|
+
response = await this.v2PublicGetTime(params);
|
|
371
|
+
//
|
|
372
|
+
// {
|
|
373
|
+
// "data": {
|
|
374
|
+
// "epoch": 1589295679,
|
|
375
|
+
// "iso": "2020-05-12T15:01:19Z"
|
|
376
|
+
// }
|
|
377
|
+
// }
|
|
378
|
+
//
|
|
379
|
+
response = this.safeValue(response, 'data', {});
|
|
380
|
+
}
|
|
381
|
+
else {
|
|
382
|
+
response = await this.v3PublicGetBrokerageTime(params);
|
|
383
|
+
//
|
|
384
|
+
// {
|
|
385
|
+
// "iso": "2024-02-27T03:37:14Z",
|
|
386
|
+
// "epochSeconds": "1709005034",
|
|
387
|
+
// "epochMillis": "1709005034333"
|
|
388
|
+
// }
|
|
389
|
+
//
|
|
390
|
+
}
|
|
391
|
+
return this.safeTimestamp2(response, 'epoch', 'epochSeconds');
|
|
368
392
|
}
|
|
369
393
|
async fetchAccounts(params = {}) {
|
|
370
394
|
/**
|
|
@@ -1760,6 +1784,7 @@ export default class coinbase extends Exchange {
|
|
|
1760
1784
|
response = await this.v3PrivateGetBrokerageAccounts(this.extend(request, params));
|
|
1761
1785
|
}
|
|
1762
1786
|
else {
|
|
1787
|
+
request['limit'] = 100;
|
|
1763
1788
|
response = await this.v2PrivateGetAccounts(this.extend(request, params));
|
|
1764
1789
|
}
|
|
1765
1790
|
//
|
|
@@ -3539,6 +3564,145 @@ export default class coinbase extends Exchange {
|
|
|
3539
3564
|
'network': this.networkIdToCode(networkId, code),
|
|
3540
3565
|
};
|
|
3541
3566
|
}
|
|
3567
|
+
async deposit(code, amount, id, params = {}) {
|
|
3568
|
+
/**
|
|
3569
|
+
* @method
|
|
3570
|
+
* @name coinbase#deposit
|
|
3571
|
+
* @description make a deposit
|
|
3572
|
+
* @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-deposits#deposit-funds
|
|
3573
|
+
* @param {string} code unified currency code
|
|
3574
|
+
* @param {float} amount the amount to deposit
|
|
3575
|
+
* @param {string} id the payment method id to be used for the deposit, can be retrieved from v2PrivateGetPaymentMethods
|
|
3576
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3577
|
+
* @param {string} [params.accountId] the id of the account to deposit into
|
|
3578
|
+
* @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
3579
|
+
*/
|
|
3580
|
+
await this.loadMarkets();
|
|
3581
|
+
let accountId = this.safeString2(params, 'account_id', 'accountId');
|
|
3582
|
+
params = this.omit(params, ['account_id', 'accountId']);
|
|
3583
|
+
if (accountId === undefined) {
|
|
3584
|
+
if (code === undefined) {
|
|
3585
|
+
throw new ArgumentsRequired(this.id + ' deposit() requires an account_id (or accountId) parameter OR a currency code argument');
|
|
3586
|
+
}
|
|
3587
|
+
accountId = await this.findAccountId(code);
|
|
3588
|
+
if (accountId === undefined) {
|
|
3589
|
+
throw new ExchangeError(this.id + ' deposit() could not find account id for ' + code);
|
|
3590
|
+
}
|
|
3591
|
+
}
|
|
3592
|
+
const request = {
|
|
3593
|
+
'account_id': accountId,
|
|
3594
|
+
'amount': this.numberToString(amount),
|
|
3595
|
+
'currency': code.toUpperCase(),
|
|
3596
|
+
'payment_method': id,
|
|
3597
|
+
};
|
|
3598
|
+
const response = await this.v2PrivatePostAccountsAccountIdDeposits(this.extend(request, params));
|
|
3599
|
+
//
|
|
3600
|
+
// {
|
|
3601
|
+
// "data": {
|
|
3602
|
+
// "id": "67e0eaec-07d7-54c4-a72c-2e92826897df",
|
|
3603
|
+
// "status": "created",
|
|
3604
|
+
// "payment_method": {
|
|
3605
|
+
// "id": "83562370-3e5c-51db-87da-752af5ab9559",
|
|
3606
|
+
// "resource": "payment_method",
|
|
3607
|
+
// "resource_path": "/v2/payment-methods/83562370-3e5c-51db-87da-752af5ab9559"
|
|
3608
|
+
// },
|
|
3609
|
+
// "transaction": {
|
|
3610
|
+
// "id": "441b9494-b3f0-5b98-b9b0-4d82c21c252a",
|
|
3611
|
+
// "resource": "transaction",
|
|
3612
|
+
// "resource_path": "/v2/accounts/2bbf394c-193b-5b2a-9155-3b4732659ede/transactions/441b9494-b3f0-5b98-b9b0-4d82c21c252a"
|
|
3613
|
+
// },
|
|
3614
|
+
// "amount": {
|
|
3615
|
+
// "amount": "10.00",
|
|
3616
|
+
// "currency": "USD"
|
|
3617
|
+
// },
|
|
3618
|
+
// "subtotal": {
|
|
3619
|
+
// "amount": "10.00",
|
|
3620
|
+
// "currency": "USD"
|
|
3621
|
+
// },
|
|
3622
|
+
// "created_at": "2015-01-31T20:49:02Z",
|
|
3623
|
+
// "updated_at": "2015-02-11T16:54:02-08:00",
|
|
3624
|
+
// "resource": "deposit",
|
|
3625
|
+
// "resource_path": "/v2/accounts/2bbf394c-193b-5b2a-9155-3b4732659ede/deposits/67e0eaec-07d7-54c4-a72c-2e92826897df",
|
|
3626
|
+
// "committed": true,
|
|
3627
|
+
// "fee": {
|
|
3628
|
+
// "amount": "0.00",
|
|
3629
|
+
// "currency": "USD"
|
|
3630
|
+
// },
|
|
3631
|
+
// "payout_at": "2015-02-18T16:54:00-08:00"
|
|
3632
|
+
// }
|
|
3633
|
+
// }
|
|
3634
|
+
//
|
|
3635
|
+
const data = this.safeDict(response, 'data', {});
|
|
3636
|
+
return this.parseTransaction(data);
|
|
3637
|
+
}
|
|
3638
|
+
async fetchDeposit(id, code = undefined, params = {}) {
|
|
3639
|
+
/**
|
|
3640
|
+
* @method
|
|
3641
|
+
* @name coinbase#fetchDeposit
|
|
3642
|
+
* @description fetch information on a deposit, fiat only, for crypto transactions use fetchLedger
|
|
3643
|
+
* @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-deposits#show-deposit
|
|
3644
|
+
* @param {string} id deposit id
|
|
3645
|
+
* @param {string} [code] unified currency code
|
|
3646
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
3647
|
+
* @param {string} [params.accountId] the id of the account that the funds were deposited into
|
|
3648
|
+
* @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
3649
|
+
*/
|
|
3650
|
+
await this.loadMarkets();
|
|
3651
|
+
let accountId = this.safeString2(params, 'account_id', 'accountId');
|
|
3652
|
+
params = this.omit(params, ['account_id', 'accountId']);
|
|
3653
|
+
if (accountId === undefined) {
|
|
3654
|
+
if (code === undefined) {
|
|
3655
|
+
throw new ArgumentsRequired(this.id + ' fetchDeposit() requires an account_id (or accountId) parameter OR a currency code argument');
|
|
3656
|
+
}
|
|
3657
|
+
accountId = await this.findAccountId(code);
|
|
3658
|
+
if (accountId === undefined) {
|
|
3659
|
+
throw new ExchangeError(this.id + ' fetchDeposit() could not find account id for ' + code);
|
|
3660
|
+
}
|
|
3661
|
+
}
|
|
3662
|
+
const request = {
|
|
3663
|
+
'account_id': accountId,
|
|
3664
|
+
'deposit_id': id,
|
|
3665
|
+
};
|
|
3666
|
+
const response = await this.v2PrivateGetAccountsAccountIdDepositsDepositId(this.extend(request, params));
|
|
3667
|
+
//
|
|
3668
|
+
// {
|
|
3669
|
+
// "data": {
|
|
3670
|
+
// "id": "67e0eaec-07d7-54c4-a72c-2e92826897df",
|
|
3671
|
+
// "status": "completed",
|
|
3672
|
+
// "payment_method": {
|
|
3673
|
+
// "id": "83562370-3e5c-51db-87da-752af5ab9559",
|
|
3674
|
+
// "resource": "payment_method",
|
|
3675
|
+
// "resource_path": "/v2/payment-methods/83562370-3e5c-51db-87da-752af5ab9559"
|
|
3676
|
+
// },
|
|
3677
|
+
// "transaction": {
|
|
3678
|
+
// "id": "441b9494-b3f0-5b98-b9b0-4d82c21c252a",
|
|
3679
|
+
// "resource": "transaction",
|
|
3680
|
+
// "resource_path": "/v2/accounts/2bbf394c-193b-5b2a-9155-3b4732659ede/transactions/441b9494-b3f0-5b98-b9b0-4d82c21c252a"
|
|
3681
|
+
// },
|
|
3682
|
+
// "amount": {
|
|
3683
|
+
// "amount": "10.00",
|
|
3684
|
+
// "currency": "USD"
|
|
3685
|
+
// },
|
|
3686
|
+
// "subtotal": {
|
|
3687
|
+
// "amount": "10.00",
|
|
3688
|
+
// "currency": "USD"
|
|
3689
|
+
// },
|
|
3690
|
+
// "created_at": "2015-01-31T20:49:02Z",
|
|
3691
|
+
// "updated_at": "2015-02-11T16:54:02-08:00",
|
|
3692
|
+
// "resource": "deposit",
|
|
3693
|
+
// "resource_path": "/v2/accounts/2bbf394c-193b-5b2a-9155-3b4732659ede/deposits/67e0eaec-07d7-54c4-a72c-2e92826897df",
|
|
3694
|
+
// "committed": true,
|
|
3695
|
+
// "fee": {
|
|
3696
|
+
// "amount": "0.00",
|
|
3697
|
+
// "currency": "USD"
|
|
3698
|
+
// },
|
|
3699
|
+
// "payout_at": "2015-02-18T16:54:00-08:00"
|
|
3700
|
+
// }
|
|
3701
|
+
// }
|
|
3702
|
+
//
|
|
3703
|
+
const data = this.safeValue(response, 'data', {});
|
|
3704
|
+
return this.parseTransaction(data);
|
|
3705
|
+
}
|
|
3542
3706
|
sign(path, api = [], method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
3543
3707
|
const version = api[0];
|
|
3544
3708
|
const signed = api[1] === 'private';
|
|
@@ -3559,6 +3723,11 @@ export default class coinbase extends Exchange {
|
|
|
3559
3723
|
'Authorization': authorization,
|
|
3560
3724
|
'Content-Type': 'application/json',
|
|
3561
3725
|
};
|
|
3726
|
+
if (method !== 'GET') {
|
|
3727
|
+
if (Object.keys(query).length) {
|
|
3728
|
+
body = this.json(query);
|
|
3729
|
+
}
|
|
3730
|
+
}
|
|
3562
3731
|
}
|
|
3563
3732
|
else if (this.token && !this.checkRequiredCredentials(false)) {
|
|
3564
3733
|
headers = {
|
|
@@ -3581,6 +3750,11 @@ export default class coinbase extends Exchange {
|
|
|
3581
3750
|
payload = body;
|
|
3582
3751
|
}
|
|
3583
3752
|
}
|
|
3753
|
+
else {
|
|
3754
|
+
if (Object.keys(query).length) {
|
|
3755
|
+
payload += '?' + this.urlencode(query);
|
|
3756
|
+
}
|
|
3757
|
+
}
|
|
3584
3758
|
const auth = nonce + method + savedPath + payload;
|
|
3585
3759
|
const signature = this.hmac(this.encode(auth), this.encode(this.secret), sha256);
|
|
3586
3760
|
headers = {
|
package/js/src/htx.js
CHANGED
|
@@ -1234,9 +1234,10 @@ export default class htx extends Exchange {
|
|
|
1234
1234
|
async fetchStatus(params = {}) {
|
|
1235
1235
|
await this.loadMarkets();
|
|
1236
1236
|
let marketType = undefined;
|
|
1237
|
-
[marketType, params] = this.handleMarketTypeAndParams('
|
|
1237
|
+
[marketType, params] = this.handleMarketTypeAndParams('fetchStatus', undefined, params);
|
|
1238
|
+
const enabledForContracts = this.handleOption('fetchStatus', 'enableForContracts', false); // temp fix for: https://status-linear-swap.huobigroup.com/api/v2/summary.json
|
|
1238
1239
|
let response = undefined;
|
|
1239
|
-
if (marketType !== 'spot') {
|
|
1240
|
+
if (marketType !== 'spot' && enabledForContracts) {
|
|
1240
1241
|
const subType = this.safeString(params, 'subType', this.options['defaultSubType']);
|
|
1241
1242
|
if (marketType === 'swap') {
|
|
1242
1243
|
if (subType === 'linear') {
|
|
@@ -1258,7 +1259,7 @@ export default class htx extends Exchange {
|
|
|
1258
1259
|
response = await this.contractPublicGetHeartbeat();
|
|
1259
1260
|
}
|
|
1260
1261
|
}
|
|
1261
|
-
else {
|
|
1262
|
+
else if (marketType === 'spot') {
|
|
1262
1263
|
response = await this.statusPublicSpotGetApiV2SummaryJson();
|
|
1263
1264
|
}
|
|
1264
1265
|
//
|
|
@@ -1427,7 +1428,12 @@ export default class htx extends Exchange {
|
|
|
1427
1428
|
let url = undefined;
|
|
1428
1429
|
if (marketType === 'contract') {
|
|
1429
1430
|
const statusRaw = this.safeString(response, 'status');
|
|
1430
|
-
|
|
1431
|
+
if (statusRaw === undefined) {
|
|
1432
|
+
status = undefined;
|
|
1433
|
+
}
|
|
1434
|
+
else {
|
|
1435
|
+
status = (statusRaw === 'ok') ? 'ok' : 'maintenance'; // 'ok', 'error'
|
|
1436
|
+
}
|
|
1431
1437
|
updated = this.safeString(response, 'ts');
|
|
1432
1438
|
}
|
|
1433
1439
|
else {
|
package/js/src/pro/bitvavo.js
CHANGED
|
@@ -105,7 +105,7 @@ export default class bitvavo extends bitvavoRest {
|
|
|
105
105
|
// "volume": "3587.05020246",
|
|
106
106
|
// "volumeQuote": "708030.17",
|
|
107
107
|
// "bid": "199.56",
|
|
108
|
-
// "bidSize": "4.
|
|
108
|
+
// "bidSize": "4.14730802",
|
|
109
109
|
// "ask": "199.57",
|
|
110
110
|
// "askSize": "6.13642074",
|
|
111
111
|
// "timestamp": 1590770885217
|
|
@@ -21,7 +21,6 @@ export default class blockchaincom extends blockchaincomRest {
|
|
|
21
21
|
handleOrderBook(client: Client, message: any): void;
|
|
22
22
|
handleDelta(bookside: any, delta: any): void;
|
|
23
23
|
handleDeltas(bookside: any, deltas: any): void;
|
|
24
|
-
checkSequenceNumber(client: Client, message: any): void;
|
|
25
24
|
handleMessage(client: Client, message: any): void;
|
|
26
25
|
handleAuthenticationMessage(client: Client, message: any): void;
|
|
27
26
|
authenticate(params?: {}): Promise<any>;
|
|
@@ -37,7 +37,6 @@ export default class blockchaincom extends blockchaincomRest {
|
|
|
37
37
|
},
|
|
38
38
|
'noOriginHeader': false,
|
|
39
39
|
},
|
|
40
|
-
'sequenceNumbers': {},
|
|
41
40
|
},
|
|
42
41
|
'streaming': {},
|
|
43
42
|
'exceptions': {},
|
|
@@ -681,21 +680,20 @@ export default class blockchaincom extends blockchaincomRest {
|
|
|
681
680
|
// }
|
|
682
681
|
//
|
|
683
682
|
const event = this.safeString(message, 'event');
|
|
683
|
+
if (event === 'subscribed') {
|
|
684
|
+
return;
|
|
685
|
+
}
|
|
684
686
|
const type = this.safeString(message, 'channel');
|
|
685
687
|
const marketId = this.safeString(message, 'symbol');
|
|
686
688
|
const symbol = this.safeSymbol(marketId);
|
|
687
689
|
const messageHash = 'orderbook:' + symbol + ':' + type;
|
|
688
690
|
const datetime = this.safeString(message, 'timestamp');
|
|
689
691
|
const timestamp = this.parse8601(datetime);
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
orderbook = this.countedOrderBook({});
|
|
693
|
-
this.orderbooks[symbol] = orderbook;
|
|
694
|
-
}
|
|
695
|
-
if (event === 'subscribed') {
|
|
696
|
-
return;
|
|
692
|
+
if (this.safeValue(this.orderbooks, symbol) === undefined) {
|
|
693
|
+
this.orderbooks[symbol] = this.countedOrderBook();
|
|
697
694
|
}
|
|
698
|
-
|
|
695
|
+
const orderbook = this.orderbooks[symbol];
|
|
696
|
+
if (event === 'snapshot') {
|
|
699
697
|
const snapshot = this.parseOrderBook(message, symbol, timestamp, 'bids', 'asks', 'px', 'qty', 'num');
|
|
700
698
|
orderbook.reset(snapshot);
|
|
701
699
|
}
|
|
@@ -721,23 +719,7 @@ export default class blockchaincom extends blockchaincomRest {
|
|
|
721
719
|
this.handleDelta(bookside, deltas[i]);
|
|
722
720
|
}
|
|
723
721
|
}
|
|
724
|
-
checkSequenceNumber(client, message) {
|
|
725
|
-
const seqnum = this.safeInteger(message, 'seqnum', 0);
|
|
726
|
-
const channel = this.safeString(message, 'channel', '');
|
|
727
|
-
const sequenceNumbersByChannel = this.safeValue(this.options, 'sequenceNumbers', {});
|
|
728
|
-
const lastSeqnum = this.safeInteger(sequenceNumbersByChannel, channel);
|
|
729
|
-
if (lastSeqnum === undefined) {
|
|
730
|
-
this.options['sequenceNumbers'][channel] = seqnum;
|
|
731
|
-
}
|
|
732
|
-
else {
|
|
733
|
-
if (seqnum !== lastSeqnum + 1) {
|
|
734
|
-
throw new ExchangeError(this.id + ' ' + channel + ' seqnum ' + seqnum + ' is not the expected ' + (lastSeqnum + 1));
|
|
735
|
-
}
|
|
736
|
-
this.options['sequenceNumbers'][channel] = seqnum;
|
|
737
|
-
}
|
|
738
|
-
}
|
|
739
722
|
handleMessage(client, message) {
|
|
740
|
-
this.checkSequenceNumber(client, message);
|
|
741
723
|
const channel = this.safeString(message, 'channel');
|
|
742
724
|
const handlers = {
|
|
743
725
|
'ticker': this.handleTicker,
|
package/js/src/pro/deribit.js
CHANGED
|
@@ -180,7 +180,7 @@ export default class deribit extends deribitRest {
|
|
|
180
180
|
// "params": {
|
|
181
181
|
// "channel": "ticker.BTC_USDC-PERPETUAL.raw",
|
|
182
182
|
// "data": {
|
|
183
|
-
// "timestamp":
|
|
183
|
+
// "timestamp": 1655393725040,
|
|
184
184
|
// "stats": [Object],
|
|
185
185
|
// "state": "open",
|
|
186
186
|
// "settlement_price": 21729.5891,
|
|
@@ -663,7 +663,7 @@ export default class deribit extends deribitRest {
|
|
|
663
663
|
const symbol = this.safeSymbol(marketId);
|
|
664
664
|
const ohlcv = this.safeValue(params, 'data', {});
|
|
665
665
|
const parsed = [
|
|
666
|
-
this.
|
|
666
|
+
this.safeInteger(ohlcv, 'tick'),
|
|
667
667
|
this.safeNumber(ohlcv, 'open'),
|
|
668
668
|
this.safeNumber(ohlcv, 'high'),
|
|
669
669
|
this.safeNumber(ohlcv, 'low'),
|