Documentation ¶
Index ¶
- type ClientWs
- func (c *ClientWs) Connect() error
- func (c *ClientWs) Process(data []byte, e *responses.WsBasicEvent) bool
- func (c *ClientWs) Send(op okex.Operation, args []map[string]interface{}) error
- func (c *ClientWs) SetErrorHandler(ch chan *responses.WsError)
- func (c *ClientWs) SetSubscribeHandler(ch chan *responses.WsSubscribe)
- func (c *ClientWs) SetUnsubscribeHandler(ch chan *responses.WsUnsubscribe)
- func (c *ClientWs) Sign(method, path string) (string, string)
- func (c *ClientWs) Subscribe(ch []okex.ChannelName, args map[string]interface{}) error
- func (c *ClientWs) Unsubscribe(ch []okex.ChannelName, args map[string]interface{}) error
- type PrivateClient
- func (c *PrivateClient) Account(accountChan chan *private.Account, ccy string) error
- func (c *PrivateClient) BalanceAndPosition(bnpChan chan *private.BalanceAndPosition) error
- func (c *PrivateClient) Login(loginChan chan *private.Login) error
- func (c *PrivateClient) Position(positionChan chan *private.Position, instType okex.InstrumentType, ...) error
- func (c *PrivateClient) UAccount(ccy string) error
- func (c *PrivateClient) UBalanceAndPosition() error
- func (c *PrivateClient) UPosition(instType okex.InstrumentType, uly, instId string) error
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) SetErrorHandler ¶
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) Subscribe ¶
func (c *ClientWs) Subscribe(ch []okex.ChannelName, args map[string]interface{}) error
Subscribe into channel(s)
func (*ClientWs) Unsubscribe ¶
func (c *ClientWs) Unsubscribe(ch []okex.ChannelName, args map[string]interface{}) error
Unsubscribe into channel(s)
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
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