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/js/src/krakenfutures.js
CHANGED
|
@@ -251,6 +251,9 @@ export default class krakenfutures extends Exchange {
|
|
|
251
251
|
},
|
|
252
252
|
},
|
|
253
253
|
},
|
|
254
|
+
'fetchTrades': {
|
|
255
|
+
'method': 'historyGetMarketSymbolExecutions', // historyGetMarketSymbolExecutions, publicGetHistory
|
|
256
|
+
},
|
|
254
257
|
},
|
|
255
258
|
'timeframes': {
|
|
256
259
|
'1m': '1m',
|
|
@@ -700,6 +703,7 @@ export default class krakenfutures extends Exchange {
|
|
|
700
703
|
* @method
|
|
701
704
|
* @name krakenfutures#fetchTrades
|
|
702
705
|
* @see https://docs.futures.kraken.com/#http-api-trading-v3-api-market-data-get-trade-history
|
|
706
|
+
* @see https://docs.futures.kraken.com/#http-api-history-market-history-get-public-execution-events
|
|
703
707
|
* @description Fetch a history of filled trades that this account has made
|
|
704
708
|
* @param {string} symbol Unified CCXT market symbol
|
|
705
709
|
* @param {int} [since] Timestamp in ms of earliest trade. Not used by krakenfutures except in combination with params.until
|
|
@@ -707,6 +711,7 @@ export default class krakenfutures extends Exchange {
|
|
|
707
711
|
* @param {object} [params] Exchange specific params
|
|
708
712
|
* @param {int} [params.until] Timestamp in ms of latest trade
|
|
709
713
|
* @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)
|
|
714
|
+
* @param {string} [params.method] The method to use to fetch trades. Can be 'historyGetMarketSymbolExecutions' or 'publicGetHistory' default is 'historyGetMarketSymbolExecutions'
|
|
710
715
|
* @returns An array of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
|
|
711
716
|
*/
|
|
712
717
|
await this.loadMarkets();
|
|
@@ -716,38 +721,113 @@ export default class krakenfutures extends Exchange {
|
|
|
716
721
|
return await this.fetchPaginatedCallDynamic('fetchTrades', symbol, since, limit, params);
|
|
717
722
|
}
|
|
718
723
|
const market = this.market(symbol);
|
|
719
|
-
|
|
724
|
+
let request = {
|
|
720
725
|
'symbol': market['id'],
|
|
721
726
|
};
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
727
|
+
let method = undefined;
|
|
728
|
+
[method, params] = this.handleOptionAndParams(params, 'fetchTrades', 'method', 'historyGetMarketSymbolExecutions');
|
|
729
|
+
let rawTrades = undefined;
|
|
730
|
+
const isFullHistoryEndpoint = (method === 'historyGetMarketSymbolExecutions');
|
|
731
|
+
if (isFullHistoryEndpoint) {
|
|
732
|
+
[request, params] = this.handleUntilOption('before', request, params);
|
|
733
|
+
if (since !== undefined) {
|
|
734
|
+
request['since'] = since;
|
|
735
|
+
request['sort'] = 'asc';
|
|
736
|
+
}
|
|
737
|
+
if (limit !== undefined) {
|
|
738
|
+
request['count'] = limit;
|
|
739
|
+
}
|
|
740
|
+
const response = await this.historyGetMarketSymbolExecutions(this.extend(request, params));
|
|
741
|
+
//
|
|
742
|
+
// {
|
|
743
|
+
// "elements": [
|
|
744
|
+
// {
|
|
745
|
+
// "uid": "a5105030-f054-44cc-98ab-30d5cae96bef",
|
|
746
|
+
// "timestamp": "1710150778607",
|
|
747
|
+
// "event": {
|
|
748
|
+
// "Execution": {
|
|
749
|
+
// "execution": {
|
|
750
|
+
// "uid": "2d485b71-cd28-4a1e-9364-371a127550d2",
|
|
751
|
+
// "makerOrder": {
|
|
752
|
+
// "uid": "0a25f66b-1109-49ec-93a3-d17bf9e9137e",
|
|
753
|
+
// "tradeable": "PF_XBTUSD",
|
|
754
|
+
// "direction": "Buy",
|
|
755
|
+
// "quantity": "0.26500",
|
|
756
|
+
// "timestamp": "1710150778570",
|
|
757
|
+
// "limitPrice": "71907",
|
|
758
|
+
// "orderType": "Post",
|
|
759
|
+
// "reduceOnly": false,
|
|
760
|
+
// "lastUpdateTimestamp": "1710150778570"
|
|
761
|
+
// },
|
|
762
|
+
// "takerOrder": {
|
|
763
|
+
// "uid": "04de3ee0-9125-4960-bf8f-f63b577b6790",
|
|
764
|
+
// "tradeable": "PF_XBTUSD",
|
|
765
|
+
// "direction": "Sell",
|
|
766
|
+
// "quantity": "0.0002",
|
|
767
|
+
// "timestamp": "1710150778607",
|
|
768
|
+
// "limitPrice": "71187.00",
|
|
769
|
+
// "orderType": "Market",
|
|
770
|
+
// "reduceOnly": false,
|
|
771
|
+
// "lastUpdateTimestamp": "1710150778607"
|
|
772
|
+
// },
|
|
773
|
+
// "timestamp": "1710150778607",
|
|
774
|
+
// "quantity": "0.0002",
|
|
775
|
+
// "price": "71907",
|
|
776
|
+
// "markPrice": "71903.32715463147",
|
|
777
|
+
// "limitFilled": false,
|
|
778
|
+
// "usdValue": "14.38"
|
|
779
|
+
// },
|
|
780
|
+
// "takerReducedQuantity": ""
|
|
781
|
+
// }
|
|
782
|
+
// }
|
|
783
|
+
// },
|
|
784
|
+
// ... followed by older items
|
|
785
|
+
// ],
|
|
786
|
+
// "len": "1000",
|
|
787
|
+
// "continuationToken": "QTexMDE0OTe33NTcyXy8xNDIzAjc1NjY5MwI="
|
|
788
|
+
// }
|
|
789
|
+
//
|
|
790
|
+
const elements = this.safeList(response, 'elements', []);
|
|
791
|
+
// we need to reverse the list to fix chronology
|
|
792
|
+
rawTrades = [];
|
|
793
|
+
const length = elements.length;
|
|
794
|
+
for (let i = 0; i < length; i++) {
|
|
795
|
+
const index = length - 1 - i;
|
|
796
|
+
const element = elements[index];
|
|
797
|
+
const event = this.safeDict(element, 'event', {});
|
|
798
|
+
const executionContainer = this.safeDict(event, 'Execution', {});
|
|
799
|
+
const rawTrade = this.safeDict(executionContainer, 'execution', {});
|
|
800
|
+
rawTrades.push(rawTrade);
|
|
801
|
+
}
|
|
725
802
|
}
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
803
|
+
else {
|
|
804
|
+
[request, params] = this.handleUntilOption('lastTime', request, params);
|
|
805
|
+
const response = await this.publicGetHistory(this.extend(request, params));
|
|
806
|
+
//
|
|
807
|
+
// {
|
|
808
|
+
// "result": "success",
|
|
809
|
+
// "history": [
|
|
810
|
+
// {
|
|
811
|
+
// "time": "2022-03-18T04:55:37.692Z",
|
|
812
|
+
// "trade_id": 100,
|
|
813
|
+
// "price": 0.7921,
|
|
814
|
+
// "size": 1068,
|
|
815
|
+
// "side": "sell",
|
|
816
|
+
// "type": "fill",
|
|
817
|
+
// "uid": "6c5da0b0-f1a8-483f-921f-466eb0388265"
|
|
818
|
+
// },
|
|
819
|
+
// ...
|
|
820
|
+
// ],
|
|
821
|
+
// "serverTime": "2022-03-18T06:39:18.056Z"
|
|
822
|
+
// }
|
|
823
|
+
//
|
|
824
|
+
rawTrades = this.safeList(response, 'history', []);
|
|
825
|
+
}
|
|
826
|
+
return this.parseTrades(rawTrades, market, since, limit);
|
|
747
827
|
}
|
|
748
828
|
parseTrade(trade, market = undefined) {
|
|
749
829
|
//
|
|
750
|
-
// fetchTrades (
|
|
830
|
+
// fetchTrades (recent trades)
|
|
751
831
|
//
|
|
752
832
|
// {
|
|
753
833
|
// "time": "2019-02-14T09:25:33.920Z",
|
|
@@ -755,10 +835,24 @@ export default class krakenfutures extends Exchange {
|
|
|
755
835
|
// "price": 3574,
|
|
756
836
|
// "size": 100,
|
|
757
837
|
// "side": "buy",
|
|
758
|
-
// "type": "fill"
|
|
838
|
+
// "type": "fill" // fill, liquidation, assignment, termination
|
|
759
839
|
// "uid": "11c3d82c-9e70-4fe9-8115-f643f1b162d4"
|
|
760
840
|
// }
|
|
761
841
|
//
|
|
842
|
+
// fetchTrades (executions history)
|
|
843
|
+
//
|
|
844
|
+
// {
|
|
845
|
+
// "timestamp": "1710152516830",
|
|
846
|
+
// "price": "71927.0",
|
|
847
|
+
// "quantity": "0.0695",
|
|
848
|
+
// "markPrice": "71936.38701675525",
|
|
849
|
+
// "limitFilled": true,
|
|
850
|
+
// "usdValue": "4998.93",
|
|
851
|
+
// "uid": "116ae634-253f-470b-bd20-fa9d429fb8b1",
|
|
852
|
+
// "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" },
|
|
853
|
+
// "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" }
|
|
854
|
+
// }
|
|
855
|
+
//
|
|
762
856
|
// fetchMyTrades (private)
|
|
763
857
|
//
|
|
764
858
|
// {
|
|
@@ -797,9 +891,9 @@ export default class krakenfutures extends Exchange {
|
|
|
797
891
|
// "type": "EXECUTION"
|
|
798
892
|
// }
|
|
799
893
|
//
|
|
800
|
-
|
|
894
|
+
let timestamp = this.parse8601(this.safeString2(trade, 'time', 'fillTime'));
|
|
801
895
|
const price = this.safeString(trade, 'price');
|
|
802
|
-
const amount = this.
|
|
896
|
+
const amount = this.safeStringN(trade, ['size', 'amount', 'quantity'], '0.0');
|
|
803
897
|
let id = this.safeString2(trade, 'uid', 'fill_id');
|
|
804
898
|
if (id === undefined) {
|
|
805
899
|
id = this.safeString(trade, 'executionId');
|
|
@@ -848,6 +942,15 @@ export default class krakenfutures extends Exchange {
|
|
|
848
942
|
takerOrMaker = 'maker';
|
|
849
943
|
}
|
|
850
944
|
}
|
|
945
|
+
const isHistoricalExecution = ('takerOrder' in trade);
|
|
946
|
+
if (isHistoricalExecution) {
|
|
947
|
+
timestamp = this.safeInteger(trade, 'timestamp');
|
|
948
|
+
const taker = this.safeDict(trade, 'takerOrder', {});
|
|
949
|
+
if (taker !== undefined) {
|
|
950
|
+
side = this.safeStringLower(taker, 'direction');
|
|
951
|
+
takerOrMaker = 'taker';
|
|
952
|
+
}
|
|
953
|
+
}
|
|
851
954
|
return this.safeTrade({
|
|
852
955
|
'info': trade,
|
|
853
956
|
'id': id,
|
package/package.json
CHANGED
package/skip-tests.json
CHANGED
|
@@ -367,13 +367,12 @@
|
|
|
367
367
|
"bitmex": {
|
|
368
368
|
"skipMethods": {
|
|
369
369
|
"loadMarkets": "some market types are out of expected market-types",
|
|
370
|
-
"fetchOHLCV":
|
|
371
|
-
|
|
372
|
-
},
|
|
373
|
-
"watchOHLCV": {
|
|
374
|
-
"1": "same as above"
|
|
375
|
-
},
|
|
370
|
+
"fetchOHLCV": "https://github.com/ccxt/ccxt/pull/21356#issuecomment-1969565862",
|
|
371
|
+
"watchOHLCV": "same as above, needs key fix",
|
|
376
372
|
"fetchTickers": "negative values",
|
|
373
|
+
"watchTickers": {
|
|
374
|
+
"open": "https://app.travis-ci.com/github/ccxt/ccxt/builds/269367056#L3473"
|
|
375
|
+
},
|
|
377
376
|
"fetchPositions": {
|
|
378
377
|
"stopLossPrice": "undefined",
|
|
379
378
|
"takeProfitPrice": "undefined",
|
|
@@ -821,6 +820,9 @@
|
|
|
821
820
|
"ask": "not above bid https://app.travis-ci.com/github/ccxt/ccxt/builds/263871244#L2163",
|
|
822
821
|
"quoteVolume": "quoteVolume >= baseVolume * low is failing",
|
|
823
822
|
"baseVolume": "quoteVolume >= baseVolume * low is failing"
|
|
823
|
+
},
|
|
824
|
+
"watchTrades": {
|
|
825
|
+
"fees": "missing https://app.travis-ci.com/github/ccxt/ccxt/builds/269365378#L3601"
|
|
824
826
|
}
|
|
825
827
|
}
|
|
826
828
|
},
|
|
@@ -1152,9 +1154,11 @@
|
|
|
1152
1154
|
"latoken": {
|
|
1153
1155
|
"skipMethods":{
|
|
1154
1156
|
"loadMarkets": {
|
|
1157
|
+
"currency": "messed",
|
|
1155
1158
|
"currencyIdAndCode": "messed"
|
|
1156
1159
|
},
|
|
1157
1160
|
"fetchCurrencies": {
|
|
1161
|
+
"currency": "messed",
|
|
1158
1162
|
"currencyIdAndCode": "https://app.travis-ci.com/github/ccxt/ccxt/builds/269188556#L4337",
|
|
1159
1163
|
"withdraw":"not provided",
|
|
1160
1164
|
"deposit":"not provided"
|
|
@@ -1183,7 +1187,10 @@
|
|
|
1183
1187
|
"watchTrades": {
|
|
1184
1188
|
"timestamp": "ts several hours ahead in in future :)"
|
|
1185
1189
|
},
|
|
1186
|
-
"watchOHLCV": "some timestamp issues"
|
|
1190
|
+
"watchOHLCV": "some timestamp issues",
|
|
1191
|
+
"watchOrderBook": {
|
|
1192
|
+
"spread": "https://app.travis-ci.com/github/ccxt/ccxt/builds/269364330#L3612"
|
|
1193
|
+
}
|
|
1187
1194
|
}
|
|
1188
1195
|
},
|
|
1189
1196
|
"lykke": {
|