binance

package
v0.0.0-...-95b083d Latest Latest
Warning

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

Go to latest
Published: May 17, 2023 License: Unlicense Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Binance

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

func New

func New(logger *logger.Logger, testnet bool) *Binance

func (*Binance) GetCandlesticks

func (f *Binance) GetCandlesticks(ctx context.Context, symbol, interval string, limit int, startTime, endTime int64) ([]*binance.Kline, error)

func (*Binance) GetCurrentPrice

func (f *Binance) GetCurrentPrice(ctx context.Context, symbol string) (*futures.SymbolPrice, error)

func (*Binance) GetExchangeInfo

func (f *Binance) GetExchangeInfo(ctx context.Context) (*futures.ExchangeInfo, error)

func (*Binance) GetLeverageBracket

func (f *Binance) GetLeverageBracket(ctx context.Context, symbol string) ([]*LeverageBracket, error)

func (*Binance) GetListenKey

func (f *Binance) GetListenKey(ctx context.Context) (string, error)

func (*Binance) GetOpenOrders

func (f *Binance) GetOpenOrders(ctx context.Context, symbol string) ([]*Order, error)

func (*Binance) GetPositionRisk

func (f *Binance) GetPositionRisk(ctx context.Context, symbol string) ([]*Position, error)

func (*Binance) OpenOrders

func (f *Binance) OpenOrders(ctx context.Context, orders []*models.Order) ([]*CreateOrderResp, error)

type Bracket

type Bracket struct {
	Bracket          int     `json:"bracket"`
	InitialLeverage  int     `json:"initialLeverage"`
	NotionalCap      float64 `json:"notionalCap"`
	NotionalFloor    float64 `json:"notionalFloor"`
	MaintMarginRatio float64 `json:"maintMarginRatio"`
	Cum              float64 `json:"cum"`
}

Bracket define the bracket

type CreateOrderResp

type CreateOrderResp struct {
	*Error
	OrderId       int    `json:"orderId,omitempty"`
	Symbol        string `json:"symbol,omitempty"`
	Status        string `json:"status,omitempty"`
	ClientOrderId string `json:"clientOrderId,omitempty"`
	Price         string `json:"price,omitempty"`
	AvgPrice      string `json:"avgPrice,omitempty"`
	OrigQty       string `json:"origQty,omitempty"`
	ExecutedQty   string `json:"executedQty,omitempty"`
	CumQty        string `json:"cumQty,omitempty"`
	CumQuote      string `json:"cumQuote,omitempty"`
	TimeInForce   string `json:"timeInForce,omitempty"`
	Type          string `json:"type,omitempty"`
	ReduceOnly    bool   `json:"reduceOnly,omitempty"`
	ClosePosition bool   `json:"closePosition,omitempty"`
	Side          string `json:"side,omitempty"`
	PositionSide  string `json:"positionSide,omitempty"`
	StopPrice     string `json:"stopPrice,omitempty"`
	WorkingType   string `json:"workingType,omitempty"`
	PriceProtect  bool   `json:"priceProtect,omitempty"`
	OrigType      string `json:"origType,omitempty"`
	UpdateTime    int64  `json:"updateTime,omitempty"`
}

type Error

type Error struct {
	Code int    `json:"code,omitempty"`
	Msg  string `json:"msg,omitempty"`
}

type LeverageBracket

type LeverageBracket struct {
	Symbol   string    `json:"symbol"`
	Brackets []Bracket `json:"brackets"`
}

LeverageBracket define the leverage bracket

type Order

type Order struct {
	Error            *Error
	Symbol           string                   `json:"symbol"`
	OrderID          int64                    `json:"orderId"`
	ClientOrderID    string                   `json:"clientOrderId"`
	Price            string                   `json:"price"`
	ReduceOnly       bool                     `json:"reduceOnly"`
	OrigQuantity     string                   `json:"origQty"`
	ExecutedQuantity string                   `json:"executedQty"`
	CumQuantity      string                   `json:"cumQty"`
	CumQuote         string                   `json:"cumQuote"`
	Status           futures.OrderStatusType  `json:"status"`
	TimeInForce      futures.TimeInForceType  `json:"timeInForce"`
	Type             futures.OrderType        `json:"type"`
	Side             futures.SideType         `json:"side"`
	StopPrice        string                   `json:"stopPrice"`
	Time             int64                    `json:"time"`
	UpdateTime       int64                    `json:"updateTime"`
	WorkingType      futures.WorkingType      `json:"workingType"`
	ActivatePrice    string                   `json:"activatePrice"`
	PriceRate        string                   `json:"priceRate"`
	AvgPrice         string                   `json:"avgPrice"`
	OrigType         string                   `json:"origType"`
	PositionSide     futures.PositionSideType `json:"positionSide"`
	PriceProtect     bool                     `json:"priceProtect"`
	ClosePosition    bool                     `json:"closePosition"`
}

type Position

type Position struct {
	*Error
	EntryPrice       string `json:"entryPrice"`
	MarginType       string `json:"marginType"`
	IsAutoAddMargin  string `json:"isAutoAddMargin"`
	IsolatedMargin   string `json:"isolatedMargin"`
	Leverage         string `json:"leverage"`
	LiquidationPrice string `json:"liquidationPrice"`
	MarkPrice        string `json:"markPrice"`
	MaxNotionalValue string `json:"maxNotionalValue"`
	PositionAmt      string `json:"positionAmt"`
	Symbol           string `json:"symbol"`
	UnRealizedProfit string `json:"unRealizedProfit"`
	PositionSide     string `json:"positionSide"`
	Notional         string `json:"notional"`
	IsolatedWallet   string `json:"isolatedWallet"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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