dukascopy-node-plus 1.0.0 → 1.1.1
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 +17 -1
- package/dist/cli/index.d.mts +1 -0
- package/dist/cli/index.js +198 -12
- package/dist/esm/chunk-3Q3J6T4N.js +6 -0
- package/dist/esm/chunk-476J4KQE.js +35 -0
- package/dist/esm/{chunk-QOULS5Y3.js → chunk-D3M3SVMW.js} +184 -14
- package/dist/esm/chunk-VHUFHYTL.js +155 -0
- package/dist/esm/chunk-YLYLH52F.js +113 -0
- package/dist/esm/cli/index.js +16 -6
- package/dist/esm/index.example.nostream.js +37 -0
- package/dist/esm/index.example.stream.js +40 -0
- package/dist/esm/index.js +15 -128
- package/dist/index.d.mts +6803 -0
- package/dist/index.d.ts +6762 -6684
- package/dist/index.example.nostream.d.mts +2 -0
- package/dist/index.example.nostream.d.ts +2 -0
- package/dist/index.example.nostream.js +13854 -0
- package/dist/index.example.stream.d.mts +2 -0
- package/dist/index.example.stream.d.ts +2 -0
- package/dist/index.example.stream.js +13875 -0
- package/dist/index.js +330 -12
- package/package.json +25 -29
package/README.md
CHANGED
|
@@ -81,6 +81,7 @@ const { getHistoricalRates } = require('dukascopy-node');
|
|
|
81
81
|
## 📖 Quick start
|
|
82
82
|
* [Basic usage of `dukascopy-node`](https://www.dukascopy-node.app/output-formats)
|
|
83
83
|
* [Downloading tick data](https://www.dukascopy-node.app/downloading-tick-data)
|
|
84
|
+
* [Date formatting and converting timezones](https://www.dukascopy-node.app/custom-date-format-and-timezone-conversion)
|
|
84
85
|
* [Dealing with empty data and errors](https://www.dukascopy-node.app/errors-and-empty-data)
|
|
85
86
|
* [Downloading data with cache](https://www.dukascopy-node.app/using-cache)
|
|
86
87
|
* [Downloading data with custom batching](https://www.dukascopy-node.app/custom-batching)
|
|
@@ -92,7 +93,7 @@ const { getHistoricalRates } = require('dukascopy-node');
|
|
|
92
93
|
## 📂 Instruments
|
|
93
94
|
|
|
94
95
|
* [Bonds 📊 (3)](#bnd_cfd)
|
|
95
|
-
* [Crypto assets ₿ (
|
|
96
|
+
* [Crypto assets ₿ (33)](#vccy)
|
|
96
97
|
* [Agricultural commodities ☕ (6)](#cmd_agricultural)
|
|
97
98
|
* [Energy commodities ⚡ (4)](#cmd_energy)
|
|
98
99
|
* [Metals commodities ⚙️ (3)](#cmd_metals)
|
|
@@ -141,19 +142,34 @@ const { getHistoricalRates } = require('dukascopy-node');
|
|
|
141
142
|
|[Cardano vs US Dollar](https://www.dukascopy-node.app/instrument/adausd)|`adausd`|Sep 25, 2021|
|
|
142
143
|
|[Aave vs US Dollar](https://www.dukascopy-node.app/instrument/aveusd)|`aveusd`|Sep 15, 2021|
|
|
143
144
|
|[Basic Attention Token vs US Dollar](https://www.dukascopy-node.app/instrument/batusd)|`batusd`|Aug 5, 2019|
|
|
145
|
+
|[Bitcoin Cash vs Swiss Franc](https://www.dukascopy-node.app/instrument/bchchf)|`bchchf`|Mar 14, 2023|
|
|
146
|
+
|[Bitcoin Cash vs Euro](https://www.dukascopy-node.app/instrument/bcheur)|`bcheur`|Mar 14, 2023|
|
|
147
|
+
|[Bitcoin Cash vs Pound Sterling](https://www.dukascopy-node.app/instrument/bchgbp)|`bchgbp`|Mar 14, 2023|
|
|
144
148
|
|[Bitcoin Cash vs US dollar](https://www.dukascopy-node.app/instrument/bchusd)|`bchusd`|May 17, 2021|
|
|
149
|
+
|[Bitcoin vs Swiss Frank](https://www.dukascopy-node.app/instrument/btcchf)|`btcchf`|Mar 14, 2023|
|
|
150
|
+
|[Bitcoin vs Euro](https://www.dukascopy-node.app/instrument/btceur)|`btceur`|May 15, 2018|
|
|
151
|
+
|[Bitcoin vs Pound Sterling](https://www.dukascopy-node.app/instrument/btcgbp)|`btcgbp`|Mar 14, 2023|
|
|
145
152
|
|[Bitcoin vs US Dollar](https://www.dukascopy-node.app/instrument/btcusd)|`btcusd`|May 7, 2017|
|
|
146
153
|
|[Compound vs US Dollar](https://www.dukascopy-node.app/instrument/cmpusd)|`cmpusd`|Sep 25, 2021|
|
|
147
154
|
|[Dashcoin vs US Dollar](https://www.dukascopy-node.app/instrument/dshusd)|`dshusd`|Aug 4, 2019|
|
|
148
155
|
|[Enjin vs US Dollar](https://www.dukascopy-node.app/instrument/enjusd)|`enjusd`|Sep 25, 2021|
|
|
149
156
|
|[EOS vs US Dollar](https://www.dukascopy-node.app/instrument/eosusd)|`eosusd`|Aug 4, 2019|
|
|
157
|
+
|[Ether vs Swiss Franc](https://www.dukascopy-node.app/instrument/ethchf)|`ethchf`|Mar 14, 2023|
|
|
158
|
+
|[Ether vs Euro](https://www.dukascopy-node.app/instrument/etheur)|`etheur`|Mar 14, 2023|
|
|
159
|
+
|[Ether vs Pound Sterling](https://www.dukascopy-node.app/instrument/ethgbp)|`ethgbp`|Mar 14, 2023|
|
|
150
160
|
|[Ether vs US Dollar](https://www.dukascopy-node.app/instrument/ethusd)|`ethusd`|Dec 11, 2017|
|
|
151
161
|
|[Chainlink vs US Dollar](https://www.dukascopy-node.app/instrument/lnkusd)|`lnkusd`|Sep 25, 2021|
|
|
162
|
+
|[Litecoin vs Swiss Franc](https://www.dukascopy-node.app/instrument/ltcchf)|`ltcchf`|Mar 14, 2023|
|
|
163
|
+
|[Litecoin vs Euro](https://www.dukascopy-node.app/instrument/ltceur)|`ltceur`|Mar 14, 2023|
|
|
164
|
+
|[Pound Sterling](https://www.dukascopy-node.app/instrument/ltcgbp)|`ltcgbp`|Mar 14, 2023|
|
|
152
165
|
|[Litecoin vs US Dollar](https://www.dukascopy-node.app/instrument/ltcusd)|`ltcusd`|Sep 3, 2018|
|
|
153
166
|
|[Polygon vs US Dollar](https://www.dukascopy-node.app/instrument/matusd)|`matusd`|Sep 25, 2021|
|
|
154
167
|
|[Maker vs US Dollar](https://www.dukascopy-node.app/instrument/mkrusd)|`mkrusd`|Sep 25, 2021|
|
|
155
168
|
|[TRON vs US Dollar](https://www.dukascopy-node.app/instrument/trxusd)|`trxusd`|Aug 4, 2019|
|
|
156
169
|
|[Uniswap vs US Dollar](https://www.dukascopy-node.app/instrument/uniusd)|`uniusd`|Oct 1, 2021|
|
|
170
|
+
|[Stellar vs Swiss Franc](https://www.dukascopy-node.app/instrument/xlmchf)|`xlmchf`|Mar 14, 2023|
|
|
171
|
+
|[Stellar vs Euro](https://www.dukascopy-node.app/instrument/xlmeur)|`xlmeur`|Mar 14, 2023|
|
|
172
|
+
|[Stellar vs Pound Sterling](https://www.dukascopy-node.app/instrument/xlmgbp)|`xlmgbp`|Mar 14, 2023|
|
|
157
173
|
|[Stellar vs US Dollar](https://www.dukascopy-node.app/instrument/xlmusd)|`xlmusd`|May 25, 2021|
|
|
158
174
|
|[Yearn.finance vs US Dollar](https://www.dukascopy-node.app/instrument/yfiusd)|`yfiusd`|Sep 25, 2021|
|
|
159
175
|
<h3 id="cmd_agricultural">Agricultural commodities ☕</h3>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
package/dist/cli/index.js
CHANGED
|
@@ -15,6 +15,10 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
15
|
return to;
|
|
16
16
|
};
|
|
17
17
|
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
18
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
19
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
20
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
21
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
18
22
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
19
23
|
mod
|
|
20
24
|
));
|
|
@@ -269,6 +273,9 @@ var Instrument = /* @__PURE__ */ ((Instrument2) => {
|
|
|
269
273
|
Instrument2["bbwiususd"] = "bbwiususd";
|
|
270
274
|
Instrument2["bbyususd"] = "bbyususd";
|
|
271
275
|
Instrument2["bciteur"] = "bciteur";
|
|
276
|
+
Instrument2["bchchf"] = "bchchf";
|
|
277
|
+
Instrument2["bcheur"] = "bcheur";
|
|
278
|
+
Instrument2["bchgbp"] = "bchgbp";
|
|
272
279
|
Instrument2["bchusd"] = "bchusd";
|
|
273
280
|
Instrument2["bdevgbgbx"] = "bdevgbgbx";
|
|
274
281
|
Instrument2["bdxususd"] = "bdxususd";
|
|
@@ -309,6 +316,9 @@ var Instrument = /* @__PURE__ */ ((Instrument2) => {
|
|
|
309
316
|
Instrument2["brxususd"] = "brxususd";
|
|
310
317
|
Instrument2["bsxususd"] = "bsxususd";
|
|
311
318
|
Instrument2["btgbgbx"] = "btgbgbx";
|
|
319
|
+
Instrument2["btcchf"] = "btcchf";
|
|
320
|
+
Instrument2["btceur"] = "btceur";
|
|
321
|
+
Instrument2["btcgbp"] = "btcgbp";
|
|
312
322
|
Instrument2["btcusd"] = "btcusd";
|
|
313
323
|
Instrument2["bundtreur"] = "bundtreur";
|
|
314
324
|
Instrument2["burlususd"] = "burlususd";
|
|
@@ -499,6 +509,9 @@ var Instrument = /* @__PURE__ */ ((Instrument2) => {
|
|
|
499
509
|
Instrument2["esususd"] = "esususd";
|
|
500
510
|
Instrument2["essususd"] = "essususd";
|
|
501
511
|
Instrument2["estcususd"] = "estcususd";
|
|
512
|
+
Instrument2["ethchf"] = "ethchf";
|
|
513
|
+
Instrument2["etheur"] = "etheur";
|
|
514
|
+
Instrument2["ethgbp"] = "ethgbp";
|
|
502
515
|
Instrument2["ethusd"] = "ethusd";
|
|
503
516
|
Instrument2["etnususd"] = "etnususd";
|
|
504
517
|
Instrument2["etsyususd"] = "etsyususd";
|
|
@@ -767,6 +780,9 @@ var Instrument = /* @__PURE__ */ ((Instrument2) => {
|
|
|
767
780
|
Instrument2["lsegbgbx"] = "lsegbgbx";
|
|
768
781
|
Instrument2["lsiususd"] = "lsiususd";
|
|
769
782
|
Instrument2["lstrususd"] = "lstrususd";
|
|
783
|
+
Instrument2["ltcchf"] = "ltcchf";
|
|
784
|
+
Instrument2["ltceur"] = "ltceur";
|
|
785
|
+
Instrument2["ltcgbp"] = "ltcgbp";
|
|
770
786
|
Instrument2["ltcusd"] = "ltcusd";
|
|
771
787
|
Instrument2["luluususd"] = "luluususd";
|
|
772
788
|
Instrument2["luvususd"] = "luvususd";
|
|
@@ -1270,6 +1286,9 @@ var Instrument = /* @__PURE__ */ ((Instrument2) => {
|
|
|
1270
1286
|
Instrument2["xlfususd"] = "xlfususd";
|
|
1271
1287
|
Instrument2["xliususd"] = "xliususd";
|
|
1272
1288
|
Instrument2["xlkususd"] = "xlkususd";
|
|
1289
|
+
Instrument2["xlmchf"] = "xlmchf";
|
|
1290
|
+
Instrument2["xlmeur"] = "xlmeur";
|
|
1291
|
+
Instrument2["xlmgbp"] = "xlmgbp";
|
|
1273
1292
|
Instrument2["xlmusd"] = "xlmusd";
|
|
1274
1293
|
Instrument2["xlnxususd"] = "xlnxususd";
|
|
1275
1294
|
Instrument2["xlpususd"] = "xlpususd";
|
|
@@ -1331,8 +1350,17 @@ var Format = /* @__PURE__ */ ((Format2) => {
|
|
|
1331
1350
|
|
|
1332
1351
|
// src/config/volume-unit.ts
|
|
1333
1352
|
var VolumeUnit = {
|
|
1353
|
+
/**
|
|
1354
|
+
* A single unit of a currency, commodity, or security.
|
|
1355
|
+
*/
|
|
1334
1356
|
units: "units",
|
|
1357
|
+
/**
|
|
1358
|
+
* A thousand units of a currency, commodity, or security.
|
|
1359
|
+
*/
|
|
1335
1360
|
thousands: "thousands",
|
|
1361
|
+
/**
|
|
1362
|
+
* A million units of a currency, commodity, or security.
|
|
1363
|
+
*/
|
|
1336
1364
|
millions: "millions"
|
|
1337
1365
|
};
|
|
1338
1366
|
|
|
@@ -1482,7 +1510,7 @@ var commanderSchema = import_commander.program.option("-d, --debug", "Output ext
|
|
|
1482
1510
|
function getConfigFromCliArgs(argv) {
|
|
1483
1511
|
const options = commanderSchema.parse(argv).opts();
|
|
1484
1512
|
if (options.dateTo === now) {
|
|
1485
|
-
options.dateTo = new Date();
|
|
1513
|
+
options.dateTo = /* @__PURE__ */ new Date();
|
|
1486
1514
|
}
|
|
1487
1515
|
const cliConfig = {
|
|
1488
1516
|
instrument: options.instrument,
|
|
@@ -3450,7 +3478,7 @@ var instrument_meta_data_default = {
|
|
|
3450
3478
|
batusd: {
|
|
3451
3479
|
name: "BAT/USD",
|
|
3452
3480
|
description: "Basic Attention Token vs US Dollar",
|
|
3453
|
-
decimalFactor:
|
|
3481
|
+
decimalFactor: 1e3,
|
|
3454
3482
|
startHourForTicks: "2019-08-05T00:00:02.214Z",
|
|
3455
3483
|
startDayForMinuteCandles: "2019-08-05T00:00:00.000Z",
|
|
3456
3484
|
startMonthForHourlyCandles: "2019-08-05T00:00:00.000Z",
|
|
@@ -3528,6 +3556,33 @@ var instrument_meta_data_default = {
|
|
|
3528
3556
|
startMonthForHourlyCandles: "2020-11-02T12:00:00.000Z",
|
|
3529
3557
|
startYearForDailyCandles: "2020-11-02T00:00:00.000Z"
|
|
3530
3558
|
},
|
|
3559
|
+
bchchf: {
|
|
3560
|
+
name: "BCH/CHF",
|
|
3561
|
+
description: "Bitcoin Cash vs Swiss Franc",
|
|
3562
|
+
decimalFactor: 10,
|
|
3563
|
+
startHourForTicks: "2023-03-14T14:52:58.644Z",
|
|
3564
|
+
startDayForMinuteCandles: "2023-03-14T14:52:00.000Z",
|
|
3565
|
+
startMonthForHourlyCandles: "2023-03-14T14:00:00.000Z",
|
|
3566
|
+
startYearForDailyCandles: "2023-03-14T00:00:00.000Z"
|
|
3567
|
+
},
|
|
3568
|
+
bcheur: {
|
|
3569
|
+
name: "BCH/EUR",
|
|
3570
|
+
description: "Bitcoin Cash vs Euro",
|
|
3571
|
+
decimalFactor: 10,
|
|
3572
|
+
startHourForTicks: "2023-03-14T14:53:02.753Z",
|
|
3573
|
+
startDayForMinuteCandles: "2023-03-14T14:53:00.000Z",
|
|
3574
|
+
startMonthForHourlyCandles: "2023-03-14T14:00:00.000Z",
|
|
3575
|
+
startYearForDailyCandles: "2023-03-14T00:00:00.000Z"
|
|
3576
|
+
},
|
|
3577
|
+
bchgbp: {
|
|
3578
|
+
name: "BCH/GBP",
|
|
3579
|
+
description: "Bitcoin Cash vs Pound Sterling",
|
|
3580
|
+
decimalFactor: 10,
|
|
3581
|
+
startHourForTicks: "2023-03-14T14:53:02.089Z",
|
|
3582
|
+
startDayForMinuteCandles: "2023-03-14T14:53:00.000Z",
|
|
3583
|
+
startMonthForHourlyCandles: "2023-03-14T14:00:00.000Z",
|
|
3584
|
+
startYearForDailyCandles: "2023-03-14T00:00:00.000Z"
|
|
3585
|
+
},
|
|
3531
3586
|
bchusd: {
|
|
3532
3587
|
name: "BCH/USD",
|
|
3533
3588
|
description: "Bitcoin Cash vs US dollar",
|
|
@@ -3888,6 +3943,33 @@ var instrument_meta_data_default = {
|
|
|
3888
3943
|
startMonthForHourlyCandles: "2011-01-04T08:00:00.000Z",
|
|
3889
3944
|
startYearForDailyCandles: "2011-01-04T00:00:00.000Z"
|
|
3890
3945
|
},
|
|
3946
|
+
btcchf: {
|
|
3947
|
+
name: "BTC/CHF",
|
|
3948
|
+
description: "Bitcoin vs Swiss Frank",
|
|
3949
|
+
decimalFactor: 10,
|
|
3950
|
+
startHourForTicks: "2023-03-14T14:53:06.990Z",
|
|
3951
|
+
startDayForMinuteCandles: "2023-03-14T14:53:00.000Z",
|
|
3952
|
+
startMonthForHourlyCandles: "2023-03-14T14:00:00.000Z",
|
|
3953
|
+
startYearForDailyCandles: "2023-03-14T00:00:00.000Z"
|
|
3954
|
+
},
|
|
3955
|
+
btceur: {
|
|
3956
|
+
name: "BTC/EUR",
|
|
3957
|
+
description: "Bitcoin vs Euro",
|
|
3958
|
+
decimalFactor: 10,
|
|
3959
|
+
startHourForTicks: "2018-05-15T10:25:32.340Z",
|
|
3960
|
+
startDayForMinuteCandles: "2018-05-15T10:24:00.000Z",
|
|
3961
|
+
startMonthForHourlyCandles: "2018-05-15T10:00:00.000Z",
|
|
3962
|
+
startYearForDailyCandles: "2018-05-15T00:00:00.000Z"
|
|
3963
|
+
},
|
|
3964
|
+
btcgbp: {
|
|
3965
|
+
name: "BTC/GBP",
|
|
3966
|
+
description: "Bitcoin vs Pound Sterling",
|
|
3967
|
+
decimalFactor: 10,
|
|
3968
|
+
startHourForTicks: "2023-03-14T15:03:45.307Z",
|
|
3969
|
+
startDayForMinuteCandles: "2023-03-14T15:03:00.000Z",
|
|
3970
|
+
startMonthForHourlyCandles: "2023-03-14T15:00:00.000Z",
|
|
3971
|
+
startYearForDailyCandles: "2023-03-14T00:00:00.000Z"
|
|
3972
|
+
},
|
|
3891
3973
|
btcusd: {
|
|
3892
3974
|
name: "BTC/USD",
|
|
3893
3975
|
description: "Bitcoin vs US Dollar",
|
|
@@ -5598,6 +5680,33 @@ var instrument_meta_data_default = {
|
|
|
5598
5680
|
startMonthForHourlyCandles: "2022-05-12T13:00:00.000Z",
|
|
5599
5681
|
startYearForDailyCandles: "2022-05-12T00:00:00.000Z"
|
|
5600
5682
|
},
|
|
5683
|
+
ethchf: {
|
|
5684
|
+
name: "ETH/CHF",
|
|
5685
|
+
description: "Ether vs Swiss Franc",
|
|
5686
|
+
decimalFactor: 10,
|
|
5687
|
+
startHourForTicks: "2023-03-14T14:53:03.726Z",
|
|
5688
|
+
startDayForMinuteCandles: "2023-03-14T14:53:00.000Z",
|
|
5689
|
+
startMonthForHourlyCandles: "2023-03-14T14:00:00.000Z",
|
|
5690
|
+
startYearForDailyCandles: "2023-03-14T00:00:00.000Z"
|
|
5691
|
+
},
|
|
5692
|
+
etheur: {
|
|
5693
|
+
name: "ETH/EUR",
|
|
5694
|
+
description: "Ether vs Euro",
|
|
5695
|
+
decimalFactor: 10,
|
|
5696
|
+
startHourForTicks: "2023-03-14T14:53:03.677Z",
|
|
5697
|
+
startDayForMinuteCandles: "2023-03-14T14:53:00.000Z",
|
|
5698
|
+
startMonthForHourlyCandles: "2023-03-14T14:00:00.000Z",
|
|
5699
|
+
startYearForDailyCandles: "2023-03-14T00:00:00.000Z"
|
|
5700
|
+
},
|
|
5701
|
+
ethgbp: {
|
|
5702
|
+
name: "ETH/GBP",
|
|
5703
|
+
description: "Ether vs Pound Sterling",
|
|
5704
|
+
decimalFactor: 10,
|
|
5705
|
+
startHourForTicks: "2023-03-14T14:53:03.676Z",
|
|
5706
|
+
startDayForMinuteCandles: "2023-03-14T14:53:00.000Z",
|
|
5707
|
+
startMonthForHourlyCandles: "2023-03-14T14:00:00.000Z",
|
|
5708
|
+
startYearForDailyCandles: "2023-03-14T00:00:00.000Z"
|
|
5709
|
+
},
|
|
5601
5710
|
ethusd: {
|
|
5602
5711
|
name: "ETH/USD",
|
|
5603
5712
|
description: "Ether vs US Dollar",
|
|
@@ -8010,6 +8119,33 @@ var instrument_meta_data_default = {
|
|
|
8010
8119
|
startMonthForHourlyCandles: "2022-05-13T13:00:00.000Z",
|
|
8011
8120
|
startYearForDailyCandles: "2022-05-13T00:00:00.000Z"
|
|
8012
8121
|
},
|
|
8122
|
+
ltcchf: {
|
|
8123
|
+
name: "LTC/CHF",
|
|
8124
|
+
description: "Litecoin vs Swiss Franc",
|
|
8125
|
+
decimalFactor: 10,
|
|
8126
|
+
startHourForTicks: "2023-03-14T14:52:50.061Z",
|
|
8127
|
+
startDayForMinuteCandles: "2023-03-14T14:52:00.000Z",
|
|
8128
|
+
startMonthForHourlyCandles: "2023-03-14T14:00:00.000Z",
|
|
8129
|
+
startYearForDailyCandles: "2023-03-14T00:00:00.000Z"
|
|
8130
|
+
},
|
|
8131
|
+
ltceur: {
|
|
8132
|
+
name: "LTC/EUR",
|
|
8133
|
+
description: "Litecoin vs Euro",
|
|
8134
|
+
decimalFactor: 10,
|
|
8135
|
+
startHourForTicks: "2023-03-14T14:55:12.375Z",
|
|
8136
|
+
startDayForMinuteCandles: "2023-03-14T14:55:00.000Z",
|
|
8137
|
+
startMonthForHourlyCandles: "2023-03-14T14:00:00.000Z",
|
|
8138
|
+
startYearForDailyCandles: "2023-03-14T00:00:00.000Z"
|
|
8139
|
+
},
|
|
8140
|
+
ltcgbp: {
|
|
8141
|
+
name: "LTC/GBP",
|
|
8142
|
+
description: "Pound Sterling",
|
|
8143
|
+
decimalFactor: 10,
|
|
8144
|
+
startHourForTicks: "2023-03-14T14:52:50.074Z",
|
|
8145
|
+
startDayForMinuteCandles: "2023-03-14T14:52:00.000Z",
|
|
8146
|
+
startMonthForHourlyCandles: "2023-03-14T14:00:00.000Z",
|
|
8147
|
+
startYearForDailyCandles: "2023-03-14T00:00:00.000Z"
|
|
8148
|
+
},
|
|
8013
8149
|
ltcusd: {
|
|
8014
8150
|
name: "LTC/USD",
|
|
8015
8151
|
description: "Litecoin vs US Dollar",
|
|
@@ -12537,6 +12673,33 @@ var instrument_meta_data_default = {
|
|
|
12537
12673
|
startMonthForHourlyCandles: "2017-11-15T16:00:00.000Z",
|
|
12538
12674
|
startYearForDailyCandles: "2017-11-15T00:00:00.000Z"
|
|
12539
12675
|
},
|
|
12676
|
+
xlmchf: {
|
|
12677
|
+
name: "XLM/CHF",
|
|
12678
|
+
description: "Stellar vs Swiss Franc",
|
|
12679
|
+
decimalFactor: 1e5,
|
|
12680
|
+
startHourForTicks: "2023-03-14T14:53:03.870Z",
|
|
12681
|
+
startDayForMinuteCandles: "2023-03-14T14:53:00.000Z",
|
|
12682
|
+
startMonthForHourlyCandles: "2023-03-14T14:00:00.000Z",
|
|
12683
|
+
startYearForDailyCandles: "2023-03-14T00:00:00.000Z"
|
|
12684
|
+
},
|
|
12685
|
+
xlmeur: {
|
|
12686
|
+
name: "XLM/EUR",
|
|
12687
|
+
description: "Stellar vs Euro",
|
|
12688
|
+
decimalFactor: 1e5,
|
|
12689
|
+
startHourForTicks: "2023-03-14T14:53:03.820Z",
|
|
12690
|
+
startDayForMinuteCandles: "2023-03-14T14:53:00.000Z",
|
|
12691
|
+
startMonthForHourlyCandles: "2023-03-14T14:00:00.000Z",
|
|
12692
|
+
startYearForDailyCandles: "2023-03-14T00:00:00.000Z"
|
|
12693
|
+
},
|
|
12694
|
+
xlmgbp: {
|
|
12695
|
+
name: "XLM/GBP",
|
|
12696
|
+
description: "Stellar vs Pound Sterling",
|
|
12697
|
+
decimalFactor: 1e5,
|
|
12698
|
+
startHourForTicks: "2023-03-14T14:53:03.821Z",
|
|
12699
|
+
startDayForMinuteCandles: "2023-03-14T14:53:00.000Z",
|
|
12700
|
+
startMonthForHourlyCandles: "2023-03-14T14:00:00.000Z",
|
|
12701
|
+
startYearForDailyCandles: "2023-03-14T00:00:00.000Z"
|
|
12702
|
+
},
|
|
12540
12703
|
xlmusd: {
|
|
12541
12704
|
name: "XLM/USD",
|
|
12542
12705
|
description: "Stellar vs US Dollar",
|
|
@@ -12810,7 +12973,7 @@ function normaliseDates({
|
|
|
12810
12973
|
minFromIsoDate = startYearForDailyCandles;
|
|
12811
12974
|
}
|
|
12812
12975
|
let minFromDate = new Date(minFromIsoDate);
|
|
12813
|
-
let maxToDate = new Date();
|
|
12976
|
+
let maxToDate = /* @__PURE__ */ new Date();
|
|
12814
12977
|
if (utcOffset) {
|
|
12815
12978
|
startDate.setUTCMinutes(startDate.getUTCMinutes() + utcOffset);
|
|
12816
12979
|
endDate.setUTCMinutes(endDate.getUTCMinutes() + utcOffset);
|
|
@@ -12832,7 +12995,7 @@ function getYMDH(date) {
|
|
|
12832
12995
|
}
|
|
12833
12996
|
function getStartOfUtc(date, period, offset = 0) {
|
|
12834
12997
|
const [year, month, day, hours] = getYMDH(date);
|
|
12835
|
-
let startOfUtc = new Date();
|
|
12998
|
+
let startOfUtc = /* @__PURE__ */ new Date();
|
|
12836
12999
|
if (period === "hour") {
|
|
12837
13000
|
startOfUtc = new Date(Date.UTC(year, month, day, hours + offset));
|
|
12838
13001
|
} else if (period === "day") {
|
|
@@ -12846,7 +13009,7 @@ function getStartOfUtc(date, period, offset = 0) {
|
|
|
12846
13009
|
}
|
|
12847
13010
|
function getIsCurrentObj(date) {
|
|
12848
13011
|
const [year, month, day, hours] = getYMDH(date);
|
|
12849
|
-
const [currentYear, currentMonth, currentDay, currentHours] = getYMDH(new Date());
|
|
13012
|
+
const [currentYear, currentMonth, currentDay, currentHours] = getYMDH(/* @__PURE__ */ new Date());
|
|
12850
13013
|
const isCurrentYear = year === currentYear;
|
|
12851
13014
|
const isCurrentMonth = isCurrentYear && month === currentMonth;
|
|
12852
13015
|
const isCurrentDay = isCurrentMonth && day === currentDay;
|
|
@@ -13008,7 +13171,7 @@ function getConstructor(instrument, priceType, endDate) {
|
|
|
13008
13171
|
};
|
|
13009
13172
|
}
|
|
13010
13173
|
function getDateLimit(startDate, endDate, timeframe) {
|
|
13011
|
-
const nowDate = new Date();
|
|
13174
|
+
const nowDate = /* @__PURE__ */ new Date();
|
|
13012
13175
|
const adjustedEndDate = endDate < nowDate ? endDate : nowDate;
|
|
13013
13176
|
let dateLimit = adjustedEndDate;
|
|
13014
13177
|
if (timeframe === "tick" /* tick */ || timeframe === "s1" /* s1 */ || timeframe === "m1" /* m1 */ || timeframe === "m5" /* m5 */ || timeframe === "m15" /* m15 */ || timeframe === "m30" /* m30 */) {
|
|
@@ -13092,6 +13255,16 @@ function printGeneral(text) {
|
|
|
13092
13255
|
// src/buffer-fetcher/index.ts
|
|
13093
13256
|
var import_node_fetch = __toESM(require("node-fetch"));
|
|
13094
13257
|
var BufferFetcher = class {
|
|
13258
|
+
batchSize;
|
|
13259
|
+
pauseBetweenBatchesMs;
|
|
13260
|
+
onItemFetch;
|
|
13261
|
+
onBatchFetch;
|
|
13262
|
+
fetcherFn;
|
|
13263
|
+
retryCount;
|
|
13264
|
+
retryOnEmpty;
|
|
13265
|
+
pauseBetweenRetriesMs;
|
|
13266
|
+
failAfterRetryCount;
|
|
13267
|
+
cacheManager;
|
|
13095
13268
|
constructor({
|
|
13096
13269
|
batchSize = 10,
|
|
13097
13270
|
pauseBetweenBatchesMs = 1e3,
|
|
@@ -13136,6 +13309,9 @@ var BufferFetcher = class {
|
|
|
13136
13309
|
})
|
|
13137
13310
|
);
|
|
13138
13311
|
}
|
|
13312
|
+
/**
|
|
13313
|
+
* @experimental
|
|
13314
|
+
*/
|
|
13139
13315
|
async fetch_optimized(urls) {
|
|
13140
13316
|
const batches = splitArrayInChunks(urls, this.batchSize);
|
|
13141
13317
|
for (let i = 0, n = batches.length; i < n; i++) {
|
|
@@ -13193,7 +13369,6 @@ var BufferFetcher = class {
|
|
|
13193
13369
|
return bufferObjects;
|
|
13194
13370
|
}
|
|
13195
13371
|
async fetchBuffer(url) {
|
|
13196
|
-
var _a;
|
|
13197
13372
|
if (this.fetcherFn) {
|
|
13198
13373
|
return this.fetcherFn(url);
|
|
13199
13374
|
}
|
|
@@ -13213,7 +13388,7 @@ var BufferFetcher = class {
|
|
|
13213
13388
|
errorMsg = e instanceof Error ? e.message : JSON.stringify(e);
|
|
13214
13389
|
}
|
|
13215
13390
|
const isStatusOk = response.status === 200;
|
|
13216
|
-
const contentLength = Number(
|
|
13391
|
+
const contentLength = Number(response?.headers?.get("content-length") || 0);
|
|
13217
13392
|
const isResponseWithData = contentLength > 0;
|
|
13218
13393
|
isTrySuccess = isCallSuccess && isStatusOk;
|
|
13219
13394
|
if (this.retryOnEmpty) {
|
|
@@ -13239,6 +13414,9 @@ var import_path = require("path");
|
|
|
13239
13414
|
var import_fs_extra = require("fs-extra");
|
|
13240
13415
|
var DEFAULT_CACHE_FOLDER = ".dukascopy-cache";
|
|
13241
13416
|
var CacheManager = class {
|
|
13417
|
+
cacheManifest;
|
|
13418
|
+
cacheFolderPath;
|
|
13419
|
+
cacheKeyFormatter;
|
|
13242
13420
|
constructor({
|
|
13243
13421
|
cacheFolderPath,
|
|
13244
13422
|
cacheKeyFormatter
|
|
@@ -13356,7 +13534,7 @@ function getOHLC({
|
|
|
13356
13534
|
volumes
|
|
13357
13535
|
}) {
|
|
13358
13536
|
if (filterFlats) {
|
|
13359
|
-
input = input.filter((data) =>
|
|
13537
|
+
input = input.filter((data) => data?.[5] !== 0);
|
|
13360
13538
|
}
|
|
13361
13539
|
if (input.length === 0) {
|
|
13362
13540
|
return [];
|
|
@@ -13705,13 +13883,21 @@ var import_utc = __toESM(require("dayjs/plugin/utc"));
|
|
|
13705
13883
|
var import_timezone = __toESM(require("dayjs/plugin/timezone"));
|
|
13706
13884
|
|
|
13707
13885
|
// package.json
|
|
13708
|
-
var version = "1.
|
|
13886
|
+
var version = "1.1.1";
|
|
13709
13887
|
|
|
13710
13888
|
// src/stream-writer/index.ts
|
|
13711
13889
|
var import_fs = __toESM(require("fs"));
|
|
13712
13890
|
var BatchStreamWriter = class {
|
|
13891
|
+
fileWriteStream;
|
|
13892
|
+
timeframe;
|
|
13893
|
+
format;
|
|
13894
|
+
isInline;
|
|
13895
|
+
volumes;
|
|
13896
|
+
isFileEmpty = true;
|
|
13897
|
+
bodyHeaders;
|
|
13898
|
+
startDateTs;
|
|
13899
|
+
endDateTs;
|
|
13713
13900
|
constructor(options) {
|
|
13714
|
-
this.isFileEmpty = true;
|
|
13715
13901
|
this.fileWriteStream = options.fileWriteStream;
|
|
13716
13902
|
this.timeframe = options.timeframe;
|
|
13717
13903
|
this.format = options.format;
|
|
@@ -13988,7 +14174,7 @@ async function run(argv) {
|
|
|
13988
14174
|
} else {
|
|
13989
14175
|
printErrors(
|
|
13990
14176
|
"Search config invalid:",
|
|
13991
|
-
validationErrors.map((err) =>
|
|
14177
|
+
validationErrors.map((err) => err?.message || "")
|
|
13992
14178
|
);
|
|
13993
14179
|
process.exit(0);
|
|
13994
14180
|
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// src/output-formatter/index.ts
|
|
2
|
+
var candleHeaders = ["timestamp", "open", "high", "low", "close", "volume"];
|
|
3
|
+
var tickHeaders = ["timestamp", "askPrice", "bidPrice", "askVolume", "bidVolume"];
|
|
4
|
+
function formatOutput({
|
|
5
|
+
processedData,
|
|
6
|
+
format,
|
|
7
|
+
timeframe
|
|
8
|
+
}) {
|
|
9
|
+
if (processedData.length === 0) {
|
|
10
|
+
return [];
|
|
11
|
+
}
|
|
12
|
+
const bodyHeaders = timeframe === "tick" /* tick */ ? tickHeaders : candleHeaders;
|
|
13
|
+
if (format === "json" /* json */) {
|
|
14
|
+
const data = processedData.map((arr) => {
|
|
15
|
+
return arr.reduce((all, item, i) => {
|
|
16
|
+
const name = bodyHeaders[i];
|
|
17
|
+
all[name] = item;
|
|
18
|
+
return all;
|
|
19
|
+
}, {});
|
|
20
|
+
});
|
|
21
|
+
return data;
|
|
22
|
+
}
|
|
23
|
+
if (format === "csv" /* csv */) {
|
|
24
|
+
const csvHeaders = bodyHeaders.filter((_, i) => processedData[0][i] !== void 0);
|
|
25
|
+
const csv = [csvHeaders, ...processedData].map((arr) => arr.join(",")).join("\n");
|
|
26
|
+
return csv;
|
|
27
|
+
}
|
|
28
|
+
return processedData;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export {
|
|
32
|
+
candleHeaders,
|
|
33
|
+
tickHeaders,
|
|
34
|
+
formatOutput
|
|
35
|
+
};
|