62 lines
1.2 KiB
Go
62 lines
1.2 KiB
Go
package main
|
|
|
|
import (
|
|
"github.com/kcotugno/tacitus/gdax"
|
|
"github.com/kcotugno/tacitus/gdax/websocket"
|
|
"github.com/kcotugno/tacitus/ops"
|
|
"github.com/kcotugno/tacitus/osutil"
|
|
"github.com/kcotugno/tacitus/postgres"
|
|
|
|
"time"
|
|
)
|
|
|
|
func main() {
|
|
logger := osutil.NewLogger()
|
|
|
|
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
|
|
r.SetLogger(logger)
|
|
if err := r.Record("ETH-USD", "BTC-USD"); err != nil {
|
|
logger.Info("Error: %v", err)
|
|
return
|
|
}
|
|
|
|
a := ops.Aggregator{}
|
|
a.Database = db
|
|
a.Logger = logger
|
|
a.Products = []string{"ETH-USD", "BTC-USD"}
|
|
a.Start(30 * time.Second)
|
|
|
|
v := ops.Validator{}
|
|
v.Database = db
|
|
v.Logger = logger
|
|
v.Products = []string{"ETH-USD", "BTC-USD"}
|
|
v.Start(30 * time.Second)
|
|
|
|
av := ops.AggregationValidator{}
|
|
av.Database = db
|
|
av.Logger = logger
|
|
av.Products = []string{"ETH-USD", "BTC-USD"}
|
|
av.Intervals = []time.Duration{30 * time.Second}
|
|
av.Start(30 * time.Second)
|
|
|
|
t := make(chan bool)
|
|
<-t
|
|
}
|