-
Notifications
You must be signed in to change notification settings - Fork 5
/
index.js
27 lines (22 loc) · 875 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
const fs = require('fs');
const path = require('path');
const inputFilePath = path.join(__dirname, "src", "data.csv");
const outputFilePath = path.join(__dirname, "output", "hammer.csv");
const chartUtils = require(path.join(__dirname,"utils", "chartUtils"));
const patternUtils = require(path.join(__dirname,"utils", "candlestickPatternUtils"));
function main() {
if (!fs.existsSync(inputFilePath)) {
throw "Should contain 'data.csv' under src folder";
}
chartUtils.renderChart(inputFilePath, "input-data-chart");
//prepare for output
if (fs.existsSync(path.dirname(outputFilePath))) {
if (fs.existsSync(outputFilePath)) {
fs.unlinkSync(outputFilePath);
}
} else {
fs.mkdirSync(path.dirname(outputFilePath));
}
patternUtils.filterHammerAndWrite(inputFilePath, outputFilePath, true);
}
main()