binance

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HostDApiPublic    = "dapiPublic"
	HostDApiPrivate   = "dapiPrivate"
	HostDApiPrivateV2 = "dapiPrivateV2"
	HostFApiPublic    = "fapiPublic"
	HostFApiPublicV2  = "fapiPublicV2"
	HostFApiPrivate   = "fapiPrivate"
	HostFApiPrivateV2 = "fapiPrivateV2"
	HostPublic        = "public"
	HostPrivate       = "private"
	HostV1            = "v1"
	HostSApi          = "sapi"
	HostSApiV2        = "sapiV2"
	HostSApiV3        = "sapiV3"
	HostSApiV4        = "sapiV4"
	HostEApiPublic    = "eapiPublic"
	HostEApiPrivate   = "eapiPrivate"
	HostDApiData      = "dapiData"
	HostFApiData      = "fapiData"
	HostPApi          = "papi"
	WssApi            = "ws"
)
View Source
const (
	OdStatusNew             = "NEW"
	OdStatusPartiallyFilled = "PARTIALLY_FILLED"
	OdStatusAccept          = "ACCEPTED"
	OdStatusFilled          = "FILLED"
	OdStatusCanceled        = "CANCELED"
	OdStatusCancelled       = "CANCELLED"
	OdStatusPendingCancel   = "PENDING_CANCEL"
	OdStatusReject          = "REJECTED"
	OdStatusExpired         = "EXPIRED"
	OdStatusExpiredInMatch  = "EXPIRED_IN_MATCH"
)
View Source
const (
	OptRecvWindow = "RecvWindow"
)

Variables

Functions

func NewExchange

func NewExchange(Options map[string]interface{}) (banexg.BanExchange, *errs.Error)

Types

type AccountTotal

type AccountTotal struct {
	BaseAccountTotal
	MultiAssetsMargin           bool   `json:"multiAssetsMargin"`
	TradeGroupId                int64  `json:"tradeGroupId"`
	TotalInitialMargin          string `json:"totalInitialMargin"`          // 当前所需起始保证金总额(存在逐仓请忽略), 仅计算usdt资产
	TotalMaintMargin            string `json:"totalMaintMargin"`            // 维持保证金总额, 仅计算usdt资产
	TotalWalletBalance          string `json:"totalWalletBalance"`          // 账户总余额, 仅计算usdt资产
	TotalUnrealizedProfit       string `json:"totalUnrealizedProfit"`       // 持仓未实现盈亏总额, 仅计算usdt资产
	TotalMarginBalance          string `json:"totalMarginBalance"`          // 保证金总余额, 仅计算usdt资产
	TotalPositionInitialMargin  string `json:"totalPositionInitialMargin"`  // 持仓所需起始保证金(基于最新标记价格), 仅计算usdt资产
	TotalOpenOrderInitialMargin string `json:"totalOpenOrderInitialMargin"` // 当前挂单所需起始保证金(基于最新标记价格), 仅计算usdt资产
	TotalCrossWalletBalance     string `json:"totalCrossWalletBalance"`     // 全仓账户余额, 仅计算usdt资产
	TotalCrossUnPnl             string `json:"totalCrossUnPnl"`             // 全仓持仓未实现盈亏总额, 仅计算usdt资产
	AvailableBalance            string `json:"availableBalance"`            // 可用余额, 仅计算usdt资产
	MaxWithdrawAmount           string `json:"maxWithdrawAmount"`           // 最大可转出余额, 仅计算usdt资产
}

type AuthRes

type AuthRes struct {
	ListenKey string `json:"listenKey"`
}

type BaseAccountTotal

type BaseAccountTotal struct {
	FeeTier     int64 `json:"feeTier"`     // 手续费等级
	CanTrade    bool  `json:"canTrade"`    // 是否可以交易
	CanDeposit  bool  `json:"canDeposit"`  // 是否可以入金
	CanWithdraw bool  `json:"canWithdraw"` // 是否可以出金
	UpdateTime  int64 `json:"updateTime"`  // 保留字段,请忽略
}

type BaseContPosition

type BaseContPosition struct {
	Symbol           string `json:"symbol"`           // 交易对
	PositionSide     string `json:"positionSide"`     // 持仓方向
	PositionAmt      string `json:"positionAmt"`      // 持仓数量
	Leverage         string `json:"leverage"`         // 杠杆倍率
	EntryPrice       string `json:"entryPrice"`       // 持仓成本价
	UnRealizedProfit string `json:"unRealizedProfit"` // 持仓未实现盈亏
	UpdateTime       int64  `json:"updateTime"`       // 更新时间
}

func (*BaseContPosition) ToStdPos

func (p *BaseContPosition) ToStdPos() *banexg.Position

type BaseLvgBracket

type BaseLvgBracket struct {
	Bracket          int     `json:"bracket"`          // 层级
	InitialLeverage  int     `json:"initialLeverage"`  // 该层允许的最高初始杠杆倍数
	MaintMarginRatio float64 `json:"maintMarginRatio"` // 该层对应的维持保证金率
	Cum              float64 `json:"cum"`              // 速算数
}

type BaseOrderBook

type BaseOrderBook struct {
	Bids [][]string `json:"bids"`
	Asks [][]string `json:"asks"`
}

func (BaseOrderBook) ToStdOrderBook

func (o BaseOrderBook) ToStdOrderBook(market *banexg.Market) *banexg.OrderBook

type Binance

type Binance struct {
	*banexg.Exchange
	RecvWindow int

	LeverageBrackets map[string]*SymbolLvgBrackets // symbol: Leverage Brackets
	// contains filtered or unexported fields
}

func New

func New(Options map[string]interface{}) (*Binance, *errs.Error)

func (*Binance) CalcMaintMargin added in v0.1.2

func (e *Binance) CalcMaintMargin(symbol string, cost float64) (float64, *errs.Error)

func (*Binance) CancelOrder

func (e *Binance) CancelOrder(id string, symbol string, params map[string]interface{}) (*banexg.Order, *errs.Error)

CancelOrder cancels an open order

:see: https://binance-docs.github.io/apidocs/spot/en/#cancel-order-trade
:see: https://binance-docs.github.io/apidocs/futures/en/#cancel-order-trade
:see: https://binance-docs.github.io/apidocs/delivery/en/#cancel-order-trade
:see: https://binance-docs.github.io/apidocs/voptions/en/#cancel-option-order-trade
:see: https://binance-docs.github.io/apidocs/spot/en/#margin-account-cancel-order-trade
:param str id: order id
:param str symbol: unified symbol of the market the order was made in
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: An `order structure <https://docs.ccxt.com/#/?id=order-structure>`

func (*Binance) Close added in v0.2.0

func (e *Binance) Close() *errs.Error

func (*Binance) CreateOrder

func (e *Binance) CreateOrder(symbol, odType, side string, amount float64, price float64, params map[string]interface{}) (*banexg.Order, *errs.Error)

CreateOrder 提交订单到交易所

