hbdm

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: May 26, 2020 License: MIT Imports: 15 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountInfo

type AccountInfo struct {
	Symbol            string      `json:"symbol"`
	MarginBalance     float64     `json:"margin_balance"`
	MarginPosition    float64     `json:"margin_position"`
	MarginFrozen      float64     `json:"margin_frozen"`
	MarginAvailable   float64     `json:"margin_available"`
	ProfitReal        float64     `json:"profit_real"`
	ProfitUnreal      float64     `json:"profit_unreal"`
	RiskRate          interface{} `json:"risk_rate"`
	WithdrawAvailable float64     `json:"withdraw_available"`
	LiquidationPrice  interface{} `json:"liquidation_price"`
	LeverRate         float64     `json:"lever_rate"`
	AdjustFactor      float64     `json:"adjust_factor"`
	MarginStatic      float64     `json:"margin_static"`
	IsDebit           int         `json:"is_debit"`
}

type AccountInfoResult

type AccountInfoResult struct {
	Status  string        `json:"status"`
	ErrCode int           `json:"err_code"`
	ErrMsg  string        `json:"err_msg"`
	Data    []AccountInfo `json:"data"`
	Ts      int64         `json:"ts"`
}

type ApiParameter

type ApiParameter struct {
	Debug              bool
	AccessKey          string
	SecretKey          string
	EnablePrivateSign  bool
	BaseURL            string
	PrivateKeyPrime256 string
	HttpClient         *http.Client
	ProxyURL           string
}

type CancelData

type CancelData struct {
	Errors    []CancelError `json:"errors"`
	Successes string        `json:"successes"`
}

type CancelError

type CancelError struct {
	OrderID string `json:"order_id"`
	ErrCode int    `json:"err_code"`
	ErrMsg  string `json:"err_msg"`
}

type CancelResult

type CancelResult struct {
	Status  string     `json:"status"`
	ErrCode int        `json:"err_code"`
	ErrMsg  string     `json:"err_msg"`
	Data    CancelData `json:"data"`
	Ts      int64      `json:"ts"`
}

type Client

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

func NewClient

func NewClient(params *ApiParameter) *Client

func (*Client) Cancel

func (c *Client) Cancel(symbol string, orderID int64, clientOrderID int64) (result CancelResult, err error)

* Cancel 撤销订单

func (*Client) GetAccountInfo

func (c *Client) GetAccountInfo(symbol string) (result AccountInfoResult, err error)

GetAccountInfo 获取用户账户信息

func (*Client) GetContractIndex

func (c *Client) GetContractIndex(symbol string) (result ContractIndexResult, err error)

*

func (*Client) GetContractInfo

func (c *Client) GetContractInfo(symbol, contractType, contractCode string) (result ContractInfoResult, err error)

*

func (*Client) GetHisOrders

func (c *Client) GetHisOrders(symbol string, tradeType int, _type int, status int, createDate int,
	pageIndex int, pageSize int, contractCode string, orderType string) (result HisOrdersResult, err error)

GetHisOrders 获取合约历史委托

func (*Client) GetKLine

func (c *Client) GetKLine(symbol string, period string, size int, from int64, to int64) (result KLineResult, err error)

获取K线数据 https://huobiapi.github.io/docs/dm/v1/cn/#k symbol true string 合约名称 如"BTC_CW"表示BTC当周合约,"BTC_NW"表示BTC次周合约,"BTC_CQ"表示BTC季度合约 period true string K线类型 1min, 5min, 15min, 30min, 60min,4hour,1day, 1mon size false integer 获取数量 150 [1,2000] from false integer 开始时间戳 10位 单位S to false integer 结束时间戳 10位 单位S

func (*Client) GetMarketDepth

func (c *Client) GetMarketDepth(symbol string, _type string) (result MarketDepthResult, err error)

