Versions in this module Expand all Collapse all v1 v1.0.31 Jan 3, 2022 Changes in this version + type Balance struct + AvailableBalance float64 + CumRealisedPnl float64 + Equity float64 + GivenCash float64 + OccClosingFee float64 + OccFundingFee float64 + OrderMargin float64 + PositionMargin float64 + RealisedPnl float64 + ServiceCash float64 + UnrealisedPnl float64 + UsedMargin float64 + WalletBalance float64 + type BaseResult struct + ExtCode string + RateLimitStatus int + Result interface{} + RetCode int + RetMsg string + TimeNow string + type ByBit struct + func New(httpClient *http.Client, baseURL string, apiKey string, secretKey string, ...) *ByBit + func (b *ByBit) CancelAllOrder(symbol string) (result []OrderV2, err error) + func (b *ByBit) CancelAllStopOrders(symbol string) (result []StopOrderV2, err error) + func (b *ByBit) CancelOrder(orderID string, symbol string) (result Order, err error) + func (b *ByBit) CancelOrderV2(orderID string, orderLinkID string, symbol string) (result OrderV2, err error) + func (b *ByBit) CancelStopOrder(orderID string, symbol string) (result Order, err error) + func (b *ByBit) CreateOrder(side string, orderType string, price float64, qty int, timeInForce string, ...) (result Order, err error) + func (b *ByBit) CreateOrderV2(side string, orderType string, price float64, qty int, timeInForce string, ...) (result OrderV2, err error) + func (b *ByBit) CreateStopOrder(side string, orderType string, price float64, basePrice float64, ...) (result Order, err error) + func (b *ByBit) GetKLine(symbol string, interval string, from int64, limit int) (result []OHLC, err error) + func (b *ByBit) GetKLine2(symbol string, interval string, from int64, limit int) (result []OHLC2, err error) + func (b *ByBit) GetLeverages() (result map[string]LeverageItem, err error) + func (b *ByBit) GetOrderBook(symbol string) (result OrderBook, err error) + func (b *ByBit) GetOrderByID(orderID string, orderLinkID string, symbol string) (result OrderV2, err error) + func (b *ByBit) GetOrderByOrderLinkID(orderLinkID string, symbol string) (result Order, err error) + func (b *ByBit) GetOrders(sort string, order string, page int, limit int, orderStatus string, ...) (result []Order, err error) + func (b *ByBit) GetPosition(symbol string) (result Position, err error) + func (b *ByBit) GetPositions() (result []Position, err error) + func (b *ByBit) GetServerTime() (timeNow int64, err error) + func (b *ByBit) GetStopOrders(orderID string, orderLinkID string, stopOrderStatus string, order string, ...) (result GetStopOrdersResult, err error) + func (b *ByBit) GetSymbols() (result []SymbolInfo, err error) + func (b *ByBit) GetTickers() (result []Ticker, err error) + func (b *ByBit) GetTradingRecords(symbol string, from int64, limit int) (result []TradingRecord, err error) + func (b *ByBit) GetWalletBalance(coin string) (result Balance, err error) + func (b *ByBit) PublicRequest(method string, apiURL string, params map[string]interface{}, ...) (resp []byte, err error) + func (b *ByBit) ReplaceOrder(symbol string, orderID string, qty int, price float64) (result Order, err error) + func (b *ByBit) SetCorrectServerTime() (err error) + func (b *ByBit) SetLeverage(leverage int, symbol string) (err error) + func (b *ByBit) SignedRequest(method string, apiURL string, params map[string]interface{}, ...) (resp []byte, err error) + type CancelAllOrderV2Result struct + ExtCode string + ExtInfo string + RateLimit int + RateLimitResetMs int64 + RateLimitStatus int + Result []OrderV2 + RetCode int + RetMsg string + TimeNow string + type CancelOrderResult struct + ExtCode string + RateLimitStatus int + Result Order + RetCode int + RetMsg string + TimeNow string + type CancelOrderV2Result struct + ExtCode string + ExtInfo string + RateLimit int + RateLimitResetMs int64 + RateLimitStatus int + Result OrderV2 + RetCode int + RetMsg string + TimeNow string + type CancelStopOrdersV2Result struct + ExtCode string + ExtInfo string + RateLimit int + RateLimitResetMs int64 + RateLimitStatus int + Result []StopOrderV2 + RetCode int + RetMsg string + TimeNow string + type CreateOrderResult struct + ExtCode string + RateLimitStatus int + Result Order + RetCode int + RetMsg string + TimeNow string + type CreateOrderV2Result struct + ExtCode string + ExtInfo string + RateLimit int + RateLimitResetMs int64 + RateLimitStatus int + Result OrderV2 + RetCode int + RetMsg string + TimeNow string + type ExtFields struct + CrossStatus string + OReqNum int64 + OpFrom string + ReduceOnly bool + Remark string + XreqType string + func (e *ExtFields) MarshalJSON() ([]byte, error) + func (e *ExtFields) UnmarshalJSON(b []byte) error + type GetBalanceResult struct + ExtCode string + ExtInfo string + RateLimit int + RateLimitResetMs int64 + RateLimitStatus int + Result GetBalanceResultData + RetCode int + RetMsg string + TimeNow string + type GetBalanceResultData struct + BTC Balance + EOS Balance + ETH Balance + USDT Balance + XRP Balance + type GetKlineResult struct + ExtCode string + ExtInfo string + Result []OHLC + RetCode int + RetMsg string + TimeNow string + type GetKlineResult2 struct + ExtCode string + ExtInfo string + Result []OHLC2 + RetCode int + RetMsg string + TimeNow string + type GetLeverageResult struct + ExtCode string + RateLimitStatus int + Result map[string]LeverageItem + RetCode int + RetMsg string + TimeNow string + type GetOrderBookResult struct + ExtCode string + ExtInfo string + Result []RawItem + RetCode int + RetMsg string + TimeNow string + type GetPositionResult struct + ExtInfo interface{} + Result Position + type GetStopOrdersResult struct + ExtCode string + ExtInfo interface{} + RateLimit int + RateLimitResetMs int64 + RateLimitStatus int + Result GetStopOrdersResultData + RetCode int + RetMsg string + TimeNow string + type GetStopOrdersResultData struct + CurrentPage int + Data []StopOrder + LastPage int + type GetSymbolsResult struct + ExtCode string + ExtInfo string + Result []SymbolInfo + RetCode int + RetMsg string + TimeNow string + type GetTickersResult struct + ExtCode string + ExtInfo string + Result []Ticker + RetCode int + RetMsg string + TimeNow string + type GetTradingRecordsResult struct + ExtCode string + ExtInfo string + Result []TradingRecord + RetCode int + RetMsg string + TimeNow string + type InExtFields struct + CrossStatus string + OReqNum int64 + OpFrom string + ReduceOnly bool + Remark string + XreqType string + type Item struct + Price float64 + Size float64 + type LeverageFilter struct + LeverageStep float64 + MaxLeverage int + MinLeverage int + type LeverageItem struct + Leverage int + type LotSizeFilter struct + MaxTradingQty int + MinTradingQty int + QtyStep int + type OHLC struct + Close float64 + High float64 + Interval string + Low float64 + Open float64 + OpenTime int64 + Symbol string + Turnover float64 + Volume float64 + type OHLC2 struct + Close float64 + High float64 + ID int64 + Interval string + Low float64 + Open float64 + OpenTime int64 + Period string + StartAt int64 + Symbol string + Turnover float64 + Volume float64 + type Order struct + CreatedAt time.Time + CumExecFee float64 + CumExecQty float64 + CumExecValue float64 + ExtFields *ExtFields + LastExecPrice float64 + LastExecTime string + LeavesQty float64 + OrderID string + OrderLinkID string + OrderStatus string + OrderType string + Price float64 + Qty float64 + RejectReason string + Side string + StopOrderID string + Symbol string + TimeInForce string + UpdatedAt time.Time + UserID int + type OrderBook struct + Asks []Item + Bids []Item + Time time.Time + type OrderListResult struct + ExtCode string + RateLimitStatus int + Result OrderListResultData + RetCode int + RetMsg string + TimeNow string + type OrderListResultData struct + CurrentPage int + Data []Order + LastPage int + type OrderLite struct + OrderID string + type OrderV2 struct + CreatedAt time.Time + CumExecFee sjson.Number + CumExecQty float64 + CumExecValue sjson.Number + LastExecPrice sjson.Number + LastExecTime sjson.Number + LeavesQty float64 + OrderID string + OrderLinkID string + OrderStatus string + OrderType string + Price sjson.Number + Qty float64 + RejectReason string + Side string + Symbol string + TimeInForce string + UpdatedAt time.Time + UserID int + type Position struct + AutoAddMargin float64 + BustPrice float64 + CreatedAt time.Time + CrossSeq float64 + CumCommission float64 + CumRealisedPnl float64 + DeleverageIndicator float64 + EntryPrice float64 + ExtFields *PositionExtFields + ID int + Leverage float64 + LiqPrice float64 + OcCalcData string + OccClosingFee float64 + OccFundingFee float64 + OrderMargin float64 + PositionMargin float64 + PositionSeq float64 + PositionStatus string + PositionValue float64 + RealisedPnl float64 + RiskID int + Side string + Size float64 + StopLoss float64 + Symbol string + TakeProfit float64 + TrailingStop float64 + UnrealisedPnl float64 + UpdatedAt time.Time + UserID int + WalletBalance float64 + type PositionExtFields struct + Remark string + type PositionListResult struct + ExtInfo interface{} + Result []PositionV1 + type PositionV1 struct + AutoAddMargin float64 + BustPrice float64 + CreatedAt time.Time + CrossSeq float64 + CumCommission float64 + CumRealisedPnl float64 + DeleverageIndicator float64 + EntryPrice float64 + ExtFields *PositionExtFields + ID int + Leverage float64 + LiqPrice float64 + OcCalcData string + OccClosingFee float64 + OccFundingFee float64 + OrderMargin float64 + PositionMargin float64 + PositionSeq float64 + PositionStatus string + PositionValue float64 + RealisedPnl float64 + RiskID int + Side string + Size float64 + StopLoss float64 + Symbol string + TakeProfit float64 + TrailingStop float64 + UnrealisedPnl float64 + UpdatedAt time.Time + UserID int + WalletBalance float64 + type PriceFilter struct + MaxPrice float64 + MinPrice float64 + TickSize float64 + type QueryOrderResult struct + ExtCode string + ExtInfo string + RateLimit int + RateLimitResetMs int64 + RateLimitStatus int + Result OrderV2 + RetCode int + RetMsg string + TimeNow string + type RawItem struct + Price float64 + Side string + Size float64 + Symbol string + type ReplaceOrderResult struct + ExtCode string + RateLimitStatus int + Result OrderLite + RetCode int + RetMsg string + TimeNow string + type StopOrder struct + BasePrice float64 + CreatedAt time.Time + OrderLinkID string + OrderType string + Price float64 + Qty float64 + Side string + StopOrderID string + StopOrderStatus string + StopOrderType string + StopPx float64 + Symbol string + TimeInForce string + TriggerBy string + UpdatedAt time.Time + UserID int64 + type StopOrderV2 struct + BasePrice sjson.Number + CancelType string + ClOrdID string + CreateType string + CreatedAt time.Time + CrossSeq float64 + CrossStatus string + ExpectedDirection string + LeavesQty float64 + LeavesValue string + OrderStatus string + OrderType string + Price sjson.Number + Qty float64 + Side string + StopOrderType string + Symbol string + TimeInForce string + TriggerBy string + UpdatedAt time.Time + UserID int64 + type SymbolInfo struct + BaseCurrency string + LeverageFilter LeverageFilter + LotSizeFilter LotSizeFilter + MakerFee float64 + Name string + PriceFilter PriceFilter + PriceScale int + QuoteCurrency string + TakerFee float64 + type Ticker struct + AskPrice float64 + BidPrice float64 + CountdownHour int + FundingRate float64 + HighPrice24H float64 + IndexPrice float64 + LastPrice float64 + LastTickDirection string + LowPrice24H float64 + MarkPrice float64 + NextFundingTime time.Time + OpenInterest int + OpenValue float64 + PredictedFundingRate float64 + PrevPrice1H float64 + PrevPrice24H float64 + Price1HPcnt float64 + Price24HPcnt float64 + Symbol string + TotalTurnover float64 + TotalVolume int64 + Turnover24H float64 + Volume24H int64 + type TradingRecord struct + ID int + Price float64 + Qty int + Side string + Symbol string + Time time.Time