:see: https://binance-docs.github.io/apidocs/spot/en/#new-order-trade

:see: https://binance-docs.github.io/apidocs/spot/en/#test-new-order-trade
:see: https://binance-docs.github.io/apidocs/futures/en/#new-order-trade
:see: https://binance-docs.github.io/apidocs/delivery/en/#new-order-trade
:see: https://binance-docs.github.io/apidocs/voptions/en/#new-order-trade
:see: https://binance-docs.github.io/apidocs/spot/en/#new-order-using-sor-trade
:see: https://binance-docs.github.io/apidocs/spot/en/#test-new-order-using-sor-trade
:param str symbol: unified symbol of the market to create an order in
:param str type: 'MARKET' or 'LIMIT' or 'STOP_LOSS' or 'STOP_LOSS_LIMIT' or 'TAKE_PROFIT' or 'TAKE_PROFIT_LIMIT' or 'STOP'
:param str side: 'buy' or 'sell'
:param float amount: how much of currency you want to trade in units of base currency
:param float [price]: the price at which the order is to be fullfilled, in units of the quote currency, ignored in market orders
:param dict [params]: extra parameters specific to the exchange API endpoint
:param str [params.marginMode]: 'cross' or 'isolated', for spot margin trading
:param boolean [params.sor]: *spot only* whether to use SOR(Smart Order Routing) or not, default is False
:param boolean [params.test]: *spot only* whether to use the test endpoint or not, default is False
:returns dict: an `order structure <https://docs.ccxt.com/#/?id=order-structure>`

func (*Binance) FetchAccountPositions

func (e *Binance) FetchAccountPositions(symbols []string, params map[string]interface{}) ([]*banexg.Position, *errs.Error)

FetchAccountPositions

:see: https://binance-docs.github.io/apidocs/futures/en/#account-information-v2-user_data
:see: https://binance-docs.github.io/apidocs/delivery/en/#account-information-user_data
:param str[]|None symbols: list of unified market symbols
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: data on account positions

func (*Binance) FetchBalance

func (e *Binance) FetchBalance(params map[string]interface{}) (*banexg.Balances, *errs.Error)

query for balance and get the amount of funds available for trading or funds locked in orders :see: https://binance-docs.github.io/apidocs/spot/en/#account-information-user_data # spot :see: https://binance-docs.github.io/apidocs/spot/en/#query-cross-margin-account-details-user_data # cross margin :see: https://binance-docs.github.io/apidocs/spot/en/#query-isolated-margin-account-info-user_data # isolated margin :see: https://binance-docs.github.io/apidocs/spot/en/#lending-account-user_data # lending :see: https://binance-docs.github.io/apidocs/spot/en/#funding-wallet-user_data # funding :see: https://binance-docs.github.io/apidocs/futures/en/#account-information-v2-user_data # swap :see: https://binance-docs.github.io/apidocs/delivery/en/#account-information-user_data # future :see: https://binance-docs.github.io/apidocs/voptions/en/#option-account-information-trade # option :param dict [params]: extra parameters specific to the exchange API endpoint :param str [params.market]: 'spot', 'future', 'swap', 'funding', or 'spot' :param str [params.marginMode]: 'cross' or 'isolated', for margin trading, uses self.options.defaultMarginMode if not passed, defaults to None/None/None :param str[]|None [params.symbols]: unified market symbols, only used in isolated margin mode :returns dict: a `balance structure <https://docs.ccxt.com/#/?id=balance-structure>`

func (*Binance) FetchOHLCV added in v0.1.2

func (e *Binance) FetchOHLCV(symbol, timeframe string, since int64, limit int, params map[string]interface{}) ([]*banexg.Kline, *errs.Error)

fetches historical candlestick data containing the open, high, low, and close price, and the volume of a market :see: https://binance-docs.github.io/apidocs/spot/en/#kline-candlestick-data :see: https://binance-docs.github.io/apidocs/voptions/en/#kline-candlestick-data :see: https://binance-docs.github.io/apidocs/futures/en/#index-price-kline-candlestick-data :see: https://binance-docs.github.io/apidocs/futures/en/#mark-price-kline-candlestick-data :see: https://binance-docs.github.io/apidocs/futures/en/#kline-candlestick-data :see: https://binance-docs.github.io/apidocs/delivery/en/#index-price-kline-candlestick-data :see: https://binance-docs.github.io/apidocs/delivery/en/#mark-price-kline-candlestick-data :see: https://binance-docs.github.io/apidocs/delivery/en/#kline-candlestick-data :param str symbol: unified symbol of the market to fetch OHLCV data for :param str timeframe: the length of time each candle represents :param int [since]: timestamp in ms of the earliest candle to fetch :param int [limit]: the maximum amount of candles to fetch :param dict [params]: extra parameters specific to the exchange API endpoint :param str [params.price]: "mark" or "index" for mark price and index price candles :param int [params.until]: timestamp in ms of the latest candle to fetch :param boolean [params.paginate]: default False, when True will automatically paginate by calling self endpoint multiple times. See in the docs all the [availble parameters](https://github.com/ccxt/ccxt/wiki/Manual#pagination-params) :returns int[][]: A list of candles ordered, open, high, low, close, volume

func (*Binance) FetchOpenOrders

func (e *Binance) FetchOpenOrders(symbol string, since int64, limit int, params map[string]interface{}) ([]*banexg.Order, *errs.Error)

FetchOpenOrders

:see: https://binance-docs.github.io/apidocs/spot/en/#cancel-an-existing-order-and-send-a-new-order-trade :see: https://binance-docs.github.io/apidocs/futures/en/#current-all-open-orders-user_data :see: https://binance-docs.github.io/apidocs/delivery/en/#current-all-open-orders-user_data :see: https://binance-docs.github.io/apidocs/voptions/en/#query-current-open-option-orders-user_data fetch all unfilled currently open orders :see: https://binance-docs.github.io/apidocs/spot/en/#current-open-orders-user_data :see: https://binance-docs.github.io/apidocs/futures/en/#current-all-open-orders-user_data :see: https://binance-docs.github.io/apidocs/delivery/en/#current-all-open-orders-user_data :see: https://binance-docs.github.io/apidocs/voptions/en/#query-current-open-option-orders-user_data :see: https://binance-docs.github.io/apidocs/spot/en/#query-margin-account-39-s-open-orders-user_data :param str symbol: unified market symbol :param int [since]: the earliest time in ms to fetch open orders for :param int [limit]: the maximum number of open orders structures to retrieve :param dict [params]: extra parameters specific to the exchange API endpoint :param str [params.marginMode]: 'cross' or 'isolated', for spot margin trading :returns Order[]: a list of `order structures <https://docs.ccxt.com/#/?id=order-structure>`

func (*Binance) FetchOrderBook

func (e *Binance) FetchOrderBook(symbol string, limit int, params map[string]interface{}) (*banexg.OrderBook, *errs.Error)

func (*Binance) FetchOrders