GetMarketDepth 获取行情深度数据 如"BTC_CW"表示BTC当周合约,"BTC_NW"表示BTC次周合约,"BTC_CQ"表示BTC季度合约 获得150档深度数据,使用step0, step1, step2, step3, step4, step5(step1至step5是进行了深度合并后的深度),使用step0时,不合并深度获取150档数据;获得20档深度数据,使用 step6, step7, step8, step9, step10, step11(step7至step11是进行了深度合并后的深度),使用step6时,不合并深度获取20档数据 https://api.hbdm.com/market/depth?symbol=BTC_CQ&type=step5

func (*Client) GetOpenOrders

func (c *Client) GetOpenOrders(symbol string, pageIndex int, pageSize int) (result OpenOrdersResult, err error)

GetOpenOrders 获取合约当前未成交委托单 page_index: 1,2,3...

func (*Client) GetPositionInfo

func (c *Client) GetPositionInfo(symbol string) (result PositionInfoResult, err error)

GetPositionInfo 用户持仓信息

func (*Client) Heartbeat

func (c *Client) Heartbeat() (result HeartbeatResult, err error)

func (*Client) LightningClosePosition

func (c *Client) LightningClosePosition(symbol string, contractType string, contractCode string, volume int,
	direction string, clientOrderID int64, orderPriceType string) (result LightningClosePositionResult, err error)

LightningClosePosition 闪电平仓下单

func (*Client) Order

func (c *Client) Order(symbol string, contractType string, contractCode string, clientOrderID int64, price float64,
	volume float64, direction string, offset string, leverRate int, orderPriceType string) (result OrderResult, err error)

Order 合约下单 https://huobiapi.github.io/docs/dm/v1/cn/#9dc85ffb46

symbol string true "BTC","ETH"... contract_type string true 合约类型 ("this_week":当周 "next_week":下周 "quarter":季度) contract_code string true BTC180914 client_order_id long false 客户自己填写和维护,必须为数字 price decimal false 价格 volume long true 委托数量(张) direction string true "buy":买 "sell":卖 offset string true "open":开 "close":平 lever_rate int true 杠杆倍数[“开仓”若有10倍多单,就不能再下20倍多单] order_price_type string true 订单报价类型 "limit":限价 "opponent":对手价 "post_only":只做maker单,post only下单只受用户持仓数量限制,optimal_5:最优5档、optimal_10:最优10档、optimal_20:最优20档,ioc:IOC订单,fok:FOK订单, "opponent_ioc": 对手价-IOC下单,"optimal_5_ioc":最优5档-IOC下单,"optimal_10_ioc":最优10档-IOC下单,"optimal_20_ioc":最优20档-IOC下单,"opponent_fok": 对手价-FOK下单,"optimal_5_fok":最优5档-FOK下单,"optimal_10_fok":最优10档-FOK下单,"optimal_20_fok":最优20档-FOK下单

func (*Client) OrderDetail

func (c *Client) OrderDetail(symbol string, orderID int64, createdAt int64, orderType int, pageIndex int, pageSize int) (err error)

TODO: OrderDetail

func (*Client) OrderInfo

func (c *Client) OrderInfo(symbol string, orderID int64, clientOrderID int64) (result OrderInfoResult, err error)

* OrderInfo 获取合约订单信息

type ContractIndex

type ContractIndex struct {
	Symbol     string  `json:"symbol"`
	IndexPrice float64 `json:"index_price"`
	IndexTs    int64   `json:"index_ts"`
}

type ContractIndexResult

type ContractIndexResult struct {
	Status  string          `json:"status"`
	ErrCode int             `json:"err_code"`
	ErrMsg  string          `json:"err_msg"`
	Data    []ContractIndex `json:"data"`
	Ts      int64           `json:"ts"`
}

type ContractInfo

