binance

package
v1.2.5 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TICKER_URI             = "ticker/24hr?symbol=%s"
	TICKERS_URI            = "ticker/allBookTickers"
	DEPTH_URI              = "depth?symbol=%s&limit=%d"
	ACCOUNT_URI            = "account?"
	ORDER_URI              = "order?"
	UNFINISHED_ORDERS_INFO = "openOrders?"
	KLINE_URI              = "klines"
	SERVER_TIME_URL        = "time"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AggTrade added in v1.0.4

type AggTrade struct {
	Trade
	FirstBreakdownTradeID int64 `json:"f"`
	LastBreakdownTradeID  int64 `json:"l"`
	TradeTime             int64 `json:"T"`
}

type Binance

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

func New

func New(client *http.Client, api_key, secret_key string) *Binance

func NewWithConfig added in v1.1.0

func NewWithConfig(config *APIConfig) *Binance

func (*Binance) CancelOrder

func (bn *Binance) CancelOrder(orderId string, currencyPair CurrencyPair) (bool, error)

func (*Binance) GetAccount

func (bn *Binance) GetAccount() (*Account, error)

func (*Binance) GetDepth

func (bn *Binance) GetDepth(size int, currencyPair CurrencyPair) (*Depth, error)

func (*Binance) GetExchangeName

func (bn *Binance) GetExchangeName() string

func (*Binance) GetKlineRecords

func (bn *Binance) GetKlineRecords(currency CurrencyPair, period, size, since int) ([]Kline, error)

func (*Binance) GetListenKey added in v1.1.3

func (bn *Binance) GetListenKey() (string, error)

func (*Binance) GetMyTrades added in v1.2.5

func (bn *Binance) GetMyTrades(currency CurrencyPair) (interface{}, error)

账户成交历史

func (*Binance) GetOneOrder

func (bn *Binance) GetOneOrder(orderId string, currencyPair CurrencyPair) (*Order, error)

func (*Binance) GetOrderHistorys

func (bn *Binance) GetOrderHistorys(currency CurrencyPair, currentPage, pageSize int) ([]Order, error)

func (*Binance) GetSymbols added in v1.1.2

func (bn *Binance) GetSymbols() ([]SymbolInfo, error)

func (*Binance) GetTicker

func (bn *Binance) GetTicker(currency CurrencyPair) (*Ticker, error)

func (*Binance) GetTradeSymbols added in v1.0.3

func (bn *Binance) GetTradeSymbols(currencyPair CurrencyPair) (*TradeSymbol, error)

func (*Binance) GetTrades

func (bn *Binance) GetTrades(currencyPair CurrencyPair, since int64) ([]Trade, error)

非个人,整个交易所的交易记录 注意:since is fromId

func (*Binance) GetUnfinishOrders

func (bn *Binance) GetUnfinishOrders(currencyPair CurrencyPair) ([]Order, error)

func (*Binance) LimitBuy

func (bn *Binance) LimitBuy(amount, price string, currencyPair CurrencyPair) (*Order, error)

func (*Binance) LimitSell

func (bn *Binance) LimitSell(amount, price string, currencyPair CurrencyPair) (*Order, error)

func (*Binance) MarketBuy

func (bn *Binance) MarketBuy(amount, price string, currencyPair CurrencyPair) (*Order, error)

func (*Binance) MarketSell

func (bn *Binance) MarketSell(amount, price string, currencyPair CurrencyPair) (*Order, error)

func (*Binance) PutListenKey added in v1.1.9

func (bn *Binance) PutListenKey(listenKey string) (bool, error)

type BinanceWs added in v1.0.3

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

func NewBinanceWs added in v1.0.3

func NewBinanceWs() *BinanceWs

func (*BinanceWs) ProxyUrl added in v1.0.3

func (bnWs *BinanceWs) ProxyUrl(proxyUrl string)

func (*BinanceWs) SetBaseUrl added in v1.0.3

func (bnWs *BinanceWs) SetBaseUrl(baseURL string)

func (*BinanceWs) SetCallbacks added in v1.0.3

func (bnWs *BinanceWs) SetCallbacks(
	tickerCallback func(*Ticker),
	depthCallback func(*Depth),
	tradeCallback func(*Trade),
	klineCallback func(*Kline, int),
)

func (*BinanceWs) SetCombinedBaseURL added in v1.0.3

func (bnWs *BinanceWs) SetCombinedBaseURL(combinedBaseURL string)