func (e *Binance) FetchOrders(symbol string, since int64, limit int, params map[string]interface{}) ([]*banexg.Order, *errs.Error)

FetchOrders 获取自己的订单 symbol: 必填,币种

func (*Binance) FetchPositions

func (e *Binance) FetchPositions(symbols []string, params map[string]interface{}) ([]*banexg.Position, *errs.Error)

func (*Binance) FetchPositionsRisk

func (e *Binance) FetchPositionsRisk(symbols []string, params map[string]interface{}) ([]*banexg.Position, *errs.Error)

func (*Binance) FetchTicker

func (e *Binance) FetchTicker(symbol string, params map[string]interface{}) (*banexg.Ticker, *errs.Error)

func (*Binance) FetchTickerPrice added in v0.2.0

func (e *Binance) FetchTickerPrice(symbol string, params map[string]interface{}) (map[string]float64, *errs.Error)

FetchTickerPrice symbol为空表示获取所有,不为空获取单个

func (*Binance) FetchTickers

func (e *Binance) FetchTickers(symbols []string, params map[string]interface{}) ([]*banexg.Ticker, *errs.Error)

FetchTickers fetches price tickers for multiple markets, statistical information calculated over the past 24 hours for each market

:see: https://binance-docs.github.io/apidocs/spot/en/#24hr-ticker-price-change-statistics         # spot
:see: https://binance-docs.github.io/apidocs/futures/en/#24hr-ticker-price-change-statistics      # swap
:see: https://binance-docs.github.io/apidocs/delivery/en/#24hr-ticker-price-change-statistics     # future
:see: https://binance-docs.github.io/apidocs/voptions/en/#24hr-ticker-price-change-statistics     # option
:param str[]|None symbols: unified symbols of the markets to fetch the ticker for, all market tickers are returned if not assigned
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: a dictionary of `ticker structures <https://docs.ccxt.com/#/?id=ticker-structure>`

func (*Binance) GetLeverage added in v0.2.0

func (e *Binance) GetLeverage(symbol string, notional float64, account string) (int, int)

func (*Binance) GetMaintMarginPct

func (e *Binance) GetMaintMarginPct(symbol string, notional float64) float64

GetMaintMarginPct 获取指定名义价值的维持保证金比率

func (*Binance) GetWsClient

func (e *Binance) GetWsClient(marType, msgHash string) (*banexg.WsClient, int, *errs.Error)

func (*Binance) HandleOrderBookSub

func (e *Binance) HandleOrderBookSub(client *banexg.WsClient, msg map[string]string, info *banexg.WsJobInfo)

func (*Binance) Init

func (e *Binance) Init() *errs.Error

func (*Binance) LoadLeverageBrackets

func (e *Binance) LoadLeverageBrackets(reload bool, params map[string]interface{}) *errs.Error

func (*Binance) SetLeverage

func (e *Binance) SetLeverage(leverage int, symbol string, params map[string]interface{}) (map[string]interface{}, *errs.Error)

SetLeverage set the level of leverage for a market

:see: https://binance-docs.github.io/apidocs/futures/en/#change-initial-leverage-trade
:see: https://binance-docs.github.io/apidocs/delivery/en/#change-initial-leverage-trade
:param float leverage: the rate of leverage
:param str symbol: unified market symbol
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: response from the exchange

func (*Binance) Stream

func (e *Binance) Stream(marType, subHash string) string

func (*Binance) UnWatchMarkPrices

func (e *Binance) UnWatchMarkPrices(symbols []string, params map[string]interface{}) *errs.Error

func (*Binance) UnWatchOHLCVs added in v0.1.2

func (e *Binance) UnWatchOHLCVs(jobs [][2]string, params map[string]interface{}) *errs.Error

func (*Binance) UnWatchOrderBooks

func (e *Binance) UnWatchOrderBooks(symbols []string, params map[string]interface{}) *errs.Error

func (*Binance) UnWatchTrades added in v0.1.3

func (e *Binance) UnWatchTrades(symbols []string, params map[string]interface{}) *errs.Error

func (*Binance) WatchAccountConfig added in v0.2.0

func (e *Binance) WatchAccountConfig(params map[string]interface{}) (chan *banexg.AccountConfig, *errs.Error)

func (*Binance) WatchBalance

func (e *Binance) WatchBalance(params map[string]interface{}) (chan *banexg.Balances, *errs.Error)

func (*Binance) WatchMarkPrices

func (e *Binance) WatchMarkPrices(symbols []string, params map[string]interface{}) (chan map[string]float64, *errs.Error)

func (*Binance) WatchMyTrades

func (e *Binance) WatchMyTrades(params map[string]interface{}) (chan *banexg.MyTrade, *errs.Error)

WatchMyTrades

watches information on multiple trades made by the user

