binance

package
v0.0.0-...-a5a6a1a Latest Latest
Warning

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

Go to latest
Published: May 13, 2021 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const URL = "wss://fstream.binance.com/stream"

Variables

This section is empty.

Functions

This section is empty.

Types

type Binance

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

func (*Binance) Close

func (b *Binance) Close()

func (*Binance) Conn

func (b *Binance) Conn() error

func (*Binance) GetSnapshot

func (b *Binance) GetSnapshot() (interface{}, error)

func (*Binance) GetSymbols

func (b *Binance) GetSymbols() []string

func (*Binance) PollMessage

func (b *Binance) PollMessage() <-chan interface{}

func (*Binance) SetFocus

func (b *Binance) SetFocus(symbol string)

type Data

type Data struct {
	Type      string `json:"e"`
	EventTime int    `json:"E"`
	Symbol    string `json:"s"`
	Price     string `json:"p"`
	Kline     Kline  `json:"k"`
	Ticker
	Depth
}

type Depth

type Depth struct {
	FirstUpdateId int         `json:"U"`
	FinalUpdateId int         `json:"u"`
	OldUpdateId   int         `json:"pu"`
	Bid           [][2]string `json:"b"`
	Ask           [][2]string `json:"a"`
}

type Kline

type Kline struct {
	StartTime   int    `json:"t"`
	EndTime     int    `json:"T"`
	Open        string `json:"o"`
	Close       string `json:"c"`
	High        string `json:"h"`
	Low         string `json:"l"`
	IsClosed    bool   `json:"x"`
	LastTradeId int    `json:"L"`
}

type Message

type Message struct {
	Stream string `json:"stream"`
	Data   Data   `json:"data"`
}

type Request

type Request struct {
	Method string   `json:"method"`
	Params []string `json:"params"`
	Id     int      `json:"id"`
}

type Snapshot

type Snapshot struct {
	LastUpdateId int `json:"lastUpdateId"`
	Symbol       string
	Bids         [][2]string `json:"bids"`
	Asks         [][2]string `json:"asks"`
}

type Ticker

type Ticker struct {
	ChangePercent string `json:"P"`
	Open          string `json:"o"`
	High          string `json:"h"`
	Low           string `json:"l"`
	LastPrice     string `json:"c"`
	OpenTime      int    `json:"O"`
	CloseTime     int    `json:"C"`
	LastTradeId   int    `json:"L"`
}

Jump to

Keyboard shortcuts

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