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/dist/cjs/ccxt.js CHANGED
@@ -177,7 +177,7 @@ var woo$1 = require('./src/pro/woo.js');
177
177
 
178
178
  //-----------------------------------------------------------------------------
179
179
  // this is updated by vss.js when building
180
- const version = '4.2.67';
180
+ const version = '4.2.68';
181
181
  Exchange["default"].ccxtVersion = version;
182
182
  const exchanges = {
183
183
  'ace': ace,
@@ -3535,6 +3535,13 @@ class Exchange {
3535
3535
  }
3536
3536
  return [value, params];
3537
3537
  }
3538
+ handleParamInteger(params, paramName, defaultValue = undefined) {
3539
+ const value = this.safeInteger(params, paramName, defaultValue);
3540
+ if (value !== undefined) {
3541
+ params = this.omit(params, paramName);
3542
+ }
3543
+ return [value, params];
3544
+ }
3538
3545
  resolvePath(path, params) {
3539
3546
  return [
3540
3547
  this.implodeParams(path, params),
@@ -882,13 +882,16 @@ class hyperliquid extends hyperliquid$1 {
882
882
  }
883
883
  orderReq.push(orderObj);
884
884
  }
885
+ const vaultAddress = this.safeString(params, 'vaultAddress');
885
886
  const orderAction = {
886
887
  'type': 'order',
887
888
  'orders': orderReq,
888
889
  'grouping': 'na',
889
- 'brokerCode': 1,
890
+ // 'brokerCode': 1, // cant
890
891
  };
891
- const vaultAddress = this.safeString(params, 'vaultAddress');
892
+ if (vaultAddress === undefined) {
893
+ orderAction['brokerCode'] = 1;
894
+ }
892
895
  const signature = this.signL1Action(orderAction, nonce, vaultAddress);
893
896
  const request = {
894
897
  'action': orderAction,
@@ -248,6 +248,9 @@ class krakenfutures extends krakenfutures$1 {
248
248
  },
249
249
  },
250
250
  },
251
+ 'fetchTrades': {
252
+ 'method': 'historyGetMarketSymbolExecutions', // historyGetMarketSymbolExecutions, publicGetHistory
253
+ },
251
254
  },
