ccxt 4.1.76 → 4.1.77
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/ccxt.browser.js +76 -11
- package/dist/ccxt.browser.min.js +5 -5
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/bingx.js +2 -0
- package/dist/cjs/src/bitmex.js +6 -0
- package/dist/cjs/src/bitrue.js +27 -1
- package/dist/cjs/src/bitstamp.js +3 -2
- package/dist/cjs/src/coinbase.js +35 -6
- package/dist/cjs/src/gate.js +1 -0
- package/dist/cjs/src/okx.js +1 -1
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/bingx.js +2 -0
- package/js/src/bitmex.d.ts +1 -1
- package/js/src/bitmex.js +6 -0
- package/js/src/bitrue.d.ts +1 -0
- package/js/src/bitrue.js +27 -1
- package/js/src/bitstamp.js +3 -2
- package/js/src/coinbase.d.ts +1 -0
- package/js/src/coinbase.js +35 -6
- package/js/src/gate.js +1 -0
- package/js/src/okx.js +1 -1
- package/package.json +1 -1
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.1.
|
|
213
|
-
* unpkg: https://unpkg.com/ccxt@4.1.
|
|
212
|
+
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.1.77/dist/ccxt.browser.js
|
|
213
|
+
* unpkg: https://unpkg.com/ccxt@4.1.77/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.1.
|
|
218
|
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.1.77/dist/ccxt.browser.js"></script>
|
|
219
219
|
```
|
|
220
220
|
|
|
221
221
|
Creates a global `ccxt` object:
|
package/dist/ccxt.browser.js
CHANGED
|
@@ -26939,6 +26939,8 @@ class bingx extends _abstract_bingx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"
|
|
|
26939
26939
|
'cancelAllOrders': true,
|
|
26940
26940
|
'cancelOrder': true,
|
|
26941
26941
|
'cancelOrders': true,
|
|
26942
|
+
'closeAllPosition': true,
|
|
26943
|
+
'closePosition': false,
|
|
26942
26944
|
'createMarketBuyOrderWithCost': true,
|
|
26943
26945
|
'createMarketOrderWithCost': true,
|
|
26944
26946
|
'createMarketSellOrderWithCost': true,
|
|
@@ -53134,6 +53136,12 @@ class bitmex extends _abstract_bitmex_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
53134
53136
|
return this.parseNumber(finalAmount);
|
|
53135
53137
|
}
|
|
53136
53138
|
convertToRealAmount(code, amount) {
|
|
53139
|
+
if (code === undefined) {
|
|
53140
|
+
return amount;
|
|
53141
|
+
}
|
|
53142
|
+
else if (amount === undefined) {
|
|
53143
|
+
return undefined;
|
|
53144
|
+
}
|
|
53137
53145
|
const currency = this.currency(code);
|
|
53138
53146
|
const precision = this.safeString(currency, 'precision');
|
|
53139
53147
|
return _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringMul(amount, precision);
|
|
@@ -59346,6 +59354,9 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
59346
59354
|
'option': false,
|
|
59347
59355
|
'cancelAllOrders': true,
|
|
59348
59356
|
'cancelOrder': true,
|
|
59357
|
+
'createMarketBuyOrderWithCost': true,
|
|
59358
|
+
'createMarketOrderWithCost': false,
|
|
59359
|
+
'createMarketSellOrderWithCost': false,
|
|
59349
59360
|
'createOrder': true,
|
|
59350
59361
|
'createStopLimitOrder': true,
|
|
59351
59362
|
'createStopMarketOrder': true,
|
|
@@ -61200,6 +61211,26 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
61200
61211
|
'trades': fills,
|
|
61201
61212
|
}, market);
|
|
61202
61213
|
}
|
|
61214
|
+
async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
|
|
61215
|
+
/**
|
|
61216
|
+
* @method
|
|
61217
|
+
* @name bitrue#createMarketBuyOrderWithCost
|
|
61218
|
+
* @description create a market buy order by providing the symbol and cost
|
|
61219
|
+
* @see https://www.bitrue.com/api-docs#new-order-trade-hmac-sha256
|
|
61220
|
+
* @see https://www.bitrue.com/api_docs_includes_file/delivery.html#new-order-trade-hmac-sha256
|
|
61221
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
61222
|
+
* @param {float} cost how much you want to trade in units of the quote currency
|
|
61223
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
61224
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
61225
|
+
*/
|
|
61226
|
+
await this.loadMarkets();
|
|
61227
|
+
const market = this.market(symbol);
|
|
61228
|
+
if (!market['swap']) {
|
|
61229
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' createMarketBuyOrderWithCost() supports swap orders only');
|
|
61230
|
+
}
|
|
61231
|
+
params['createMarketBuyOrderRequiresPrice'] = false;
|
|
61232
|
+
return await this.createOrder(symbol, 'market', 'buy', cost, undefined, params);
|
|
61233
|
+
}
|
|
61203
61234
|
async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
|
|
61204
61235
|
/**
|
|
61205
61236
|
* @method
|
|
@@ -61223,6 +61254,7 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
61223
61254
|
* EXCHANGE SPECIFIC PARAMETERS
|
|
61224
61255
|
* @param {decimal} [params.icebergQty]
|
|
61225
61256
|
* @param {long} [params.recvWindow]
|
|
61257
|
+
* @param {float} [params.cost] *swap market buy only* the quote quantity that can be used as an alternative for the amount
|
|
61226
61258
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
61227
61259
|
*/
|
|
61228
61260
|
await this.loadMarkets();
|
|
@@ -61259,7 +61291,9 @@ class bitrue extends _abstract_bitrue_js__WEBPACK_IMPORTED_MODULE_0__/* ["defaul
|
|
|
61259
61291
|
request['type'] = 'IOC';
|
|
61260
61292
|
}
|
|
61261
61293
|
request['contractName'] = market['id'];
|
|
61262
|
-
|
|
61294
|
+
let createMarketBuyOrderRequiresPrice = true;
|
|
61295
|
+
[createMarketBuyOrderRequiresPrice, params] = this.handleOptionAndParams(params, 'createOrder', 'createMarketBuyOrderRequiresPrice', true);
|
|
61296
|
+
if (isMarket && (side === 'buy') && createMarketBuyOrderRequiresPrice) {
|
|
61263
61297
|
const cost = this.safeString(params, 'cost');
|
|
61264
61298
|
params = this.omit(params, 'cost');
|
|
61265
61299
|
if (price === undefined && cost === undefined) {
|
|
@@ -65362,6 +65396,7 @@ class bitstamp extends _abstract_bitstamp_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
65362
65396
|
* @method
|
|
65363
65397
|
* @name bitstamp#fetchOHLCV
|
|
65364
65398
|
* @description fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market
|
|
65399
|
+
* @see https://www.bitstamp.net/api/#tag/Market-info/operation/GetOHLCData
|
|
65365
65400
|
* @param {string} symbol unified symbol of the market to fetch OHLCV data for
|
|
65366
65401
|
* @param {string} timeframe the length of time each candle represents
|
|
65367
65402
|
* @param {int} [since] timestamp in ms of the earliest candle to fetch
|
|
@@ -65384,7 +65419,7 @@ class bitstamp extends _abstract_bitstamp_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
65384
65419
|
limit = 1000;
|
|
65385
65420
|
const start = this.parseToInt(since / 1000);
|
|
65386
65421
|
request['start'] = start;
|
|
65387
|
-
request['end'] = this.sum(start,
|
|
65422
|
+
request['end'] = this.sum(start, duration * (limit - 1));
|
|
65388
65423
|
request['limit'] = limit;
|
|
65389
65424
|
}
|
|
65390
65425
|
}
|
|
@@ -65392,7 +65427,7 @@ class bitstamp extends _abstract_bitstamp_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
65392
65427
|
if (since !== undefined) {
|
|
65393
65428
|
const start = this.parseToInt(since / 1000);
|
|
65394
65429
|
request['start'] = start;
|
|
65395
|
-
request['end'] = this.sum(start,
|
|
65430
|
+
request['end'] = this.sum(start, duration * (limit - 1));
|
|
65396
65431
|
}
|
|
65397
65432
|
request['limit'] = Math.min(limit, 1000); // min 1, max 1000
|
|
65398
65433
|
}
|
|
@@ -85462,7 +85497,10 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
85462
85497
|
'createLimitBuyOrder': true,
|
|
85463
85498
|
'createLimitSellOrder': true,
|
|
85464
85499
|
'createMarketBuyOrder': true,
|
|
85500
|
+
'createMarketBuyOrderWithCost': true,
|
|
85501
|
+
'createMarketOrderWithCost': false,
|
|
85465
85502
|
'createMarketSellOrder': true,
|
|
85503
|
+
'createMarketSellOrderWithCost': false,
|
|
85466
85504
|
'createOrder': true,
|
|
85467
85505
|
'createPostOnlyOrder': true,
|
|
85468
85506
|
'createReduceOnlyOrder': false,
|
|
@@ -87501,6 +87539,25 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
87501
87539
|
}
|
|
87502
87540
|
return request;
|
|
87503
87541
|
}
|
|
87542
|
+
async createMarketBuyOrderWithCost(symbol, cost, params = {}) {
|
|
87543
|
+
/**
|
|
87544
|
+
* @method
|
|
87545
|
+
* @name coinbase#createMarketBuyOrderWithCost
|
|
87546
|
+
* @description create a market buy order by providing the symbol and cost
|
|
87547
|
+
* @see https://docs.cloud.coinbase.com/advanced-trade-api/reference/retailbrokerageapi_postorder
|
|
87548
|
+
* @param {string} symbol unified symbol of the market to create an order in
|
|
87549
|
+
* @param {float} cost how much you want to trade in units of the quote currency
|
|
87550
|
+
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
87551
|
+
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
87552
|
+
*/
|
|
87553
|
+
await this.loadMarkets();
|
|
87554
|
+
const market = this.market(symbol);
|
|
87555
|
+
if (!market['spot']) {
|
|
87556
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' createMarketBuyOrderWithCost() supports spot orders only');
|
|
87557
|
+
}
|
|
87558
|
+
params['createMarketBuyOrderRequiresPrice'] = false;
|
|
87559
|
+
return await this.createOrder(symbol, 'market', 'buy', cost, undefined, params);
|
|
87560
|
+
}
|
|
87504
87561
|
async createOrder(symbol, type, side, amount, price = undefined, params = {}) {
|
|
87505
87562
|
/**
|
|
87506
87563
|
* @method
|
|
@@ -87521,6 +87578,7 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
87521
87578
|
* @param {string} [params.timeInForce] 'GTC', 'IOC', 'GTD' or 'PO'
|
|
87522
87579
|
* @param {string} [params.stop_direction] 'UNKNOWN_STOP_DIRECTION', 'STOP_DIRECTION_STOP_UP', 'STOP_DIRECTION_STOP_DOWN' the direction the stopPrice is triggered from
|
|
87523
87580
|
* @param {string} [params.end_time] '2023-05-25T17:01:05.092Z' for 'GTD' orders
|
|
87581
|
+
* @param {float} [params.cost] *spot market buy only* the quote quantity that can be used as an alternative for the amount
|
|
87524
87582
|
* @returns {object} an [order structure]{@link https://docs.ccxt.com/#/?id=order-structure}
|
|
87525
87583
|
*/
|
|
87526
87584
|
await this.loadMarkets();
|
|
@@ -87623,21 +87681,27 @@ class coinbase extends _abstract_coinbase_js__WEBPACK_IMPORTED_MODULE_0__/* ["de
|
|
|
87623
87681
|
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.NotSupported(this.id + ' createOrder() only stop limit orders are supported');
|
|
87624
87682
|
}
|
|
87625
87683
|
if (side === 'buy') {
|
|
87626
|
-
const createMarketBuyOrderRequiresPrice = this.safeValue(this.options, 'createMarketBuyOrderRequiresPrice', true);
|
|
87627
87684
|
let total = undefined;
|
|
87628
|
-
|
|
87685
|
+
let createMarketBuyOrderRequiresPrice = true;
|
|
87686
|
+
[createMarketBuyOrderRequiresPrice, params] = this.handleOptionAndParams(params, 'createOrder', 'createMarketBuyOrderRequiresPrice', true);
|
|
87687
|
+
const cost = this.safeNumber(params, 'cost');
|
|
87688
|
+
params = this.omit(params, 'cost');
|
|
87689
|
+
if (cost !== undefined) {
|
|
87690
|
+
total = this.costToPrecision(symbol, cost);
|
|
87691
|
+
}
|
|
87692
|
+
else if (createMarketBuyOrderRequiresPrice) {
|
|
87629
87693
|
if (price === undefined) {
|
|
87630
|
-
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder(this.id + ' createOrder() requires a price argument for market buy orders on spot markets to calculate the total amount to spend (amount * price), alternatively set the createMarketBuyOrderRequiresPrice option to false and pass
|
|
87694
|
+
throw new _base_errors_js__WEBPACK_IMPORTED_MODULE_2__.InvalidOrder(this.id + ' createOrder() requires a price argument for market buy orders on spot markets to calculate the total amount to spend (amount * price), alternatively set the createMarketBuyOrderRequiresPrice option or param to false and pass the cost to spend in the amount argument');
|
|
87631
87695
|
}
|
|
87632
87696
|
else {
|
|
87633
87697
|
const amountString = this.numberToString(amount);
|
|
87634
87698
|
const priceString = this.numberToString(price);
|
|
87635
|
-
const
|
|
87636
|
-
total = this.
|
|
87699
|
+
const costRequest = _base_Precise_js__WEBPACK_IMPORTED_MODULE_3__/* .Precise */ .O.stringMul(amountString, priceString);
|
|
87700
|
+
total = this.costToPrecision(symbol, costRequest);
|
|
87637
87701
|
}
|
|
87638
87702
|
}
|
|
87639
87703
|
else {
|
|
87640
|
-
total = this.
|
|
87704
|
+
total = this.costToPrecision(symbol, amount);
|
|
87641
87705
|
}
|
|
87642
87706
|
request['order_configuration'] = {
|
|
87643
87707
|
'market_market_ioc': {
|
|
@@ -122459,6 +122523,7 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
122459
122523
|
'15m': '15m',
|
|
122460
122524
|
'30m': '30m',
|
|
122461
122525
|
'1h': '1h',
|
|
122526
|
+
'2h': '2h',
|
|
122462
122527
|
'4h': '4h',
|
|
122463
122528
|
'8h': '8h',
|
|
122464
122529
|
'1d': '1d',
|
|
@@ -185626,7 +185691,7 @@ class okx extends _abstract_okx_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */
|
|
|
185626
185691
|
'name': 'OKX',
|
|
185627
185692
|
'countries': ['CN', 'US'],
|
|
185628
185693
|
'version': 'v5',
|
|
185629
|
-
'rateLimit': 100,
|
|
185694
|
+
'rateLimit': 100 * 1.03,
|
|
185630
185695
|
'pro': true,
|
|
185631
185696
|
'certified': true,
|
|
185632
185697
|
'has': {
|
|
@@ -288200,7 +288265,7 @@ SOFTWARE.
|
|
|
288200
288265
|
|
|
288201
288266
|
//-----------------------------------------------------------------------------
|
|
288202
288267
|
// this is updated by vss.js when building
|
|
288203
|
-
const version = '4.1.
|
|
288268
|
+
const version = '4.1.77';
|
|
288204
288269
|
_src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
|
|
288205
288270
|
//-----------------------------------------------------------------------------
|
|
288206
288271
|
|