type ContractInfo struct {
	Symbol         string  `json:"symbol"`
	ContractCode   string  `json:"contract_code"`
	ContractType   string  `json:"contract_type"`
	ContractSize   float64 `json:"contract_size"`
	PriceTick      float64 `json:"price_tick"`
	DeliveryDate   string  `json:"delivery_date"`
	CreateDate     string  `json:"create_date"`
	ContractStatus int     `json:"contract_status"`
}

type ContractInfoResult

type ContractInfoResult struct {
	Status  string         `json:"status"`
	ErrCode int            `json:"err_code"`
	ErrMsg  string         `json:"err_msg"`
	Data    []ContractInfo `json:"data"`
	Ts      int64          `json:"ts"`
}

type Heartbeat

type Heartbeat struct {
	Heartbeat                 int         `json:"heartbeat"`
	EstimatedRecoveryTime     interface{} `json:"estimated_recovery_time"`
	SwapHeartbeat             int         `json:"swap_heartbeat"`
	SwapEstimatedRecoveryTime interface{} `json:"swap_estimated_recovery_time"`
}

type HeartbeatResult

type HeartbeatResult struct {
	Status string    `json:"status"`
	Data   Heartbeat `json:"data"`
	Ts     int64     `json:"ts"`
}

type HisOrdersData

type HisOrdersData struct {
	Orders      []Order `json:"orders"`
	TotalPage   int     `json:"total_page"`
	CurrentPage int     `json:"current_page"`
	TotalSize   int     `json:"total_size"`
}

type HisOrdersResult

type HisOrdersResult struct {
	Status  string        `json:"status"`
	ErrCode int           `json:"err_code"`
	ErrMsg  string        `json:"err_msg"`
	Data    HisOrdersData `json:"data"`
	Ts      int64         `json:"ts"`
}

type KLine

type KLine struct {
	Amount float64 `json:"amount"`
	Close  float64 `json:"close"`
	Count  int     `json:"count"`
	High   float64 `json:"high"`
	ID     int     `json:"id"`
	Low    float64 `json:"low"`
	Open   float64 `json:"open"`
	Vol    int     `json:"vol"`
}

type KLineResult

type KLineResult struct {
	Ch      string  `json:"ch"`
	Data    []KLine `json:"data"`
	Status  string  `json:"status"`
	ErrCode int     `json:"err_code"`
	ErrMsg  string  `json:"err_msg"`
	Ts      int64   `json:"ts"`
}

type LightningClosePositionResult

type LightningClosePositionResult struct {
	Status  string    `json:"status"`
	ErrCode int       `json:"err_code"`
	ErrMsg  string    `json:"err_msg"`
	Data    OrderData `json:"data"`
	Ts      int64     `json:"ts"`
}

type MarketDepthResult

type MarketDepthResult struct {
	Ch      string `json:"ch"`
	Status  string `json:"status"`
	ErrCode int    `json:"err_code"`
	ErrMsg  string `json:"err_msg"`
	Tick    Tick   `json:"tick"`
	Ts      int64  `json:"ts"`
}

type NWS

type NWS struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

NWS WebSocket 订单和用户数据接口

func NewNWS

func NewNWS(wsURL string, accessKey string, secretKey string) *NWS

NewNWS 创建 NWS wsURL: 正式地址 wss://api.hbdm.com/notification 开发地址 wss://api.btcgateway.pro/notification

func (*NWS) Login

func (ws *NWS) Login() error

Login 授权接口

func (*NWS) SetAccountsCallback

func (ws *NWS) SetAccountsCallback(callback func(accounts *WSAccounts))

func (*NWS) SetLiquidationOrdersCallback

func (ws *NWS) SetLiquidationOrdersCallback(callback func(liquidationOrders *WSLiquidationOrders))

func (*NWS) SetMatchOrdersCallback

func (ws *NWS) SetMatchOrdersCallback(callback func(order *WSMatchOrder))

func (*NWS) SetOrdersCallback

func (ws *NWS) SetOrdersCallback(callback func(order *WSOrder))

func (*NWS) SetPositionsCallback