:param str symbol: unified market symbol of the market orders were made in :param int [since]: the earliest time in ms to fetch orders for :param int [limit]: the maximum number of orde structures to retrieve :param dict [params]: extra parameters specific to the exchange API endpoint :returns dict[]: a list of [trade structures]{@link https://docs.ccxt.com/#/?id=trade-structure

func (*Binance) WatchOHLCVs added in v0.1.2

func (e *Binance) WatchOHLCVs(jobs [][2]string, params map[string]interface{}) (chan *banexg.PairTFKline, *errs.Error)

WatchOHLCVs watches historical candlestick data containing the open, high, low, and close price, and the volume of a market :param [][2]string jobs: array of arrays containing unified symbols and timeframes to fetch OHLCV data for, example [['BTC/USDT', '1m'], ['LTC/USDT', '5m']] :param dict [params]: extra parameters specific to the exchange API endpoint :returns int[][]: A list of candles ordered, open, high, low, close, volume

func (*Binance) WatchOrderBooks

func (e *Binance) WatchOrderBooks(symbols []string, limit int, params map[string]interface{}) (chan *banexg.OrderBook, *errs.Error)

WatchOrderBooks watches information on open orders with bid(buy) and ask(sell) prices, volumes and other data

:param str symbol: unified symbol of the market to fetch the order book for
:param int [limit]: the maximum amount of order book entries to return
:param dict [params]: extra parameters specific to the exchange API endpoint
:returns dict: A dictionary of `order book structures <https://docs.ccxt.com/#/?id=order-book-structure>` indexed by market symbols

func (*Binance) WatchPositions

func (e *Binance) WatchPositions(params map[string]interface{}) (chan []*banexg.Position, *errs.Error)

func (*Binance) WatchTrades added in v0.1.3

func (e *Binance) WatchTrades(symbols []string, params map[string]interface{}) (chan *banexg.Trade, *errs.Error)

type BnbCurrency

type BnbCurrency struct {
	Coin              string        `json:"coin"`
	DepositAllEnable  bool          `json:"depositAllEnable"`
	Free              string        `json:"free"`
	Freeze            string        `json:"freeze"`
	Ipoable           string        `json:"ipoable"`
	Ipoing            string        `json:"ipoing"`
	IsLegalMoney      bool          `json:"isLegalMoney"`
	Locked            string        `json:"locked"`
	Name              string        `json:"name"`
	Storage           string        `json:"storage"`
	Trading           bool          `json:"trading"`
	WithdrawAllEnable bool          `json:"withdrawAllEnable"`
	Withdrawing       string        `json:"withdrawing"`
	NetworkList       []*BnbNetwork `json:"networkList"`
}

***************************** CurrencyMap ***********************************

type BnbFilter

type BnbFilter = map[string]interface{}

type BnbMarket

type BnbMarket 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"`
	QuoteAssetPrecision             int         `json:"quoteAssetPrecision"`
	BaseCommissionPrecision         int         `json:"baseCommissionPrecision"`
	QuoteCommissionPrecision        int         `json:"quoteCommissionPrecision"`
	OrderTypes                      []string    `json:"orderTypes"`
	IcebergAllowed                  bool        `json:"icebergAllowed"`
	OcoAllowed                      bool        `json:"ocoAllowed"`
	QuoteOrderQtyMarketAllowed      bool        `json:"quoteOrderQtyMarketAllowed"`
	AllowTrailingStop               bool        `json:"allowTrailingStop"`
	CancelReplaceAllowed            bool        `json:"cancelReplaceAllowed"`
	IsSpotTradingAllowed            bool        `json:"isSpotTradingAllowed"`
	IsMarginTradingAllowed          bool        `json:"isMarginTradingAllowed"`
	Filters                         []BnbFilter `json:"filters"`
	Permissions                     []string    `json:"permissions"`
	DefaultSelfTradePreventionMode  string      `json:"defaultSelfTradePreventionMode"`
	AllowedSelfTradePreventionModes []string    `json:"allowedSelfTradePreventionModes"`

	// 合约
	ContractType      string `json:"contractType"`
	DeliveryDate      int64  `json:"deliveryDate"`      //期货交割时间
	MarginAsset       string `json:"marginAsset"`       // 保证金资产
	QuantityPrecision int    `json:"quantityPrecision"` // U合约数量小数点位数
	PricePrecision    int    `json:"pricePrecision"`    // U合约价格小数点位数
	OnboardDate       int64  `json:"onboardDate"`       // 合约上线时间,币u合约都有

	ContractSize   int    `json:"contractSize"`   // 币合约数量
	ContractStatus string `json:"contractStatus"` // 币合约状态

	// 期权
	ExpiryDate    int64  `json:"expiryDate"`    // 期权到期时间
	Underlying    string `json:"underlying"`    // 期权合约底层资产
	StrikePrice   string `json:"strikePrice"`   // 期权行权价
	Unit          int    `json:"unit"`          // 期权合约单位,单一合约代表的底层资产数量
	Side          string `json:"side"`          // 期权方向
	QuantityScale int    `json:"quantityScale"` // 期权数量精读
	PriceScale    int    `json:"priceScale"`    // 期权价格精度
	MinQty        string `json:"minQty"`        // 期权最小下单数量
	MaxQty        string `json:"maxQty"`        // 期权最大下单数量
}

func (*BnbMarket) GetMarketLimits

func (mar *BnbMarket) GetMarketLimits() (*banexg.MarketLimits, float64, float64)

func (*BnbMarket) GetPrecision

func (mar *BnbMarket) GetPrecision() *banexg.Precision

type BnbMarketRsp

type BnbMarketRsp struct {
	Timezone        string       `json:"timezone"`
	ServerTime      int64        `json:"serverTime"`
	RateLimits      []*RateLimit `json:"rateLimits"`
	ExchangeFilters []BnbFilter  `json:"exchangeFilters"`
	Symbols         []*BnbMarket `json:"symbols"`
}

type BnbNetwork

type BnbNetwork struct {
	AddressRegex            string `json:"addressRegex"`
	Coin                    string `json:"coin"`
	DepositDesc             string `json:"depositDesc"`
	DepositEnable           bool   `json:"depositEnable"`
	IsDefault               bool   `json:"isDefault"`
	MemoRegex               string `json:"memoRegex"`
	MinConfirm              int    `json:"minConfirm"`
	Name                    string `json:"name"`
	Network                 string `json:"network"`
	ResetAddressStatus      bool   `json:"resetAddressStatus"`
	SpecialTips             string `json:"specialTips"`
	UnLockConfirm           int    `json:"unLockConfirm"`
	WithdrawDesc            string `json:"withdrawDesc"`
	WithdrawEnable          bool   `json:"withdrawEnable"`
	WithdrawFee             string `json:"withdrawFee"`
	WithdrawIntegerMultiple string `json:"withdrawIntegerMultiple"`
	WithdrawMax             string `json:"withdrawMax"`
	WithdrawMin             string `json:"withdrawMin"`
	SameAddress             bool   `json:"sameAddress"`
	EstimatedArrivalTime    int    `json:"estimatedArrivalTime"`
	Busy                    bool   `json:"busy"`
}

type BnbOptionKline

type BnbOptionKline struct {
	Open        string `json:"open"`        // 开盘价
	High        string `json:"high"`        // 最高价
	Low         string `json:"low"`         // 最低价
	Close       string `json:"close"`       // 收盘价(当前K线未结束的即为最新价)
	Volume      string `json:"volume"`      // 成交额
	Amount      string `json:"amount"`      // 成交量
	Interval    string `json:"interval"`    // 时间区间
	TradeCount  int    `json:"tradeCount"`  // 成交笔数
	TakerVolume string `json:"takerVolume"` // 主动买入成交额
	TakerAmount string `json:"takerAmount"` // 主动买入成交量
	OpenTime    int64  `json:"openTime"`    // 开盘时间
	CloseTime   int64  `json:"closeTime"`   // 收盘时间
}

***************************** Kline ***********************************

type BookTicker

type BookTicker struct {
	Symbol   string `json:"symbol"`   // 交易对
	AskPrice string `json:"askPrice"` // 卖价
	AskQty   string `json:"askQty"`   // 卖单数量
	BidPrice string `json:"bidPrice"` // 买价
	BidQty   string `json:"bidQty"`   // 买单数量
}

func (*BookTicker) SetStdTicker

func (t *BookTicker) SetStdTicker(ticker *banexg.Ticker)

type ContPositionRisk

type ContPositionRisk struct {
	BaseContPosition
	BreakEvenPrice   string `json:"breakEvenPrice"` // 盈亏平衡价
	MarginType       string `json:"marginType"`     // 逐仓模式或全仓模式
	IsAutoAddMargin  string `json:"isAutoAddMargin"`
	IsolatedMargin   string `json:"isolatedMargin"`   // 逐仓保证金
	LiquidationPrice string `json:"liquidationPrice"` // 参考强平价格
	MarkPrice        string `json:"markPrice"`        // 当前标记价格
}

合约持仓风险

func (*ContPositionRisk) ToStdPos

func (p *ContPositionRisk) ToStdPos() *banexg.Position

type ContractAsset

