cexio

package module
v0.0.0-...-ff95b28 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2017 License: MIT Imports: 11 Imported by: 0

README

Not spported

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	//Key API key
	Key string
	//Secret API secret
	Secret string

	//Dialer used to connect to WebSocket server
	Dialer *websocket.Dialer
	//Logger used for error logging
	Logger *log.Logger

	//ReceiveDone send message after Close() initiation
	ReceiveDone chan bool
	// contains filtered or unexported fields
}

API cex.io websocket API type

func NewAPI

func NewAPI(key string, secret string) *API

NewAPI returns new API instance with default settings

func (*API) Close

func (a *API) Close() error

Close closes API connection

func (*API) Connect

func (a *API) Connect() error

Connect connects to cex.io websocket API server

func (*API) OrderBookSubscribe

func (a *API) OrderBookSubscribe(cCode1 string, cCode2 string, depth int64, handler SubscriptionHandler) (int64, error)

OrderBookSubscribe subscribes to order book updates. Order book snapshot will come as a first update

func (*API) OrderBookUnsubscribe

func (a *API) OrderBookUnsubscribe(cCode1 string, cCode2 string) error

OrderBookUnsubscribe unsubscribes from order book updates

func (*API) Ticker

func (a *API) Ticker(cCode1 string, cCode2 string) (*responseTicker, error)

Ticker send ticker request

type OrderBookUpdateData

type OrderBookUpdateData struct {
	ID        int64
	Pair      string
	Timestamp int64
	Bids      [][]float64
	Asks      [][]float64
}

OrderBookUpdateData data of order book update

type SubscriptionHandler

type SubscriptionHandler func(updateData OrderBookUpdateData)

SubscriptionHandler subscription update handler type

Jump to

Keyboard shortcuts

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