binance

package
v0.0.0-...-fb247b5 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2018 License: MIT Imports: 17 Imported by: 0

README

binance api

Supported API list

Func API endpoint Meanings
GetTicker GET /api/v1/ticker/24hr 24hr ticker price change statistics
Ping GET /api/v1/ping Test connectivity to the Rest API
GetTime GET /api/v1/time Check server time
GetDepth GET /api/v1/depth Order book
GetTickers GET /api/v1/ticker/allPrices Symbols price ticker
GetTrades GET /api/v1/aggTrades Compressed/Aggregate trades list
GetRecords GET /api/v1/ticker/allPrices Kline/candlesticks
GetBookTickers GET /api/v1/ticker/allBookTickers Symbols order book ticker
GetAccount GET /api/v3/account Account information
Trade POST /api/v3/order Send in a new order
GetOrder GET /api/v3/order Check an order's status
CancelOrder DELETE /api/v3/order Cancel an active order
GetOrders GET /api/v3/openOrders Get all open orders on a symbol
GetAllOrders GET /api/v3/allOrders Get all account orders; active, canceled, or filled
GetMyTrades GET /api/v3/myTrades Get trades for a specific account and symbol

Documentation

Overview

Package binance binance rest api

Index

Constants

View Source
const (
	RestHost = "www.binance.com"
	ApiV1    = "v1"
	ApiV3    = "v3"
)

Variables

View Source
var (
	Interval    enums.Enum
	Interval1m  = Interval.Iota("1m")
	Interval3m  = Interval.Iota("3m")
	Interval5m  = Interval.Iota("5m")
	Interval15m = Interval.Iota("15m")
	Interval30m = Interval.Iota("30m")
	Interval1h  = Interval.Iota("1h")
	Interval2h  = Interval.Iota("2h")
	Interval4h  = Interval.Iota("4h")
	Interval6h  = Interval.Iota("6h")
	Interval8h  = Interval.Iota("8h")
	Interval12h = Interval.Iota("12h")
	Interval1d  = Interval.Iota("1d")
	Interval3d  = Interval.Iota("3d")
	Interval1w  = Interval.Iota("1w")
	Interval1M  = Interval.Iota("1M")
)

Kline intervals m -> minutes; h -> hours; d -> days; w -> weeks; M -> months

View Source
var (
	OrderType   enums.Enum
	OrderLimit  = OrderType.Iota("LIMIT")
	OrderMarket = OrderType.Iota("MARKET")
)

Order types

View Source
var (
	OrderSide enums.Enum
	OrderBuy  = OrderSide.Iota("BUY")
	OrderSell = OrderSide.Iota("SELL")
)

Order Side

View Source
var (
	TimeInForce enums.Enum
	GTC         = TimeInForce.Iota("GTC")
	IOC         = TimeInForce.Iota("IOC")
)

Time in force

Functions

This section is empty.

Types

type Client

type Client struct {
	URL        url.URL
	HTTPClient *http.Client
	AccessKey  string
	SecretKey  string
}

Client Binance client

func New

func New(accessKey string, secretKey string) *Client

New creates a new Binance Client

func (*Client) CancelOrder

func (c *Client) CancelOrder(ctx context.Context, quote string, base string, orderID int64, recvWindow int64) error

CancelOrder Cancel an active orderf for DELETE /api/v3/order

func (*Client) GetAccount

func (c *Client) GetAccount(ctx context.Context, recvWindow int64) ([]model.Balance, error)

GetAccount Account information (SIGNED), for GET /api/v3/account

func (*Client) GetAllOrders

func (c *Client) GetAllOrders(ctx context.Context, quote string, base string, orderID int64, limit int64, recvWindow int64) ([]model.Order, error)

GetAllOrders Get all account orders; active, canceled, or filled, for GET /api/v3/allOrders

func (*Client) GetBookTickers

func (c *Client) GetBookTickers(ctx context.Context) ([]model.BookTicker, error)

GetBookTickers Symbols order book ticker, for GET /api/v1/ticker/allBookTickers

func (*Client) GetDepth

func (c *Client) GetDepth(ctx context.Context, quote string, base string, limit int64) (*model.OrderBook, error)

GetDepth Order book, for GET /api/v1/depth

func (*Client) GetMyTrades

func (c *Client) GetMyTrades(ctx context.Context, quote string, base string, fromID int64, limit int64, recvWindow int64) ([]model.Trade, error)

GetMyTrades Get trades for a specific account and symbol, for GET /api/v3/myTrades

func (*Client) GetOrder

func (c *Client) GetOrder(ctx context.Context, quote string, base string, orderID int64, recvWindow int64) (*model.Order, error)

GetOrder Check an order's status, for GET /api/v3/order

func (*Client) GetOrders

func (c *Client) GetOrders(ctx context.Context, quote string, base string, recvWindow int64) ([]model.Order, error)

GetOrders Get all open orders on a symbol, for GET /api/v3/openOrders

func (*Client) GetRecords

func (c *Client) GetRecords(ctx context.Context, quote string, base string, interval string, startTime int64, endTime int64, limit int64) ([]model.Record, error)

GetRecords for Kline/candlesticks, for GET /api/v1/ticker/allPrices

func (*Client) GetTicker

func (c *Client) GetTicker(ctx context.Context, quote string, base string) (*model.Ticker, error)

GetTicker 24hr ticker price change statistics, for GET /api/v1/ticker/24hr

func (*Client) GetTickers

func (c *Client) GetTickers(ctx context.Context) ([]model.SimpleTicker, error)

GetTickers Symbols price ticker, for GET /api/v1/ticker/allPrices

func (*Client) GetTime

func (c *Client) GetTime(ctx context.Context) (*time.Time, error)

GetTime Check server time, for GET /api/v1/time

func (*Client) GetTrades

func (c *Client) GetTrades(ctx context.Context, quote string, base string, fromID int64, startTime int64, endTime int64, limit int64) ([]model.Trade, error)

GetTrades Compressed/Aggregate trades list, for GET /api/v1/aggTrades

func (*Client) Ping

func (c *Client) Ping(ctx context.Context) error

Ping Test connectivity to the Rest API, for GET /api/v1/ping

func (*Client) Trade

func (c *Client) Trade(ctx context.Context, quote string, base string, side string, typ string, timeInForce string, quantity float64, price float64, stopPrice float64, icebergQty float64, recvWindow int64) (int64, error)

Trade Send in a new order, for POST /api/v3/order

Jump to

Keyboard shortcuts

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