252
255
  'timeframes': {
253
256
  '1m': '1m',
@@ -697,6 +700,7 @@ class krakenfutures extends krakenfutures$1 {
697
700
  * @method
698
701
  * @name krakenfutures#fetchTrades
699
702
  * @see https://docs.futures.kraken.com/#http-api-trading-v3-api-market-data-get-trade-history
703
+ * @see https://docs.futures.kraken.com/#http-api-history-market-history-get-public-execution-events
700
704
  * @description Fetch a history of filled trades that this account has made
701
705
  * @param {string} symbol Unified CCXT market symbol
702
706
  * @param {int} [since] Timestamp in ms of earliest trade. Not used by krakenfutures except in combination with params.until
@@ -704,6 +708,7 @@ class krakenfutures extends krakenfutures$1 {
704
708
  * @param {object} [params] Exchange specific params
705
709
  * @param {int} [params.until] Timestamp in ms of latest trade
706
710
  * @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)
711
+ * @param {string} [params.method] The method to use to fetch trades. Can be 'historyGetMarketSymbolExecutions' or 'publicGetHistory' default is 'historyGetMarketSymbolExecutions'
707
712
  * @returns An array of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure}
708
713
  */
709
714
  await this.loadMarkets();
@@ -713,38 +718,113 @@ class krakenfutures extends krakenfutures$1 {
713
718
  return await this.fetchPaginatedCallDynamic('fetchTrades', symbol, since, limit, params);
714
719
  }
715
720
  const market = this.market(symbol);
716
- const request = {
721
+ let request = {
717
722
  'symbol': market['id'],
718
723
  };
719
- const until = this.safeInteger(params, 'until');
720
- if (until !== undefined) {
721
- request['lastTime'] = this.iso8601(until);
724
+ let method = undefined;
725
+ [method, params] = this.handleOptionAndParams(params, 'fetchTrades', 'method', 'historyGetMarketSymbolExecutions');
726
+ let rawTrades = undefined;
727
+ const isFullHistoryEndpoint = (method === 'historyGetMarketSymbolExecutions');
728
+ if (isFullHistoryEndpoint) {
729
+ [request, params] = this.handleUntilOption('before', request, params);
730
+ if (since !== undefined) {
731
+ request['since'] = since;
732
+ request['sort'] = 'asc';
733
+ }
734
+ if (limit !== undefined) {
735
+ request['count'] = limit;
736
+ }
737
+ const response = await this.historyGetMarketSymbolExecutions(this.extend(request, params));
738
+ //
739
+ // {
740
+ // "elements": [
741
+ // {
742
+ // "uid": "a5105030-f054-44cc-98ab-30d5cae96bef",
743
+ // "timestamp": "1710150778607",
744
+ // "event": {
745
+ // "Execution": {
746
+ // "execution": {
747
+ // "uid": "2d485b71-cd28-4a1e-9364-371a127550d2",
748
+ // "makerOrder": {
749
+ // "uid": "0a25f66b-1109-49ec-93a3-d17bf9e9137e",
750
+ // "tradeable": "PF_XBTUSD",
751
+ // "direction": "Buy",
752
+ // "quantity": "0.26500",
753
+ // "timestamp": "1710150778570",
754
+ // "limitPrice": "71907",
755
+ // "orderType": "Post",
756
+ // "reduceOnly": false,
757
+ // "lastUpdateTimestamp": "1710150778570"
758
+ // },
759
+ // "takerOrder": {
760
+ // "uid": "04de3ee0-9125-4960-bf8f-f63b577b6790",
761
+ // "tradeable": "PF_XBTUSD",
762
+ // "direction": "Sell",
763
+ // "quantity": "0.0002",
764
+ // "timestamp": "1710150778607",
765
+ // "limitPrice": "71187.00",
766
+ // "orderType": "Market",
767
+ // "reduceOnly": false,
768
+ // "lastUpdateTimestamp": "1710150778607"
769
+ // },
770
+ // "timestamp": "1710150778607",
771
+ // "quantity": "0.0002",
772
+ // "price": "71907",
773
+ // "markPrice": "71903.32715463147",
774
+ // "limitFilled": false,
775
+ // "usdValue": "14.38"
776
+ // },
777
+ // "takerReducedQuantity": ""
778
+ // }
779
+ // }
780
+ // },
781
+ // ... followed by older items
782
+ // ],
783
+ // "len": "1000",
784
+ // "continuationToken": "QTexMDE0OTe33NTcyXy8xNDIzAjc1NjY5MwI="
785
+ // }
786
+ //
787
+ const elements = this.safeList(response, 'elements', []);
788
+ // we need to reverse the list to fix chronology
789
+ rawTrades = [];
790
+ const length = elements.length;
791
+ for (let i = 0; i < length; i++) {
792
+ const index = length - 1 - i;
793
+ const element = elements[index];
794
+ const event = this.safeDict(element, 'event', {});
795
+ const executionContainer = this.safeDict(event, 'Execution', {});
796
+ const rawTrade = this.safeDict(executionContainer, 'execution', {});
797
+ rawTrades.push(rawTrade);
798
+ }
722
799
  }
723
- //
724
- // {
725
- // "result": "success",
726
- // "history": [
727
- // {
728
- // "time": "2022-03-18T04:55:37.692Z",
729
- // "trade_id": 100,
730
- // "price": 0.7921,
731
- // "size": 1068,
732
- // "side": "sell",
733
- // "type": "fill",
734
- // "uid": "6c5da0b0-f1a8-483f-921f-466eb0388265"
735
- // },
736
- // ...
737
- // ],
738
- // "serverTime": "2022-03-18T06:39:18.056Z"
739
- // }
740
- //
741
- const response = await this.publicGetHistory(this.extend(request, params));
742
- const history = this.safeValue(response, 'history');
743
- return this.parseTrades(history, market, since, limit);
800
+ else {
801
+ [request, params] = this.handleUntilOption('lastTime', request, params);
802
+ const response = await this.publicGetHistory(this.extend(request, params));
803
+ //
804
+ // {
805
+ // "result": "success",
806
+ // "history": [
807
+ // {
808
+ // "time": "2022-03-18T04:55:37.692Z",
809
+ // "trade_id": 100,
810
+ // "price": 0.7921,
811
+ // "size": 1068,
812
+ // "side": "sell",
813
+ // "type": "fill",
814
+ // "uid": "6c5da0b0-f1a8-483f-921f-466eb0388265"
815
+ // },
816
+ // ...
817
+ // ],
818
+ // "serverTime": "2022-03-18T06:39:18.056Z"
819
+ // }
820
+ //
821
+ rawTrades = this.safeList(response, 'history', []);
822
+ }
823
+ return this.parseTrades(rawTrades, market, since, limit);
744
824
  }
745
825
  parseTrade(trade, market = undefined) {
746
826
  //
747
- // fetchTrades (public)
827
+ // fetchTrades (recent trades)
748
828
  //
749
829
  // {
750
830
  // "time": "2019-02-14T09:25:33.920Z",
@@ -752,10 +832,24 @@ class krakenfutures extends krakenfutures$1 {
752
832
  // "price": 3574,
753
833
  // "size": 100,
754
834
  // "side": "buy",
755
- // "type": "fill" // fill, liquidation, assignment, termination
835
+ // "type": "fill" // fill, liquidation, assignment, termination
756
836
  // "uid": "11c3d82c-9e70-4fe9-8115-f643f1b162d4"
757
837
  // }
758
838
  //
839
+ // fetchTrades (executions history)
840
+ //
841
+ // {
842
+ // "timestamp": "1710152516830",
843
+ // "price": "71927.0",
844
+ // "quantity": "0.0695",
845
+ // "markPrice": "71936.38701675525",
846
+ // "limitFilled": true,
847
+ // "usdValue": "4998.93",
848
+ // "uid": "116ae634-253f-470b-bd20-fa9d429fb8b1",
849
+ // "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" },
850
+ // "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" }
851
+ // }
852
+ //
759
853
  // fetchMyTrades (private)
760
854
  //
761
855
  // {
@@ -794,9 +888,9 @@ class krakenfutures extends krakenfutures$1 {
794
888
  // "type": "EXECUTION"
795
889
  // }
796
890
  //
797
- const timestamp = this.parse8601(this.safeString2(trade, 'time', 'fillTime'));
891
+ let timestamp = this.parse8601(this.safeString2(trade, 'time', 'fillTime'));
798
892
  const price = this.safeString(trade, 'price');
799
- const amount = this.safeString2(trade, 'size', 'amount', '0.0');
893
+ const amount = this.safeStringN(trade, ['size', 'amount', 'quantity'], '0.0');
800
894
  let id = this.safeString2(trade, 'uid', 'fill_id');
801
895
  if (id === undefined) {
802
896
  id = this.safeString(trade, 'executionId');
@@ -845,6 +939,15 @@ class krakenfutures extends krakenfutures$1 {
845
939
  takerOrMaker = 'maker';
846
940
  }
847
941
  }
942
+ const isHistoricalExecution = ('takerOrder' in trade);
943
+ if (isHistoricalExecution) {
944
+ timestamp = this.safeInteger(trade, 'timestamp');
945
+ const taker = this.safeDict(trade, 'takerOrder', {});
946
+ if (taker !== undefined) {
947
+ side = this.safeStringLower(taker, 'direction');
948
+ takerOrMaker = 'taker';
949
+ }
950
+ }
848
951
  return this.safeTrade({
849
952
  'info': trade,
850
953
  'id': id,
package/js/ccxt.d.ts CHANGED
@@ -4,7 +4,7 @@ import * as functions from './src/base/functions.js';
4
4
  import * as errors from './src/base/errors.js';
5
5
  import type { Market, Trade, Fee, Ticker, OrderBook, Order, Transaction, Tickers, Currency, Balance, DepositAddress, WithdrawalResponse, DepositAddressResponse, OHLCV, Balances, PartialBalances, Dictionary, MinMax, Position, FundingRateHistory, Liquidation, FundingHistory, MarginMode, Greeks, Leverage, Leverages } from './src/base/types.js';
6
6
  import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
7
- declare const version = "4.2.66";
7
+ declare const version = "4.2.67";
8
8
  import ace from './src/ace.js';
9
9
  import alpaca from './src/alpaca.js';
10
10
  import ascendex from './src/ascendex.js';
package/js/ccxt.js CHANGED
@@ -38,7 +38,7 @@ import * as errors from './src/base/errors.js';
38
38
  import { BaseError, ExchangeError, PermissionDenied, AccountNotEnabled, AccountSuspended, ArgumentsRequired, BadRequest, BadSymbol, MarginModeAlreadySet, BadResponse, NullResponse, InsufficientFunds, InvalidAddress, InvalidOrder, OrderNotFound, OrderNotCached, CancelPending, OrderImmediatelyFillable, OrderNotFillable, DuplicateOrderId, NotSupported, NetworkError, DDoSProtection, RateLimitExceeded, ExchangeNotAvailable, OnMaintenance, InvalidNonce, RequestTimeout, AuthenticationError, AddressPending, NoChange } from './src/base/errors.js';
39
39
  //-----------------------------------------------------------------------------
40
40
  // this is updated by vss.js when building
41
- const version = '4.2.67';
41
+ const version = '4.2.68';
42
42
  Exchange.ccxtVersion = version;
43
43
  //-----------------------------------------------------------------------------
44
44
  import ace from './src/ace.js';
@@ -795,7 +795,8 @@ export default class Exchange {
795
795
  setHeaders(headers: any): any;
796
796
  marketId(symbol: string): string;
797
797
  symbol(symbol: string): string;
798
- handleParamString(params: object, paramName: string, defaultValue?: any): [string, object];
798
+ handleParamString(params: object, paramName: string, defaultValue?: Str): [string, object];
799
+ handleParamInteger(params: object, paramName: string, defaultValue?: Int): [Int, object];
799
800
  resolvePath(path: any, params: any): any[];
800
801
  getListFromObjectValues(objects: any, key: IndexType): any[];
801
802
  getSymbolsForMarketType(marketType?: string, subType?: string, symbolWithActiveStatus?: boolean, symbolWithUnknownStatus?: boolean): any[];
@@ -3522,6 +3522,13 @@ export default class Exchange {
3522
3522
  }
3523
3523
  return [value, params];
3524
3524
  }
3525
+ handleParamInteger(params, paramName, defaultValue = undefined) {
3526
+ const value = this.safeInteger(params, paramName, defaultValue);
3527
+ if (value !== undefined) {
3528
+ params = this.omit(params, paramName);
3529
+ }
3530
+ return [value, params];
3531
+ }
3525
3532
  resolvePath(path, params) {
3526
3533
  return [
3527
3534
  this.implodeParams(path, params),
@@ -11,8 +11,10 @@ export declare type SubType = 'linear' | 'inverse' | undefined;
11
11
  export interface Dictionary<T> {
12
12
  [key: string]: T;
13
13
  }
14
- export declare type Dict = Dictionary<any> | undefined;
14
+ export declare type Dict = Dictionary<any>;
15
+ export declare type NullableDict = Dict | undefined;
15
16
  export declare type List = Array<any> | undefined;
17
+ export declare type NullableList = List | undefined;
16
18
  /** Request parameters */
17
19
  export interface MinMax {
18
20
  min: Num;
@@ -885,13 +885,16 @@ export default class hyperliquid extends Exchange {
885
885
  }
886
886
  orderReq.push(orderObj);
887
887
  }
888
+ const vaultAddress = this.safeString(params, 'vaultAddress');
888
889
  const orderAction = {
889
890
  'type': 'order',
890
891
  'orders': orderReq,
891
892
  'grouping': 'na',
892
- 'brokerCode': 1,
893
+ // 'brokerCode': 1, // cant
893
894
  };
894
- const vaultAddress = this.safeString(params, 'vaultAddress');
895
+ if (vaultAddress === undefined) {
896
+ orderAction['brokerCode'] = 1;
897
+ }
895
898
  const signature = this.signL1Action(orderAction, nonce, vaultAddress);
896
899
  const request = {
897
900
  'action': orderAction,
@@ -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
- const request = {
724
+ let request = {
720
725
  'symbol': market['id'],
721
726
  };
722
- const until = this.safeInteger(params, 'until');
723
- if (until !== undefined) {
724
- request['lastTime'] = this.iso8601(until);
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
- // "result": "success",
729
- // "history": [
730
- // {
731
- // "time": "2022-03-18T04:55:37.692Z",
732
- // "trade_id": 100,
733
- // "price": 0.7921,
734
- // "size": 1068,
735
- // "side": "sell",
736
- // "type": "fill",
737
- // "uid": "6c5da0b0-f1a8-483f-921f-466eb0388265"
738
- // },
739
- // ...
740
- // ],
741
- // "serverTime": "2022-03-18T06:39:18.056Z"
742
- // }
743
- //
744
- const response = await this.publicGetHistory(this.extend(request, params));
745
- const history = this.safeValue(response, 'history');
746
- return this.parseTrades(history, market, since, limit);
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 (public)
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" // fill, liquidation, assignment, termination
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
- const timestamp = this.parse8601(this.safeString2(trade, 'time', 'fillTime'));
894
+ let timestamp = this.parse8601(this.safeString2(trade, 'time', 'fillTime'));
801
895
  const price = this.safeString(trade, 'price');
802
- const amount = this.safeString2(trade, 'size', 'amount', '0.0');
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ccxt",
3
- "version": "4.2.67",
3
+ "version": "4.2.68",
4
4
  "description": "A JavaScript / TypeScript / Python / C# / PHP cryptocurrency trading library with support for 100+ exchanges",
5
5
  "unpkg": "dist/ccxt.browser.js",
6
6
  "type": "module",