func (ws *NWS) SetPositionsCallback(callback func(positions *WSPositions))

func (*NWS) SetProxy

func (ws *NWS) SetProxy(proxyURL string) (err error)

SetProxy 设置代理地址 porxyURL: socks5://127.0.0.1:1080 https://127.0.0.1:1080

func (*NWS) Start

func (ws *NWS) Start()

func (*NWS) Subscribe

func (ws *NWS) Subscribe(id string, ch map[string]interface{}) error

Subscribe 订阅

func (*NWS) SubscribeAccounts

func (ws *NWS) SubscribeAccounts(id string, symbol string)

SubscribeAccounts 订阅资产变动数据 symbol: BTC

func (*NWS) SubscribeLiquidationOrders

func (ws *NWS) SubscribeLiquidationOrders(id string, symbol string)

SubscribeLiquidationOrders 订阅强平订单数据 symbol: BTC

func (*NWS) SubscribeMatchOrders

func (ws *NWS) SubscribeMatchOrders(id string, symbol string)

SubscribeMatchOrders 订阅撮合订单成交数据 symbol: BTC

func (*NWS) SubscribeOrders

func (ws *NWS) SubscribeOrders(id string, symbol string)

SubscribeOrders 订阅订单成交数据 symbol: BTC

func (*NWS) SubscribePositions

func (ws *NWS) SubscribePositions(id string, symbol string)

SubscribePositions 订阅持仓变动更新数据 symbol: BTC

func (*NWS) SubscribeTopic

func (ws *NWS) SubscribeTopic(id string, topic string)

SubscribeTopic 订阅

func (*NWS) Unsubscribe

func (ws *NWS) Unsubscribe(id string) error

Unsubscribe 取消订阅

type OpenOrdersData

type OpenOrdersData struct {
	Orders      []Order `json:"orders"`
	TotalPage   int     `json:"total_page"`
	CurrentPage int     `json:"current_page"`
	TotalSize   int     `json:"total_size"`
}

type OpenOrdersResult

type OpenOrdersResult struct {
	Status  string         `json:"status"`
	ErrCode int            `json:"err_code"`
	ErrMsg  string         `json:"err_msg"`
	Data    OpenOrdersData `json:"data"`
	Ts      int64          `json:"ts"`
}

type Order

type Order struct {
	Symbol            string           `json:"symbol"`
	ContractCode      string           `json:"contract_code"`
	ContractType      string           `json:"contract_type"`
	Volume            float64          `json:"volume"`
	Price             float64          `json:"price"`
	OrderPriceTypeRaw sjson.RawMessage `json:"order_price_type"` // 1限价单,3对手价,4闪电平仓,5计划委托,6post_only
	OrderType         int              `json:"order_type"`
	Direction         string           `json:"direction"`
	Offset            string           `json:"offset"`
	LeverRate         int              `json:"lever_rate"`
	OrderID           int64            `json:"order_id"`
	ClientOrderID     string           `json:"client_order_id"`
	CreatedAt         int64            `json:"created_at"`
	TradeVolume       float64          `json:"trade_volume"`
	TradeTurnover     float64          `json:"trade_turnover"`
	Fee               float64          `json:"fee"`
	TradeAvgPrice     float64          `json:"trade_avg_price"`
	MarginFrozen      float64          `json:"margin_frozen"`
	Profit            float64          `json:"profit"`
	Status            int              `json:"status"`
	OrderSource       string           `json:"order_source"`
	OrderIDStr        string           `json:"order_id_str"`
	FeeAsset          string           `json:"fee_asset"`
	LiquidationType   string           `json:"liquidation_type"`
	CreateDate        int64            `json:"create_date"`
}

func (*Order) OrderPriceType

func (o *Order) OrderPriceType() string

type OrderData

type OrderData struct {
	OrderID       int64  `json:"order_id"`
	OrderIDStr    string `json:"order_id_str"`
	ClientOrderID int64  `json:"client_order_id"`
}

