ws

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: May 1, 2022 License: Apache-2.0 Imports: 5 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         = false            // UseTestnet 使用测试api
	UseAWSnet          = false            // UseAWSnet 使用AWS api
	WebsocketTimeout   = time.Second * 25 // WebsocketTimeout 发送ping时间间隔
	WebsocketKeepalive = false            // WebsocketKeepalive 是否一直连接
)

Functions

func NewWsConfig

func NewWsConfig(channelType ChannelType) *wsConfig

func SubscribeWsDepthServe

func SubscribeWsDepthServe(w *wsConfig, symbolLevels []string, channel DepthChannel, handler WebsDepthHandler, errHandler ErrHandler) (doneC, stopC chan struct{}, err error)

SubscribeWsDepthServe 订阅深度信息

Types

type ChannelType

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

WsType wps类型

type DepthChannel

type DepthChannel string

DepthChannel 深度频道

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

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   []common.PriceLevel `json:"bids"`
	Asks   []common.PriceLevel `json:"asks"`
}

WebsDepthEvent 深度数据

type WebsDepthHandler

type WebsDepthHandler func(event *WebsDepthEvent)

WebsDepthHandler 深度处理器

type WsHandler

type WsHandler func(message []byte)

WsHandler 处理返回信息

Jump to

Keyboard shortcuts

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