Versions in this module Expand all Collapse all v1 v1.0.1 May 8, 2023 v1.0.0 Jan 20, 2023 Changes in this version + type AccountRatio struct + BuyRatio sjson.Number + SellRatio sjson.Number + Symbol string + Timestamp sjson.Number + 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 + ExtInfo string + RateLimit int + RateLimitResetMs int64 + 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) (query string, resp []byte, result []Order, err error) + func (b *ByBit) CancelAllStopOrders(symbol string) (query string, resp []byte, result []StopOrder, err error) + func (b *ByBit) CancelOrder(orderID string, symbol string) (query string, resp []byte, result Order, err error) + func (b *ByBit) CancelStopOrder(orderID string, symbol string) (query string, resp []byte, result StopOrder, err error) + func (b *ByBit) CreateOrder(side string, orderType string, price float64, qty int, timeInForce string, ...) (query string, resp []byte, result Order, err error) + func (b *ByBit) CreateStopOrder(side string, orderType string, price float64, basePrice float64, ...) (query string, resp []byte, result StopOrder, err error) + func (b *ByBit) GetAccountRatio(symbol string, period string, limit int) (query string, resp []byte, result []AccountRatio, err error) + func (b *ByBit) GetActiveOrders(symbol string) (query string, resp []byte, result OrderArrayResponse, err error) + func (b *ByBit) GetActiveStopOrders(symbol string) (query string, resp []byte, result StopOrderArrayResponse, err error) + func (b *ByBit) GetFunding(symbol string, page int, limit int) (query string, resp []byte, result []FundingData, e error) + func (b *ByBit) GetKLine(symbol string, interval string, from int64, limit int) (query string, resp []byte, result []OHLC, err error) + func (b *ByBit) GetOpenInterest(symbol string, period string, limit int) (query string, resp []byte, result []OpenInterest, err error) + func (b *ByBit) GetOrderBook(symbol string) (query string, resp []byte, result OrderBook, err error) + func (b *ByBit) GetOrders(symbol string, orderStatus string, direction string, limit int, cursor string) (query string, resp []byte, result OrderListResponseResult, err error) + func (b *ByBit) GetPosition(symbol string) (query string, resp []byte, result Position, err error) + func (b *ByBit) GetPositions() (query string, resp []byte, result []PositionData, err error) + func (b *ByBit) GetPremiumIndex(symbol string, resolution string, from int64, to int64) (query string, resp []byte, result []IndexOHLC, e error) + func (b *ByBit) GetPriceIndex(symbol string, resolution string, from int64, to int64) (query string, resp []byte, result []IndexOHLC, e error) + func (b *ByBit) GetServerTime() (query string, resp []byte, timeNow int64, err error) + func (b *ByBit) GetStopOrders(symbol string, stopOrderStatus string, direction string, limit int, ...) (query string, resp []byte, result StopOrderListResponseResult, err error) + func (b *ByBit) GetSymbols() (query string, resp []byte, result []SymbolInfo, err error) + func (b *ByBit) GetTickers() (query string, resp []byte, result []Ticker, err error) + func (b *ByBit) GetTradingRecords(symbol string, from int64, limit int) (query string, resp []byte, result []TradingRecord, err error) + func (b *ByBit) GetWalletBalance(coin string) (query string, resp []byte, result Balance, err error) + func (b *ByBit) LinearCancelAllOrder(symbol string) (query string, resp []byte, result []string, err error) + func (b *ByBit) LinearCancelAllStopOrders(symbol string) (query string, resp []byte, result []string, err error) + func (b *ByBit) LinearCancelOrder(orderID string, orderLinkId string, symbol string) (query string, resp []byte, result Order, err error) + func (b *ByBit) LinearCancelStopOrder(orderID string, symbol string) (query string, resp []byte, result StopOrder, err error) + func (b *ByBit) LinearCreateOrder(side string, orderType string, price float64, qty float64, timeInForce string, ...) (query string, resp []byte, result Order, err error) + func (b *ByBit) LinearCreateStopOrder(side string, orderType string, price float64, basePrice float64, ...) (query string, resp []byte, result StopOrder, err error) + func (b *ByBit) LinearGetActiveOrder(symbol string, orderId string, orderLinkId string) (query string, resp []byte, result OrderResponse, err error) + func (b *ByBit) LinearGetActiveOrders(symbol string) (query string, resp []byte, result OrderArrayResponse, err error) + func (b *ByBit) LinearGetActiveStopOrders(symbol string) (query string, resp []byte, result StopOrderArrayResponse, err error) + func (b *ByBit) LinearGetFunding(symbol string, page int, limit int) (query string, resp []byte, result []FundingData, e error) + func (b *ByBit) LinearGetKLine(symbol string, interval string, from int64, limit int) (query string, resp []byte, result []OHLCLinear, err error) + func (b *ByBit) LinearGetOrders(symbol string, orderStatus string, limit int, page int) (query string, resp []byte, result OrderListResponseResultPaginated, err error) + func (b *ByBit) LinearGetPosition(symbol string) (query string, resp []byte, result []LinearPosition, err error) + func (b *ByBit) LinearGetPositions() (query string, resp []byte, result []LinearPositionData, err error) + func (b *ByBit) LinearGetPremiumIndex(symbol string, resolution string, from int64, to int64) (query string, resp []byte, result []IndexOHLC, e error) + func (b *ByBit) LinearGetPriceIndex(symbol string, resolution string, from int64, to int64) (query string, resp []byte, result []IndexOHLC, e error) + func (b *ByBit) LinearGetStopOrders(symbol string, stopOrderStatus string, limit int, page int) (query string, resp []byte, result StopOrderListResponseResult, err error) + func (b *ByBit) LinearReplaceOrder(symbol string, orderID string, orderLinkId string, qty float64, price float64, ...) (query string, resp []byte, orderId string, err error) + func (b *ByBit) LinearReplaceStopOrder(symbol string, orderID string, qty float64, price float64, ...) (query string, resp []byte, result StopOrder, err error) + func (b *ByBit) PublicRequest(method string, apiURL string, params map[string]interface{}, ...) (fullURL string, resp []byte, err error) + func (b *ByBit) ReplaceOrder(symbol string, orderID string, qty int, price float64) (query string, resp []byte, result Order, err error) + func (b *ByBit) ReplaceStopOrder(symbol string, orderID string, qty int, price float64, triggerPrice float64) (query string, resp []byte, result StopOrder, err error) + func (b *ByBit) SetCorrectServerTime() (err error) + func (b *ByBit) SetLeverage(leverage int, symbol string) (query string, resp []byte, err error) + func (b *ByBit) SignedRequest(method string, apiURL string, params map[string]interface{}, ...) (fullURL string, resp []byte, err error) + func (b *ByBit) WalletRecords(symbol string, page int, limit int) (query string, resp []byte, result []WalletFundRecord, err error) + type Funding struct + CurrentPage int + Data []FundingData + FirstPageUrl string + From int + LastPage int + LastPageUrl string + NextPageUrl string + Path string + PerPage sjson.Number + PrevPageUrl string + To int + Total int + type FundingData struct + Id int + Symbol string + Time string + Value sjson.Number + type FundingResult struct + Result Funding + type GetAccountRatioResult struct + Result []AccountRatio + 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 + Result []OHLC + type GetLinearKlineResult struct + Result []OHLCLinear + type GetOpenInterestResult struct + Result []OpenInterest + type GetOrderBookResult struct + Result []RawItem + 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 IndexOHLC struct + Close sjson.Number + High sjson.Number + Id int + Low sjson.Number + Open sjson.Number + Period string + StartAt int + Symbol string + type IndexOHLCResult struct + Result []IndexOHLC + type Item struct + Price float64 + Size float64 + type LeverageFilter struct + LeverageStep float64 + MaxLeverage int + MinLeverage int + type LinearPosition struct + AutoAddMargin float64 + BustPrice float64 + CumRealisedPnl float64 + DeleverageIndicator float64 + EntryPrice float64 + FreeQty float64 + IsIsolated bool + Leverage float64 + LiqPrice float64 + Mode string + OccClosingFee float64 + PositionIdx int + PositionMargin float64 + PositionValue float64 + RealisedPnl float64 + RiskID int + Side string + Size float64 + StopLoss float64 + Symbol string + TakeProfit float64 + TpSlMode string + TrailingStop float64 + UnrealisedPnl float64 + UserID int + type LinearPositionArrayResponse struct + Result []LinearPosition + type LinearPositionData struct + Data LinearPosition + IsValid bool + type LinearPositionDataArrayResponse struct + Result []LinearPositionData + 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 OHLCLinear struct + Close float64 + High float64 + Low float64 + Open float64 + OpenTime int64 + Period string + Symbol string + Turnover float64 + Volume float64 + type OpenInterest struct + OpenInterest sjson.Number + Symbol string + Timestamp sjson.Number + type Order struct + CreatedAt time.Time + CumExecFee sjson.Number + CumExecQty sjson.Number + CumExecValue sjson.Number + LastExecPrice sjson.Number + LastExecTime sjson.Number + LeavesQty sjson.Number + OrderId string + OrderLinkID string + OrderStatus string + OrderType string + Price sjson.Number + Qty sjson.Number + RejectReason string + Side string + Symbol string + TimeInForce string + UpdatedAt time.Time + UserId int + type OrderArrayResponse struct + Result []Order + type OrderBook struct + Asks []Item + Bids []Item + Time time.Time + type OrderListResponse struct + Result OrderListResponseResult + type OrderListResponseArray struct + Data []WalletFundRecord + type OrderListResponsePaginated struct + Result OrderListResponseResultPaginated + type OrderListResponseResult struct + Cursor string + Data []Order + type OrderListResponseResultPaginated struct + CurrentPage sjson.Number + Data []Order + LastPage sjson.Number + type OrderResponse struct + Result Order + type Position struct + AutoAddMargin float64 + BustPrice float64 + CreatedAt time.Time + CrossSeq float64 + CumCommission float64 + CumRealisedPnl float64 + DeleverageIndicator float64 + EntryPrice float64 + 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 PositionArrayResponse struct + Result []PositionData + type PositionData struct + Data Position + IsValid bool + type PositionResponse struct + Result Position + type PriceFilter struct + MaxPrice float64 + MinPrice float64 + TickSize float64 + type RawItem struct + Price float64 + Side string + Size float64 + Symbol string + type ResultStringArrayResponse struct + Result []string + type StopOrder struct + BasePrice sjson.Number + CancelType string + CreateType string + CreatedAt time.Time + CrossSeq sjson.Number + CrossStatus string + ExpectedDirection string + LeavesQty sjson.Number + LeavesValue string + OrderId string + OrderStatus string + OrderType string + Price sjson.Number + Qty sjson.Number + Side string + StopOrderId string + StopOrderStatus string + StopOrderType string + StopPx sjson.Number + Symbol string + TimeInForce string + TriggerBy string + UpdatedAt time.Time + UserId int64 + type StopOrderArrayResponse struct + Result []StopOrder + type StopOrderListResponse struct + Result StopOrderListResponseResult + type StopOrderListResponsePaginated struct + Result StopOrderListResponseResultPaginated + type StopOrderListResponseResult struct + Cursor string + Data []StopOrder + type StopOrderListResponseResultPaginated struct + CurrentPage string + Data []StopOrder + LastPage string + type StopOrderResponse struct + Result StopOrder + 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 sjson.Number + BidPrice sjson.Number + CountdownHour int + FundingRate float64 + HighPrice24H float64 + IndexPrice float64 + LastPrice float64 + LastTickDirection string + LowPrice24H float64 + MarkPrice float64 + NextFundingTime string + OpenInterest float64 + OpenValue float64 + PredictedFundingRate float64 + PrevPrice1H float64 + PrevPrice24H float64 + Price1HPcnt float64 + Price24HPcnt float64 + Symbol string + TotalTurnover float64 + TotalVolume float64 + Turnover24H float64 + Volume24H float64 + type TradingRecord struct + ID int + Price float64 + Qty int + Side string + Symbol string + Time time.Time + type WalletFundRecord struct + Address string + Amount sjson.Number + Coin string + CrossSeq sjson.Number + ExecTime sjson.Number + Id int + TxId string + Type string + UserId int + WalletBalance sjson.Number + WalletId int + type WalletFundRecordResponse struct + Result OrderListResponseArray