ws

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//实盘API交易地址如下
	WS_PUBLIC  common.BaseURL = "wss://ws.okex.com:8443/ws/v5/public"
	WS_PRIVATE common.BaseURL = "wss://ws.okex.com:8443/ws/v5/private"

	//AWS 地址如下
	AWS_WS_PUBLIC  common.BaseURL = "wss://wsaws.okex.com:8443/ws/v5/public"
	AWS_WS_PRIVATE common.BaseURL = "wss://wsaws.okex.com:8443/ws/v5/private"

	//模拟盘交易
	SIMULATE_WS_PUBLIC  common.BaseURL = "wss://wspap.okex.com:8443/ws/v5/public?brokerId=9999"
	SIMULATE_WS_PRIVATE common.BaseURL = "wss://wspap.okex.com:8443/ws/v5/private?brokerId=9999"
)

Endpoint ws地址

Variables

View Source
var (
	// UseTestnet 使用测试api
	UseTestnet = false
	// UseAWSnet 使用AWS api
	UseAWSnet = false
	// WebsocketTimeout is an interval for sending ping/pong messages if WebsocketKeepalive is enabled
	WebsocketTimeout = time.Second * 25
	// WebsocketKeepalive enables sending ping/pong messages to check the connection stability
	WebsocketKeepalive = false
)

Functions

func WebsDepthServe

func WebsDepthServe(symbolLevels []string, handler WebsDepthHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)

WebsDepthServe 获取深度信息

Types

type Ask

type Ask = common.PriceLevel

Ask is a type alias for PriceLevel.

type Bid

type Bid = common.PriceLevel

Bid is a type alias for PriceLevel.

type DepthChannel added in v1.1.1

type DepthChannel string

DepthChannel 深度频道

const (
	DepthBooks        DepthChannel = "books"
	DepthBooks5       DepthChannel = "books5"
	DepthBooks12tbt   DepthChannel = "books-12-tbt"
	DepthBooks5012tbt DepthChannel = "books50-12-tbt"
)
var WebsDepthChannel DepthChannel = DepthBooks5

type DepthParam

type DepthParam struct {
	Op   string              `json:"op"`
	Args []map[string]string `json:"args"`
}

DepthParam 深度参数

type ErrHandler

type ErrHandler func(err error)

ErrHandler 处理错误

type WebsDepthEvent

type WebsDepthEvent struct {
	Symbol string
	Action string `json:"action"`
	Ts     string `json:"ts"`
	Bids   []Bid  `json:"bids"`
	Asks   []Ask  `json:"asks"`
}

WebsDepthEvent 深度数据

type WebsDepthHandler

type WebsDepthHandler func(event *WebsDepthEvent)

WebsDepthHandler handle websocket partial depth event

type WsHandler

type WsHandler func(message []byte)

WsHandler 处理返回信息

type WsType

type WsType string
const (
	PUBLIC  WsType = "public"
	PRIVATE WsType = "private"
)

WsType wps类型

Jump to

Keyboard shortcuts

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