ccxt 4.2.66 → 4.2.68
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 +159 -37
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +15 -2
- package/dist/cjs/src/bitfinex2.js +4 -2
- package/dist/cjs/src/gate.js +2 -1
- package/dist/cjs/src/hyperliquid.js +5 -2
- package/dist/cjs/src/krakenfutures.js +132 -29
- package/js/ccxt.d.ts +1 -1
- package/js/ccxt.js +1 -1
- package/js/src/base/Exchange.d.ts +2 -1
- package/js/src/base/Exchange.js +15 -2
- package/js/src/base/types.d.ts +3 -1
- package/js/src/bitfinex2.js +4 -2
- package/js/src/gate.js +2 -1
- package/js/src/hyperliquid.js +5 -2
- package/js/src/krakenfutures.js +132 -29
- package/package.json +1 -1
- package/skip-tests.json +14 -7
package/README.md
CHANGED
|
@@ -210,13 +210,13 @@ console.log(version, Object.keys(exchanges));
|
|
|
210
210
|
|
|
211
211
|
All-in-one browser bundle (dependencies included), served from a CDN of your choice:
|
|
212
212
|
|
|
213
|
-
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.2.
|
|
214
|
-
* unpkg: https://unpkg.com/ccxt@4.2.
|
|
213
|
+
* jsDelivr: https://cdn.jsdelivr.net/npm/ccxt@4.2.68/dist/ccxt.browser.js
|
|
214
|
+
* unpkg: https://unpkg.com/ccxt@4.2.68/dist/ccxt.browser.js
|
|
215
215
|
|
|
216
216
|
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.
|
|
217
217
|
|
|
218
218
|
```HTML
|
|
219
|
-
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.2.
|
|
219
|
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ccxt@4.2.68/dist/ccxt.browser.js"></script>
|
|
220
220
|
```
|
|
221
221
|
|
|
222
222
|
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
|
@@ -10561,6 +10561,13 @@ class Exchange {
|
|
|
10561
10561
|
}
|
|
10562
10562
|
return [value, params];
|
|
10563
10563
|
}
|
|
10564
|
+
handleParamInteger(params, paramName, defaultValue = undefined) {
|
|
10565
|
+
const value = this.safeInteger(params, paramName, defaultValue);
|
|
10566
|
+
if (value !== undefined) {
|
|
10567
|
+
params = this.omit(params, paramName);
|
|
10568
|
+
}
|
|
10569
|
+
return [value, params];
|
|
10570
|
+
}
|
|
10564
10571
|
resolvePath(path, params) {
|
|
10565
10572
|
return [
|
|
10566
10573
|
this.implodeParams(path, params),
|
|
@@ -12356,7 +12363,10 @@ class Exchange {
|
|
|
12356
12363
|
const response = await this[method](symbol, undefined, maxEntriesPerRequest, params);
|
|
12357
12364
|
const responseLength = response.length;
|
|
12358
12365
|
if (this.verbose) {
|
|
12359
|
-
|
|
12366
|
+
let backwardMessage = 'Dynamic pagination call ' + this.numberToString(calls) + ' method ' + method + ' response length ' + this.numberToString(responseLength);
|
|
12367
|
+
if (paginationTimestamp !== undefined) {
|
|
12368
|
+
backwardMessage += ' timestamp ' + this.numberToString(paginationTimestamp);
|
|
12369
|
+
}
|
|
12360
12370
|
this.log(backwardMessage);
|
|
12361
12371
|
}
|
|
12362
12372
|
if (responseLength === 0) {
|
|
@@ -12375,7 +12385,10 @@ class Exchange {
|
|
|
12375
12385
|
const response = await this[method](symbol, paginationTimestamp, maxEntriesPerRequest, params);
|
|
12376
12386
|
const responseLength = response.length;
|
|
12377
12387
|
if (this.verbose) {
|
|
12378
|
-
|
|
12388
|
+
let forwardMessage = 'Dynamic pagination call ' + this.numberToString(calls) + ' method ' + method + ' response length ' + this.numberToString(responseLength);
|
|
12389
|
+
if (paginationTimestamp !== undefined) {
|
|
12390
|
+
forwardMessage += ' timestamp ' + this.numberToString(paginationTimestamp);
|
|
12391
|
+
}
|
|
12379
12392
|
this.log(forwardMessage);
|
|
12380
12393
|
}
|
|
12381
12394
|
if (responseLength === 0) {
|
|
@@ -41502,9 +41515,11 @@ class bitfinex2 extends _abstract_bitfinex2_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
41502
41515
|
'symbol': market['id'],
|
|
41503
41516
|
'timeframe': this.safeString(this.timeframes, timeframe, timeframe),
|
|
41504
41517
|
'sort': 1,
|
|
41505
|
-
'start': since,
|
|
41506
41518
|
'limit': limit,
|
|
41507
41519
|
};
|
|
41520
|
+
if (since !== undefined) {
|
|
41521
|
+
request['start'] = since;
|
|
41522
|
+
}
|
|
41508
41523
|
[request, params] = this.handleUntilOption('end', request, params);
|
|
41509
41524
|
const response = await this.publicGetCandlesTradeTimeframeSymbolHist(this.extend(request, params));
|
|
41510
41525
|
//
|
|
@@ -43077,7 +43092,7 @@ class bitfinex2 extends _abstract_bitfinex2_js__WEBPACK_IMPORTED_MODULE_0__/* ["
|
|
|
43077
43092
|
* @param {object} [params] extra parameters specific to the exchange API endpoint
|
|
43078
43093
|
* @returns {object} a [funding rate structure]{@link https://docs.ccxt.com/#/?id=funding-rate-structure}
|
|
43079
43094
|
*/
|
|
43080
|
-
return this.fetchFundingRates([symbol], params);
|
|
43095
|
+
return await this.fetchFundingRates([symbol], params);
|
|
43081
43096
|
}
|
|
43082
43097
|
async fetchFundingRates(symbols = undefined, params = {}) {
|
|
43083
43098
|
/**
|
|
@@ -135482,7 +135497,8 @@ class gate extends _abstract_gate_js__WEBPACK_IMPORTED_MODULE_0__/* ["default"]
|
|
|
135482
135497
|
const [request, requestParams] = this.prepareRequest(market, type, query);
|
|
135483
135498
|
request['type'] = 'fund'; // 'dnw' 'pnl' 'fee' 'refr' 'fund' 'point_dnw' 'point_fee' 'point_refr'
|
|
135484
135499
|
if (since !== undefined) {
|
|
135485
|
-
|
|
135500
|
+
// from should be integer
|
|
135501
|
+
request['from'] = this.parseToInt(since / 1000);
|
|
135486
135502
|
}
|
|
135487
135503
|
if (limit !== undefined) {
|
|
135488
135504
|
request['limit'] = limit;
|
|
@@ -159789,13 +159805,16 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
|
|
|
159789
159805
|
}
|
|
159790
159806
|
orderReq.push(orderObj);
|
|
159791
159807
|
}
|
|
159808
|
+
const vaultAddress = this.safeString(params, 'vaultAddress');
|
|
159792
159809
|
const orderAction = {
|
|
159793
159810
|
'type': 'order',
|
|
159794
159811
|
'orders': orderReq,
|
|
159795
159812
|
'grouping': 'na',
|
|
159796
|
-
'brokerCode': 1,
|
|
159813
|
+
// 'brokerCode': 1, // cant
|
|
159797
159814
|
};
|
|
159798
|
-
|
|
159815
|
+
if (vaultAddress === undefined) {
|
|
159816
|
+
orderAction['brokerCode'] = 1;
|
|
159817
|
+
}
|
|
159799
159818
|
const signature = this.signL1Action(orderAction, nonce, vaultAddress);
|
|
159800
159819
|
const request = {
|
|
159801
159820
|
'action': orderAction,
|
|
@@ -168149,6 +168168,9 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
168149
168168
|
},
|
|
168150
168169
|
},
|
|
168151
168170
|
},
|
|
168171
|
+
'fetchTrades': {
|
|
168172
|
+
'method': 'historyGetMarketSymbolExecutions', // historyGetMarketSymbolExecutions, publicGetHistory
|
|
168173
|
+
},
|
|
168152
168174
|
},
|
|
168153
168175
|
'timeframes': {
|
|
168154
168176
|
'1m': '1m',
|
|
@@ -168598,6 +168620,7 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
168598
168620
|
* @method
|
|
168599
168621
|
* @name krakenfutures#fetchTrades
|
|
168600
168622
|
* @see https://docs.futures.kraken.com/#http-api-trading-v3-api-market-data-get-trade-history
|
|
168623
|
+
* @see https://docs.futures.kraken.com/#http-api-history-market-history-get-public-execution-events
|
|
168601
168624
|
* @description Fetch a history of filled trades that this account has made
|
|
168602
168625
|
* @param {string} symbol Unified CCXT market symbol
|
|
168603
168626
|
* @param {int} [since] Timestamp in ms of earliest trade. Not used by krakenfutures except in combination with params.until
|
|
@@ -168605,6 +168628,7 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
168605
168628
|
* @param {object} [params] Exchange specific params
|
|
168606
168629
|
* @param {int} [params.until] Timestamp in ms of latest trade
|
|
168607
168630
|
* @param {boolean} [params.paginate] default false, when true will automatically paginate by calling this endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params)
|
|
168631
|
+
* @param {string} [params.method] The method to use to fetch trades. Can be 'historyGetMarketSymbolExecutions' or 'publicGetHistory' default is 'historyGetMarketSymbolExecutions'
|
|
168608
168632
|
* @returns An array of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
|
|
168609
168633
|
*/
|
|
168610
168634
|
await this.loadMarkets();
|
|
@@ -168614,38 +168638,113 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
168614
168638
|
return await this.fetchPaginatedCallDynamic('fetchTrades', symbol, since, limit, params);
|
|
168615
168639
|
}
|
|
168616
168640
|
const market = this.market(symbol);
|
|
168617
|
-
|
|
168641
|
+
let request = {
|
|
168618
168642
|
'symbol': market['id'],
|
|
168619
168643
|
};
|
|
168620
|
-
|
|
168621
|
-
|
|
168622
|
-
|
|
168644
|
+
let method = undefined;
|
|
168645
|
+
[method, params] = this.handleOptionAndParams(params, 'fetchTrades', 'method', 'historyGetMarketSymbolExecutions');
|
|
168646
|
+
let rawTrades = undefined;
|
|
168647
|
+
const isFullHistoryEndpoint = (method === 'historyGetMarketSymbolExecutions');
|
|
168648
|
+
if (isFullHistoryEndpoint) {
|
|
168649
|
+
[request, params] = this.handleUntilOption('before', request, params);
|
|
168650
|
+
if (since !== undefined) {
|
|
168651
|
+
request['since'] = since;
|
|
168652
|
+
request['sort'] = 'asc';
|
|
168653
|
+
}
|
|
168654
|
+
if (limit !== undefined) {
|
|
168655
|
+
request['count'] = limit;
|
|
168656
|
+
}
|
|
168657
|
+
const response = await this.historyGetMarketSymbolExecutions(this.extend(request, params));
|
|
168658
|
+
//
|
|
168659
|
+
// {
|
|
168660
|
+
// "elements": [
|
|
168661
|
+
// {
|
|
168662
|
+
// "uid": "a5105030-f054-44cc-98ab-30d5cae96bef",
|
|
168663
|
+
// "timestamp": "1710150778607",
|
|
168664
|
+
// "event": {
|
|
168665
|
+
// "Execution": {
|
|
168666
|
+
// "execution": {
|
|
168667
|
+
// "uid": "2d485b71-cd28-4a1e-9364-371a127550d2",
|
|
168668
|
+
// "makerOrder": {
|
|
168669
|
+
// "uid": "0a25f66b-1109-49ec-93a3-d17bf9e9137e",
|
|
168670
|
+
// "tradeable": "PF_XBTUSD",
|
|
168671
|
+
// "direction": "Buy",
|
|
168672
|
+
// "quantity": "0.26500",
|
|
168673
|
+
// "timestamp": "1710150778570",
|
|
168674
|
+
// "limitPrice": "71907",
|
|
168675
|
+
// "orderType": "Post",
|
|
168676
|
+
// "reduceOnly": false,
|
|
168677
|
+
// "lastUpdateTimestamp": "1710150778570"
|
|
168678
|
+
// },
|
|
168679
|
+
// "takerOrder": {
|
|
168680
|
+
// "uid": "04de3ee0-9125-4960-bf8f-f63b577b6790",
|
|
168681
|
+
// "tradeable": "PF_XBTUSD",
|
|
168682
|
+
// "direction": "Sell",
|
|
168683
|
+
// "quantity": "0.0002",
|
|
168684
|
+
// "timestamp": "1710150778607",
|
|
168685
|
+
// "limitPrice": "71187.00",
|
|
168686
|
+
// "orderType": "Market",
|
|
168687
|
+
// "reduceOnly": false,
|
|
168688
|
+
// "lastUpdateTimestamp": "1710150778607"
|
|
168689
|
+
// },
|
|
168690
|
+
// "timestamp": "1710150778607",
|
|
168691
|
+
// "quantity": "0.0002",
|
|
168692
|
+
// "price": "71907",
|
|
168693
|
+
// "markPrice": "71903.32715463147",
|
|
168694
|
+
// "limitFilled": false,
|
|
168695
|
+
// "usdValue": "14.38"
|
|
168696
|
+
// },
|
|
168697
|
+
// "takerReducedQuantity": ""
|
|
168698
|
+
// }
|
|
168699
|
+
// }
|
|
168700
|
+
// },
|
|
168701
|
+
// ... followed by older items
|
|
168702
|
+
// ],
|
|
168703
|
+
// "len": "1000",
|
|
168704
|
+
// "continuationToken": "QTexMDE0OTe33NTcyXy8xNDIzAjc1NjY5MwI="
|
|
168705
|
+
// }
|
|
168706
|
+
//
|
|
168707
|
+
const elements = this.safeList(response, 'elements', []);
|
|
168708
|
+
// we need to reverse the list to fix chronology
|
|
168709
|
+
rawTrades = [];
|
|
168710
|
+
const length = elements.length;
|
|
168711
|
+
for (let i = 0; i < length; i++) {
|
|
168712
|
+
const index = length - 1 - i;
|
|
168713
|
+
const element = elements[index];
|
|
168714
|
+
const event = this.safeDict(element, 'event', {});
|
|
168715
|
+
const executionContainer = this.safeDict(event, 'Execution', {});
|
|
168716
|
+
const rawTrade = this.safeDict(executionContainer, 'execution', {});
|
|
168717
|
+
rawTrades.push(rawTrade);
|
|
168718
|
+
}
|
|
168623
168719
|
}
|
|
168624
|
-
|
|
168625
|
-
|
|
168626
|
-
|
|
168627
|
-
|
|
168628
|
-
|
|
168629
|
-
|
|
168630
|
-
|
|
168631
|
-
|
|
168632
|
-
|
|
168633
|
-
|
|
168634
|
-
|
|
168635
|
-
|
|
168636
|
-
|
|
168637
|
-
|
|
168638
|
-
|
|
168639
|
-
|
|
168640
|
-
|
|
168641
|
-
|
|
168642
|
-
|
|
168643
|
-
|
|
168644
|
-
|
|
168720
|
+
else {
|
|
168721
|
+
[request, params] = this.handleUntilOption('lastTime', request, params);
|
|
168722
|
+
const response = await this.publicGetHistory(this.extend(request, params));
|
|
168723
|
+
//
|
|
168724
|
+
// {
|
|
168725
|
+
// "result": "success",
|
|
168726
|
+
// "history": [
|
|
168727
|
+
// {
|
|
168728
|
+
// "time": "2022-03-18T04:55:37.692Z",
|
|
168729
|
+
// "trade_id": 100,
|
|
168730
|
+
// "price": 0.7921,
|
|
168731
|
+
// "size": 1068,
|
|
168732
|
+
// "side": "sell",
|
|
168733
|
+
// "type": "fill",
|
|
168734
|
+
// "uid": "6c5da0b0-f1a8-483f-921f-466eb0388265"
|
|
168735
|
+
// },
|
|
168736
|
+
// ...
|
|
168737
|
+
// ],
|
|
168738
|
+
// "serverTime": "2022-03-18T06:39:18.056Z"
|
|
168739
|
+
// }
|
|
168740
|
+
//
|
|
168741
|
+
rawTrades = this.safeList(response, 'history', []);
|
|
168742
|
+
}
|
|
168743
|
+
return this.parseTrades(rawTrades, market, since, limit);
|
|
168645
168744
|
}
|
|
168646
168745
|
parseTrade(trade, market = undefined) {
|
|
168647
168746
|
//
|
|
168648
|
-
// fetchTrades (
|
|
168747
|
+
// fetchTrades (recent trades)
|
|
168649
168748
|
//
|
|
168650
168749
|
// {
|
|
168651
168750
|
// "time": "2019-02-14T09:25:33.920Z",
|
|
@@ -168653,10 +168752,24 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
168653
168752
|
// "price": 3574,
|
|
168654
168753
|
// "size": 100,
|
|
168655
168754
|
// "side": "buy",
|
|
168656
|
-
// "type": "fill"
|
|
168755
|
+
// "type": "fill" // fill, liquidation, assignment, termination
|
|
168657
168756
|
// "uid": "11c3d82c-9e70-4fe9-8115-f643f1b162d4"
|
|
168658
168757
|
// }
|
|
168659
168758
|
//
|
|
168759
|
+
// fetchTrades (executions history)
|
|
168760
|
+
//
|
|
168761
|
+
// {
|
|
168762
|
+
// "timestamp": "1710152516830",
|
|
168763
|
+
// "price": "71927.0",
|
|
168764
|
+
// "quantity": "0.0695",
|
|
168765
|
+
// "markPrice": "71936.38701675525",
|
|
168766
|
+
// "limitFilled": true,
|
|
168767
|
+
// "usdValue": "4998.93",
|
|
168768
|
+
// "uid": "116ae634-253f-470b-bd20-fa9d429fb8b1",
|
|
168769
|
+
// "makerOrder": { "uid": "17bfe4de-c01e-4938-926c-617d2a2d0597", "tradeable": "PF_XBTUSD", "direction": "Buy", "quantity": "0.0695", "timestamp": "1710152515836", "limitPrice": "71927.0", "orderType": "Post", "reduceOnly": false, "lastUpdateTimestamp": "1710152515836" },
|
|
168770
|
+
// "takerOrder": { "uid": "d3e437b4-aa70-4108-b5cf-b1eecb9845b5", "tradeable": "PF_XBTUSD", "direction": "Sell", "quantity": "0.940100", "timestamp": "1710152516830", "limitPrice": "71915", "orderType": "IoC", "reduceOnly": false, "lastUpdateTimestamp": "1710152516830" }
|
|
168771
|
+
// }
|
|
168772
|
+
//
|
|
168660
168773
|
// fetchMyTrades (private)
|
|
168661
168774
|
//
|
|
168662
168775
|
// {
|
|
@@ -168695,9 +168808,9 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
168695
168808
|
// "type": "EXECUTION"
|
|
168696
168809
|
// }
|
|
168697
168810
|
//
|
|
168698
|
-
|
|
168811
|
+
let timestamp = this.parse8601(this.safeString2(trade, 'time', 'fillTime'));
|
|
168699
168812
|
const price = this.safeString(trade, 'price');
|
|
168700
|
-
const amount = this.
|
|
168813
|
+
const amount = this.safeStringN(trade, ['size', 'amount', 'quantity'], '0.0');
|
|
168701
168814
|
let id = this.safeString2(trade, 'uid', 'fill_id');
|
|
168702
168815
|
if (id === undefined) {
|
|
168703
168816
|
id = this.safeString(trade, 'executionId');
|
|
@@ -168746,6 +168859,15 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
168746
168859
|
takerOrMaker = 'maker';
|
|
168747
168860
|
}
|
|
168748
168861
|
}
|
|
168862
|
+
const isHistoricalExecution = ('takerOrder' in trade);
|
|
168863
|
+
if (isHistoricalExecution) {
|
|
168864
|
+
timestamp = this.safeInteger(trade, 'timestamp');
|
|
168865
|
+
const taker = this.safeDict(trade, 'takerOrder', {});
|
|
168866
|
+
if (taker !== undefined) {
|
|
168867
|
+
side = this.safeStringLower(taker, 'direction');
|
|
168868
|
+
takerOrMaker = 'taker';
|
|
168869
|
+
}
|
|
168870
|
+
}
|
|
168749
168871
|
return this.safeTrade({
|
|
168750
168872
|
'info': trade,
|
|
168751
168873
|
'id': id,
|
|
@@ -316805,7 +316927,7 @@ SOFTWARE.
|
|
|
316805
316927
|
|
|
316806
316928
|
//-----------------------------------------------------------------------------
|
|
316807
316929
|
// this is updated by vss.js when building
|
|
316808
|
-
const version = '4.2.
|
|
316930
|
+
const version = '4.2.68';
|
|
316809
316931
|
_src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
|
|
316810
316932
|
//-----------------------------------------------------------------------------
|
|
316811
316933
|
|