This repository has been archived on 2022-11-30. You can view files and clone it, but cannot push or open issues or pull requests.
tacitus/cmd/watcher/main.go

47 lines
858 B
Go
Raw Normal View History

2017-09-18 23:11:53 -07:00
package main
import (
2017-09-27 21:05:51 -07:00
"github.com/kcotugno/tacitus/gdax"
"github.com/kcotugno/tacitus/gdax/websocket"
2017-09-24 22:21:13 -07:00
"github.com/kcotugno/tacitus/ops"
2017-09-24 20:46:21 -07:00
"github.com/kcotugno/tacitus/osutil"
2017-09-27 21:05:51 -07:00
"github.com/kcotugno/tacitus/postgres"
2017-09-18 23:11:53 -07:00
)
func main() {
2017-09-24 20:46:21 -07:00
logger := osutil.NewLogger()
2017-09-18 23:11:53 -07:00
2017-09-27 21:05:51 -07:00
db := postgres.NewClient()
db.Name = "gdax"
db.User = "gdax"
db.SetLogger(logger)
err := db.Open()
if err != nil {
logger.Info("Error openning database connection: %v", err)
return
}
ws := websocket.NewClient()
ls := &gdax.ListenerService{}
ls.Client = ws
ls.Logger = logger
r := ops.Registrar{}
r.Database = db
r.Listener = ls
2017-09-24 22:21:13 -07:00
r.SetLogger(logger)
if err := r.Record("ETH-USD", "BTC-USD"); err != nil {
logger.Info("Error: %v", err)
2017-09-27 21:05:51 -07:00
return
2017-09-24 20:46:21 -07:00
}
2017-09-18 23:11:53 -07:00
v := validator{}
v.db = db
v.logger = logger
v.validate("ETH-USD", "BTC-USD")
v.stop()
2017-09-24 22:21:13 -07:00
t := make(chan bool)
2017-09-24 22:23:13 -07:00
<-t
2017-09-18 23:11:53 -07:00
}