Documentation ¶
Overview ¶
v5 (https://bybit-exchange.github.io/docs/v5/intro)
Enums Definitions (https://bybit-exchange.github.io/docs/v5/enum)
Index ¶
- func Get[T any](c *Client, path string, param any) (T, error)
- func GetPub[T any](c *Client, path string, param any) (T, error)
- func Post[T any](c *Client, path string, param any) (T, error)
- type AccountType
- type Category
- type Client
- func (o *Client) Get(path string, param any, ret any) error
- func (o *Client) GetAccountCoinsBalance(accountType AccountType) (CoinsBalance, error)
- func (o *Client) GetCoinsBalance(v GetCoinsBalance) (CoinsBalance, error)
- func (o *Client) GetDeliveryPrice(v GetDeliveryPrice) ([]DeliveryPrice, error)
- func (o *Client) GetFundingRateHistory(v GetFundingRateHistory) ([]FundingRateHistory, error)
- func (o *Client) GetHistoricalVolatility(v GetHistoricalVolatility) ([]HistoricalVolatility, error)
- func (o *Client) GetIndexPriceKline(v GetKline) ([]Kline, error)
- func (o *Client) GetInstruments(v GetInstruments) ([]Instrument, error)
- func (o *Client) GetInsurance(v GetInsurance) ([]Insurance, error)
- func (o *Client) GetKeyInfo() (KeyInfo, error)
- func (o *Client) GetKline(v GetKline) ([]KlineExt, error)
- func (o *Client) GetMarkPriceKline(v GetKline) ([]Kline, error)
- func (o *Client) GetOpenInterest(v GetOpenInterest) ([]OpenInterest, error)
- func (o *Client) GetOrderbook(v GetOrderbook) (Orderbook, error)
- func (o *Client) GetPremiumIndexPriceKline(v GetKline) ([]Kline, error)
- func (o *Client) GetPub(path string, param any, ret any) error
- func (o *Client) GetPublicTradingHistory(v GetPublicTradingHistory) ([]PublicTradingHistory, error)
- func (o *Client) GetRiskLimit(v GetRiskLimit) ([]RiskLimit, error)
- func (o *Client) GetTickers(v GetTickers) ([]Ticker, error)
- func (o *Client) Post(path string, param any, ret any) error
- func (o *Client) Transport() *transport.Client
- type CoinBalance
- type CoinsBalance
- type ContractType
- type DeliveryPrice
- type Error
- type FundingRateHistory
- type GetCoinsBalance
- type GetDeliveryPrice
- type GetFundingRateHistory
- type GetHistoricalVolatility
- type GetInstruments
- type GetInsurance
- type GetKeyInfo
- type GetKline
- type GetOpenInterest
- type GetOrderbook
- type GetPublicTradingHistory
- type GetRiskLimit
- type GetTickers
- type HistoricalVolatility
- type Instrument
- type Insurance
- type Interval
- type IntervalTime
- type KeyInfo
- type Kline
- type KlineExt
- type LeverageFilter
- type LotSizeFilter
- type OpenInterest
- type Orderbook
- type Period
- type Permissions
- type PositionIdx
- type PriceFilter
- type PublicTradingHistory
- type Response
- type RiskLimit
- type SmpType
- type Status
- type Ticker
- type TimeInForce
- type TriggerBy
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AccountType ¶
type AccountType string
accountType (https://bybit-exchange.github.io/docs/v5/enum#accounttype)
const ( AccountContract AccountType = "CONTRACT" AccountSpot AccountType = "SPOT" AccountInvestment AccountType = "INVESTMENT" AccountOption AccountType = "OPTION" AccountUnified AccountType = "UNIFIED" AccountFund AccountType = "FUND" )
type Category ¶
type Category string
category (https://bybit-exchange.github.io/docs/v5/enum#category)
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
v5 HTTP client
func (*Client) GetAccountCoinsBalance ¶
func (o *Client) GetAccountCoinsBalance(accountType AccountType) (CoinsBalance, error)
func (*Client) GetCoinsBalance ¶
func (o *Client) GetCoinsBalance(v GetCoinsBalance) (CoinsBalance, error)
func (*Client) GetDeliveryPrice ¶
func (o *Client) GetDeliveryPrice(v GetDeliveryPrice) ([]DeliveryPrice, error)
func (*Client) GetFundingRateHistory ¶
func (o *Client) GetFundingRateHistory(v GetFundingRateHistory) ([]FundingRateHistory, error)
func (*Client) GetHistoricalVolatility ¶
func (o *Client) GetHistoricalVolatility(v GetHistoricalVolatility) ([]HistoricalVolatility, error)
func (*Client) GetIndexPriceKline ¶
func (*Client) GetInstruments ¶
func (o *Client) GetInstruments(v GetInstruments) ([]Instrument, error)
func (*Client) GetInsurance ¶
func (o *Client) GetInsurance(v GetInsurance) ([]Insurance, error)
func (*Client) GetKeyInfo ¶
func (*Client) GetOpenInterest ¶
func (o *Client) GetOpenInterest(v GetOpenInterest) ([]OpenInterest, error)
func (*Client) GetOrderbook ¶
func (o *Client) GetOrderbook(v GetOrderbook) (Orderbook, error)
func (*Client) GetPremiumIndexPriceKline ¶
func (*Client) GetPublicTradingHistory ¶
func (o *Client) GetPublicTradingHistory(v GetPublicTradingHistory) ([]PublicTradingHistory, error)
func (*Client) GetRiskLimit ¶
func (o *Client) GetRiskLimit(v GetRiskLimit) ([]RiskLimit, error)
func (*Client) GetTickers ¶
func (o *Client) GetTickers(v GetTickers) ([]Ticker, error)
type CoinBalance ¶
type CoinsBalance ¶
type CoinsBalance struct { AccountType AccountType MemberId string Balances []CoinBalance }
(Get All Coins Balance) https://bybit-exchange.github.io/docs/v5/asset/all-balance
type ContractType ¶
type ContractType string
contractType (https://bybit-exchange.github.io/docs/v5/enum#contracttype)
const ( InversePerpetual ContractType = "InversePerpetual" LinearPerpetual ContractType = "LinearPerpetual" LinearFutures ContractType = "LinearFutures" InverseFutures ContractType = "InverseFutures" )
type DeliveryPrice ¶
type Error ¶
https://bybit-exchange.github.io/docs/v5/error
func (*Error) ApiKeyExpired ¶
func (*Error) ApiKeyInvalid ¶
func (*Error) InsufficientBalance ¶
func (*Error) TooManyVisits ¶
func (*Error) UnmatchedIp ¶
type FundingRateHistory ¶
type GetCoinsBalance ¶
type GetCoinsBalance struct { AccountType AccountType `param:"accountType"` MemberId *string `param:"memberId"` Coin *string `param:"coin"` WithBonus *bool `param:"withBonus"` }
func (GetCoinsBalance) Do ¶
func (o GetCoinsBalance) Do(client *Client) (CoinsBalance, error)
type GetDeliveryPrice ¶
type GetDeliveryPrice struct { Category Category `param:"category"` Symbol *string `param:"symbol"` BaseCoin *string `param:"baseCoin"` Limit *int `param:"limit"` Cursor *string `param:"cursor"` }
Get Delivery Price (https://bybit-exchange.github.io/docs/v5/market/delivery-price)
category Required string Product type. spot,linear,inverse symbol string Symbol name baseCoin string Base coin. Default: BTC. valid for option only limit integer Limit for data size per page. [1, 200]. Default: 50 cursor string Cursor. Used for pagination
func (GetDeliveryPrice) Do ¶
func (o GetDeliveryPrice) Do(c *Client) ([]DeliveryPrice, error)
type GetFundingRateHistory ¶
type GetFundingRateHistory struct { Category Category `param:"category"` Symbol string `param:"symbol"` StartTime *int `param:"startTime"` EndTime *int `param:"endTime"` Limit *int `param:"limit"` }
Get Funding Rate History (https://bybit-exchange.github.io/docs/v5/market/history-fund-rate)
category Required string Product type. linear,inverse symbol Required string Symbol name startTime integer The start timestamp (ms) endTime integer The end timestamp (ms) limit integer Limit for data size per page. [1, 200]. Default: 200
func (GetFundingRateHistory) Do ¶
func (o GetFundingRateHistory) Do(c *Client) ([]FundingRateHistory, error)
type GetHistoricalVolatility ¶
type GetHistoricalVolatility struct { Category Category `param:"category"` BaseCoin *string `param:"baseCoin"` Period *Period `param:"period"` StartTime *int `param:"startTime"` EndTime *int `param:"endTime"` }
Get Historical Volatility (https://bybit-exchange.github.io/docs/v5/market/iv)
category Required string Product type. option baseCoin string Base coin. Default: return BTC data period integer Period startTime integer The start timestamp (ms) endTime integer The end timestamp (ms)
func (GetHistoricalVolatility) Do ¶
func (o GetHistoricalVolatility) Do(c *Client) ([]HistoricalVolatility, error)
type GetInstruments ¶
type GetInstruments struct { Category Category `param:"category"` Symbol *string `param:"symbol"` Status *Status `param:"status"` BaseCoin *string `param:"baseCoin"` Limit *int `param:"limit"` Cursor *string `param:"cursor"` }
Get Instruments Info (https://bybit-exchange.github.io/docs/v5/market/instrument)
category Required string Product type. spot,linear,inverse symbol string Symbol name status string Symbol status filter, spot/linear/inverse has Trading only baseCoin string Base coin. linear,inverse,option only limit integer Limit for data size per page. [1, 1000]. Default: 500 cursor string Cursor. Used for pagination
func (GetInstruments) Do ¶
func (o GetInstruments) Do(c *Client) ([]Instrument, error)
type GetInsurance ¶
type GetInsurance struct {
Coin *string `param:"coin"`
}
Get Insurance (https://bybit-exchange.github.io/docs/v5/market/insurance)
coin string coin. Default: return all insurance coins
type GetKeyInfo ¶
type GetKeyInfo struct { }
type GetKline ¶
type GetKline struct { Category Category `param:"category"` Symbol string `param:"symbol"` Interval Interval `param:"interval"` Start *int `param:"start"` End *int `param:"end"` Limit *int `param:"limit"` }
Get Kline (https://bybit-exchange.github.io/docs/v5/market/kline)
category Required string Product type. spot,linear,inverse symbol Required string Symbol name interval Required string Kline interval. 1,3,5,15,30,60,120,240,360,720,D,M,W start integer The start timestamp (ms) end integer The end timestamp (ms) limit integer Limit for data size per page. [1, 200]. Default: 200
func (GetKline) DoIndexPrice ¶
Get Index Price Kline (https://bybit-exchange.github.io/docs/v5/market/index-kline)
func (GetKline) DoMarkPrice ¶
Get Mark Price Kline (https://bybit-exchange.github.io/docs/v5/market/mark-kline)
func (GetKline) DoPremiumIndexPrice ¶
Get Premium Index Price Kline (https://bybit-exchange.github.io/docs/v5/market/preimum-index-kline)
type GetOpenInterest ¶
type GetOpenInterest struct { Category Category `param:"category"` Symbol string `param:"symbol"` IntervalTime IntervalTime `param:"intervalTime"` StartTime *int `param:"startTime"` EndTime *int `param:"endTime"` Limit *int `param:"limit"` Cursor *string `param:"cursor"` }
Get Open Interest (https://bybit-exchange.github.io/docs/v5/market/open-interest)
category Required string Product type. linear,inverse symbol Required string Symbol name intervalTime Required string Interval. 5min,15min,30min,1h,4h,1d startTime integer The start timestamp (ms) endTime integer The end timestamp (ms) limit integer Limit for data size per page. [1, 200]. Default: 50 cursor string Cursor. Used for pagination
func (GetOpenInterest) Do ¶
func (o GetOpenInterest) Do(c *Client) ([]OpenInterest, error)
type GetOrderbook ¶
type GetOrderbook struct { Category Category `param:"category"` Symbol string `param:"symbol"` Limit *int `param:"limit"` }
Get Orderbook (https://bybit-exchange.github.io/docs/v5/market/orderbook)
category Required string Product type. spot,linear,inverse,option symbol Required string Symbol name limit integer Limit size for each bid and ask
spot: [1, 50]. Default: 1. linear&inverse: [1, 200]. Default: 25. option: [1, 25]. Default: 1.
type GetPublicTradingHistory ¶
type GetPublicTradingHistory struct { Category Category `param:"category"` Symbol *string `param:"symbol"` BaseCoin *string `param:"baseCoin"` OptionType *string `param:"optionType"` Limit *int `param:"limit"` }
Get Public Trading History (https://bybit-exchange.github.io/docs/v5/market/recent-trade)
category Required string Product type. spot,linear,inverse,option symbol string Symbol name baseCoin string Base coin. For option only. If not passed, return BTC data by default optionType string Option type. Call or Put. For option only limit integer
func (GetPublicTradingHistory) Do ¶
func (o GetPublicTradingHistory) Do(c *Client) ([]PublicTradingHistory, error)
type GetRiskLimit ¶
Get Risk Limit (https://bybit-exchange.github.io/docs/v5/market/risk-limit)
category Required string Product type. linear,inverse symbol string Symbol name
type GetTickers ¶
type GetTickers struct { Category Category `param:"category"` Symbol *string `param:"symbol"` BaseCoin *string `param:"baseCoin"` ExpDate *string `param:"expDate"` }
Get Tickers (https://bybit-exchange.github.io/docs/v5/market/tickers)
category Required string Product type. spot,linear,inverse,option symbol string Symbol name baseCoin string Base coin. For option only expDate string Expiry date. e.g., 25DEC22. For option only
type HistoricalVolatility ¶
type Instrument ¶
type Instrument struct { Symbol string ContractType ContractType Status Status BaseCoin string QuoteCoin string LaunchTime string DeliveryTime string DeliveryFeeRate string PriceScale string LeverageFilter LeverageFilter PriceFilter PriceFilter UnifiedMarginTrade bool FundingInterval int SettleCoin string }
type Interval ¶
type Interval string
interval (https://bybit-exchange.github.io/docs/v5/enum#interval)
1 - 1 minute 3 - 3 minutes 5 - 5 minutes 15 - 15 minutes 30 - 30 minutes 60 - 1 hour 120 - 2 hours 240 - 4 hours 360 - 6 hours 720 - 12 hours D - 1 day W - 1 week M - 1 month
const ( Interval1m Interval = "1" Interval3m Interval = "3" Interval5m Interval = "5" Interval15m Interval = "15" Interval30m Interval = "30" Interval1h Interval = "60" Interval2h Interval = "120" Interval4h Interval = "240" Interval6h Interval = "360" Interval12h Interval = "720" Interval1d Interval = "D" Interval1w Interval = "W" Interval1M Interval = "M" )
type IntervalTime ¶
type IntervalTime string
const ( IntervalTime5min IntervalTime = "5min" IntervalTime15min IntervalTime = "15min" IntervalTime30min IntervalTime = "30min" IntervalTime1h IntervalTime = "1h" IntervalTime4h IntervalTime = "4h" IntervalTime1d IntervalTime = "1d" )
type KeyInfo ¶
type KeyInfo struct { Id transport.Float64 Note string ApiKey string ReadOnly int Secret string Permissions Permissions Ips []string Type int DeadlineDay int CreatedAt time.Time ExpiredAt time.Time Unified int Uta int UserID int InviterID int VipLevel string MktMakerLevel string AffiliateID int RsaPublicKey string }
type Kline ¶
type Kline struct { StartTime string OpenPrice string HighPrice string LowPrice string ClosePrice string }
func UnmarshalKline ¶
type KlineExt ¶
func UnmarshalKlineExt ¶
type LeverageFilter ¶
type LotSizeFilter ¶
type OpenInterest ¶
type Permissions ¶
type PositionIdx ¶
type PositionIdx int
positionIdx (https://bybit-exchange.github.io/docs/v5/enum#positionidx)
const ( OneWayMode PositionIdx = 0 BuySideOfHedgeMode PositionIdx = 1 SellSideOfHedgeMode PositionIdx = 2 )
type PriceFilter ¶
type PublicTradingHistory ¶
type Ticker ¶
type Ticker struct { Symol string LastPrice string IndexPrice string MarkPrice string PrevPrice24h string Price24hPcnt string HighPrice24h string LowPrice24h string PrevPrice1h string OpenInterest string OpenInterestValue string Turnover24h string Volume24h string FundingRate string NextFundingTime string PredictedDeliveryPrice string BasisRate string DeliveryFeeRate string DeliveryTime string Ask1Size string Bid1Price string Ask1Price string Bid1Size string Basis string }
type TimeInForce ¶
type TimeInForce string
timeInForce (https://bybit-exchange.github.io/docs/v5/enum#timeinforce)
const ( GoodTillCancel TimeInForce = "GTC" ImmediateOrCancel TimeInForce = "IOC" FillOrKill TimeInForce = "FOK" )