binance

package
v0.0.0-...-0c57d95 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ApiURL         = "https://api.binance.com"
	SpotApiURL     = "https://sapi.binance.com"
	CFuturesApiURL = "https://dapi.binance.com"
	UFuturesApiURL = "https://fapi.binance.com"

	StreamHostURL = "wss://stream.binance.com:9443"

	RawStreamEndpoint      = "/ws"
	CombinedStreamEndpoint = "/stream?streams=%s"

	ExchangeInfo = "/api/v3/exchangeInfo"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Binance

type Binance struct {
	common.BaseBroker
}

Binance : is Object that will hold the connection and configuration with the Binance Service.

func (*Binance) Initialize

func (b *Binance) Initialize()

Initialize : will initialize the broker config and setup

func (*Binance) Listen

func (b *Binance) Listen(symbol string, itemChan *chan *common.Item)

Listen : will listen the market data changes for the selected symbol

func (*Binance) OnWSError

func (b *Binance) OnWSError(err error)

func (*Binance) OnWSMessage

func (b *Binance) OnWSMessage(msg []byte, w *ws.Conn)

OnWSMessage : will be triggered when a message is received from the Financial Broker

func (*Binance) RegisterWebsocketClient

func (b *Binance) RegisterWebsocketClient(url string)

type Kpi

type Kpi struct {
	KStartTime       int64  `json:"t"`
	KSEndTime        int64  `json:"T"`
	Symbol           string `json:"s"`
	Interval         string `json:"i"`
	FirstTradeID     int    `json:"f"`
	LastTradeID      int    `json:"L"`
	OpenPrice        string `json:"o"`
	ClosePrice       string `json:"c"`
	HighestPrice     string `json:"h"`
	LowestPrice      string `json:"l"`
	BassAssetVolume  string `json:"v"`
	NoOfTrade        int    `json:"n"`
	IsKlineClosed    bool   `json:"x"`
	QuoteAssetVolume string `json:"q"`
	Buy              string `json:"V"`
	Quote            string `json:"Q"`
	Ignore           string `json:"B"`
}

type WebSocketRequest

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

type WebSocketResponse

type WebSocketResponse struct {
	EventType string `json:"e"`
	EventName int64  `json:"E"`
	Symbol    string `json:"s"`
	KPI       Kpi    `json:"k"`
}

Jump to

Keyboard shortcuts

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