Documentation ¶
Index ¶
- Constants
- Variables
- func GetRequestsPerSecond(client *Client, weight int) (float64, error)
- func GetSymbol(client *Client, name string) (*exchange.Symbol, error)
- func NewClientOrderID() string
- func NewClientOrderMetadata(metadata string) (string, error)
- func ParseClientOrderMetadata(order *Order) (string, error)
- type BinanceError
- type BookEntry
- type Cache
- type Client
- func (self *Client) CancelOrder(symbol string, orderID int64) error
- func (self *Client) Depth(symbol string, limit int) (*exchange.DepthResponse, error)
- func (self *Client) NewCreateOCOService() *CreateOCOService
- func (self *Client) NewCreateOrderService() *CreateOrderService
- func (self *Client) OpenOrders() ([]Order, error)
- func (self *Client) OpenOrdersEx(symbol string) ([]Order, error)
- func (self *Client) Orders(symbol string) ([]Order, error)
- func (self *Client) Ticker(symbol string) (*exchange.PriceChangeStats, error)
- type CreateOCOService
- func (self *CreateOCOService) Do(ctx context.Context, opts ...exchange.RequestOption) (*exchange.CreateOCOResponse, error)
- func (self *CreateOCOService) LimitClientOrderID(limitClientOrderID string) *CreateOCOService
- func (self *CreateOCOService) Price(price float64) *CreateOCOService
- func (self *CreateOCOService) Quantity(quantity float64) *CreateOCOService
- func (self *CreateOCOService) Side(side exchange.SideType) *CreateOCOService
- func (self *CreateOCOService) StopClientOrderID(stopClientOrderID string) *CreateOCOService
- func (self *CreateOCOService) StopLimitPrice(stopLimitPrice float64) *CreateOCOService
- func (self *CreateOCOService) StopLimitTimeInForce(stopLimitTimeInForce exchange.TimeInForceType) *CreateOCOService
- func (self *CreateOCOService) StopPrice(stopPrice float64) *CreateOCOService
- func (self *CreateOCOService) Symbol(symbol string) *CreateOCOService
- type CreateOrderService
- func (self *CreateOrderService) Do(ctx context.Context, opts ...exchange.RequestOption) (*exchange.CreateOrderResponse, error)
- func (self *CreateOrderService) NewClientOrderID(newClientOrderID string) *CreateOrderService
- func (self *CreateOrderService) Price(price float64) *CreateOrderService
- func (self *CreateOrderService) Quantity(quantity float64) *CreateOrderService
- func (self *CreateOrderService) Side(side exchange.SideType) *CreateOrderService
- func (self *CreateOrderService) StopPrice(stopPrice float64) *CreateOrderService
- func (self *CreateOrderService) Symbol(symbol string) *CreateOrderService
- func (self *CreateOrderService) TimeInForce(timeInForce exchange.TimeInForceType) *CreateOrderService
- func (self *CreateOrderService) Type(orderType exchange.OrderType) *CreateOrderService
- type Order
- type Prec
- type Precs
- type Request
Constants ¶
View Source
const ( BASE_URL = "https://api.binance.com" BASE_URL_1 = "https://api1.binance.com" BASE_URL_2 = "https://api2.binance.com" BASE_URL_3 = "https://api3.binance.com" BASE_URL_US = "https://api.binance.us" )
View Source
const ( MAX_LEN = 36 BROKER = "J6MCRYME" )
Variables ¶
View Source
var ( SERVER_TIME_OFFSET int64 // offset between device time and server time SERVER_TIME_UPDATE time.Time // the last time we asked for server time )
View Source
var ( BeforeRequest func(client *Client, method, path string, weight int) error = nil AfterRequest func() = nil )
View Source
var Method = map[Request]string{ ALL_ORDERS: http.MethodGet, CANCEL_ORDER: http.MethodDelete, CREATE_OCO_ORDER: http.MethodPost, CREATE_ORDER: http.MethodPost, DEPT: http.MethodGet, EXCHANGE_INFO: http.MethodGet, OPEN_ORDERS_WITH_SYMBOL: http.MethodGet, OPEN_ORDERS_WITHOUT_SYMBOL: http.MethodGet, TICKER_24H_WITH_SYMBOL: http.MethodGet, TICKER_24H_WITHOUT_SYMBOL: http.MethodGet, }
View Source
var Path = map[Request]string{ ALL_ORDERS: "/api/v3/allOrders?symbol=%s", CANCEL_ORDER: "/api/v3/order?symbol=%s", CREATE_OCO_ORDER: "/api/v3/order/oco?symbol=%s&side=%s&quantity=%f&price=%f&stopPrice=%f", CREATE_ORDER: "/api/v3/order?symbol=%s&side=%s&type=%s", DEPT: "/api/v3/depth?symbol=%s", EXCHANGE_INFO: "/api/v3/exchangeInfo", OPEN_ORDERS_WITH_SYMBOL: "/api/v3/openOrders?symbol=%s", OPEN_ORDERS_WITHOUT_SYMBOL: "/api/v3/openOrders", TICKER_24H_WITH_SYMBOL: "/api/v3/ticker/24hr?symbol=%s", TICKER_24H_WITHOUT_SYMBOL: "/api/v3/ticker/24hr", }
View Source
var Weight = map[Request]int{ ALL_ORDERS: 10, CANCEL_ORDER: 1, CREATE_OCO_ORDER: 1, CREATE_ORDER: 1, DEPT: 1, EXCHANGE_INFO: 10, OPEN_ORDERS_WITH_SYMBOL: 3, OPEN_ORDERS_WITHOUT_SYMBOL: 40, TICKER_24H_WITH_SYMBOL: 1, TICKER_24H_WITHOUT_SYMBOL: 40, }
Functions ¶
func NewClientOrderID ¶
func NewClientOrderID() string
func NewClientOrderMetadata ¶
func ParseClientOrderMetadata ¶
get metadata from order.ClientOrderId
Types ¶
type BinanceError ¶
func IsBinanceError ¶
func IsBinanceError(err error) (*BinanceError, bool)
type BookEntry ¶
type BookEntry = common.PriceLevel
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) CancelOrder ¶
Cancel an active order.
func (*Client) NewCreateOCOService ¶
func (self *Client) NewCreateOCOService() *CreateOCOService
func (*Client) NewCreateOrderService ¶
func (self *Client) NewCreateOrderService() *CreateOrderService
func (*Client) OpenOrders ¶
Get all open orders without a symbol.
func (*Client) OpenOrdersEx ¶
Get all open orders on a symbol.
type CreateOCOService ¶
type CreateOCOService struct {
// contains filtered or unexported fields
}
func (*CreateOCOService) Do ¶
func (self *CreateOCOService) Do(ctx context.Context, opts ...exchange.RequestOption) (*exchange.CreateOCOResponse, error)
func (*CreateOCOService) LimitClientOrderID ¶
func (self *CreateOCOService) LimitClientOrderID(limitClientOrderID string) *CreateOCOService
func (*CreateOCOService) Price ¶
func (self *CreateOCOService) Price(price float64) *CreateOCOService
func (*CreateOCOService) Quantity ¶
func (self *CreateOCOService) Quantity(quantity float64) *CreateOCOService
func (*CreateOCOService) Side ¶
func (self *CreateOCOService) Side(side exchange.SideType) *CreateOCOService
func (*CreateOCOService) StopClientOrderID ¶
func (self *CreateOCOService) StopClientOrderID(stopClientOrderID string) *CreateOCOService
func (*CreateOCOService) StopLimitPrice ¶
func (self *CreateOCOService) StopLimitPrice(stopLimitPrice float64) *CreateOCOService
func (*CreateOCOService) StopLimitTimeInForce ¶
func (self *CreateOCOService) StopLimitTimeInForce(stopLimitTimeInForce exchange.TimeInForceType) *CreateOCOService
func (*CreateOCOService) StopPrice ¶
func (self *CreateOCOService) StopPrice(stopPrice float64) *CreateOCOService
func (*CreateOCOService) Symbol ¶
func (self *CreateOCOService) Symbol(symbol string) *CreateOCOService
type CreateOrderService ¶
type CreateOrderService struct {
// contains filtered or unexported fields
}
func (*CreateOrderService) Do ¶
func (self *CreateOrderService) Do(ctx context.Context, opts ...exchange.RequestOption) (*exchange.CreateOrderResponse, error)
func (*CreateOrderService) NewClientOrderID ¶
func (self *CreateOrderService) NewClientOrderID(newClientOrderID string) *CreateOrderService
func (*CreateOrderService) Price ¶
func (self *CreateOrderService) Price(price float64) *CreateOrderService
func (*CreateOrderService) Quantity ¶
func (self *CreateOrderService) Quantity(quantity float64) *CreateOrderService
func (*CreateOrderService) Side ¶
func (self *CreateOrderService) Side(side exchange.SideType) *CreateOrderService
func (*CreateOrderService) StopPrice ¶
func (self *CreateOrderService) StopPrice(stopPrice float64) *CreateOrderService
func (*CreateOrderService) Symbol ¶
func (self *CreateOrderService) Symbol(symbol string) *CreateOrderService
func (*CreateOrderService) TimeInForce ¶
func (self *CreateOrderService) TimeInForce(timeInForce exchange.TimeInForceType) *CreateOrderService
func (*CreateOrderService) Type ¶
func (self *CreateOrderService) Type(orderType exchange.OrderType) *CreateOrderService
type Order ¶
func (*Order) GetStopPrice ¶
GetStopPrice returns the StopPrice as float64
Click to show internal directories.
Click to hide internal directories.