type OrderInfoResult

type OrderInfoResult struct {
	Status  string  `json:"status"`
	ErrCode int     `json:"err_code"`
	ErrMsg  string  `json:"err_msg"`
	Data    []Order `json:"data"`
	Ts      int64   `json:"ts"`
}

type OrderResult

type OrderResult struct {
	Status  string    `json:"status"`
	ErrCode int       `json:"err_code"`
	ErrMsg  string    `json:"err_msg"`
	Data    OrderData `json:"data"`
	Ts      int64     `json:"ts"`
}

type Position

type Position struct {
	Symbol         string  `json:"symbol"`
	ContractCode   string  `json:"contract_code"`
	ContractType   string  `json:"contract_type"`
	Volume         float64 `json:"volume"`
	Available      float64 `json:"available"`
	Frozen         float64 `json:"frozen"`
	CostOpen       float64 `json:"cost_open"`
	CostHold       float64 `json:"cost_hold"`
	ProfitUnreal   float64 `json:"profit_unreal"`
	ProfitRate     float64 `json:"profit_rate"`
	LeverRate      float64 `json:"lever_rate"`
	PositionMargin float64 `json:"position_margin"`
	Direction      string  `json:"direction"`
	Profit         float64 `json:"profit"`
	LastPrice      float64 `json:"last_price"`
}

type PositionInfoResult

type PositionInfoResult struct {
	Status  string     `json:"status"`
	ErrCode int        `json:"err_code"`
	ErrMsg  string     `json:"err_msg"`
	Data    []Position `json:"data"`
	Ts      int64      `json:"ts"`
}

type Tick

type Tick struct {
	Asks    [][]float64 `json:"asks"`
	Bids    [][]float64 `json:"bids"`
	Ch      string      `json:"ch"`
	ID      int         `json:"id"`
	MrID    int64       `json:"mrid"`
	Ts      int64       `json:"ts"`
	Version int         `json:"version"`
}

type WS

type WS struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

WS WebSocket 市场行情接口

func NewWS

func NewWS(wsURL string, accessKey string, secretKey string, debugMode bool) *WS

NewWS 创建 WS wsURL: 正式地址 wss://api.hbdm.com/ws 开发地址 wss://api.btcgateway.pro/ws

func (*WS) SetDepthCallback

func (ws *WS) SetDepthCallback(callback func(depth *WSDepth))

func (*WS) SetDepthHFCallback

func (ws *WS) SetDepthHFCallback(callback func(depth *WSDepthHF))

func (*WS) SetProxy

func (ws *WS) SetProxy(proxyURL string) (err error)

SetProxy 设置代理地址 porxyURL: socks5://127.0.0.1:1080 https://127.0.0.1:1080

func (*WS) SetTickerCallback

func (ws *WS) SetTickerCallback(callback func(ticker *WSTicker))

func (*WS) SetTradeCallback

func (ws *WS) SetTradeCallback(callback func(trade *WSTrade))

func (*WS) Start

func (ws *WS) Start()

func (*WS) Subscribe

func (ws *WS) Subscribe(id string, ch map[string]interface{}) error

Subscribe 订阅

func (*WS) SubscribeDepth

func (ws *WS) SubscribeDepth(id string, symbol string)

SubscribeDepth 订阅 Market Depth 数据 id: 订阅的编号 symbol: BTC_CQ

func (*WS) SubscribeDepthHF

func (ws *WS) SubscribeDepthHF(id string, symbol string, size int, dateType string)

SubscribeDepthHF 订阅增量深度 size: 20/150 档位数,20:表示20档不合并的深度,150:表示150档不合并的深度 dateType: 数据类型,不填默认为全量数据,"incremental":增量数据,"snapshot":全量数据

func (*WS) SubscribeTicker

func (ws *WS) SubscribeTicker(id string, symbol string)