type ContractAsset struct {
	Asset         string `json:"a"`
	WalletBalance string `json:"wb"`
	CrossWallet   string `json:"cw"`
	BalanceChange string `json:"bc"`
}

type ErrRsp

type ErrRsp struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
}

type FundingAsset

type FundingAsset struct {
	Asset        string `json:"asset"`
	Free         string `json:"free"`         // 可用余额
	Locked       string `json:"locked"`       // 锁定资金
	Freeze       string `json:"freeze"`       // 冻结资金
	Withdrawing  string `json:"withdrawing"`  // 提币
	BtcValuation string `json:"btcValuation"` // btc估值
}

FundingAsset 资金账户余额

type FutBase

type FutBase struct {
	OrderBase
	ReduceOnly bool   `json:"reduceOnly"` // 是否仅减仓
	AvgPrice   string `json:"avgPrice"`   // 平均成交价
}

type FutureAsset

type FutureAsset struct {
	Asset                  string `json:"asset"`                  // 资产名
	WalletBalance          string `json:"walletBalance"`          // 账户余额
	UnrealizedProfit       string `json:"unrealizedProfit"`       // 全部持仓未实现盈亏
	MarginBalance          string `json:"marginBalance"`          // 保证金余额
	MaintMargin            string `json:"maintMargin"`            // 维持保证金
	InitialMargin          string `json:"initialMargin"`          // 当前所需起始保证金(按最新标标记价格)
	PositionInitialMargin  string `json:"positionInitialMargin"`  // 当前所需持仓起始保证金(按最新标标记价格)
	OpenOrderInitialMargin string `json:"openOrderInitialMargin"` // 当前所需挂单起始保证金(按最新标标记价格)
	MaxWithdrawAmount      string `json:"maxWithdrawAmount"`      // 最大可提款金额
	CrossWalletBalance     string `json:"crossWalletBalance"`     // 可用于全仓的账户余额
	CrossUnPnl             string `json:"crossUnPnl"`             // 所有全仓持仓的未实现盈亏
	AvailableBalance       string `json:"availableBalance"`       // 可用下单余额
	UpdateTime             int64  `json:"updateTime"`             // 更新时间
}

资产内容

func (*FutureAsset) ToStdAsset

func (a *FutureAsset) ToStdAsset(getCurrCode func(string) string) *banexg.Asset

type FutureBase

type FutureBase struct {
	FutBase
	Time          int64  `json:"time"`          // 订单时间
	OrigType      string `json:"origType"`      // 触发前订单类型
	ActivatePrice string `json:"activatePrice"` // 跟踪止损激活价格, 仅`TRAILING_STOP_MARKET` 订单返回此字段
	WorkingType   string `json:"workingType"`   // 条件价格触发类型
	ClosePosition bool   `json:"closePosition"` // 是否条件全平仓
	PositionSide  string `json:"positionSide"`  // 持仓方向
	OrigQty       string `json:"origQty"`       // 原始委托数量
	StopPrice     string `json:"stopPrice"`     // 触发价,对`TRAILING_STOP_MARKET`无效
	PriceRate     string `json:"priceRate"`     // 跟踪止损回调比例, 仅`TRAILING_STOP_MARKET` 订单返回此字段
	PriceProtect  bool   `json:"priceProtect"`  // 是否开启条件单触发保护
	CumQty        string `json:"cumQty"`
}

func (*FutureBase) ToStdOrder

func (o *FutureBase) ToStdOrder(mapSymbol func(string) string) *banexg.Order

type FutureOrder

type FutureOrder struct {
	FutureBase
	GoodTillDate            int64  `json:"goodTillDate"`            //订单TIF为GTD时的自动取消时间
	SelfTradePreventionMode string `json:"selfTradePreventionMode"` //订单自成交保护模式
	CumQuote                string `json:"cumQuote"`                // 成交金额
	PriceMatch              string `json:"priceMatch"`              //盘口价格下单模式
}

FutureOrder U本位合约订单

func (*FutureOrder) ToStdOrder

func (o *FutureOrder) ToStdOrder(mapSymbol func(string) string) *banexg.Order

type FuturePosition

type FuturePosition struct {
	BaseContPosition
	InitialMargin          string `json:"initialMargin"`          // 当前所需起始保证金(基于最新标记价格)
	MaintMargin            string `json:"maintMargin"`            // 维持保证金
	PositionInitialMargin  string `json:"positionInitialMargin"`  // 持仓所需起始保证金(基于最新标记价格)
	OpenOrderInitialMargin string `json:"openOrderInitialMargin"` // 当前挂单所需起始保证金(基于最新标记价格)
	Isolated               bool   `json:"isolated"`               // 是否是逐仓模式
	IsolatedWallet         string `json:"isolatedWallet"`
}

type IAccPosition

type IAccPosition interface {
	GetFutPosition() *FuturePosition
	GetNotional() string
}

type IBnbOrder

type IBnbOrder interface {
	ToStdOrder(func(string) string) *banexg.Order
}

type IBnbOrderBook

type IBnbOrderBook interface {
	ToStdOrderBook(m *banexg.Market) *banexg.OrderBook
}

type IBnbPosRisk

type IBnbPosRisk interface {
	ToStdPos(*Binance) (*banexg.Position, *errs.Error)
}

type IBnbTicker

type IBnbTicker interface {
	ToStdTicker(e *Binance, marketType string) *banexg.Ticker
}

type ISymbolLvgBracket

type ISymbolLvgBracket interface {
	ToStdBracket() *SymbolLvgBrackets
	GetSymbol() string
}

type ITickerPrice added in v0.2.0

type ITickerPrice interface {
	ToStdPrice(e *Binance, marketType string) (string, float64)
}

type InverseAccPositions

type InverseAccPositions struct {
	BaseAccountTotal
	Assets    []*FutureAsset     `json:"assets"`
	Positions []*InversePosition `json:"positions"`
}

InverseAccPositions 币本位合约的AccountPositions

type InverseBalances

type InverseBalances struct {
	Assets      []*FutureAsset     `json:"assets"`
	Positions   []*InversePosition `json:"positions"`
	CanDeposit  bool               `json:"canDeposit"`
	CanTrade    bool               `json:"canTrade"`
	CanWithdraw bool               `json:"canWithdraw"`
	FeeTier     int                `json:"feeTier"`
	UpdateTime  int64              `json:"updateTime"`
}

InverseBalances Coin-Based Balances

type InverseBookTicker

type InverseBookTicker struct {
	LinearBookTicker
	Pair string `json:"pair"`
}

type InverseLvgBracket

type InverseLvgBracket struct {
	BaseLvgBracket
	QtyCap    float64 `json:"qtyCap"`    //该层对应的数量上限
	QtylFloor float64 `json:"qtylFloor"` // 该层对应的数量下限
}

type InverseOrder

type InverseOrder struct {
	FutureBase
	Pair    string `json:"pair"`    // 标的交易对
	CumBase string `json:"cumBase"` // 成交金额(标的数量)
}

InverseOrder 币本位合约订单

