Hunting whales on OMXS.
These instructions will get you up and running on your local machine.
SOURCE db.sql;
Copy config.yml.sample into config.yml and fill in your secrets.
user: "your db user"
password: "your db password"
schema: "/harpun"
multiplier: 10
hook: false
Init stocks table with First North Stockholm by parsing -initDb=true
or by calling AddStocks()
with a custom set of stocks.
func AddStocks(s []Stock) {
q := "INSERT INTO stocks(avanzaId, ticker, name) VALUES "
vals := []interface{}{}
for i := range s {
s[i].Ticker = getTicker(s[i])
q += "(?, ?, ?),"
vals = append(vals, s[i].ID, s[i].Ticker, s[i].Name)
}
q = q[0:len(q)-1]
...
Configure custom hooks in hooks.go and by setting hook: true
in config.yml.
func AlertHook(s Stock, t Trade, tp float64) {
// My custom alert hook to be configured here...
}
Run every 5th minute during trading hours (07:00 - 15:30 UTC) with a 30 minute delay on close.
(crontab -l ; echo "*/5 7-16 * * 1-5 $GOPATH/bin/harpun -config=/PATH/TO/CONFIG/config.yml") | crontab -