SubscribeTicker 订阅 Market Ticker 数据 id: 订阅的编号 symbol: BTC_CQ

func (*WS) SubscribeTrade

func (ws *WS) SubscribeTrade(id string, symbol string)

SubscribeTrade 订阅 Market Trade 数据 id: 订阅的编号 symbol: BTC_CQ

func (*WS) Unsubscribe

func (ws *WS) Unsubscribe(id string) error

Unsubscribe 取消订阅

type WSAccountData

type WSAccountData struct {
	Symbol            string  `json:"symbol"`
	MarginBalance     float64 `json:"margin_balance"`
	MarginStatic      float64 `json:"margin_static"`
	MarginPosition    float64 `json:"margin_position"`
	MarginFrozen      float64 `json:"margin_frozen"`
	MarginAvailable   float64 `json:"margin_available"`
	ProfitReal        float64 `json:"profit_real"`
	ProfitUnreal      float64 `json:"profit_unreal"`
	WithdrawAvailable float64 `json:"withdraw_available"`
	RiskRate          float64 `json:"risk_rate"`
	LiquidationPrice  float64 `json:"liquidation_price"`
	LeverRate         float64 `json:"lever_rate"`
	AdjustFactor      float64 `json:"adjust_factor"`
}

type WSAccounts

type WSAccounts struct {
	Op    string          `json:"op"`
	Topic string          `json:"topic"`
	Ts    int64           `json:"ts"`
	Event string          `json:"event"`
	Data  []WSAccountData `json:"data"`
}

type WSDepth

type WSDepth struct {
	Ch   string `json:"ch"`
	Ts   int64  `json:"ts"`
	Tick Tick   `json:"tick"`
}

type WSDepthHF

type WSDepthHF struct {
	Ch   string   `json:"ch"`
	Tick WSTickHF `json:"tick"`
	Ts   int64    `json:"ts"`
}

type WSLiquidationOrders

type WSLiquidationOrders struct {
	Op           string  `json:"op"`
	Topic        string  `json:"topic"`
	Ts           int64   `json:"ts"`
	Symbol       string  `json:"symbol"`
	ContractCode string  `json:"contract_code"`
	Direction    string  `json:"direction"`
	Offset       string  `json:"offset"`
	Volume       float64 `json:"volume"`
	Price        float64 `json:"price"`
	CreatedAt    int64   `json:"created_at"`
}

type WSMatchOrder

type WSMatchOrder struct {
	Op           string      `json:"op"`
	Topic        string      `json:"topic"`
	Ts           int64       `json:"ts"`
	Symbol       string      `json:"symbol"`
	ContractType string      `json:"contract_type"`
	ContractCode string      `json:"contract_code"`
	Status       int         `json:"status"`
	OrderID      int64       `json:"order_id"`
	OrderIDStr   string      `json:"order_id_str"`
	OrderType    int         `json:"order_type"`
	Trade        []WSMyTrade `json:"trade"`
}

type WSMyTrade

type WSMyTrade struct {
	ID            string  `json:"id"`
	TradeID       int64   `json:"trade_id"`
	TradeVolume   float64 `json:"trade_volume"`
	TradePrice    float64 `json:"trade_price"`
	TradeFee      float64 `json:"trade_fee"`
	TradeTurnover float64 `json:"trade_turnover"`
	CreatedAt     int64   `json:"created_at"`
	Role          string  `json:"role"`
}

type WSOrder