func (*InverseOrder) ToStdOrder

func (o *InverseOrder) ToStdOrder(mapSymbol func(string) string) *banexg.Order

type InverseOrderBook

type InverseOrderBook struct {
	LinearOrderBook
	Symbol string `json:"symbol"`
	Pair   string `json:"pair"`
}

func (InverseOrderBook) ToStdOrderBook

func (o InverseOrderBook) ToStdOrderBook(market *banexg.Market) *banexg.OrderBook

type InversePairLvgBrackets

type InversePairLvgBrackets struct {
	Symbol       string               `json:"symbol"`
	NotionalCoef float64              `json:"notionalCoef"` //用户bracket相对默认bracket的倍数,仅在和交易对默认不一样时显示
	Brackets     []*InverseLvgBracket `json:"brackets"`
}

func (*InversePairLvgBrackets) GetSymbol

func (b *InversePairLvgBrackets) GetSymbol() string

func (*InversePairLvgBrackets) ToStdBracket

func (b *InversePairLvgBrackets) ToStdBracket() *SymbolLvgBrackets

type InversePosition

type InversePosition struct {
	FuturePosition
	BreakEvenPrice string `json:"breakEvenPrice"` // 盈亏平衡价
	MaxQty         string `json:"maxQty"`         // 当前杠杆下最大可开仓数(标的数量)
	NotionalValue  string `json:"notionalValue"`  // 当前名义价值
}

头寸

func (*InversePosition) GetFutPosition

func (p *InversePosition) GetFutPosition() *FuturePosition

func (*InversePosition) GetNotional

func (p *InversePosition) GetNotional() string

type InversePositionRisk

type InversePositionRisk struct {
	ContPositionRisk
	MaxQuantity   string `json:"maxQty"`        // 当前杠杆倍数允许的数量上限(标的数量)
	NotionalValue string `json:"notionalValue"` // 当前名义价值
}

币本位合约持仓风险

func (*InversePositionRisk) ToStdPos

func (p *InversePositionRisk) ToStdPos(e *Binance) (*banexg.Position, *errs.Error)

type InversePriceTicker

type InversePriceTicker struct {
	LinearPriceTicker
	PS string `json:"ps"` // 标的交易对
}

type InverseTicker24hr

type InverseTicker24hr struct {
	SpotTicker
	BaseVolume string `json:"baseVolume"` // 24小时成交额
	LastQty    string `json:"lastQty"`    // 最近一次成交额
	Pair       string `json:"pair"`
}

func (*InverseTicker24hr) ToStdTicker

func (t *InverseTicker24hr) ToStdTicker(e *Binance, marketType string) *banexg.Ticker

type InverseTickerPrice added in v0.2.0

type InverseTickerPrice struct {
	LinearTickerPrice
	PS string `json:"ps"` // 标的交易对
}

type IsolatedAsset

type IsolatedAsset struct {
	BaseAsset         *IsolatedCurrAsset `json:"baseAsset"`
	QuoteAsset        *IsolatedCurrAsset `json:"quoteAsset"`
	Symbol            string             `json:"symbol"`
	IsolatedCreated   bool               `json:"isolatedCreated"`
	Enabled           bool               `json:"enabled"`
	MarginLevel       string             `json:"marginLevel"`
	MarginLevelStatus string             `json:"marginLevelStatus"`
	MarginRatio       string             `json:"marginRatio"`
	IndexPrice        string             `json:"indexPrice"`
	LiquidatePrice    string             `json:"liquidatePrice"`
	LiquidateRate     string             `json:"liquidateRate"`
	TradeEnabled      bool               `json:"tradeEnabled"`
}

type IsolatedBalances

type IsolatedBalances struct {
	Assets              []IsolatedAsset `json:"assets"`
	TotalAssetOfBtc     string          `json:"totalAssetOfBtc"`
	TotalLiabilityOfBtc string          `json:"totalLiabilityOfBtc"`
	TotalNetAssetOfBtc  string          `json:"totalNetAssetOfBtc"`
}

IsolatedBalances Binance Margin Isolated Balance

type IsolatedCurrAsset

type IsolatedCurrAsset struct {
	SpotAsset
	BorrowEnabled bool   `json:"borrowEnabled"`
	NetAssetOfBtc string `json:"netAssetOfBtc"`
	RepayEnabled  bool   `json:"repayEnabled"`
	TotalAsset    string `json:"totalAsset"`
}

type LinearAccPositions

type LinearAccPositions struct {
	AccountTotal
	Assets    []*LinearAsset           `json:"assets"`
	Positions []*LinearAccountPosition `json:"positions"`
}

LinearAccPositions U本位合约的AccountPositions

type LinearAccountPosition

type LinearAccountPosition struct {
	LinearPosition
	Notional       string `json:"notional"`
	IsolatedWallet string `json:"isolatedWallet"`
	BreakEvenPrice string `json:"breakEvenPrice"` // 盈亏平衡价
}

LinearAccountPosition Account Position for Linear Contract

func (*LinearAccountPosition) GetFutPosition

func (p *LinearAccountPosition) GetFutPosition() *FuturePosition

func (*LinearAccountPosition) GetNotional

func (p *LinearAccountPosition) GetNotional() string

type LinearAsset

type LinearAsset struct {
	FutureAsset
	MarginAvailable bool `json:"marginAvailable"` // 是否可用作联合保证金
}

type LinearBalances

type LinearBalances struct {
	AccountTotal
	Assets    []*LinearAsset    `json:"assets"`
	Positions []*LinearPosition `json:"positions"`
}

LinearBalances U本位合约账户余额

type LinearBookTicker

type LinearBookTicker struct {
	BookTicker
	LastUpdateId int   `json:"lastUpdateId"`
	Time         int64 `json:"time"`
}

type LinearLvgBracket

type LinearLvgBracket struct {
	BaseLvgBracket
	NotionalCap   float64 `json:"notionalCap"`   // 该层对应的名义价值上限
	NotionalFloor float64 `json:"notionalFloor"` // 该层对应的名义价值下限
}

合约的杠杆分层标准

type LinearOrderBook

type LinearOrderBook struct {
	BaseOrderBook
	Time     int64 `json:"T"`
	MsgTime  int64 `json:"E"`
	UpdateID int   `json:"lastUpdateId"`
}

func (LinearOrderBook) ToStdOrderBook

func (o LinearOrderBook) ToStdOrderBook(market *banexg.Market) *banexg.OrderBook

type LinearPosition

type LinearPosition struct {
	FuturePosition
	MaxNotional string `json:"maxNotional"` // 当前杠杆下用户可用的最大名义价值
	BidNotional string `json:"bidNotional"` // 买单净值,忽略
	AskNotional string `json:"askNotional"` // 卖单净值,忽略
}

type LinearPositionRisk

type LinearPositionRisk struct {
	ContPositionRisk
	Notional         string `json:"notional"`
	MaxNotionalValue string `json:"maxNotionalValue"` // 当前杠杆倍数允许的名义价值上限
	IsolatedWallet   string `json:"isolatedWallet"`
}

