-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
70 lines (46 loc) · 1.04 KB
/
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*
@name: BlueBot
@desc: Self-Trading Stock Bot
@date: 2021-03-08
@vers: 1.0.0
*/
package main
import (
"fmt"
"time"
)
const (
PORT = "" // Set oauth port
YF_SCREENER_URL = "" // Set custom yahoo finance screener endpoint
)
// An example trade strategy
func Strategy(mc *MainConfig) (string, interface{}) {
t.Sort(2.00)
m1 := Short(t, mc.c)
m2 := Sift(m1)
m2 := Mechanics(FetchLong(m1.Ticker, NewFetchConfig(HOUR, "1", 365)), NewLongMechConfig())
Check(m1.Ticker, EMA)
}
func main() {
mc := NewMainConfig()
// Start oauth service
// OAuth(mc, PORT)
go Status(mc)
for info := range mc.mOut {
if info.IsOpen {
fmt.Println("Bot is Ready. Starting...")
go Scan(mc)
for {
t := <-mc.tOut
Strategy(mc) // Custom trade strategy goes here
time.Sleep(60 * time.Second)
}
} else {
fmt.Println("Bot is Waiting...", mc.m.Wait)
go Status(mc)
}
}
}
// ########## GoDoc References ##########
// https://github.com/sdcoffey/techan
// https://alpaca.Statuss/docs/api-documentation/api-v2/