dukascopy-node-plus 1.1.1 → 1.1.2

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/cli/index.js CHANGED
@@ -13883,7 +13883,7 @@ var import_utc = __toESM(require("dayjs/plugin/utc"));
13883
13883
  var import_timezone = __toESM(require("dayjs/plugin/timezone"));
13884
13884
 
13885
13885
  // package.json
13886
- var version = "1.1.1";
13886
+ var version = "1.1.2";
13887
13887
 
13888
13888
  // src/stream-writer/index.ts
13889
13889
  var import_fs = __toESM(require("fs"));
@@ -1,5 +1,5 @@
1
1
  // package.json
2
- var version = "1.1.1";
2
+ var version = "1.1.2";
3
3
 
4
4
  export {
5
5
  version
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  version
3
- } from "./chunk-3Q3J6T4N.js";
3
+ } from "./chunk-7MFC3GUP.js";
4
4
  import {
5
5
  formatOutput
6
6
  } from "./chunk-476J4KQE.js";
@@ -87,26 +87,35 @@ function getHistoricalRatesToStream(config) {
87
87
  startDate,
88
88
  endDate
89
89
  });
90
- pipeline(
91
- Readable.from(urlsforFetchingData),
92
- new Transform({
93
- objectMode: true,
94
- transform: async (url, _, callback) => {
95
- const bufferObject = {
96
- url,
97
- buffer: await bufferFetcher.fetchBuffer(url),
98
- isCacheHit: useCache
99
- };
90
+ const promiseProcessedData = urlsforFetchingData.map((url) => {
91
+ return new Promise((resolve, reject) => {
92
+ bufferFetcher.fetch([url]).then((bufferObjects) => {
100
93
  try {
101
94
  const processedData = processData({
102
95
  instrument: input.instrument,
103
96
  requestedTimeframe: input.timeframe,
104
- bufferObjects: [bufferObject],
97
+ bufferObjects,
105
98
  priceType: input.priceType,
106
99
  volumes: input.volumes,
107
100
  volumeUnits: input.volumeUnits,
108
101
  ignoreFlats: input.ignoreFlats
109
102
  });
103
+ resolve(processedData);
104
+ } catch (err) {
105
+ reject(err);
106
+ }
107
+ }).catch((err) => {
108
+ reject(err);
109
+ });
110
+ });
111
+ });
112
+ pipeline(
113
+ Readable.from(promiseProcessedData),
114
+ new Transform({
115
+ objectMode: true,
116
+ transform: async (processedDataPr, _, callback) => {
117
+ const processedData = await processedDataPr;
118
+ try {
110
119
  processedData.forEach((item) => {
111
120
  const [timestamp] = item;
112
121
  if (timestamp && timestamp >= startDateMs && timestamp < endDateMs) {
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  version
4
- } from "../chunk-3Q3J6T4N.js";
4
+ } from "../chunk-7MFC3GUP.js";
5
5
  import {
6
6
  BufferFetcher,
7
7
  CacheManager,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getHistoricalRates
3
- } from "./chunk-YLYLH52F.js";
4
- import "./chunk-3Q3J6T4N.js";
3
+ } from "./chunk-MTHVPJMW.js";
4
+ import "./chunk-7MFC3GUP.js";
5
5
  import "./chunk-476J4KQE.js";
6
6
  import "./chunk-D3M3SVMW.js";
7
7
 
@@ -24,12 +24,13 @@ var printMemory = () => {
24
24
  instrument: "eurusd",
25
25
  dates: {
26
26
  from: /* @__PURE__ */ new Date("2021-02-01"),
27
- to: /* @__PURE__ */ new Date("2021-02-03")
27
+ to: /* @__PURE__ */ new Date("2021-06-03")
28
28
  },
29
29
  timeframe: "m1",
30
30
  format: "csv"
31
31
  });
32
32
  process.stdout.write(data);
33
+ console.log();
33
34
  printMemory();
34
35
  } catch (error) {
35
36
  console.log("error", error);
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  getHistoricalRatesToStream
3
- } from "./chunk-VHUFHYTL.js";
3
+ } from "./chunk-NBUGCZCI.js";
4
4
  import "./chunk-476J4KQE.js";
5
5
  import "./chunk-D3M3SVMW.js";
6
6
 
@@ -23,15 +23,16 @@ var printMemory = () => {
23
23
  instrument: "eurusd",
24
24
  dates: {
25
25
  from: /* @__PURE__ */ new Date("2021-02-01"),
26
- to: /* @__PURE__ */ new Date("2021-02-03")
26
+ to: /* @__PURE__ */ new Date("2021-06-03")
27
27
  },
28
28
  timeframe: "m1",
29
29
  format: "csv"
30
30
  });
31
- data.on("data", (_chunk) => {
32
- process.stdout.write(_chunk);
31
+ data.on("data", (chunk) => {
32
+ process.stdout.write(chunk);
33
33
  });
34
34
  data.on("end", () => {
35
+ console.log();
35
36
  printMemory();
36
37
  });
37
38
  } catch (error) {
package/dist/esm/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  getHistoricalRatesToStream
3
- } from "./chunk-VHUFHYTL.js";
3
+ } from "./chunk-NBUGCZCI.js";
4
4
  import {
5
5
  getHistoricRates,
6
6
  getHistoricalRates
7
- } from "./chunk-YLYLH52F.js";
8
- import "./chunk-3Q3J6T4N.js";
7
+ } from "./chunk-MTHVPJMW.js";
8
+ import "./chunk-7MFC3GUP.js";
9
9
  import {
10
10
  formatOutput
11
11
  } from "./chunk-476J4KQE.js";
@@ -13728,7 +13728,7 @@ function formatBytes(bytes, decimals = 2) {
13728
13728
  }
13729
13729
 
13730
13730
  // package.json
13731
- var version = "1.1.1";
13731
+ var version = "1.1.2";
13732
13732
 
13733
13733
  // src/getHistoricalRates.ts
13734
13734
  var import_debug = __toESM(require("debug"));
@@ -13841,12 +13841,13 @@ var printMemory = () => {
13841
13841
  instrument: "eurusd",
13842
13842
  dates: {
13843
13843
  from: /* @__PURE__ */ new Date("2021-02-01"),
13844
- to: /* @__PURE__ */ new Date("2021-02-03")
13844
+ to: /* @__PURE__ */ new Date("2021-06-03")
13845
13845
  },
13846
13846
  timeframe: "m1",
13847
13847
  format: "csv"
13848
13848
  });
13849
13849
  process.stdout.write(data);
13850
+ console.log();
13850
13851
  printMemory();
13851
13852
  } catch (error) {
13852
13853
  console.log("error", error);
@@ -13776,26 +13776,35 @@ function getHistoricalRatesToStream(config) {
13776
13776
  startDate,
13777
13777
  endDate
13778
13778
  });
13779
- (0, import_promises.pipeline)(
13780
- import_stream.Readable.from(urlsforFetchingData),
13781
- new import_stream.Transform({
13782
- objectMode: true,
13783
- transform: async (url, _, callback) => {
13784
- const bufferObject = {
13785
- url,
13786
- buffer: await bufferFetcher.fetchBuffer(url),
13787
- isCacheHit: useCache
13788
- };
13779
+ const promiseProcessedData = urlsforFetchingData.map((url) => {
13780
+ return new Promise((resolve2, reject) => {
13781
+ bufferFetcher.fetch([url]).then((bufferObjects) => {
13789
13782
  try {
13790
13783
  const processedData = processData({
13791
13784
  instrument: input.instrument,
13792
13785
  requestedTimeframe: input.timeframe,
13793
- bufferObjects: [bufferObject],
13786
+ bufferObjects,
13794
13787
  priceType: input.priceType,
13795
13788
  volumes: input.volumes,
13796
13789
  volumeUnits: input.volumeUnits,
13797
13790
  ignoreFlats: input.ignoreFlats
13798
13791
  });
13792
+ resolve2(processedData);
13793
+ } catch (err) {
13794
+ reject(err);
13795
+ }
13796
+ }).catch((err) => {
13797
+ reject(err);
13798
+ });
13799
+ });
13800
+ });
13801
+ (0, import_promises.pipeline)(
13802
+ import_stream.Readable.from(promiseProcessedData),
13803
+ new import_stream.Transform({
13804
+ objectMode: true,
13805
+ transform: async (processedDataPr, _, callback) => {
13806
+ const processedData = await processedDataPr;
13807
+ try {
13799
13808
  processedData.forEach((item) => {
13800
13809
  const [timestamp] = item;
13801
13810
  if (timestamp && timestamp >= startDateMs && timestamp < endDateMs) {
@@ -13858,15 +13867,16 @@ var printMemory = () => {
13858
13867
  instrument: "eurusd",
13859
13868
  dates: {
13860
13869
  from: /* @__PURE__ */ new Date("2021-02-01"),
13861
- to: /* @__PURE__ */ new Date("2021-02-03")
13870
+ to: /* @__PURE__ */ new Date("2021-06-03")
13862
13871
  },
13863
13872
  timeframe: "m1",
13864
13873
  format: "csv"
13865
13874
  });
13866
- data.on("data", (_chunk) => {
13867
- process.stdout.write(_chunk);
13875
+ data.on("data", (chunk) => {
13876
+ process.stdout.write(chunk);
13868
13877
  });
13869
13878
  data.on("end", () => {
13879
+ console.log();
13870
13880
  printMemory();
13871
13881
  });
13872
13882
  } catch (error) {
package/dist/index.js CHANGED
@@ -13767,7 +13767,7 @@ function formatBytes(bytes, decimals = 2) {
13767
13767
  }
13768
13768
 
13769
13769
  // package.json
13770
- var version = "1.1.1";
13770
+ var version = "1.1.2";
13771
13771
 
13772
13772
  // src/getHistoricalRates.ts
13773
13773
  var import_debug = __toESM(require("debug"));
@@ -14060,26 +14060,35 @@ function getHistoricalRatesToStream(config) {
14060
14060
  startDate,
14061
14061
  endDate
14062
14062
  });
14063
- (0, import_promises.pipeline)(
14064
- import_stream.Readable.from(urlsforFetchingData),
14065
- new import_stream.Transform({
14066
- objectMode: true,
14067
- transform: async (url, _, callback) => {
14068
- const bufferObject = {
14069
- url,
14070
- buffer: await bufferFetcher.fetchBuffer(url),
14071
- isCacheHit: useCache
14072
- };
14063
+ const promiseProcessedData = urlsforFetchingData.map((url) => {
14064
+ return new Promise((resolve2, reject) => {
14065
+ bufferFetcher.fetch([url]).then((bufferObjects) => {
14073
14066
  try {
14074
14067
  const processedData = processData({
14075
14068
  instrument: input.instrument,
14076
14069
  requestedTimeframe: input.timeframe,
14077
- bufferObjects: [bufferObject],
14070
+ bufferObjects,
14078
14071
  priceType: input.priceType,
14079
14072
  volumes: input.volumes,
14080
14073
  volumeUnits: input.volumeUnits,
14081
14074
  ignoreFlats: input.ignoreFlats
14082
14075
  });
14076
+ resolve2(processedData);
14077
+ } catch (err) {
14078
+ reject(err);
14079
+ }
14080
+ }).catch((err) => {
14081
+ reject(err);
14082
+ });
14083
+ });
14084
+ });
14085
+ (0, import_promises.pipeline)(
14086
+ import_stream.Readable.from(promiseProcessedData),
14087
+ new import_stream.Transform({
14088
+ objectMode: true,
14089
+ transform: async (processedDataPr, _, callback) => {
14090
+ const processedData = await processedDataPr;
14091
+ try {
14083
14092
  processedData.forEach((item) => {
14084
14093
  const [timestamp] = item;
14085
14094
  if (timestamp && timestamp >= startDateMs && timestamp < endDateMs) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dukascopy-node-plus",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "description": "Node.js library for downloading historical market tick data for for Crypto, Stocks, ETFs, CFDs, Forex",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/esm/index.js",