type WSOrder struct {
	Op              string      `json:"op"`
	Topic           string      `json:"topic"`
	Ts              int64       `json:"ts"`
	Symbol          string      `json:"symbol"`
	ContractType    string      `json:"contract_type"`
	ContractCode    string      `json:"contract_code"`
	Volume          float64     `json:"volume"`
	Price           float64     `json:"price"`
	OrderPriceType  string      `json:"order_price_type"`
	Direction       string      `json:"direction"`
	Offset          string      `json:"offset"`
	Status          int         `json:"status"`
	LeverRate       float64     `json:"lever_rate"`
	OrderID         int64       `json:"order_id"`
	OrderIDStr      string      `json:"order_id_str"`
	ClientOrderID   int64       `json:"client_order_id"`
	OrderSource     string      `json:"order_source"`
	OrderType       int         `json:"order_type"`
	CreatedAt       int64       `json:"created_at"`
	TradeVolume     float64     `json:"trade_volume"`
	TradeTurnover   float64     `json:"trade_turnover"`
	Fee             float64     `json:"fee"`
	TradeAvgPrice   float64     `json:"trade_avg_price"`
	MarginFrozen    float64     `json:"margin_frozen"`
	Profit          float64     `json:"profit"`
	Trade           []WSMyTrade `json:"trade"`
	LiquidationType string      `json:"liquidation_type"`
}

type WSPositionData

type WSPositionData struct {
	Symbol         string  `json:"symbol"`
	ContractCode   string  `json:"contract_code"`
	ContractType   string  `json:"contract_type"`
	Volume         float64 `json:"volume"`
	Available      float64 `json:"available"`
	Frozen         float64 `json:"frozen"`
	CostOpen       float64 `json:"cost_open"`
	CostHold       float64 `json:"cost_hold"`
	ProfitUnreal   float64 `json:"profit_unreal"`
	ProfitRate     float64 `json:"profit_rate"`
	Profit         float64 `json:"profit"`
	PositionMargin float64 `json:"position_margin"`
	LeverRate      float64 `json:"lever_rate"`
	Direction      string  `json:"direction"`
	LastPrice      float64 `json:"last_price"`
}

type WSPositions

type WSPositions struct {
	Op    string           `json:"op"`
	Topic string           `json:"topic"`
	Ts    int64            `json:"ts"`
	Event string           `json:"event"`
	Data  []WSPositionData `json:"data"`
}

type WSTick

type WSTick struct {
	MrID    int64       `json:"mrid"`
	ID      int         `json:"id"`
	Bids    [][]float64 `json:"bids"`
	Asks    [][]float64 `json:"asks"`
	Ts      int64       `json:"ts"`
	Version int         `json:"version"`
	Ch      string      `json:"ch"`
}

type WSTickHF

type WSTickHF struct {
	Asks    [][]float64 `json:"asks"`
	Bids    [][]float64 `json:"bids"`
	Ch      string      `json:"ch"`
	Event   string      `json:"event"`
	ID      int64       `json:"id"`
	Mrid    int64       `json:"mrid"`
	Ts      int64       `json:"ts"`
	Version int         `json:"version"`
}

type WSTicker

type WSTicker struct {
	Ch   string       `json:"ch"`
	Ts   int64        `json:"ts"`
	Tick WSTickerTick `json:"tick"`
}

type WSTickerTick

type WSTickerTick struct {
	ID     int64   `json:"id"`
	MrID   int64   `json:"mrid"`
	Open   float64 `json:"open"`
	Close  float64 `json:"close"`
	High   float64 `json:"high"`
	Low    float64 `json:"low"`
	Amount float64 `json:"amount"`
	Vol    float64 `json:"vol"`
	Count  int64   `json:"count"`
}

type WSTrade

type WSTrade struct {
	Ch   string      `json:"ch"`
	Ts   int64       `json:"ts"`
	Tick WSTradeTick `json:"tick"`
}

type WSTradeItem

type WSTradeItem struct {
	Amount    int     `json:"amount"`
	Ts        int64   `json:"ts"`
	ID        int64   `json:"id"`
	Price     float64 `json:"price"`
	Direction string  `json:"direction"`
}

type WSTradeTick

type WSTradeTick struct {
	ID   int64         `json:"id"`
	Ts   int64         `json:"ts"`
	Data []WSTradeItem `json:"data"`
}

Jump to

Keyboard shortcuts

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