harpun

command module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 22, 2023 License: GPL-3.0 Imports: 1 Imported by: 0

README

harpun

Build Status GitHub go.mod Go version

Hunting whales on OMXS.

Getting Started

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]
    ...

Hooks

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...
}

Cron

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 -

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL