okex

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const Okex = "Okex"

Variables

This section is empty.

Functions

func ErrNotSupportType

func ErrNotSupportType(format string, a ...interface{}) error

func IsErrNotSupportType

func IsErrNotSupportType(err error) bool

Types

type Client

type Client struct {
	APIKey    string
	SecretKey string
	BaseURL   string
	Id        string
	// contains filtered or unexported fields
}

Client 单个 websocket 信息

func New

func New(opts ...Option) *Client

func NewOkexStream

func NewOkexStream(apiKey, secretKey string, streamName string) *Client

func (*Client) RpcId

func (c *Client) RpcId(data []byte)

func (*Client) Send

func (c *Client) Send(data []byte, id int64, callback Service)

func (*Client) Start

func (c *Client) Start() error

func (*Client) Stop

func (c *Client) Stop() error

func (*Client) Subscribe

func (c *Client) Subscribe(ch interface{}) event.Subscription

type FUTURES

type FUTURES struct {
}

type Instruments

type Instruments struct {
	Arg struct {
		Channel  string `json:"channel,omitempty"`
		InstType string `json:"instType,omitempty"`
	} `json:"arg,omitempty"`
	Data []FUTURES `json:"data,omitempty"`
}

type OkexSubscribe

type OkexSubscribe struct {
	Channel string `json:"channel,omitempty"`
	InstId  string `json:"instId,omitempty"`
}

type OkexSubscribeReq

type OkexSubscribeReq struct {
	Op   string        `json:"op,omitempty"`
	Args []interface{} `json:"args,omitempty"`
}

type OkexSubscribeResp

type OkexSubscribeResp struct {
	Event string        `json:"event,omitempty"`
	Arg   OkexSubscribe `json:"args,omitempty"`
}

type Option

type Option func(*options)

func APIKey

func APIKey(key string) Option

func BaseURL

func BaseURL(path string) Option

func SecretKey

func SecretKey(name string) Option

func UnmarshalFunc

func UnmarshalFunc(f Service) Option

type Service

type Service interface {
	Unmarshal(data []byte) (interface{}, error)
}

type SubscribeService

type SubscribeService struct {
	ExName string
	// contains filtered or unexported fields
}

func (*SubscribeService) Do

func (s *SubscribeService) Do(ctx context.Context, ID uint) error

func (*SubscribeService) Subscribe

func (s *SubscribeService) Subscribe(x string)

func (*SubscribeService) SubscribeOk

func (s *SubscribeService) SubscribeOk(channel, instId string)

Jump to

Keyboard shortcuts

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