ws

package
v5.0.0-...-84a6732 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientWs

type ClientWs struct {
	AuthorizedUntil *time.Time
	Cancel          context.CancelFunc
	DoneChan        chan interface{}
	EventChan       chan *responses.WsBasicEvent
	// contains filtered or unexported fields
}

ClientWs is the websocket api client

func NewClientWs

func NewClientWs(ctx context.Context, apiKey, secretKey, passphrase string, url okex.BaseUrl) *ClientWs

NewClientWs returns a pointer to a fresh ClientWs

func (*ClientWs) Connect

func (c *ClientWs) Connect() error

Connect into the server

https://www.okex.com/docs-v5/en/#websocket-api-connect

func (*ClientWs) Process

func (c *ClientWs) Process(data []byte, e *responses.WsBasicEvent) bool

func (*ClientWs) Send

func (c *ClientWs) Send(op okex.Operation, args []map[string]interface{}) error

Send message through either connections

func (*ClientWs) SetErrorHandler

func (c *ClientWs) SetErrorHandler(ch chan *responses.WsError)

SetErrorHandler will set the error event handler

func (*ClientWs) SetSubscribeHandler

func (c *ClientWs) SetSubscribeHandler(ch chan *responses.WsSubscribe)

SetSubscribeHandler will set the error event handler

func (*ClientWs) SetUnsubscribeHandler

func (c *ClientWs) SetUnsubscribeHandler(ch chan *responses.WsUnsubscribe)

SetUnsubscribeHandler will set the error event handler

func (*ClientWs) Sign

func (c *ClientWs) Sign(method, path string) (string, string)

func (*ClientWs) Subscribe

func (c *ClientWs) Subscribe(ch []okex.ChannelName, args map[string]interface{}) error

Subscribe into channel(s)

https://www.okex.com/docs-v5/en/#websocket-api-subscribe

func (*ClientWs) Unsubscribe

func (c *ClientWs) Unsubscribe(ch []okex.ChannelName, args map[string]interface{}) error

Unsubscribe into channel(s)

https://www.okex.com/docs-v5/en/#websocket-api-unsubscribe

type PrivateClient

type PrivateClient struct {
	*ClientWs
	// contains filtered or unexported fields
}

PrivateClient is the private websocket api client

func NewPrivateClient

func NewPrivateClient(c *ClientWs) *PrivateClient

NewPrivateClient returns a pointer to a fresh PrivateClient

func (*PrivateClient) Account

func (c *PrivateClient) Account(accountChan chan *private.Account, ccy string) error

Account subscribes on an account channel

https://www.okex.com/docs-v5/en/#websocket-api-private-channel-account-channel

func (*PrivateClient) BalanceAndPosition

func (c *PrivateClient) BalanceAndPosition(bnpChan chan *private.BalanceAndPosition) error

BalanceAndPosition subscribes on a position channel

https://www.okex.com/docs-v5/en/#websocket-api-private-channel-balance-and-position-channel

func (*PrivateClient) Login

func (c *PrivateClient) Login(loginChan chan *private.Login) error

Login into the private server

https://www.okex.com/docs-v5/en/#websocket-api-login

func (*PrivateClient) Position

func (c *PrivateClient) Position(positionChan chan *private.Position, instType okex.InstrumentType, uly, instId string) error

Position subscribes on a position channel

https://www.okex.com/docs-v5/en/#websocket-api-private-channel-positions-channel

func (*PrivateClient) UAccount

func (c *PrivateClient) UAccount(ccy string) error

UAccount unsubscribes an account channel

https://www.okex.com/docs-v5/en/#websocket-api-private-channel-account-channel

func (*PrivateClient) UBalanceAndPosition

func (c *PrivateClient) UBalanceAndPosition() error

UBalanceAndPosition unsubscribes a position channel

https://www.okex.com/docs-v5/en/#websocket-api-private-channel-balance-and-position-channel

func (*PrivateClient) UPosition

func (c *PrivateClient) UPosition(instType okex.InstrumentType, uly, instId string) error

UPosition unsubscribes a position channel

https://www.okex.com/docs-v5/en/#websocket-api-private-channel-positions-channel

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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