-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.go
43 lines (35 loc) · 829 Bytes
/
main.go
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package main
import (
"fmt"
"io/ioutil"
"log"
"path"
"strings"
)
const SOURCE_FOLDER = "D:\\MarketData\\US\\Candles\\1Min"
const DEST_FOLDER = "D:\\MarketData\\US\\EnrichedDays"
const FILE_MASK = ".txt"
func main() {
files, err := ioutil.ReadDir(SOURCE_FOLDER)
if err != nil {
panic(err)
}
for _, f := range files {
if !strings.HasSuffix(f.Name(), FILE_MASK) {
continue
}
compressed, err := processFile(path.Join(SOURCE_FOLDER, f.Name()))
if err != nil {
log.Printf("Failed to process file: %s", f.Name())
continue
}
if compressed == nil || len(compressed) == 0 {
fmt.Printf("%s no candles found", f.Name())
continue
}
err = saveCandlesEnriched(compressed, path.Join(DEST_FOLDER, f.Name()))
if err != nil {
log.Printf("Failed to save processed file: %s", f.Name())
}
}
}