U本位合约持仓风险

func (*LinearPositionRisk) ToStdPos

func (p *LinearPositionRisk) ToStdPos(e *Binance) (*banexg.Position, *errs.Error)

type LinearPriceTicker

type LinearPriceTicker struct {
	SpotPriceTicker
	Time int64 `json:"time"`
}

type LinearSymbolLvgBrackets

type LinearSymbolLvgBrackets struct {
	Symbol       string              `json:"symbol"`
	NotionalCoef float64             `json:"notionalCoef"` //用户bracket相对默认bracket的倍数,仅在和交易对默认不一样时显示
	Brackets     []*LinearLvgBracket `json:"brackets"`
}

func (*LinearSymbolLvgBrackets) GetSymbol

func (b *LinearSymbolLvgBrackets) GetSymbol() string

func (*LinearSymbolLvgBrackets) ToStdBracket

func (b *LinearSymbolLvgBrackets) ToStdBracket() *SymbolLvgBrackets

type LinearTicker

type LinearTicker struct {
	SpotTicker
	LastQty string `json:"lastQty"` // 最近一次成交额
}

func (*LinearTicker) ToStdTicker

func (t *LinearTicker) ToStdTicker(e *Binance, marketType string) *banexg.Ticker

type LinearTickerPrice added in v0.2.0

type LinearTickerPrice struct {
	SymbolPrice
	Time int64 `json:"time"` // 撮合引擎的时间戳,单位为毫秒
}

type LvgBracket added in v0.1.2

type LvgBracket struct {
	BaseLvgBracket
	Capacity float64
	Floor    float64
}

LvgBracket 标准杠杆费率信息

type MarginCrossBalances

type MarginCrossBalances struct {
	BorrowEnabled              bool         `json:"borrowEnabled"`
	MarginLevel                string       `json:"marginLevel"`
	CollateralMarginLevel      string       `json:"CollateralMarginLevel"`
	TotalAssetOfBtc            string       `json:"totalAssetOfBtc"`
	TotalLiabilityOfBtc        string       `json:"totalLiabilityOfBtc"`
	TotalNetAssetOfBtc         string       `json:"totalNetAssetOfBtc"`
	TotalCollateralValueInUSDT string       `json:"TotalCollateralValueInUSDT"`
	TradeEnabled               bool         `json:"tradeEnabled"`
	TransferEnabled            bool         `json:"transferEnabled"`
	AccountType                string       `json:"accountType"`
	UserAssets                 []*SpotAsset `json:"userAssets"`
}

MarginCrossBalances

binance margin cross balance

type MarginOrder

type MarginOrder struct {
	SpotBase
	IsIsolated bool `json:"isIsolated"` // 是否是逐仓symbol交易
}

MarginOrder 保证金杠杆订单

func (*MarginOrder) ToStdOrder

func (o *MarginOrder) ToStdOrder(mapSymbol func(string) string) *banexg.Order

type OptionOrder

type OptionOrder struct {
	FutBase
	PostOnly      bool    `json:"postOnly"`      // 仅做maker
	PriceScale    int     `json:"priceScale"`    // 价格精度
	OptionSide    string  `json:"optionSide"`    // 期权类型
	QuoteAsset    string  `json:"quoteAsset"`    // 报价资产
	Quantity      float64 `json:"quantity"`      // 订单数量
	QuantityScale int     `json:"quantityScale"` // 数量精度
	Fee           float64 `json:"fee"`           // 手续费
	CreateTime    int64   `json:"createTime"`    // 订单创建时间
	Source        string  `json:"source"`        // 订单来源
	Mmp           bool    `json:"mmp"`           // 是否为MMP订单
}

OptionOrder 期权订单

func (*OptionOrder) ToStdOrder

func (o *OptionOrder) ToStdOrder(mapSymbol func(string) string) *banexg.Order

type OptionOrderBook

type OptionOrderBook struct {
	BaseOrderBook
	Time     int64 `json:"T"`
	UpdateID int   `json:"u"`
}

func (OptionOrderBook) ToStdOrderBook

func (o OptionOrderBook) ToStdOrderBook(market *banexg.Market) *banexg.OrderBook

type OptionTicker

type OptionTicker struct {
	Symbol             string  `json:"symbol"`
	PriceChange        float64 `json:"priceChange,string"`        // 24小时价格变动
	PriceChangePercent float64 `json:"priceChangePercent,string"` // 24小时价格变动百分比
	LastPrice          float64 `json:"lastPrice,string"`          // 最近一次成交价
	LastQty            float64 `json:"lastQty,string"`            // 最近一次成交额
	Open               float64 `json:"open,string"`               // 24小时内第一次成交的价格
	High               float64 `json:"high,string"`               // 24小时最高价
	Low                float64 `json:"low,string"`                // 24小时最低价
	Volume             float64 `json:"volume,string"`             // 成交额
	Amount             float64 `json:"amount,string"`             // 成交量
	BidPrice           float64 `json:"bidPrice,string"`           // 最优买价
	AskPrice           float64 `json:"askPrice,string"`           // 最优卖价
	OpenTime           int64   `json:"openTime"`                  // 24小时内,第一笔交易的发生时间
	CloseTime          int64   `json:"closeTime"`                 // 24小时内,最后一笔交易的发生时间
	FirstTradeID       int     `json:"firstTradeId"`              // 首笔成交ID
	TradeCount         int     `json:"tradeCount"`                // 成交笔数
	StrikePrice        float64 `json:"strikePrice,string"`        // 行权价
	ExercisePrice      float64 `json:"exercisePrice,string"`      // 行权前半小时返回预估结算价,其他时刻返回指数价格
}

func (*OptionTicker) ToStdPrice added in v0.2.0

func (t *OptionTicker) ToStdPrice(e *Binance, marketType string) (string, float64)

func (*OptionTicker) ToStdTicker

func (t *OptionTicker) ToStdTicker(e *Binance, marketType string) *banexg.Ticker

type OrderBase

type OrderBase struct {
	Symbol        string `json:"symbol"`
	Side          string `json:"side"`
	ClientOrderId string `json:"clientOrderId"`
	ExecutedQty   string `json:"executedQty"`
	UpdateTime    int64  `json:"updateTime"`
	Status        string `json:"status"`
	Type          string `json:"type"` // 订单类型
	OrderId       int    `json:"orderId"`
	Price         string `json:"price"`
	TimeInForce   string `json:"timeInForce"`
}

***************************** Private Rows ***********************************

func (*OrderBase) ToStdOrder

func (o *OrderBase) ToStdOrder(mapSymbol func(string) string) *banexg.Order

type RateLimit

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

type SpotAccount

