stream

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 1, 2021 License: MIT Imports: 13 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ChannelOrderBook = "orderbook"
	ChannelTrades    = "trades"
	ChannelTicker    = "ticker"
	ChannelFills     = "fills"
	ChannelOrders    = "orders"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Conn

type Conn struct {
	// contains filtered or unexported fields
}

func New

func New(conn *websocket.Conn, key string, secret []byte, subaccount string) *Conn

func (*Conn) Close

func (c *Conn) Close() error

func (*Conn) Login

func (c *Conn) Login() error

func (*Conn) Ping

func (c *Conn) Ping() error

func (*Conn) Recv

func (c *Conn) Recv() (interface{}, error)

func (*Conn) RecvRaw

func (c *Conn) RecvRaw() ([]byte, error)

func (*Conn) Subscribe

func (c *Conn) Subscribe(channel string, market ...string) error

func (*Conn) Unsubscribe

func (c *Conn) Unsubscribe(channel string, market ...string) error

type Error

type Error struct {
	Type string `json:"type"`
	Code int    `json:"code"`
	Msg  string `json:"msg"`
}

type Fills

type Fills struct {
	Type    string `json:"type"`
	Channel string `json:"channel"`
	Data    struct {
		Fee       float64   `json:"fee"`
		FeeRate   float64   `json:"feeRate"`
		Future    string    `json:"future"`
		ID        int       `json:"id"`
		Liquidity string    `json:"liquidity"`
		Market    string    `json:"market"`
		OrderID   int       `json:"orderId"`
		TradeID   int       `json:"tradeId"`
		Price     float64   `json:"price"`
		Side      string    `json:"side"`
		Size      float64   `json:"size"`
		Time      time.Time `json:"time"`
		Type      string    `json:"type"`
	} `json:"data"`
}

type General

type General struct {
	Type    string `json:"type"`
	Channel string `json:"channel"`
	Market  string `json:"market"`
}

type OrderBook

type OrderBook struct {
	General
	Data struct {
		Bids     [][]float64 `json:"bids"`
		Asks     [][]float64 `json:"asks"`
		Time     *Time       `json:"time"`
		Checksum int         `json:"checksum"`
		Action   string      `json:"action"`
	} `json:"data"`
}

type Orders

type Orders struct {
	Type    string `json:"type"`
	Channel string `json:"channel"`
	Data    struct {
		ID            int     `json:"id"`
		ClientID      string  `json:"clientId"`
		Market        string  `json:"market"`
		Type          string  `json:"type"`
		Side          string  `json:"side"`
		Size          float64 `json:"size"`
		Price         float64 `json:"price"`
		ReduceOnly    bool    `json:"reduceOnly"`
		IOC           bool    `json:"ioc"`
		PostOnly      bool    `json:"postOnly"`
		Status        string  `json:"status"`
		FilledSize    float64 `json:"filledSize"`
		RemainingSize float64 `json:"remainingSize"`
		AvgFillPrice  float64 `json:"avgFillPrice"`
	} `json:"data"`
}

type Pong

type Pong struct {
	Type string `json:"op"`
}

type Ticker

type Ticker struct {
	General
	Data struct {
		Bid     float64 `json:"bid"`
		Ask     float64 `json:"ask"`
		BidSize float64 `json:"bidSize"`
		AskSize float64 `json:"askSize"`
		Last    float64 `json:"last"`
		Time    *Time   `json:"time"`
	} `json:"data"`
}

type Time

type Time struct {
	time.Time
}

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(data []byte) error

type Trade

type Trade struct {
	General
	Data []struct {
		ID          int       `json:"id"`
		Liquidation bool      `json:"liquidation"`
		Price       float64   `json:"price"`
		Side        string    `json:"side"`
		Size        float64   `json:"size"`
		Time        time.Time `json:"time"`
	} `json:"data"`
}

Jump to

Keyboard shortcuts

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