func (*BinanceWs) SubscribeAggTrade added in v1.0.4

func (bnWs *BinanceWs) SubscribeAggTrade(pair CurrencyPair, tradeCallback func(*Trade)) error

func (*BinanceWs) SubscribeDepth added in v1.0.3

func (bnWs *BinanceWs) SubscribeDepth(pair CurrencyPair, size int) error

func (*BinanceWs) SubscribeDiffDepth added in v1.0.4

func (bnWs *BinanceWs) SubscribeDiffDepth(pair CurrencyPair, depthCallback func(*Depth)) error

func (*BinanceWs) SubscribeKline added in v1.0.3

func (bnWs *BinanceWs) SubscribeKline(pair CurrencyPair, period int) error

func (*BinanceWs) SubscribeTicker added in v1.0.3

func (bnWs *BinanceWs) SubscribeTicker(pair CurrencyPair) error

func (*BinanceWs) SubscribeTrade added in v1.0.3

func (bnWs *BinanceWs) SubscribeTrade(pair CurrencyPair) error

type DiffDepth added in v1.0.4

type DiffDepth struct {
	Depth
	UpdateID      int64 `json:"u"`
	FirstUpdateID int64 `json:"U"`
}

type ExchangeInfo added in v1.0.3

type ExchangeInfo struct {
	Timezone        string        `json:"timezone"`
	ServerTime      int           `json:"serverTime"`
	ExchangeFilters []interface{} `json:"exchangeFilters,omitempty"`
	RateLimits      []RateLimit   `json:"rateLimits"`
	Symbols         []TradeSymbol `json:"symbols"`
}

type Filter added in v1.0.3

type Filter struct {
	FilterType string `json:"filterType"`
	MaxPrice   string `json:"maxPrice"`
	MinPrice   string `json:"minPrice"`
	TickSize   string `json:"tickSize"`
}

type MyTrade added in v1.2.5

type MyTrade struct {
	Symbol          string `json:"symbol"`
	ID              int    `json:"id"`
	OrderID         int    `json:"orderId"`
	OrderListID     int    `json:"orderListId"`
	Price           string `json:"price"`
	Qty             string `json:"qty"`
	QuoteQty        string `json:"quoteQty"`
	Commission      string `json:"commission"`
	CommissionAsset string `json:"commissionAsset"`
	Time            int64  `json:"time"`
	IsBuyer         bool   `json:"isBuyer"`
	IsMaker         bool   `json:"isMaker"`
	IsBestMatch     bool   `json:"isBestMatch"`
}

type RateLimit added in v1.0.3

type RateLimit struct {
	Interval      string `json:"interval"`
	IntervalNum   int    `json:"intervalNum"`
	Limit         int    `json:"limit"`
	RateLimitType string `json:"rateLimitType"`
}

type RawTrade added in v1.0.4

type RawTrade struct {
	Trade
	BuyerOrderID  int64 `json:"b"`
	SellerOrderID int64 `json:"a"`
}

type Symbol added in v1.1.6

type Symbol struct {
	Symbols []SymbolInfo `json:"symbols"`
}

type SymbolInfo added in v1.1.2

type SymbolInfo struct {
	Symbol             string `json:"symbol"`
	Status             string `json:"status"`
	BaseAsset          string `json:"baseAsset"`
	BaseAssetPrecision int    `json:"baseAssetPrecision"`
	QuoteAsset         string `json:"quoteAsset"`
	QuotePrecision     int    `json:"quotePrecision"`
}

type TradeSymbol added in v1.0.3

type TradeSymbol struct {
	BaseAsset              string   `json:"baseAsset"`
	BaseAssetPrecision     int      `json:"baseAssetPrecision"`
	Filters                []Filter `json:"filters"`
	IcebergAllowed         bool     `json:"icebergAllowed"`
	IsMarginTradingAllowed bool     `json:"isMarginTradingAllowed"`
	IsSpotTradingAllowed   bool     `json:"isSpotTradingAllowed"`
	OcoAllowed             bool     `json:"ocoAllowed"`
	OrderTypes             []string `json:"orderTypes"`
	QuoteAsset             string   `json:"quoteAsset"`
	QuotePrecision         int      `json:"quotePrecision"`
	Status                 string   `json:"status"`
	Symbol                 string   `json:"symbol"`
}

Jump to

Keyboard shortcuts

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