okex

package
v0.3.0-pre2 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2020 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OkexWSAddr     = "wss://real.okex.com:8443/ws/v3"
	OkexTESTWSAddr = "wss://real.okex.com:8443/ws/v3?brokerId=9999"
	OKEX           = "okex"
)

Variables

This section is empty.

Functions

func NewSpotSymbol

func NewSpotSymbol(base, quote string) exchange.SpotSymbol

func ParseTime

func ParseTime(timestamp string) (time.Time, error)

func SubscribeCB

func SubscribeCB(channel string, cb ResponseParseCB)

Types

type CodeC

type CodeC struct {
	LastSUBID string //okex op fail do not return operate type. we have to record
}

func NewCodeC

func NewCodeC() *CodeC

func (*CodeC) Decode

func (cc *CodeC) Decode(raw []byte) (rpc.Response, error)

func (*CodeC) Encode

func (cc *CodeC) Encode(req rpc.Request) ([]byte, error)

type ResponseParseCB

type ResponseParseCB func(string, string, json.RawMessage) (*rpc.Notify, error)

type RestClient

type RestClient struct {
	// contains filtered or unexported fields
}

func NewRestClient

func NewRestClient(key, secret, passPhrase string) *RestClient

func NewTESTRestClient

func NewTESTRestClient(key, secret, passPhrase string) *RestClient

func (*RestClient) FeeRate

func (rc *RestClient) FeeRate(ctx context.Context, syms ...exchange.Symbol) ([]exchange.TradeFee, error)

func (*RestClient) Request

func (rc *RestClient) Request(ctx context.Context, method, endPoint string, params url.Values, body io.Reader, sign bool, dst interface{}) error

type SpotSymbol

type SpotSymbol struct {
	*exchange.BaseSpotSymbol
}

func (*SpotSymbol) String

func (ss *SpotSymbol) String() string

type TradeFee

type TradeFee struct {
	Maker     string `json:"maker"`
	Taker     string `json:"taker"`
	Timestamp string `json:"timestamp"`
}

type WSClient

type WSClient struct {
	*exchange.WSClient

	Key        string
	Secret     string
	PassPhrase string
	// contains filtered or unexported fields
}

func NewTESTWSClient

func NewTESTWSClient(key, secret, passPhrase string, data chan interface{}) *WSClient

NewTESTWSClient return a wsclient for okex testnet

func NewWSClient

func NewWSClient(key, secret, passPhrase string, data chan interface{}) *WSClient

func (*WSClient) Auth

func (ws *WSClient) Auth(ctx context.Context) error

func (*WSClient) Handle

func (ws *WSClient) Handle(ctx context.Context, notify *rpc.Notify)

func (*WSClient) Run

func (ws *WSClient) Run(ctx context.Context) error

Run start the websocket loop and create a goroutine which will send ping message to okex server periodically

func (*WSClient) Subscribe

func (ws *WSClient) Subscribe(ctx context.Context, channel ...exchange.Channel) error

Subscribe in order to get subscribe result only one channle can subscribe each time

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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