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/README.md
CHANGED
|
@@ -209,13 +209,13 @@ console.log(version, Object.keys(exchanges));
|
|
|
209
209
|
|
|
210
210
|
All-in-one browser bundle (dependencies included), served from a CDN of your choice:
|
|
211
211
|
|
|
212
|
-
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.2.
|
|
213
|
-
* unpkg: https://unpkg.com/ccxt@4.2.
|
|
212
|
+
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.2.53/dist/ccxt.browser.js
|
|
213
|
+
* unpkg: https://unpkg.com/ccxt@4.2.53/dist/ccxt.browser.js
|
|
214
214
|
|
|
215
215
|
CDNs are not updated in real-time and may have delays. Defaulting to the most recent version without specifying the version number is not recommended. Please, keep in mind that we are not responsible for the correct operation of those CDN servers.
|
|
216
216
|
|
|
217
217
|
```HTML
|
|
218
|
-
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.2.
|
|
218
|
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.2.53/dist/ccxt.browser.js"></script>
|
|
219
219
|
```
|
|
220
220
|
|
|
221
221
|
Creates a global `ccxt` object:
|
package/build.sh
CHANGED
|
@@ -116,7 +116,7 @@ diff=$(echo "$diff" | sed -e "s/^ts\/src\/test\/static.*json//") #remove static
|
|
|
116
116
|
# diff=$(echo "$diff" | sed -e "s/^\.travis\.yml//")
|
|
117
117
|
# diff=$(echo "$diff" | sed -e "s/^package\-lock\.json//")
|
|
118
118
|
# diff=$(echo "$diff" | sed -e "s/python\/qa\.py//")
|
|
119
|
-
#echo $diff
|
|
119
|
+
#echo $diff
|
|
120
120
|
|
|
121
121
|
critical_pattern='Client(Trait)?\.php|Exchange\.php|\/base|^build|static_dependencies|^run-tests|package(-lock)?\.json|composer\.json|ccxt\.ts|__init__.py|test' # add \/test|
|
|
122
122
|
if [[ "$diff" =~ $critical_pattern ]]; then
|
package/dist/ccxt.browser.js
CHANGED
|
@@ -18127,13 +18127,13 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
18127
18127
|
'closeAllPositions': false,
|
|
18128
18128
|
'closePosition': false,
|
|
18129
18129
|
'createDepositAddress': false,
|
|
18130
|
-
'createMarketBuyOrderWithCost': true,
|
|
18131
|
-
'createMarketOrderWithCost': true,
|
|
18132
|
-
'createMarketSellOrderWithCost': true,
|
|
18133
18130
|
'createLimitBuyOrder': true,
|
|
18134
18131
|
'createLimitSellOrder': true,
|
|
18135
18132
|
'createMarketBuyOrder': true,
|
|
18133
|
+
'createMarketBuyOrderWithCost': true,
|
|
18134
|
+
'createMarketOrderWithCost': true,
|
|
18136
18135
|
'createMarketSellOrder': true,
|
|
18136
|
+
'createMarketSellOrderWithCost': true,
|
|
18137
18137
|
'createOrder': true,
|
|
18138
18138
|
'createOrders': true,
|
|
18139
18139
|
'createOrderWithTakeProfitAndStopLoss': true,
|
|
@@ -18153,6 +18153,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
18153
18153
|
'fetchBorrowInterest': true,
|
|
18154
18154
|
'fetchBorrowRateHistories': false,
|
|
18155
18155
|
'fetchBorrowRateHistory': true,
|
|
18156
|
+
'fetchCanceledAndClosedOrders': 'emulated',
|
|
18156
18157
|
'fetchCanceledOrders': 'emulated',
|
|
18157
18158
|
'fetchClosedOrder': false,
|
|
18158
18159
|
'fetchClosedOrders': 'emulated',
|
|
@@ -18210,7 +18211,7 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
18210
18211
|
'fetchTrades': true,
|
|
18211
18212
|
'fetchTradingFee': true,
|
|
18212
18213
|
'fetchTradingFees': true,
|
|
18213
|
-
'fetchTradingLimits':
|
|
18214
|
+
'fetchTradingLimits': 'emulated',
|
|
18214
18215
|
'fetchTransactionFee': 'emulated',
|
|
18215
18216
|
'fetchTransactionFees': true,
|
|
18216
18217
|
'fetchTransactions': false,
|
|
@@ -24909,6 +24910,38 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
24909
24910
|
const filteredOrders = this.filterBy(orders, 'status', 'canceled');
|
|
24910
24911
|
return this.filterBySinceLimit(filteredOrders, since, limit);
|
|
24911
24912
|
}
|
|
24913
|
+
async fetchCanceledAndClosedOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
24914
|
+
/**
|
|
24915
|
+
* @method
|
|
24916
|
+
* @name binance#fetchCanceledAndClosedOrders
|
|
24917
|
+
* @description fetches information on multiple canceled orders made by the user
|
|
24918
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#all-orders-user_data
|
|
24919
|
+
* @see https://binance-docs.github.io/apidocs/spot/en/#query-margin-account-39-s-all-orders-user_data
|
|
24920
|
+
* @see https://binance-docs.github.io/apidocs/voptions/en/#query-option-order-history-trade
|
|
24921
|
+
* @see https://binance-docs.github.io/apidocs/pm/en/#query-all-um-orders-user_data
|
|
24922
|
+
* @see https://binance-docs.github.io/apidocs/pm/en/#query-all-cm-orders-user_data
|
|
24923
|
+
* @see https://binance-docs.github.io/apidocs/pm/en/#query-all-um-conditional-orders-user_data
|
|
24924
|
+
* @see https://binance-docs.github.io/apidocs/pm/en/#query-all-cm-conditional-orders-user_data
|
|
24925
|
+
* @see https://binance-docs.github.io/apidocs/pm/en/#query-all-margin-account-orders-user_data
|
|
24926
|
+
* @param {string} symbol unified market symbol of the market the orders were made in
|
|
24927
|
+
* @param {int} [since] the earliest time in ms to fetch orders for
|
|
24928
|
+
* @param {int} [limit] the maximum number of order structures to retrieve
|
|
24929
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
24930
|
+
* @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)
|
|
24931
|
+
* @param {boolean} [params.portfolioMargin] set to true if you would like to fetch orders in a portfolio margin account
|
|
24932
|
+
* @param {boolean} [params.stop] set to true if you would like to fetch portfolio margin account stop or conditional orders
|
|
24933
|
+
* @returns {object[]} a list of [order structures]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
24934
|
+
*/
|
|
24935
|
+
if (symbol === undefined) {
|
|
24936
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' fetchCanceledAndClosedOrders() requires a symbol argument');
|
|
24937
|
+
}
|
|
24938
|
+
const orders = await this.fetchOrders(symbol, since, undefined, params);
|
|
24939
|
+
const canceledOrders = this.filterBy(orders, 'status', 'canceled');
|
|
24940
|
+
const closedOrders = this.filterBy(orders, 'status', 'closed');
|
|
24941
|
+
const filteredOrders = this.arrayConcat(canceledOrders, closedOrders);
|
|
24942
|
+
const sortedOrders = this.sortBy(filteredOrders, 'timestamp');
|
|
24943
|
+
return this.filterBySinceLimit(sortedOrders, since, limit);
|
|
24944
|
+
}
|
|
24912
24945
|
async cancelOrder(id, symbol = undefined, params = {}) {
|
|
24913
24946
|
/**
|
|
24914
24947
|
* @method
|
|
@@ -30080,6 +30113,19 @@ class binance extends _abstract_binance_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
30080
30113
|
'info': greeks,
|
|
30081
30114
|
};
|
|
30082
30115
|
}
|
|
30116
|
+
async fetchTradingLimits(symbols = undefined, params = {}) {
|
|
30117
|
+
// this method should not be called directly, use loadTradingLimits () instead
|
|
30118
|
+
const markets = await this.fetchMarkets();
|
|
30119
|
+
const tradingLimits = {};
|
|
30120
|
+
for (let i = 0; i < markets.length; i++) {
|
|
30121
|
+
const market = markets[i];
|
|
30122
|
+
const symbol = market['symbol'];
|
|
30123
|
+
if ((symbols === undefined) || (this.inArray(symbol, symbols))) {
|
|
30124
|
+
tradingLimits[symbol] = market['limits']['amount'];
|
|
30125
|
+
}
|
|
30126
|
+
}
|
|
30127
|
+
return tradingLimits;
|
|
30128
|
+
}
|
|
30083
30129
|
async fetchPositionMode(symbol = undefined, params = {}) {
|
|
30084
30130
|
/**
|
|
30085
30131
|
* @method
|
|
@@ -30532,6 +30578,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
30532
30578
|
'fetchOpenOrders': true,
|
|
30533
30579
|
'fetchOrder': true,
|
|
30534
30580
|
'fetchOrderBook': true,
|
|
30581
|
+
'fetchPositionMode': true,
|
|
30535
30582
|
'fetchPositions': true,
|
|
30536
30583
|
'fetchTicker': true,
|
|
30537
30584
|
'fetchTickers': true,
|
|
@@ -30542,6 +30589,7 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
30542
30589
|
'setLeverage': true,
|
|
30543
30590
|
'setMargin': true,
|
|
30544
30591
|
'setMarginMode': true,
|
|
30592
|
+
'setPositionMode': true,
|
|
30545
30593
|
'transfer': true,
|
|
30546
30594
|
},
|
|
30547
30595
|
'hostname': 'bingx.com',
|
|
@@ -33968,13 +34016,14 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
33968
34016
|
* @param {float} leverage the rate of leverage
|
|
33969
34017
|
* @param {string} symbol unified market symbol
|
|
33970
34018
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
34019
|
+
* @param {string} [params.side] hedged: ['long' or 'short']. one way: ['both']
|
|
33971
34020
|
* @returns {object} response from the exchange
|
|
33972
34021
|
*/
|
|
33973
34022
|
if (symbol === undefined) {
|
|
33974
34023
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' setLeverage() requires a symbol argument');
|
|
33975
34024
|
}
|
|
33976
34025
|
const side = this.safeStringUpper(params, 'side');
|
|
33977
|
-
this.checkRequiredArgument('setLeverage', side, 'side', ['LONG', 'SHORT']);
|
|
34026
|
+
this.checkRequiredArgument('setLeverage', side, 'side', ['LONG', 'SHORT', 'BOTH']);
|
|
33978
34027
|
await this.loadMarkets();
|
|
33979
34028
|
const market = this.market(symbol);
|
|
33980
34029
|
const request = {
|
|
@@ -34418,6 +34467,34 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
34418
34467
|
}
|
|
34419
34468
|
return positions;
|
|
34420
34469
|
}
|
|
34470
|
+
async fetchPositionMode(symbol = undefined, params = {}) {
|
|
34471
|
+
/**
|
|
34472
|
+
* @method
|
|
34473
|
+
* @name bingx#fetchPositionMode
|
|
34474
|
+
* @description fetchs the position mode, hedged or one way, hedged for binance is set identically for all linear markets or all inverse markets
|
|
34475
|
+
* @see https://bingx-api.github.io/docs/#/en-us/swapV2/trade-api.html#Get%20Position%20Mode
|
|
34476
|
+
* @param {string} symbol unified symbol of the market to fetch the order book for
|
|
34477
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
34478
|
+
* @returns {object} an object detailing whether the market is in hedged or one-way mode
|
|
34479
|
+
*/
|
|
34480
|
+
const response = await this.swapV1PrivateGetPositionSideDual(params);
|
|
34481
|
+
//
|
|
34482
|
+
// {
|
|
34483
|
+
// "code": "0",
|
|
34484
|
+
// "msg": "",
|
|
34485
|
+
// "timeStamp": "1709002057516",
|
|
34486
|
+
// "data": {
|
|
34487
|
+
// "dualSidePosition": "false"
|
|
34488
|
+
// }
|
|
34489
|
+
// }
|
|
34490
|
+
//
|
|
34491
|
+
const data = this.safeDict(response, 'data', {});
|
|
34492
|
+
const dualSidePosition = this.safeString(data, 'dualSidePosition');
|
|
34493
|
+
return {
|
|
34494
|
+
'info': response,
|
|
34495
|
+
'hedged': (dualSidePosition === 'true'),
|
|
34496
|
+
};
|
|
34497
|
+
}
|
|
34421
34498
|
async setPositionMode(hedged, symbol = undefined, params = {}) {
|
|
34422
34499
|
/**
|
|
34423
34500
|
* @method
|
|
@@ -47955,6 +48032,7 @@ class bitget extends _abstract_bitget_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
47955
48032
|
'not_trigger': 'open',
|
|
47956
48033
|
'partial_fill': 'open',
|
|
47957
48034
|
'partially_fill': 'open',
|
|
48035
|
+
'partially_filled': 'open',
|
|
47958
48036
|
'triggered': 'closed',
|
|
47959
48037
|
'full_fill': 'closed',
|
|
47960
48038
|
'filled': 'closed',
|
|
@@ -73137,7 +73215,7 @@ class bitvavo extends _abstract_bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["defa
|
|
|
73137
73215
|
// "market":"ETH-BTC",
|
|
73138
73216
|
// "open":"0.022578",
|
|
73139
73217
|
// "high":"0.023019",
|
|
73140
|
-
// "low":"0.
|
|
73218
|
+
// "low":"0.022572",
|
|
73141
73219
|
// "last":"0.023019",
|
|
73142
73220
|
// "volume":"25.16366324",
|
|
73143
73221
|
// "volumeQuote":"0.57333305",
|
|
@@ -92029,6 +92107,7 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
92029
92107
|
'createStopLimitOrder': true,
|
|
92030
92108
|
'createStopMarketOrder': false,
|
|
92031
92109
|
'createStopOrder': true,
|
|
92110
|
+
'deposit': true,
|
|
92032
92111
|
'editOrder': true,
|
|
92033
92112
|
'fetchAccounts': true,
|
|
92034
92113
|
'fetchBalance': true,
|
|
@@ -92040,6 +92119,7 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
92040
92119
|
'fetchCrossBorrowRate': false,
|
|
92041
92120
|
'fetchCrossBorrowRates': false,
|
|
92042
92121
|
'fetchCurrencies': true,
|
|
92122
|
+
'fetchDeposit': true,
|
|
92043
92123
|
'fetchDepositAddress': 'emulated',
|
|
92044
92124
|
'fetchDepositAddresses': false,
|
|
92045
92125
|
'fetchDepositAddressesByNetwork': true,
|
|
@@ -92168,6 +92248,11 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
92168
92248
|
},
|
|
92169
92249
|
},
|
|
92170
92250
|
'v3': {
|
|
92251
|
+
'public': {
|
|
92252
|
+
'get': [
|
|
92253
|
+
'brokerage/time',
|
|
92254
|
+
],
|
|
92255
|
+
},
|
|
92171
92256
|
'private': {
|
|
92172
92257
|
'get': [
|
|
92173
92258
|
'brokerage/accounts',
|
|
@@ -92185,7 +92270,6 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
92185
92270
|
'brokerage/product_book',
|
|
92186
92271
|
'brokerage/best_bid_ask',
|
|
92187
92272
|
'brokerage/convert/trade/{trade_id}',
|
|
92188
|
-
'brokerage/time',
|
|
92189
92273
|
'brokerage/cfm/balance_summary',
|
|
92190
92274
|
'brokerage/cfm/positions',
|
|
92191
92275
|
'brokerage/cfm/positions/{product_id}',
|
|
@@ -92316,6 +92400,7 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
92316
92400
|
'fetchTickers': 'fetchTickersV3',
|
|
92317
92401
|
'fetchAccounts': 'fetchAccountsV3',
|
|
92318
92402
|
'fetchBalance': 'v2PrivateGetAccounts',
|
|
92403
|
+
'fetchTime': 'v2PublicGetTime',
|
|
92319
92404
|
'user_native_currency': 'USD', // needed to get fees for v3
|
|
92320
92405
|
},
|
|
92321
92406
|
});
|
|
@@ -92327,19 +92412,36 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
92327
92412
|
* @description fetches the current integer timestamp in milliseconds from the exchange server
|
|
92328
92413
|
* @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-time#http-request
|
|
92329
92414
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
92415
|
+
* @param {string} [params.method] 'v2PublicGetTime' or 'v3PublicGetBrokerageTime' default is 'v2PublicGetTime'
|
|
92330
92416
|
* @returns {int} the current integer timestamp in milliseconds from the exchange server
|
|
92331
92417
|
*/
|
|
92332
|
-
const
|
|
92333
|
-
|
|
92334
|
-
|
|
92335
|
-
|
|
92336
|
-
|
|
92337
|
-
|
|
92338
|
-
|
|
92339
|
-
|
|
92340
|
-
|
|
92341
|
-
|
|
92342
|
-
|
|
92418
|
+
const defaultMethod = this.safeString(this.options, 'fetchTime', 'v2PublicGetTime');
|
|
92419
|
+
const method = this.safeString(params, 'method', defaultMethod);
|
|
92420
|
+
params = this.omit(params, 'method');
|
|
92421
|
+
let response = undefined;
|
|
92422
|
+
if (method === 'v2PublicGetTime') {
|
|
92423
|
+
response = await this.v2PublicGetTime(params);
|
|
92424
|
+
//
|
|
92425
|
+
// {
|
|
92426
|
+
// "data": {
|
|
92427
|
+
// "epoch": 1589295679,
|
|
92428
|
+
// "iso": "2020-05-12T15:01:19Z"
|
|
92429
|
+
// }
|
|
92430
|
+
// }
|
|
92431
|
+
//
|
|
92432
|
+
response = this.safeValue(response, 'data', {});
|
|
92433
|
+
}
|
|
92434
|
+
else {
|
|
92435
|
+
response = await this.v3PublicGetBrokerageTime(params);
|
|
92436
|
+
//
|
|
92437
|
+
// {
|
|
92438
|
+
// "iso": "2024-02-27T03:37:14Z",
|
|
92439
|
+
// "epochSeconds": "1709005034",
|
|
92440
|
+
// "epochMillis": "1709005034333"
|
|
92441
|
+
// }
|
|
92442
|
+
//
|
|
92443
|
+
}
|
|
92444
|
+
return this.safeTimestamp2(response, 'epoch', 'epochSeconds');
|
|
92343
92445
|
}
|
|
92344
92446
|
async fetchAccounts(params = {}) {
|
|
92345
92447
|
/**
|
|
@@ -93735,6 +93837,7 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
93735
93837
|
response = await this.v3PrivateGetBrokerageAccounts(this.extend(request, params));
|
|
93736
93838
|
}
|
|
93737
93839
|
else {
|
|
93840
|
+
request['limit'] = 100;
|
|
93738
93841
|
response = await this.v2PrivateGetAccounts(this.extend(request, params));
|
|
93739
93842
|
}
|
|
93740
93843
|
//
|
|
@@ -95514,6 +95617,145 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
95514
95617
|
'network': this.networkIdToCode(networkId, code),
|
|
95515
95618
|
};
|
|
95516
95619
|
}
|
|
95620
|
+
async deposit(code, amount, id, params = {}) {
|
|
95621
|
+
/**
|
|
95622
|
+
* @method
|
|
95623
|
+
* @name coinbase#deposit
|
|
95624
|
+
* @description make a deposit
|
|
95625
|
+
* @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-deposits#deposit-funds
|
|
95626
|
+
* @param {string} code unified currency code
|
|
95627
|
+
* @param {float} amount the amount to deposit
|
|
95628
|
+
* @param {string} id the payment method id to be used for the deposit, can be retrieved from v2PrivateGetPaymentMethods
|
|
95629
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
95630
|
+
* @param {string} [params.accountId] the id of the account to deposit into
|
|
95631
|
+
* @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
95632
|
+
*/
|
|
95633
|
+
await this.loadMarkets();
|
|
95634
|
+
let accountId = this.safeString2(params, 'account_id', 'accountId');
|
|
95635
|
+
params = this.omit(params, ['account_id', 'accountId']);
|
|
95636
|
+
if (accountId === undefined) {
|
|
95637
|
+
if (code === undefined) {
|
|
95638
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' deposit() requires an account_id (or accountId) parameter OR a currency code argument');
|
|
95639
|
+
}
|
|
95640
|
+
accountId = await this.findAccountId(code);
|
|
95641
|
+
if (accountId === undefined) {
|
|
95642
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError(this.id + ' deposit() could not find account id for ' + code);
|
|
95643
|
+
}
|
|
95644
|
+
}
|
|
95645
|
+
const request = {
|
|
95646
|
+
'account_id': accountId,
|
|
95647
|
+
'amount': this.numberToString(amount),
|
|
95648
|
+
'currency': code.toUpperCase(),
|
|
95649
|
+
'payment_method': id,
|
|
95650
|
+
};
|
|
95651
|
+
const response = await this.v2PrivatePostAccountsAccountIdDeposits(this.extend(request, params));
|
|
95652
|
+
//
|
|
95653
|
+
// {
|
|
95654
|
+
// "data": {
|
|
95655
|
+
// "id": "67e0eaec-07d7-54c4-a72c-2e92826897df",
|
|
95656
|
+
// "status": "created",
|
|
95657
|
+
// "payment_method": {
|
|
95658
|
+
// "id": "83562370-3e5c-51db-87da-752af5ab9559",
|
|
95659
|
+
// "resource": "payment_method",
|
|
95660
|
+
// "resource_path": "/v2/payment-methods/83562370-3e5c-51db-87da-752af5ab9559"
|
|
95661
|
+
// },
|
|
95662
|
+
// "transaction": {
|
|
95663
|
+
// "id": "441b9494-b3f0-5b98-b9b0-4d82c21c252a",
|
|
95664
|
+
// "resource": "transaction",
|
|
95665
|
+
// "resource_path": "/v2/accounts/2bbf394c-193b-5b2a-9155-3b4732659ede/transactions/441b9494-b3f0-5b98-b9b0-4d82c21c252a"
|
|
95666
|
+
// },
|
|
95667
|
+
// "amount": {
|
|
95668
|
+
// "amount": "10.00",
|
|
95669
|
+
// "currency": "USD"
|
|
95670
|
+
// },
|
|
95671
|
+
// "subtotal": {
|
|
95672
|
+
// "amount": "10.00",
|
|
95673
|
+
// "currency": "USD"
|
|
95674
|
+
// },
|
|
95675
|
+
// "created_at": "2015-01-31T20:49:02Z",
|
|
95676
|
+
// "updated_at": "2015-02-11T16:54:02-08:00",
|
|
95677
|
+
// "resource": "deposit",
|
|
95678
|
+
// "resource_path": "/v2/accounts/2bbf394c-193b-5b2a-9155-3b4732659ede/deposits/67e0eaec-07d7-54c4-a72c-2e92826897df",
|
|
95679
|
+
// "committed": true,
|
|
95680
|
+
// "fee": {
|
|
95681
|
+
// "amount": "0.00",
|
|
95682
|
+
// "currency": "USD"
|
|
95683
|
+
// },
|
|
95684
|
+
// "payout_at": "2015-02-18T16:54:00-08:00"
|
|
95685
|
+
// }
|
|
95686
|
+
// }
|
|
95687
|
+
//
|
|
95688
|
+
const data = this.safeDict(response, 'data', {});
|
|
95689
|
+
return this.parseTransaction(data);
|
|
95690
|
+
}
|
|
95691
|
+
async fetchDeposit(id, code = undefined, params = {}) {
|
|
95692
|
+
/**
|
|
95693
|
+
* @method
|
|
95694
|
+
* @name coinbase#fetchDeposit
|
|
95695
|
+
* @description fetch information on a deposit, fiat only, for crypto transactions use fetchLedger
|
|
95696
|
+
* @see https://docs.cloud.coinbase.com/sign-in-with-coinbase/docs/api-deposits#show-deposit
|
|
95697
|
+
* @param {string} id deposit id
|
|
95698
|
+
* @param {string} [code] unified currency code
|
|
95699
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
95700
|
+
* @param {string} [params.accountId] the id of the account that the funds were deposited into
|
|
95701
|
+
* @returns {object} a [transaction structure]{@link https://docs.ccxt.com/#/?id=transaction-structure}
|
|
95702
|
+
*/
|
|
95703
|
+
await this.loadMarkets();
|
|
95704
|
+
let accountId = this.safeString2(params, 'account_id', 'accountId');
|
|
95705
|
+
params = this.omit(params, ['account_id', 'accountId']);
|
|
95706
|
+
if (accountId === undefined) {
|
|
95707
|
+
if (code === undefined) {
|
|
95708
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ArgumentsRequired(this.id + ' fetchDeposit() requires an account_id (or accountId) parameter OR a currency code argument');
|
|
95709
|
+
}
|
|
95710
|
+
accountId = await this.findAccountId(code);
|
|
95711
|
+
if (accountId === undefined) {
|
|
95712
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.ExchangeError(this.id + ' fetchDeposit() could not find account id for ' + code);
|
|
95713
|
+
}
|
|
95714
|
+
}
|
|
95715
|
+
const request = {
|
|
95716
|
+
'account_id': accountId,
|
|
95717
|
+
'deposit_id': id,
|
|
95718
|
+
};
|
|
95719
|
+
const response = await this.v2PrivateGetAccountsAccountIdDepositsDepositId(this.extend(request, params));
|
|
95720
|
+
//
|
|
95721
|
+
// {
|
|
95722
|
+
// "data": {
|
|
95723
|
+
// "id": "67e0eaec-07d7-54c4-a72c-2e92826897df",
|
|
95724
|
+
// "status": "completed",
|
|
95725
|
+
// "payment_method": {
|
|
95726
|
+
// "id": "83562370-3e5c-51db-87da-752af5ab9559",
|
|
95727
|
+
// "resource": "payment_method",
|
|
95728
|
+
// "resource_path": "/v2/payment-methods/83562370-3e5c-51db-87da-752af5ab9559"
|
|
95729
|
+
// },
|
|
95730
|
+
// "transaction": {
|
|
95731
|
+
// "id": "441b9494-b3f0-5b98-b9b0-4d82c21c252a",
|
|
95732
|
+
// "resource": "transaction",
|
|
95733
|
+
// "resource_path": "/v2/accounts/2bbf394c-193b-5b2a-9155-3b4732659ede/transactions/441b9494-b3f0-5b98-b9b0-4d82c21c252a"
|
|
95734
|
+
// },
|
|
95735
|
+
// "amount": {
|
|
95736
|
+
// "amount": "10.00",
|
|
95737
|
+
// "currency": "USD"
|
|
95738
|
+
// },
|
|
95739
|
+
// "subtotal": {
|
|
95740
|
+
// "amount": "10.00",
|
|
95741
|
+
// "currency": "USD"
|
|
95742
|
+
// },
|
|
95743
|
+
// "created_at": "2015-01-31T20:49:02Z",
|
|
95744
|
+
// "updated_at": "2015-02-11T16:54:02-08:00",
|
|
95745
|
+
// "resource": "deposit",
|
|
95746
|
+
// "resource_path": "/v2/accounts/2bbf394c-193b-5b2a-9155-3b4732659ede/deposits/67e0eaec-07d7-54c4-a72c-2e92826897df",
|
|
95747
|
+
// "committed": true,
|
|
95748
|
+
// "fee": {
|
|
95749
|
+
// "amount": "0.00",
|
|
95750
|
+
// "currency": "USD"
|
|
95751
|
+
// },
|
|
95752
|
+
// "payout_at": "2015-02-18T16:54:00-08:00"
|
|
95753
|
+
// }
|
|
95754
|
+
// }
|
|
95755
|
+
//
|
|
95756
|
+
const data = this.safeValue(response, 'data', {});
|
|
95757
|
+
return this.parseTransaction(data);
|
|
95758
|
+
}
|
|
95517
95759
|
sign(path, api = [], method = 'GET', params = {}, headers = undefined, body = undefined) {
|
|
95518
95760
|
const version = api[0];
|
|
95519
95761
|
const signed = api[1] === 'private';
|
|
@@ -95534,6 +95776,11 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
95534
95776
|
'Authorization': authorization,
|
|
95535
95777
|
'Content-Type': 'application/json',
|
|
95536
95778
|
};
|
|
95779
|
+
if (method !== 'GET') {
|
|
95780
|
+
if (Object.keys(query).length) {
|
|
95781
|
+
body = this.json(query);
|
|
95782
|
+
}
|
|
95783
|
+
}
|
|
95537
95784
|
}
|
|
95538
95785
|
else if (this.token && !this.checkRequiredCredentials(false)) {
|
|
95539
95786
|
headers = {
|
|
@@ -95556,6 +95803,11 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
95556
95803
|
payload = body;
|
|
95557
95804
|
}
|
|
95558
95805
|
}
|
|
95806
|
+
else {
|
|
95807
|
+
if (Object.keys(query).length) {
|
|
95808
|
+
payload += '?' + this.urlencode(query);
|
|
95809
|
+
}
|
|
95810
|
+
}
|
|
95559
95811
|
const auth = nonce + method + savedPath + payload;
|
|
95560
95812
|
const signature = this.hmac(this.encode(auth), this.encode(this.secret), _static_dependencies_noble_hashes_sha256_js__WEBPACK_IMPORTED_MODULE_4__/* .sha256 */ .J);
|
|
95561
95813
|
headers = {
|
|
@@ -147610,9 +147862,10 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
147610
147862
|
async fetchStatus(params = {}) {
|
|
147611
147863
|
await this.loadMarkets();
|
|
147612
147864
|
let marketType = undefined;
|
|
147613
|
-
[marketType, params] = this.handleMarketTypeAndParams('
|
|
147865
|
+
[marketType, params] = this.handleMarketTypeAndParams('fetchStatus', undefined, params);
|
|
147866
|
+
const enabledForContracts = this.handleOption('fetchStatus', 'enableForContracts', false); // temp fix for: https://status-linear-swap.huobigroup.com/api/v2/summary.json
|
|
147614
147867
|
let response = undefined;
|
|
147615
|
-
if (marketType !== 'spot') {
|
|
147868
|
+
if (marketType !== 'spot' && enabledForContracts) {
|
|
147616
147869
|
const subType = this.safeString(params, 'subType', this.options['defaultSubType']);
|
|
147617
147870
|
if (marketType === 'swap') {
|
|
147618
147871
|
if (subType === 'linear') {
|
|
@@ -147634,7 +147887,7 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
147634
147887
|
response = await this.contractPublicGetHeartbeat();
|
|
147635
147888
|
}
|
|
147636
147889
|
}
|
|
147637
|
-
else {
|
|
147890
|
+
else if (marketType === 'spot') {
|
|
147638
147891
|
response = await this.statusPublicSpotGetApiV2SummaryJson();
|
|
147639
147892
|
}
|
|
147640
147893
|
//
|
|
@@ -147803,7 +148056,12 @@ class htx extends _abstract_htx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
147803
148056
|
let url = undefined;
|
|
147804
148057
|
if (marketType === 'contract') {
|
|
147805
148058
|
const statusRaw = this.safeString(response, 'status');
|
|
147806
|
-
|
|
148059
|
+
if (statusRaw === undefined) {
|
|
148060
|
+
status = undefined;
|
|
148061
|
+
}
|
|
148062
|
+
else {
|
|
148063
|
+
status = (statusRaw === 'ok') ? 'ok' : 'maintenance'; // 'ok', 'error'
|
|
148064
|
+
}
|
|
147807
148065
|
updated = this.safeString(response, 'ts');
|
|
147808
148066
|
}
|
|
147809
148067
|
else {
|
|
@@ -232428,7 +232686,7 @@ class bitvavo extends _bitvavo_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
232428
232686
|
// "volume": "3587.05020246",
|
|
232429
232687
|
// "volumeQuote": "708030.17",
|
|
232430
232688
|
// "bid": "199.56",
|
|
232431
|
-
// "bidSize": "4.
|
|
232689
|
+
// "bidSize": "4.14730802",
|
|
232432
232690
|
// "ask": "199.57",
|
|
232433
232691
|
// "askSize": "6.13642074",
|
|
232434
232692
|
// "timestamp": 1590770885217
|
|
@@ -233725,7 +233983,6 @@ class blockchaincom extends _blockchaincom_js__WEBPACK_IMPORTED_MODULE_0__/* ["d
|
|
|
233725
233983
|
},
|
|
233726
233984
|
'noOriginHeader': false,
|
|
233727
233985
|
},
|
|
233728
|
-
'sequenceNumbers': {},
|
|
233729
233986
|
},
|
|
233730
233987
|
'streaming': {},
|
|
233731
233988
|
'exceptions': {},
|
|
@@ -234369,21 +234626,20 @@ class blockchaincom extends _blockchaincom_js__WEBPACK_IMPORTED_MODULE_0__/* ["d
|
|
|
234369
234626
|
// }
|
|
234370
234627
|
//
|
|
234371
234628
|
const event = this.safeString(message, 'event');
|
|
234629
|
+
if (event === 'subscribed') {
|
|
234630
|
+
return;
|
|
234631
|
+
}
|
|
234372
234632
|
const type = this.safeString(message, 'channel');
|
|
234373
234633
|
const marketId = this.safeString(message, 'symbol');
|
|
234374
234634
|
const symbol = this.safeSymbol(marketId);
|
|
234375
234635
|
const messageHash = 'orderbook:' + symbol + ':' + type;
|
|
234376
234636
|
const datetime = this.safeString(message, 'timestamp');
|
|
234377
234637
|
const timestamp = this.parse8601(datetime);
|
|
234378
|
-
|
|
234379
|
-
|
|
234380
|
-
orderbook = this.countedOrderBook({});
|
|
234381
|
-
this.orderbooks[symbol] = orderbook;
|
|
234382
|
-
}
|
|
234383
|
-
if (event === 'subscribed') {
|
|
234384
|
-
return;
|
|
234638
|
+
if (this.safeValue(this.orderbooks, symbol) === undefined) {
|
|
234639
|
+
this.orderbooks[symbol] = this.countedOrderBook();
|
|
234385
234640
|
}
|
|
234386
|
-
|
|
234641
|
+
const orderbook = this.orderbooks[symbol];
|
|
234642
|
+
if (event === 'snapshot') {
|
|
234387
234643
|
const snapshot = this.parseOrderBook(message, symbol, timestamp, 'bids', 'asks', 'px', 'qty', 'num');
|
|
234388
234644
|
orderbook.reset(snapshot);
|
|
234389
234645
|
}
|
|
@@ -234409,23 +234665,7 @@ class blockchaincom extends _blockchaincom_js__WEBPACK_IMPORTED_MODULE_0__/* ["d
|
|
|
234409
234665
|
this.handleDelta(bookside, deltas[i]);
|
|
234410
234666
|
}
|
|
234411
234667
|
}
|
|
234412
|
-
checkSequenceNumber(client, message) {
|
|
234413
|
-
const seqnum = this.safeInteger(message, 'seqnum', 0);
|
|
234414
|
-
const channel = this.safeString(message, 'channel', '');
|
|
234415
|
-
const sequenceNumbersByChannel = this.safeValue(this.options, 'sequenceNumbers', {});
|
|
234416
|
-
const lastSeqnum = this.safeInteger(sequenceNumbersByChannel, channel);
|
|
234417
|
-
if (lastSeqnum === undefined) {
|
|
234418
|
-
this.options['sequenceNumbers'][channel] = seqnum;
|
|
234419
|
-
}
|
|
234420
|
-
else {
|
|
234421
|
-
if (seqnum !== lastSeqnum + 1) {
|
|
234422
|
-
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ExchangeError(this.id + ' ' + channel + ' seqnum ' + seqnum + ' is not the expected ' + (lastSeqnum + 1));
|
|
234423
|
-
}
|
|
234424
|
-
this.options['sequenceNumbers'][channel] = seqnum;
|
|
234425
|
-
}
|
|
234426
|
-
}
|
|
234427
234668
|
handleMessage(client, message) {
|
|
234428
|
-
this.checkSequenceNumber(client, message);
|
|
234429
234669
|
const channel = this.safeString(message, 'channel');
|
|
234430
234670
|
const handlers = {
|
|
234431
234671
|
'ticker': this.handleTicker,
|
|
@@ -242932,7 +243172,7 @@ class deribit extends _deribit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
242932
243172
|
// "params": {
|
|
242933
243173
|
// "channel": "ticker.BTC_USDC-PERPETUAL.raw",
|
|
242934
243174
|
// "data": {
|
|
242935
|
-
// "timestamp":
|
|
243175
|
+
// "timestamp": 1655393725040,
|
|
242936
243176
|
// "stats": [Object],
|
|
242937
243177
|
// "state": "open",
|
|
242938
243178
|
// "settlement_price": 21729.5891,
|
|
@@ -243415,7 +243655,7 @@ class deribit extends _deribit_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
243415
243655
|
const symbol = this.safeSymbol(marketId);
|
|
243416
243656
|
const ohlcv = this.safeValue(params, 'data', {});
|
|
243417
243657
|
const parsed = [
|
|
243418
|
-
this.
|
|
243658
|
+
this.safeInteger(ohlcv, 'tick'),
|
|
243419
243659
|
this.safeNumber(ohlcv, 'open'),
|
|
243420
243660
|
this.safeNumber(ohlcv, 'high'),
|
|
243421
243661
|
this.safeNumber(ohlcv, 'low'),
|
|
@@ -245845,7 +246085,7 @@ class gemini extends _gemini_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z
|
|
|
245845
246085
|
// "time_ms": 1655323185000,
|
|
245846
246086
|
// "result": "failure",
|
|
245847
246087
|
// "highest_bid_price": "21661.90",
|
|
245848
|
-
// "lowest_ask_price": "21663.
|
|
246088
|
+
// "lowest_ask_price": "21663.78",
|
|
245849
246089
|
// "collar_price": "21662.845"
|
|
245850
246090
|
// },
|
|
245851
246091
|
// ]
|
|
@@ -262154,9 +262394,6 @@ class okx extends _okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
262154
262394
|
* @param {object} params extra parameters specific to the exchange API endpoint
|
|
262155
262395
|
* @returns {object[]} a list of [position structure]{@link https://docs.ccxt.com/en/latest/manual.html#position-structure}
|
|
262156
262396
|
*/
|
|
262157
|
-
if (this.isEmpty(symbols)) {
|
|
262158
|
-
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_1__.ArgumentsRequired(this.id + ' watchPositions requires a list of symbols');
|
|
262159
|
-
}
|
|
262160
262397
|
await this.loadMarkets();
|
|
262161
262398
|
await this.authenticate(params);
|
|
262162
262399
|
symbols = this.marketSymbols(symbols);
|
|
@@ -262164,7 +262401,23 @@ class okx extends _okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
262164
262401
|
'instType': 'ANY',
|
|
262165
262402
|
};
|
|
262166
262403
|
const channel = 'positions';
|
|
262167
|
-
|
|
262404
|
+
let newPositions = undefined;
|
|
262405
|
+
if (symbols === undefined) {
|
|
262406
|
+
const arg = {
|
|
262407
|
+
'channel': 'positions',
|
|
262408
|
+
'instType': 'ANY',
|
|
262409
|
+
};
|
|
262410
|
+
const args = [arg];
|
|
262411
|
+
const nonSymbolRequest = {
|
|
262412
|
+
'op': 'subscribe',
|
|
262413
|
+
'args': args,
|
|
262414
|
+
};
|
|
262415
|
+
const url = this.getUrl(channel, 'private');
|
|
262416
|
+
newPositions = await this.watch(url, channel, nonSymbolRequest, channel);
|
|
262417
|
+
}
|
|
262418
|
+
else {
|
|
262419
|
+
newPositions = await this.subscribeMultiple('private', channel, symbols, this.extend(request, params));
|
|
262420
|
+
}
|
|
262168
262421
|
if (this.newUpdates) {
|
|
262169
262422
|
return newPositions;
|
|
262170
262423
|
}
|
|
@@ -262262,6 +262515,7 @@ class okx extends _okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z {
|
|
|
262262
262515
|
client.resolve(positions, messageHash);
|
|
262263
262516
|
}
|
|
262264
262517
|
}
|
|
262518
|
+
client.resolve(newPositions, channel);
|
|
262265
262519
|
}
|
|
262266
262520
|
async watchOrders(symbol = undefined, since = undefined, limit = undefined, params = {}) {
|
|
262267
262521
|
/**
|
|
@@ -307206,7 +307460,7 @@ SOFTWARE.
|
|
|
307206
307460
|
|
|
307207
307461
|
//-----------------------------------------------------------------------------
|
|
307208
307462
|
// this is updated by vss.js when building
|
|
307209
|
-
const version = '4.2.
|
|
307463
|
+
const version = '4.2.53';
|
|
307210
307464
|
_src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
|
|
307211
307465
|
//-----------------------------------------------------------------------------
|
|
307212
307466
|
|