type SpotAccount struct {
	MakerCommission            int               `json:"makerCommission"`
	TakerCommission            int               `json:"takerCommission"`
	BuyerCommission            int               `json:"buyerCommission"`
	SellerCommission           int               `json:"sellerCommission"`
	CommissionRates            map[string]string `json:"commissionRates"`
	CanTrade                   bool              `json:"canTrade"`
	CanWithdraw                bool              `json:"canWithdraw"`
	CanDeposit                 bool              `json:"canDeposit"`
	Brokered                   bool              `json:"brokered"`
	RequireSelfTradePrevention bool              `json:"requireSelfTradePrevention"`
	PreventSor                 bool              `json:"preventSor"`
	UpdateTime                 int64             `json:"updateTime"`
	AccountType                string            `json:"accountType"`
	Balances                   []*SpotAsset      `json:"balances"`
	Permissions                []string          `json:"permissions"`
	Uid                        int               `json:"uid"`
}

***************************** Account ***********************************

type SpotAsset

type SpotAsset struct {
	Asset    string `json:"asset"`
	Free     string `json:"free"`
	Locked   string `json:"locked"`
	Borrowed string `json:"borrowed"` // margin cross only
	Interest string `json:"interest"` // margin cross only
	NetAsset string `json:"netAsset"` // margin cross only
}

func (SpotAsset) ToStdAsset

func (a SpotAsset) ToStdAsset(getCurrCode func(string) string) *banexg.Asset

type SpotBase

type SpotBase struct {
	OrderBase
	IcebergQty              string `json:"icebergQty"`
	Time                    int64  `json:"time"`
	SelfTradePreventionMode string `json:"selfTradePreventionMode"`
	CummulativeQuoteQty     string `json:"cummulativeQuoteQty"`
	IsWorking               bool   `json:"isWorking"`
	OrigQty                 string `json:"origQty"`
	StopPrice               string `json:"stopPrice"`
	TransactTime            int64  `json:"transactTime"` // 交易时间戳
}

func (*SpotBase) ToStdOrder

func (o *SpotBase) ToStdOrder(mapSymbol func(string) string) *banexg.Order

type SpotFill

type SpotFill struct {
	Price           string `json:"price"`
	Qty             string `json:"qty"`
	Commission      string `json:"commission"`
	CommissionAsset string `json:"commissionAsset"`
	TradeId         int    `json:"tradeId"`
	AllocId         int    `json:"allocId"`   // sor
	MatchType       string `json:"matchType"` // sor
}

type SpotOrder

type SpotOrder struct {
	SpotBase
	OrderListId             int         `json:"orderListId"` // OCO订单ID,否则为 -1
	OrigQuoteOrderQty       string      `json:"origQuoteOrderQty"`
	WorkingTime             int64       `json:"workingTime"`
	Fills                   []*SpotFill `json:"fills"`
	WorkingFloor            string      `json:"workingFloor"`            // sor
	SelfTradePreventionMode string      `json:"selfTradePreventionMode"` // sor
	UsedSor                 bool        `json:"usedSor"`
}

SpotOrder 现货订单

func (*SpotOrder) ToStdOrder

func (o *SpotOrder) ToStdOrder(mapSymbol func(string) string) *banexg.Order

type SpotOrderBook

type SpotOrderBook struct {
	BaseOrderBook
	UpdateID int `json:"lastUpdateId"`
}

func (SpotOrderBook) ToStdOrderBook

func (o SpotOrderBook) ToStdOrderBook(market *banexg.Market) *banexg.OrderBook

type SpotPriceTicker

type SpotPriceTicker struct {
	Symbol string `json:"symbol"` // 交易对
	Price  string `json:"price"`  // 最新价格
}

type SpotTicker

type SpotTicker struct {
	Symbol             string `json:"symbol"`             // 交易对
	PriceChange        string `json:"priceChange"`        // 24小时价格变动
	PriceChangePercent string `json:"priceChangePercent"` // 24小时价格变动百分比
	WeightedAvgPrice   string `json:"weightedAvgPrice"`   // 加权平均价
	LastPrice          string `json:"lastPrice"`          // 最近一次成交价
	LastQty            string `json:"lastQty"`            // 最近一次成交额
	OpenPrice          string `json:"openPrice"`          // 24小时内第一次成交的价格
	HighPrice          string `json:"highPrice"`          // 24小时最高价
	LowPrice           string `json:"lowPrice"`           // 24小时最低价
	Volume             string `json:"volume"`             // 24小时成交量
	QuoteVolume        string `json:"quoteVolume"`        // 24小时成交额
	OpenTime           int64  `json:"openTime"`           // 24小时内,第一笔交易的发生时间
	CloseTime          int64  `json:"closeTime"`          // 24小时内,最后一笔交易的发生时间
	FirstId            int    `json:"firstId"`            // 首笔成交id
	LastId             int    `json:"lastId"`             // 末笔成交id
	Count              int    `json:"count"`              // 成交笔数
}

SpotTicker 现货: /ticker & /ticker/tradingDay

func (*SpotTicker) ToStdTicker

func (t *SpotTicker) ToStdTicker(e *Binance, marketType string) *banexg.Ticker

type SpotTicker24hr

type SpotTicker24hr struct {
	BookTicker
	LinearTicker
	PrevClosePrice string `json:"prevClosePrice"` // 前收盘价
}

func (*SpotTicker24hr) ToStdTicker

func (t *SpotTicker24hr) ToStdTicker(e *Binance, marketType string) *banexg.Ticker

type SymbolLvgBrackets added in v0.1.2

type SymbolLvgBrackets struct {
	Symbol       string  `json:"symbol"`
	NotionalCoef float64 `json:"notionalCoef"` //用户bracket相对默认bracket的倍数,仅在和交易对默认不一样时显示
	Brackets     []*LvgBracket
}

SymbolLvgBrackets 币种所有杠杆费率信息

type SymbolPrice added in v0.2.0

type SymbolPrice struct {
	Symbol string  `json:"symbol"`       // 交易对,比如 "LTCBTC"
	Price  float64 `json:"price,string"` // 交易价格,保留为字符串以防止精度损失
}

func (*SymbolPrice) ToStdPrice added in v0.2.0

func (t *SymbolPrice) ToStdPrice(e *Binance, marketType string) (string, float64)

type WSContractPosition

type WSContractPosition struct {
	Symbol         string `json:"s"`
	PosAmount      string `json:"pa"`
	EntryPrice     string `json:"ep"`
	BreakEvenPrice string `json:"bep"`
	AccuRealized   string `json:"cr"`
	UnrealizedPnl  string `json:"up"`
	MarginType     string `json:"mt"`
	IsolatedWallet string `json:"iw"`
	PositionSide   string `json:"ps"`
}

type WsKline

type WsKline struct {
	OpenTime   int64  `json:"t"`
	CloseTime  int64  `json:"T"`
	Symbol     string `json:"s"`
	PairSymbol string `json:"ps"`
	TimeFrame  string `json:"i"`
	Open       string `json:"o"`
	Close      string `json:"c"`
	High       string `json:"h"`
	Low        string `json:"l"`
	Volume     string `json:"v"`
	LastId     int64  `json:"L"`
}

Jump to

Keyboard shortcuts

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