ccxt 4.2.67 → 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 +145 -32
- package/dist/ccxt.browser.min.js +2 -2
- package/dist/cjs/ccxt.js +1 -1
- package/dist/cjs/src/base/Exchange.js +7 -0
- 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 +7 -0
- package/js/src/base/types.d.ts +3 -1
- package/js/src/hyperliquid.js +5 -2
- package/js/src/krakenfutures.js +132 -29
- package/package.json +1 -1
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),
|
|
@@ -159798,13 +159805,16 @@ class hyperliquid extends _abstract_hyperliquid_js__WEBPACK_IMPORTED_MODULE_0__/
|
|
|
159798
159805
|
}
|
|
159799
159806
|
orderReq.push(orderObj);
|
|
159800
159807
|
}
|
|
159808
|
+
const vaultAddress = this.safeString(params, 'vaultAddress');
|
|
159801
159809
|
const orderAction = {
|
|
159802
159810
|
'type': 'order',
|
|
159803
159811
|
'orders': orderReq,
|
|
159804
159812
|
'grouping': 'na',
|
|
159805
|
-
'brokerCode': 1,
|
|
159813
|
+
// 'brokerCode': 1, // cant
|
|
159806
159814
|
};
|
|
159807
|
-
|
|
159815
|
+
if (vaultAddress === undefined) {
|
|
159816
|
+
orderAction['brokerCode'] = 1;
|
|
159817
|
+
}
|
|
159808
159818
|
const signature = this.signL1Action(orderAction, nonce, vaultAddress);
|
|
159809
159819
|
const request = {
|
|
159810
159820
|
'action': orderAction,
|
|
@@ -168158,6 +168168,9 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
168158
168168
|
},
|
|
168159
168169
|
},
|
|
168160
168170
|
},
|
|
168171
|
+
'fetchTrades': {
|
|
168172
|
+
'method': 'historyGetMarketSymbolExecutions', // historyGetMarketSymbolExecutions, publicGetHistory
|
|
168173
|
+
},
|
|
168161
168174
|
},
|
|
168162
168175
|
'timeframes': {
|
|
168163
168176
|
'1m': '1m',
|
|
@@ -168607,6 +168620,7 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
168607
168620
|
* @method
|
|
168608
168621
|
* @name krakenfutures#fetchTrades
|
|
168609
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
|
|
168610
168624
|
* @description Fetch a history of filled trades that this account has made
|
|
168611
168625
|
* @param {string} symbol Unified CCXT market symbol
|
|
168612
168626
|
* @param {int} [since] Timestamp in ms of earliest trade. Not used by krakenfutures except in combination with params.until
|
|
@@ -168614,6 +168628,7 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
168614
168628
|
* @param {object} [params] Exchange specific params
|
|
168615
168629
|
* @param {int} [params.until] Timestamp in ms of latest trade
|
|
168616
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'
|
|
168617
168632
|
* @returns An array of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
|
|
168618
168633
|
*/
|
|
168619
168634
|
await this.loadMarkets();
|
|
@@ -168623,38 +168638,113 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
168623
168638
|
return await this.fetchPaginatedCallDynamic('fetchTrades', symbol, since, limit, params);
|
|
168624
168639
|
}
|
|
168625
168640
|
const market = this.market(symbol);
|
|
168626
|
-
|
|
168641
|
+
let request = {
|
|
168627
168642
|
'symbol': market['id'],
|
|
168628
168643
|
};
|
|
168629
|
-
|
|
168630
|
-
|
|
168631
|
-
|
|
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
|
+
}
|
|
168632
168719
|
}
|
|
168633
|
-
|
|
168634
|
-
|
|
168635
|
-
|
|
168636
|
-
|
|
168637
|
-
|
|
168638
|
-
|
|
168639
|
-
|
|
168640
|
-
|
|
168641
|
-
|
|
168642
|
-
|
|
168643
|
-
|
|
168644
|
-
|
|
168645
|
-
|
|
168646
|
-
|
|
168647
|
-
|
|
168648
|
-
|
|
168649
|
-
|
|
168650
|
-
|
|
168651
|
-
|
|
168652
|
-
|
|
168653
|
-
|
|
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);
|
|
168654
168744
|
}
|
|
168655
168745
|
parseTrade(trade, market = undefined) {
|
|
168656
168746
|
//
|
|
168657
|
-
// fetchTrades (
|
|
168747
|
+
// fetchTrades (recent trades)
|
|
168658
168748
|
//
|
|
168659
168749
|
// {
|
|
168660
168750
|
// "time": "2019-02-14T09:25:33.920Z",
|
|
@@ -168662,10 +168752,24 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
168662
168752
|
// "price": 3574,
|
|
168663
168753
|
// "size": 100,
|
|
168664
168754
|
// "side": "buy",
|
|
168665
|
-
// "type": "fill"
|
|
168755
|
+
// "type": "fill" // fill, liquidation, assignment, termination
|
|
168666
168756
|
// "uid": "11c3d82c-9e70-4fe9-8115-f643f1b162d4"
|
|
168667
168757
|
// }
|
|
168668
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
|
+
//
|
|
168669
168773
|
// fetchMyTrades (private)
|
|
168670
168774
|
//
|
|
168671
168775
|
// {
|
|
@@ -168704,9 +168808,9 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
168704
168808
|
// "type": "EXECUTION"
|
|
168705
168809
|
// }
|
|
168706
168810
|
//
|
|
168707
|
-
|
|
168811
|
+
let timestamp = this.parse8601(this.safeString2(trade, 'time', 'fillTime'));
|
|
168708
168812
|
const price = this.safeString(trade, 'price');
|
|
168709
|
-
const amount = this.
|
|
168813
|
+
const amount = this.safeStringN(trade, ['size', 'amount', 'quantity'], '0.0');
|
|
168710
168814
|
let id = this.safeString2(trade, 'uid', 'fill_id');
|
|
168711
168815
|
if (id === undefined) {
|
|
168712
168816
|
id = this.safeString(trade, 'executionId');
|
|
@@ -168755,6 +168859,15 @@ class krakenfutures extends _abstract_krakenfutures_js__WEBPACK_IMPORTED_MODULE_
|
|
|
168755
168859
|
takerOrMaker = 'maker';
|
|
168756
168860
|
}
|
|
168757
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
|
+
}
|
|
168758
168871
|
return this.safeTrade({
|
|
168759
168872
|
'info': trade,
|
|
168760
168873
|
'id': id,
|
|
@@ -316814,7 +316927,7 @@ SOFTWARE.
|
|
|
316814
316927
|
|
|
316815
316928
|
//-----------------------------------------------------------------------------
|
|
316816
316929
|
// this is updated by vss.js when building
|
|
316817
|
-
const version = '4.2.
|
|
316930
|
+
const version = '4.2.68';
|
|
316818
316931
|
_src_base_Exchange_js__WEBPACK_IMPORTED_MODULE_0__/* .Exchange */ .e.ccxtVersion = version;
|
|
316819
316932
|
//-----------------------------------------------------------------------------
|
|
316820
316933
|
|