websocketApi

package
v0.0.0-...-057132d Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2017 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IDLE  = 0
	RESET = 1
	EXIT  = 2
)

Variables

This section is empty.

Functions

This section is empty.

Types

type WS

type WS struct {
	sync.Mutex
	// contains filtered or unexported fields
}

WS - websocket connection object

func NewWS

func NewWS() *WS

NewWS - creates new websocket object

func (*WS) Auth

func (ws *WS) Auth(key, secret string) chan struct{}

Auth - authentication

func (*WS) Connect

func (ws *WS) Connect() error

Connect - connects

func (*WS) Disconnect

func (ws *WS) Disconnect() error

Disconnect - Disconnects from websocket

func (*WS) Nonce

func (ws *WS) Nonce() int64

Nonce - gets next nonce

func (*WS) RegisterReStart

func (ws *WS) RegisterReStart(ch chan int64)

func (*WS) SubOrder

func (ws *WS) SubOrder(ch chan WSOrder, contracts []bitmex.Contracts) chan struct{}

SubOrder - subscribe to order events

func (*WS) SubPosition

func (ws *WS) SubPosition(ch chan WSPosition, contracts []bitmex.Contracts) chan struct{}

SubPosition - subscribe to position chage events

func (*WS) SubQuote

func (ws *WS) SubQuote(ch chan WSQuote, contracts []bitmex.Contracts)

SubQuote - subscribes to quotes

func (*WS) SubTrade

func (ws *WS) SubTrade(ch chan WSTrade, contracts []bitmex.Contracts)

SubTrade - subscribes channel to trades

func (*WS) SubWallet

func (ws *WS) SubWallet(ch chan bitmex.WSWallet) chan struct{}

func (*WS) SubWalletAgain

func (ws *WS) SubWalletAgain() chan struct{}

type WSOrder

type WSOrder struct {
	Timestamp             time.Time        `json:"timestamp"`
	TransactTime          time.Time        `json:"transactTime"`
	OrderID               uuid.UUID        `json:"orderID"`
	OrderQty              int64            `json:"orderQty"`
	Account               int64            `json:"account"`
	DisplayQty            int64            `json:"displayQty"`
	LeavesQty             int64            `json:"leavesQty"`
	CumQty                int64            `json:"cumQty"`
	Price                 float64          `json:"price"`
	SimpleOrderQty        float64          `json:"simpleOrderQty"`
	StopPx                float64          `json:"stopPx"`
	PegOffsetValue        float64          `json:"pegOffsetValue"`
	SimpleCumQty          float64          `json:"simpleCumQty"`
	SimpleLeavesQty       float64          `json:"simpleLeavesQty"`
	AvgPx                 float64          `json:"avgPx"`
	Side                  string           `json:"side"`
	ClOrdID               string           `json:"clOrdID"`
	Symbol                bitmex.Contracts `json:"symbol"`
	PegPriceType          string           `json:"pegPriceType"`
	Currency              bitmex.Contracts `json:"currency"`
	SettlCurrency         bitmex.Contracts `json:"settlCurrency"`
	ExecInst              string           `json:"execInst"`
	ContingencyType       string           `json:"contingencyType"`
	ExDestination         string           `json:"exDestination"`
	OrdStatus             string           `json:"ordStatus"`
	Triggered             string           `json:"triggered"`
	WorkingIndicator      string           `json:"workingIndicator"`
	OrdRejReason          string           `json:"ordRejReason"`
	MultiLegReportingType string           `json:"multiLegReportingType"`
	Text                  string           `json:"text"`
}

WSOrder - order structure

type WSPosition

type WSPosition struct {
	Timestamp        time.Time        `json:"timestamp"`
	Symbol           bitmex.Contracts `json:"symbol"`
	Account          int64            `json:"account"`
	CurrentQty       int64            `json:"currentQty"`
	MarkPrice        float64          `json:"markPrice"`
	SimpleQty        float64          `json:"simpleQty"`
	SimplePnl        float64          `json:"simplePnl"`
	LiquidationPrice float64          `json:"liquidationPrice"`
}

WSPosition - position structure

type WSQuote

type WSQuote struct {
	Timestamp time.Time        `json:"timestamp"`
	Symbol    bitmex.Contracts `json:"symbol"`
	BidPrice  float64          `json:"bidPrice"`
	BidSize   int64            `json:"bidSize"`
	AskPrice  float64          `json:"askPrice"`
	AskSize   int64            `json:"askSize"`
}

WSQuote - quote structure

type WSTrade

type WSTrade struct {
	Size            float64   `json:"size"`
	Price           float64   `json:"price"`
	ForeignNotional float64   `json:"foreignNotional"`
	GrossValue      float64   `json:"grossValue"`
	HomeNotional    float64   `json:"homeNotional"`
	Symbol          string    `json:"symbol"`
	TickDirection   string    `json:"tickDirection"`
	Side            string    `json:"side"`
	TradeMatchID    string    `json:"trdMatchID"`
	Timestamp       time.Time `json:"timestamp"`
}

WSTrade - trade structure

Jump to

Keyboard shortcuts

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