Move gdax message/request to new package

This commit is contained in:
Kevin Cotugno 2017-09-21 14:03:35 -07:00
parent a70168ce7e
commit f1a4e5730c
3 changed files with 10 additions and 10 deletions

View File

@ -1,4 +1,4 @@
package tacitus
package gdax
import (
"github.com/shopspring/decimal"

View File

@ -1,4 +1,4 @@
package tacitus
package gdax
const Subscribe = RequestType("subscribe")
const Unsubscribe = RequestType("unsubscribe")

View File

@ -1,7 +1,7 @@
package websocket
import (
"github.com/kcotugno/tacitus"
"github.com/kcotugno/tacitus/gdax"
"github.com/gorilla/websocket"
)
@ -9,9 +9,9 @@ import (
const ENDPOINT = "wss://ws-feed.gdax.com"
type Client struct {
msgs chan tacitus.Message
msgs chan gdax.Message
err chan error
writer chan tacitus.Request
writer chan gdax.Request
conn *websocket.Conn
connected bool
@ -20,9 +20,9 @@ type Client struct {
func NewClient() *Client {
c := Client{}
c.msgs = make(chan tacitus.Message, 1024)
c.msgs = make(chan gdax.Message, 1024)
c.err = make(chan error)
c.writer = make(chan tacitus.Request)
c.writer = make(chan gdax.Request)
c.close = make(chan bool)
return &c
@ -42,7 +42,7 @@ func (c *Client) Open() error {
select {
case <- c.close:
default:
var msg tacitus.Message
var msg gdax.Message
err := c.conn.ReadJSON(&msg)
if err != nil {
@ -78,13 +78,13 @@ func (c *Client) Close() {
c.conn.Close()
}
func (c *Client) Send(msg tacitus.Request) {
func (c *Client) Send(msg gdax.Request) {
if c.connected {
c.writer <- msg
}
}
func (c *Client) MessageStream() <- chan tacitus.Message {
func (c *Client) MessageStream() <- chan gdax.Message {
return c.msgs
}