Documentation ¶
Overview ¶
Account Data Endpoints (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-accountdata)
Active Orders (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-activeorders)
API Key Info (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-key)
Conditional Orders (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-conditionalorders)
Position (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-position)
Risk Limit (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-risklimit)
API Data Endpoints (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-api)
Inverse Perpetual (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-introduction)
Enums Definitions (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-enums)
Market Data Endpoints (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-marketdata)
Advanced Data (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-advanceddata)
WebSocket Data (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-websocket)
Index ¶
- func Get[T any](c *Client, path string, param any) (T, error)
- func GetPublic[T any](c *Client, path string, param any) (T, error)
- func Post[T any](c *Client, path string, param any) (T, error)
- func WsDeltaApply[T any](v *T, delta Delta)
- func WsDeltaSetValue[T any](s *T, name string, v any)
- func WsDeltaUpdate[T any](s *T, delta Delta)
- func WsFunc[T any, F func(T)](m []byte, f F) error
- func WsFuncDelta[T any, F func(T), TD any, FD func(TD)](m []byte, f F, delta bool, fd FD) error
- type Announcement
- type Balance
- type CancelAllOrders
- type CancelOrder
- type CancelOrderItem
- type CancelType
- type ChangeMargin
- type Client
- func (o *Client) Announcement() ([]Announcement, error)
- func (o *Client) CancelAllConditionalOrders(symbol string) ([]ConditionalCancelOrderItem, error)
- func (o *Client) CancelAllOrders(symbol string) ([]CancelOrderItem, error)
- func (o *Client) CancelConditionalOrder(v CancelOrder) (string, error)
- func (o *Client) CancelOrder(v CancelOrder) (OrderCancelled, error)
- func (o *Client) ChangeMargin(v ChangeMargin) (float64, error)
- func (o *Client) ClosedProfitLoss(v ClosedProfitLoss) (ClosedProfitLossResult, error)
- func (o *Client) ConditionalOrderList(v OrderList) (ConditionalOrderListResult, error)
- func (o *Client) Get(path string, param any, ret any) error
- func (o *Client) GetAllPositions() ([]PositionItem, error)
- func (o *Client) GetKeyInfo() ([]KeyInfo, error)
- func (o *Client) GetOnePosition(symbol string) (i PositionItem, err error)
- func (o *Client) GetPosition(symbol *string) ([]PositionItem, error)
- func (o *Client) GetPublic(path string, param any, ret any) error
- func (o *Client) GetRiskLimit(symbol *string) ([]RiskLimitItem, error)
- func (o *Client) GetTradeRecords(v GetTradeRecords) (TradeRecords, error)
- func (this *Client) LatestBigDeal(v LatestBigDeal) ([]LatestBigDealItem, error)
- func (this *Client) LongShortRatio(v LongShortRatio) ([]LongShortRatioItem, error)
- func (o *Client) MarginSwitch(v MarginSwitch) error
- func (o *Client) OneSymbolLatestInformation(symbol string) (i LatestInformation, err error)
- func (this *Client) OpenInterest(v OpenInterest) ([]InterestItem, error)
- func (o *Client) OrderBook(symbol string) ([]OrderBookItem, error)
- func (o *Client) OrderList(v OrderList) (OrderListResult, error)
- func (o *Client) PlaceActiveOrder(v PlaceActiveOrder) (OrderCreated, error)
- func (o *Client) PlaceConditionalOrder(v PlaceConditionalOrder) (ConditionalOrderCreated, error)
- func (o *Client) Post(path string, param any, ret any) error
- func (o *Client) PublicTradingRecords(v PublicTradingRecords) ([]PublicTradingRecord, error)
- func (o *Client) QueryConditionalOrder(v QueryOrder) ([]ConditionalOrder, error)
- func (o *Client) QueryIndexKline(v QueryKline) ([]IndexKlineItem, error)
- func (o *Client) QueryKline(v QueryKline) ([]KlineItem, error)
- func (o *Client) QueryMarkKline(v QueryKline) ([]MarkKlineItem, error)
- func (o *Client) QueryOrder(v QueryOrder) ([]Order, error)
- func (o *Client) QueryOrderByID(symbol string, orderID string) (i Order, err error)
- func (o *Client) QueryOrderByLinkID(symbol string, orderLinkID string) (i Order, err error)
- func (o *Client) QueryPremiumKline(v QueryKline) ([]IndexKlineItem, error)
- func (o *Client) QuerySymbol() ([]SymbolInfo, error)
- func (o *Client) QuerySymbolNames() ([]string, error)
- func (o *Client) ReplaceConditionalOrder(v ReplaceConditionalOrder) (string, error)
- func (o *Client) ReplaceOrder(v ReplaceOrder) (string, error)
- func (o *Client) ServerTime() (string, error)
- func (o *Client) SetLeverage(v SetLeverage) (int, error)
- func (o *Client) SetRiskLimit(v SetRiskLimit) (int, error)
- func (o *Client) SetTradingStop(v SetTradingStop) (SetTradingStopResult, error)
- func (o *Client) SymbolLatestInformation(symbol *string) ([]LatestInformation, error)
- func (o *Client) TpSlModeSwitch(v TpSlModeSwitch) (TpSlMode, error)
- func (o *Client) Transport() *transport.Client
- func (o *Client) WalletBalance(currency *string) (map[string]Balance, error)
- func (o *Client) WithPreRateLimit(preRateLimit int) *Client
- type ClosedData
- type ClosedProfitLoss
- type ClosedProfitLossResult
- type ConditionalCancelOrderItem
- type ConditionalOrder
- type ConditionalOrderBase
- type ConditionalOrderCreated
- type ConditionalOrderExtFields
- type ConditionalOrderItem
- type ConditionalOrderListResult
- type ConditionalOrderProfitLoss
- type ContractStatus
- type ContractType
- type CreateType
- type Delta
- type Direction
- type Error
- type ExecType
- type ExecutionShot
- type GetKeyInfo
- type GetPosition
- type GetRiskLimit
- type GetTradeRecords
- type IndexKlineItem
- type InstrumentShot
- type InsuranceShot
- type InterestItem
- type KeyInfo
- type KlineInterval
- type KlineItem
- type KlineShot
- type LatestBigDeal
- type LatestBigDealItem
- type LatestInformation
- type LeverageFilter
- type LiquidationShot
- type Liquidity
- type LongShortRatio
- type LongShortRatioItem
- type LotSizeFilter
- type MarginSwitch
- type MarkKlineItem
- type OpenInterest
- type Order
- type OrderBase
- type OrderBook
- type OrderBookItem
- type OrderBookShot
- type OrderCancelled
- type OrderCreated
- type OrderExtFields
- type OrderItem
- type OrderList
- type OrderListResult
- type OrderMain
- type OrderProfitLoss
- type OrderShot
- type OrderStatus
- type OrderType
- type PlaceActiveOrder
- type PlaceConditionalOrder
- type PositionBase
- type PositionData
- type PositionIdx
- type PositionItem
- type PositionShot
- type Price
- type PriceFilter
- type PublicTradingRecord
- type PublicTradingRecords
- type Qty
- type QueryKline
- type QueryOrder
- type ReplaceConditionalOrder
- type ReplaceOrder
- type Request
- type Responce
- type Response
- type RiskLimitItem
- type SetLeverage
- type SetRiskLimit
- type SetTradingStop
- type SetTradingStopExt
- type SetTradingStopResult
- type Side
- type SortOrder
- type StopOrder
- type StopOrderShot
- type Subscription
- type SubscriptionFunc
- type Subscriptions
- type SymbolInfo
- type SymbolLatestInformation
- type TickDirection
- type TimeInForce
- type Topic
- type TopicMessage
- type TopicName
- type TpSlMode
- type TpSlModeSwitch
- type TradeRecord
- type TradeRecords
- type TradeShot
- type TriggerPrice
- type WalletBalance
- type WalletFund
- type WalletShot
- type Withdraw
- type WsClient
- func (o *WsClient) Conf() *transport.WsConf
- func (o *WsClient) Connected() bool
- func (o *WsClient) Private() *WsPrivate
- func (o *WsClient) Public() *WsPublic
- func (o *WsClient) Ready() bool
- func (o *WsClient) Run()
- func (o *WsClient) SetOnAuth(onAuth func(bool))
- func (o *WsClient) SetOnConnected(onConnected func())
- func (o *WsClient) SetOnDialError(onDialError func(error) bool)
- func (o *WsClient) SetOnDisconnected(onDisconnected func())
- func (o *WsClient) Shutdown()
- func (o *WsClient) WithAuth(key string, secret string) *WsClient
- func (o *WsClient) WithByTickUrl() *WsClient
- func (o *WsClient) WithLog(log *ulog.Log) *WsClient
- func (o *WsClient) WithProxy(proxy string) *WsClient
- func (o *WsClient) WithUrl(url string) *WsClient
- type WsDeltaExecutor
- type WsExecutor
- type WsExecutorInterface
- type WsInstant
- type WsPrivate
- type WsPublic
- func (o WsPublic) Instrument(symbol string) *WsDeltaExecutor[InstrumentShot]
- func (o WsPublic) Insurance() *WsExecutor[[]InsuranceShot]
- func (o WsPublic) Kline(symbol string, interval KlineInterval) *WsExecutor[[]KlineShot]
- func (o WsPublic) Liquidation() *WsExecutor[LiquidationShot]
- func (o WsPublic) OrderBook200(symbol string) *WsDeltaExecutor[[]OrderBookShot]
- func (o WsPublic) OrderBook25(symbol string) *WsDeltaExecutor[[]OrderBookShot]
- func (o WsPublic) Trade() *WsExecutor[[]TradeShot]
- type WsSection
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WsDeltaSetValue ¶
Set delta value by name in struct
Types ¶
type Announcement ¶
type Announcement struct { ID int `json:"id"` Title string `json:"title"` Linkg string `json:"link"` Summary string `json:"summary"` CreatedAt string `json:"created_at"` }
Announcement (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-announcement)
Get Bybit OpenAPI announcements in the last 30 days in reverse order.
type Balance ¶
type Balance struct { Equity float64 `json:"equity"` AvailableBalance float64 `json:"available_balance"` UsedMargin float64 `json:"used_margin"` OrderMargin float64 `json:"order_margin"` PositionMargin float64 `json:"position_margin"` OccClosingFee float64 `json:"occ_closing_fee"` OccFundingFee float64 `json:"occ_funding_fee"` WalletBalance float64 `json:"wallet_balance"` RealisedPnl float64 `json:"realised_pnl"` UnrealisedPnl float64 `json:"unrealised_pnl"` CumRealisedPnl float64 `json:"cum_realised_pnl"` GivenCash float64 `json:"given_cash"` ServiceCash float64 `json:"service_cash"` }
type CancelAllOrders ¶
type CancelAllOrders struct {
Symbol string `param:"symbol"`
}
Cancel All Active Orders (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-cancelallactive)
func (CancelAllOrders) Do ¶
func (o CancelAllOrders) Do(client *Client) ([]CancelOrderItem, error)
func (CancelAllOrders) DoConditional ¶
func (o CancelAllOrders) DoConditional(client *Client) ([]ConditionalCancelOrderItem, error)
Cancel All Conditional Orders (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-cancelallcond)
type CancelOrder ¶
type CancelOrder struct { Symbol string `param:"symbol"` OrderId *string `param:"order_id"` OrderLinkId *string `param:"order_link_id"` }
Cancel Active Order (https://bybit-exchange.github.io/docs/futuresV2/inverse_futures/#t-cancelactive)
func (CancelOrder) Do ¶
func (o CancelOrder) Do(client *Client) (OrderCancelled, error)
func (CancelOrder) DoConditional ¶
func (o CancelOrder) DoConditional(client *Client) (string, error)
Cancel Conditional Order (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-cancelcond)
type CancelOrderItem ¶
type CancelOrderItem struct { OrderMain OrderID string `json:"clOrdID"` LeavesValue string `json:"leaves_value"` CreateType CreateType `json:"create_type"` CancelType CancelType `json:"cancel_type"` CrossStatus OrderStatus `json:"cross_status"` CrossSeq int `json:"cross_seq"` OrderLinkID string `оыщт:"order_link_id"` }
type CancelType ¶
type CancelType string
Cancel type (cancel_type) (https://bybit-exchange.github.io/docs/futuresV2/inverse/#cancel-type-cancel_type)
CancelByPrepareLiq, CancelAllBeforeLiq - canceled due to liquidation CancelByPrepareAdl, CancelAllBeforeAdl - canceled due to ADL CancelByTpSlTsClear - TP/SL order canceled successfully CancelByPzSideCh - order has been canceled after TP/SL is triggered
const ( CancelByUser CancelType = "CancelByUser" CancelByReduceOnly CancelType = "CancelByReduceOnly" CancelByPrepareLiq CancelType = "CancelByPrepareLiq" CancelAllBeforeLiq CancelType = "CancelAllBeforeLiq" CancelByPrepareAdl CancelType = "CancelByPrepareAdl" CancelAllBeforeAdl CancelType = "CancelAllBeforeAdl" CancelByAdmin CancelType = "CancelByAdmin" CancelByTpSlTsClear CancelType = "CancelByTpSlTsClear" CancelByPzSideCh CancelType = "CancelByPzSideCh" )
type ChangeMargin ¶
Change Margin (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-changemargin)
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Inverse Perpetual HTTP client
func (*Client) Announcement ¶
func (o *Client) Announcement() ([]Announcement, error)
func (*Client) CancelAllConditionalOrders ¶
func (o *Client) CancelAllConditionalOrders(symbol string) ([]ConditionalCancelOrderItem, error)
func (*Client) CancelAllOrders ¶
func (o *Client) CancelAllOrders(symbol string) ([]CancelOrderItem, error)
func (*Client) CancelConditionalOrder ¶
func (o *Client) CancelConditionalOrder(v CancelOrder) (string, error)
func (*Client) CancelOrder ¶
func (o *Client) CancelOrder(v CancelOrder) (OrderCancelled, error)
func (*Client) ChangeMargin ¶
func (o *Client) ChangeMargin(v ChangeMargin) (float64, error)
func (*Client) ClosedProfitLoss ¶
func (o *Client) ClosedProfitLoss(v ClosedProfitLoss) (ClosedProfitLossResult, error)
func (*Client) ConditionalOrderList ¶
func (o *Client) ConditionalOrderList(v OrderList) (ConditionalOrderListResult, error)
func (*Client) GetAllPositions ¶
func (o *Client) GetAllPositions() ([]PositionItem, error)
func (*Client) GetKeyInfo ¶
func (*Client) GetOnePosition ¶
func (o *Client) GetOnePosition(symbol string) (i PositionItem, err error)
func (*Client) GetPosition ¶
func (o *Client) GetPosition(symbol *string) ([]PositionItem, error)
func (*Client) GetRiskLimit ¶
func (o *Client) GetRiskLimit(symbol *string) ([]RiskLimitItem, error)
func (*Client) GetTradeRecords ¶
func (o *Client) GetTradeRecords(v GetTradeRecords) (TradeRecords, error)
func (*Client) LatestBigDeal ¶
func (this *Client) LatestBigDeal(v LatestBigDeal) ([]LatestBigDealItem, error)
func (*Client) LongShortRatio ¶
func (this *Client) LongShortRatio(v LongShortRatio) ([]LongShortRatioItem, error)
func (*Client) MarginSwitch ¶
func (o *Client) MarginSwitch(v MarginSwitch) error
func (*Client) OneSymbolLatestInformation ¶
func (o *Client) OneSymbolLatestInformation(symbol string) (i LatestInformation, err error)
func (*Client) OpenInterest ¶
func (this *Client) OpenInterest(v OpenInterest) ([]InterestItem, error)
func (*Client) PlaceActiveOrder ¶
func (o *Client) PlaceActiveOrder(v PlaceActiveOrder) (OrderCreated, error)
func (*Client) PlaceConditionalOrder ¶
func (o *Client) PlaceConditionalOrder(v PlaceConditionalOrder) (ConditionalOrderCreated, error)
func (*Client) PublicTradingRecords ¶
func (o *Client) PublicTradingRecords(v PublicTradingRecords) ([]PublicTradingRecord, error)
func (*Client) QueryConditionalOrder ¶
func (o *Client) QueryConditionalOrder(v QueryOrder) ([]ConditionalOrder, error)
func (*Client) QueryIndexKline ¶
func (o *Client) QueryIndexKline(v QueryKline) ([]IndexKlineItem, error)
func (*Client) QueryKline ¶
func (o *Client) QueryKline(v QueryKline) ([]KlineItem, error)
func (*Client) QueryMarkKline ¶
func (o *Client) QueryMarkKline(v QueryKline) ([]MarkKlineItem, error)
func (*Client) QueryOrder ¶
func (o *Client) QueryOrder(v QueryOrder) ([]Order, error)
func (*Client) QueryOrderByID ¶
func (*Client) QueryOrderByLinkID ¶ added in v0.2.17
func (*Client) QueryPremiumKline ¶
func (o *Client) QueryPremiumKline(v QueryKline) ([]IndexKlineItem, error)
func (*Client) QuerySymbol ¶
func (o *Client) QuerySymbol() ([]SymbolInfo, error)
func (*Client) QuerySymbolNames ¶
func (*Client) ReplaceConditionalOrder ¶
func (o *Client) ReplaceConditionalOrder(v ReplaceConditionalOrder) (string, error)
func (*Client) ReplaceOrder ¶
func (o *Client) ReplaceOrder(v ReplaceOrder) (string, error)
func (*Client) ServerTime ¶
Server Time (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-servertime)
func (*Client) SetLeverage ¶
func (o *Client) SetLeverage(v SetLeverage) (int, error)
func (*Client) SetRiskLimit ¶
func (o *Client) SetRiskLimit(v SetRiskLimit) (int, error)
func (*Client) SetTradingStop ¶
func (o *Client) SetTradingStop(v SetTradingStop) (SetTradingStopResult, error)
func (*Client) SymbolLatestInformation ¶
func (o *Client) SymbolLatestInformation(symbol *string) ([]LatestInformation, error)
func (*Client) TpSlModeSwitch ¶
func (o *Client) TpSlModeSwitch(v TpSlModeSwitch) (TpSlMode, error)
func (*Client) WalletBalance ¶
func (*Client) WithPreRateLimit ¶
type ClosedData ¶
type ClosedData struct { ID int `json:"id"` UserID int `json:"user_id"` Symbol string `json:"symbol"` OrderID string `json:"order_id"` Side Side `json:"side"` Qty float64 `json:"qty"` OrderPrice float64 `json:"order_price"` OrderType OrderType `json:"order_type"` ExecType ExecType `json:"exec_type"` ClosedSize float64 `json:"closed_size"` CumEntryValue float64 `json:"cum_entry_value"` AvgEntryPrice float64 `json:"avg_entry_price"` CumExitValue float64 `json:"cum_exit_value"` AvgExitPrice float64 `json:"avg_exit_price"` ClosedPnl float64 `json:"closed_pnl"` FillCount int `json:"fill_count"` Leverage int `json:"leverage"` CreatedAt uint64 `json:"created_at"` }
type ClosedProfitLoss ¶
type ClosedProfitLoss struct { Symbol string `param:"symbol"` StartTime *int `param:"start_time"` EndTime *int `param:"end_time"` ExecType *ExecType `param:"exec_type"` Page *int `param:"page"` Limit *int `param:"limit"` }
Closed Profit and Loss (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-closedprofitandloss)
func (ClosedProfitLoss) Do ¶
func (o ClosedProfitLoss) Do(client *Client) (ClosedProfitLossResult, error)
type ClosedProfitLossResult ¶
type ClosedProfitLossResult struct { CurrentPage int `json:"current_page"` Data []ClosedData `json:"data"` }
type ConditionalCancelOrderItem ¶
type ConditionalCancelOrderItem struct { ConditionalOrderProfitLoss OrderID string `json:"clOrdID"` CrossStatus string `json:"cross_status"` CrossSeq int `json:"cross_seq"` ExpectedDirection string `json:"expected_direction"` CreateType CreateType `json:"create_type"` CancelType CancelType `json:"cancel_type"` OrderStatus OrderStatus `json:"order_status"` LeavesQty float64 `json:"leaves_qty"` LeavesValue string `json:"leaves_value"` StopOrderType StopOrder `json:"stop_order_type"` }
type ConditionalOrder ¶
type ConditionalOrder struct { ConditionalOrderProfitLoss CumExecQty float64 `json:"cum_exec_qty"` CumExecValue float64 `json:"cum_exec_value"` CumExecFee float64 `json:"cum_exec_fee"` OrderID string `json:"order_id"` RejectReason string `json:"reject_reason"` OrderStatus OrderStatus `json:"order_status"` LeavesQty float64 `json:"leaves_qty"` LeavesValue string `json:"leaves_value"` CancelType CancelType `json:"cancel_type"` OrderLinkID string `json:"order_link_id"` PositionIdx PositionIdx `json:"position_idx"` ExtFields ConditionalOrderExtFields `json:"ext_fields"` }
type ConditionalOrderBase ¶
type ConditionalOrderBase struct { UserID int `json:"user_id"` Symbol string `json:"symbol"` Side Side `json:"side"` OrderType OrderType `json:"order_type"` Price float64 `json:"price"` Qty int `json:"qty"` TimeInForce TimeInForce `json:"time_in_force"` TriggerBy TriggerPrice `json:"trigger_by"` StopPx string `json:"stop_px"` BasePrice string `json:"base_price"` CreatedAt string `json:"created_at"` UpdatedAt string `json:"updated_at"` }
type ConditionalOrderCreated ¶
type ConditionalOrderCreated struct { ConditionalOrderBase ConditionalOrderProfitLoss Remark string `json:"remark"` RejectReason string `json:"reject_reason"` LeavesQty float64 `json:"leaves_qty"` LeavesValue string `json:"leaves_value"` StopOrderID string `json:"stop_order_id"` OrderLinkID string `json:"order_link_id"` }
type ConditionalOrderExtFields ¶
type ConditionalOrderExtFields struct {
// contains filtered or unexported fields
}
type ConditionalOrderItem ¶
type ConditionalOrderItem struct { ConditionalOrderProfitLoss StopOrderStatus OrderStatus `json:"stop_order_status"` StopOrderID string `json:"stop_order_id"` OrderLinkID string `json:"order_link_id"` StopOrderType StopOrder `json:"stop_order_type"` PositionIdx PositionIdx `json:"position_idx"` }
type ConditionalOrderListResult ¶
type ConditionalOrderListResult struct { Items []ConditionalOrderItem `json:"data"` Cursor string `json:"cursor"` }
type ConditionalOrderProfitLoss ¶
type ConditionalOrderProfitLoss struct { TakeProfit float64 `json:"take_profit"` StopLoss float64 `json:"stop_loss"` TpTrigger TriggerPrice `json:"tp_trigger_by"` SlTrigger TriggerPrice `json:"sl_trigger_by"` }
type ContractStatus ¶
type ContractStatus string
Contract Status (status) (https://bybit-exchange.github.io/docs/futuresV2/inverse/#contract-status-status)
const ( Trading ContractStatus = "Trading" Settling ContractStatus = "Settling" Closed ContractStatus = "Closed" )
type ContractType ¶
type ContractType string
Contract Type (contract_type) (https://bybit-exchange.github.io/docs/futuresV2/inverse/#contract-type-contract_type)
const ( InversePerpetual ContractType = "InversePerpetual" LinearPerpetual ContractType = "LinearPerpetual" InverseFutures ContractType = "InverseFutures" )
type CreateType ¶
type CreateType string
Create type (create_type) (https://bybit-exchange.github.io/docs/futuresV2/inverse/#create-type-create_type)
CreateByLiq - Created by partial liquidation CreateByAdl_PassThrough - Created by ADL CreateByTakeOver_PassThrough - Created by liquidation takeover
const ( CreateByUser CreateType = "CreateByUser" CreateByClosing CreateType = "CreateByClosing" CreateByAdminClosing CreateType = "CreateByAdminClosing" CreateByStopOrder CreateType = "CreateByStopOrder" CreateByTakeProfit CreateType = "CreateByTakeProfit" CreateByStopLoss CreateType = "CreateByStopLoss" CreateByPartialTakeProfit CreateType = "CreateByPartialTakeProfit" CreateByPartialStopLoss CreateType = "CreateByPartialStopLoss" CreateByTrailingStop CreateType = "CreateByTrailingStop" CreateByLiq CreateType = "CreateByLiq" CreateByAdlPassThrough CreateType = "CreateByAdl_PassThrough" CreateByTakeOverPassThrough CreateType = "CreateByTakeOver_PassThrough" )
type Delta ¶
type Error ¶
func (*Error) ApiKeyExpired ¶
func (*Error) ApiKeyInvalid ¶
func (*Error) InsufficientBalance ¶
func (*Error) TooManyVisits ¶
func (*Error) UnmatchedIp ¶
type ExecType ¶
type ExecType string
Exec type (exec_type) (https://bybit-exchange.github.io/docs/futuresV2/inverse/#exec-type-exec_type)
type ExecutionShot ¶
type ExecutionShot struct { OrderID string `json:"order_id"` OrderLinkID string `json:"order_link_id"` Symbol string `json:"symbol"` Side Side `json:"side"` ExecID string `json:"exec_id"` Price string `json:"price"` OrderQty float64 `json:"order_qty"` ExecType ExecType `json:"exec_type"` ExecQty int `json:"exec_qty"` ExecFee string `json:"exec_fee"` LeavesQty float64 `json:"leaves_qty"` IsMaker bool `json:"is_maker"` TradeTime string `json:"trade_time"` }
type GetKeyInfo ¶
type GetKeyInfo struct { }
type GetPosition ¶
type GetPosition struct {
Symbol *string `param:"symbol"`
}
My Position (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-myposition)
func (GetPosition) Do ¶
func (o GetPosition) Do(client *Client) ([]PositionItem, error)
type GetRiskLimit ¶
type GetRiskLimit struct {
Symbol *string `param:"symbol"`
}
Get Risk Limit (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-getrisklimit)
func (GetRiskLimit) Do ¶
func (o GetRiskLimit) Do(client *Client) ([]RiskLimitItem, error)
type GetTradeRecords ¶
type GetTradeRecords struct { Symbol string `param:"symbol"` OrderID *string `param:"order_id"` StartTime *int `param:"start_time"` Page *int `param:"page"` Limit *int `param:"limit"` Order *SortOrder `param:"order"` }
Get User Trade Records (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-usertraderecords)
Get user's trading records. The results are ordered in ascending order (the first item is the oldest)
func (GetTradeRecords) Do ¶
func (o GetTradeRecords) Do(client *Client) (TradeRecords, error)
type IndexKlineItem ¶
type InstrumentShot ¶
type InstrumentShot struct { ID uint64 `json:"id"` Symbol string `json:"symbol"` LastPriceE4 int64 `json:"last_price_e4"` LastPrice string `json:"last_price"` Bid1PriceE4 int64 `json:"bid1_price_e4"` Bid1Price string `json:"bid1_price"` Ask1PriceE4 int64 `json:"ask1_price_e4"` Ask1Price string `json:"ask1_price"` LastTickDirection TickDirection `json:"last_tick_direction"` PrevPrice24hE4 int64 `json:"prev_price_24h_e4"` PrevPrice24h string `json:"prev_price_24h"` HighPrice24hE4 int64 `json:"high_price_24h_e4"` HighPrice24h string `json:"high_price_24h"` LowPrice24hE4 int64 `json:"low_price_24h_e4"` LowPrice24h string `json:"low_price_24h"` PrevPrice1hE4 int64 `json:"prev_price_1h_e4"` PrevPrice1h string `json:"prev_price_1h"` MarkPriceE4 int64 `json:"mark_price_e4"` MarkPrice string `json:"mark_price"` IndexPriceE4 int64 `json:"index_price_e4"` IndexPrice string `json:"index_price"` OpenInterest int64 `json:"open_interest"` OpenValueE8 int64 `json:"open_value_e8"` TotalTurnoverE8 int64 `json:"total_turnover_e8"` Turnover24hE8 int64 `json:"turnover_24h_e8"` TotalVolume int64 `json:"total_volume"` Volume24h int64 `json:"volume_24h"` FundingRateE6 int64 `json:"funding_rate_e6"` PredictedFundingRateE6 int64 `json:"predicted_funding_rate_e6"` CrossSeq uint64 `json:"cross_seq"` CreatedAt string `json:"created_at"` UpdatedAt string `json:"updated_at"` NextFundingTime string `json:"next_funding_time"` CountdownHour uint64 `json:"countdown_hour"` FundingRateInterval uint64 `json:"funding_rate_interval"` SettleTimeE9 uint64 `json:"settle_time_e9"` DelistingStatus string `json:"delisting_status"` }
type InsuranceShot ¶
type InterestItem ¶
type KeyInfo ¶
type KeyInfo struct { ApiKey string `json:"api_key"` Type string `json:"type"` UserID int `json:"user_id"` InviterID int `json:"inviter_id"` Ips []string `json:"ips"` Note string `json:"note"` Permissions []string `json:"permissions"` CreatedAt time.Time `json:"created_at"` ExpiredAt time.Time `json:"expired_at"` ReadOnly bool `json:"read_only"` VipLevel string `json:"vip_level"` MktMakerLevel string `json:"mkt_maker_level"` AffiliateID int `json:"affiliate_id"` }
type KlineInterval ¶
type KlineInterval string
Kline interval (interval) (https://bybit-exchange.github.io/docs/futuresV2/inverse/#kline-interval-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 KlineInterval = "1" Interval3m KlineInterval = "3" Interval5m KlineInterval = "5" Interval15m KlineInterval = "15" Interval30m KlineInterval = "30" Interval1h KlineInterval = "60" Interval2h KlineInterval = "120" Interval4h KlineInterval = "240" Interval6h KlineInterval = "360" Interval12h KlineInterval = "720" Interval1d KlineInterval = "D" Interval1w KlineInterval = "W" Interval1M KlineInterval = "M" )
type KlineShot ¶
type KlineShot struct { Start uint64 `json:"start"` End uint64 `json:"end"` Open float64 `json:"open"` Close float64 `json:"close"` High float64 `json:"high"` Low float64 `json:"low"` Volume float64 `json:"volume"` Turnover float64 `json:"turnover"` Confirm bool `json:"confirm"` CrossSeq float64 `json:"cross_seq"` Timestamp uint64 `json:"timestamp"` }
type LatestBigDeal ¶
Latest Big Deal (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-marketbigdeal)
Obtain filled orders worth more than 500,000 USD within the last 24h. This endpoint may return orders which are over the maximum order qty for the symbol you call. For instance, the maximum order qty for BTCUSD is 1 million contracts, but in the event of the liquidation of a position larger than 1 million this endpoint returns this "impossible" order size.
symbol Required string Symbol limit int Limit for data size per page, max size is 1000. Default as showing 500 pieces of data per page
func (LatestBigDeal) Do ¶
func (this LatestBigDeal) Do(client *Client) ([]LatestBigDealItem, error)
type LatestBigDealItem ¶
type LatestInformation ¶
type LatestInformation struct { Symbol string `json:"symbol"` BidPrice transport.Float64 `json:"bid_price"` AskPrice transport.Float64 `json:"ask_price"` LastPrice transport.Float64 `json:"last_price"` LastTickDirection TickDirection `json:"last_tick_direction"` PrevPrice24h transport.Float64 `json:"prev_price_24h"` Price24hPcnt transport.Float64 `json:"price_24h_pcnt"` HighPrice24h transport.Float64 `json:"high_price_24h"` LowPrice24h transport.Float64 `json:"low_price_24h"` PrevPrice1h transport.Float64 `json:"prev_price_1h"` Price1hPcnt transport.Float64 `json:"price_1h_pcnt"` MarkPrice transport.Float64 `json:"mark_price"` IndexPrice transport.Float64 `json:"index_price"` OpenInterest float64 `json:"open_interest"` OpenValue transport.Float64 `json:"open_value"` TotalTurnover transport.Float64 `json:"total_turnover"` Turnover24h transport.Float64 `json:"turnover_24h"` TotalVolume float64 `json:"total_volume"` Volume24h float64 `json:"volume_24h"` FundingRate transport.Float64 `json:"funding_rate"` PredictedFundingRate transport.Float64 `json:"predicted_funding_rate"` NextFundingTime string `json:"next_funding_time"` CountdownHour int `json:"countdown_hour"` DeliveryFeeRate string `json:"delivery_fee_rate"` PredictedDeliveryPrice string `json:"predicted_delivery_price"` DeliveryTime string `json:"delivery_time"` }
type LeverageFilter ¶
type LiquidationShot ¶
type Liquidity ¶
type Liquidity string
Liquidity type (last_liquidity_ind) (https://bybit-exchange.github.io/docs/futuresV2/inverse/#liquidity-type-last_liquidity_ind)
AddedLiquidity - liquidity maker RemovedLiquidity - liquidity Taker
type LongShortRatio ¶
type LongShortRatio struct { Symbol string `param:"symbol"` Period string `param:"period"` Limit *int `param:"limit"` }
Long-Short Ratio (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-marketaccountratio)
Gets the Bybit user accounts' long-short ratio.
symbol Required string Symbol period Required string Data recording period. 5min, 15min, 30min, 1h, 4h, 1d limit int Limit for data size per page, max size is 500. Default as showing 50 pieces of data per page
func (LongShortRatio) Do ¶
func (this LongShortRatio) Do(client *Client) ([]LongShortRatioItem, error)
type LongShortRatioItem ¶
type LotSizeFilter ¶
type MarginSwitch ¶
type MarginSwitch struct { Symbol string `param:"symbol"` IsIsolated bool `param:"is_isolated"` BuyLeverage int `param:"buy_leverage"` SellLeverage int `param:"sell_leverage"` }
Cross/Isolated Margin Switch (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-marginswitch)
Switch Cross/Isolated; must set leverage value when switching from Cross to Isolated
func (MarginSwitch) Do ¶
func (o MarginSwitch) Do(client *Client) error
type MarkKlineItem ¶
type OpenInterest ¶
type OpenInterest struct { Symbol string `param:"symbol"` Period string `param:"period"` Limit *int `param:"limit"` }
Open Interest (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-marketopeninterest)
Gets the total amount of unsettled contracts. In other words, the total number of contracts held in open positions.
symbol Required string Symbol period Required string Data recording period. 5min, 15min, 30min, 1h, 4h, 1d limit int Limit for data size per page, max size is 200. Default as showing 50 pieces of data per page
func (OpenInterest) Do ¶
func (this OpenInterest) Do(client *Client) ([]InterestItem, error)
type Order ¶
type Order struct { OrderCancelled LeavesValue string `json:"leaves_value"` PositionIdx PositionIdx `json:"position_idx"` CancelType CancelType `json:"cancel_type"` ExtFields OrderExtFields `json:"ext_fields"` }
type OrderBase ¶
type OrderBase struct { OrderMain OrderID string `json:"order_id"` OrderLinkID string `json:"order_link_id"` CumExecQty transport.Float64 `json:"cum_exec_qty"` CumExecValue transport.Float64 `json:"cum_exec_value"` CumExecFee transport.Float64 `json:"cum_exec_fee"` RejectReason string `json:"reject_reason"` }
type OrderBook ¶
type OrderBook struct {
Symbol string `param:"symbol"`
}
Order Book (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-orderbook)
type OrderBookItem ¶
type OrderBookShot ¶
type OrderCancelled ¶
type OrderCancelled struct {
OrderCreated
}
type OrderCreated ¶
type OrderExtFields ¶
type OrderExtFields struct { XreqType string `json:"xreq_type"` // contains filtered or unexported fields }
type OrderItem ¶
type OrderItem struct { OrderBase OrderProfitLoss LeavesValue string `json:"leaves_value"` PositionIdx PositionIdx `json:"position_idx"` }
type OrderList ¶
type OrderList struct { Symbol string `param:"symbol"` OrderStatus *OrderStatus `param:"order_status"` Direction *Direction `param:"direction"` Limit *int `param:"limit"` Cursor *string `param:"cursor"` }
Get Active Order (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-getactive)
func (OrderList) DoConditional ¶
func (o OrderList) DoConditional(client *Client) (ConditionalOrderListResult, error)
Get Conditional Order (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-getcond)
type OrderListResult ¶
type OrderMain ¶
type OrderMain struct { UserID int `json:"user_id"` Symbol string `json:"symbol"` Side Side `json:"side"` OrderType OrderType `json:"order_type"` Price transport.Float64 `json:"price"` Qty int `json:"qty"` TimeInForce TimeInForce `json:"time_in_force"` OrderStatus OrderStatus `json:"order_status"` LeavesQty float64 `json:"leaves_qty"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
type OrderProfitLoss ¶
type OrderProfitLoss struct { TakeProfit string `json:"take_profit"` StopLoss string `json:"stop_loss"` TpTrigger TriggerPrice `json:"tp_trigger_by"` SlTrigger TriggerPrice `json:"sl_trigger_by"` }
type OrderShot ¶
type OrderShot struct { OrderID string `json:"order_id"` OrderLinkID string `json:"order_link_id"` Symbol string `json:"symbol"` Side Side `json:"side"` OrderType OrderType `json:"order_type"` Price transport.Float64 `json:"price"` Qty transport.Float64 `json:"qty"` TimeInForce TimeInForce `json:"time_in_force"` CreateType CreateType `json:"create_type"` CancelType CancelType `json:"cancel_type"` OrderStatus OrderStatus `json:"order_status"` LeavesQty float64 `json:"leaves_qty"` CumExecQty float64 `json:"cum_exec_qty"` CumExecValue transport.Float64 `json:"cum_exec_value"` CumExecFee transport.Float64 `json:"cum_exec_fee"` Timestamp time.Time `json:"timestamp"` TakeProfit transport.Float64 `json:"take_profit"` TpTrigger TriggerPrice `json:"tp_trigger_by"` SlTrigger TriggerPrice `json:"sl_trigger_by"` StopLoss string `json:"stop_loss"` TrailingStop string `json:"trailing_stop"` LastExecPrice transport.Float64 `json:"last_exec_price"` ReduceOnly bool `json:"reduce_only"` CloseOnTrigger bool `json:"close_on_trigger"` }
type OrderStatus ¶
type OrderStatus string
Order status (order_status/stop_order_status) (https://bybit-exchange.github.io/docs/futuresV2/inverse/#order-status-order_status-stop_order_status)
Created - order has been accepted by the system but not yet put through the matching engine New - order has been placed successfully PendingCancel - matching engine has received the cancelation request but it may not be canceled successfully Only for conditional orders: Untriggered - order yet to be triggered Deactivated - order has been canceled by the user before being triggered Triggered - order has been triggered by last traded price Active - order has been triggered and the new active order has been successfully placed. Is the final state of a successful conditional order
const ( Created OrderStatus = "Created" New OrderStatus = "New" Rejected OrderStatus = "Rejected" PartiallyFilled OrderStatus = "PartiallyFilled" Filled OrderStatus = "Filled" PendingCancel OrderStatus = "PendingCancel" Cancelled OrderStatus = "Cancelled" Untriggered OrderStatus = "Untriggered" Deactivated OrderStatus = "Deactivated" Triggered OrderStatus = "Triggered" Active OrderStatus = "Active" )
type OrderType ¶
type OrderType string
Order type (order_type) (https://bybit-exchange.github.io/docs/futuresV2/inverse/#order-type-order_type)
type PlaceActiveOrder ¶
type PlaceActiveOrder struct { Side Side `param:"side"` Symbol string `param:"symbol"` OrderType OrderType `param:"order_type"` Qty float64 `param:"qty"` TimeInForce TimeInForce `param:"time_in_force"` Price *float64 `param:"price"` CloseOnTrigger *bool `param:"close_on_trigger"` OrderLinkID *string `param:"order_link_id"` TakeProfit *float64 `param:"take_profit"` StopLoss *float64 `param:"stop_loss"` TpTrigger *TriggerPrice `param:"tp_trigger_by"` SlTrigger *TriggerPrice `param:"sl_trigger_by"` ReduceOnly *bool `param:"reduce_only"` }
Place Active Order (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-placeactive)
func (PlaceActiveOrder) Do ¶
func (o PlaceActiveOrder) Do(client *Client) (OrderCreated, error)
type PlaceConditionalOrder ¶
type PlaceConditionalOrder struct { Side Side `param:"side"` Symbol string `param:"symbol"` OrderType OrderType `param:"order_type"` Qty float64 `param:"qty"` TimeInForce TimeInForce `param:"time_in_force"` BasePrice string `param:"base_price"` StopPx string `param:"stop_px"` Price *float64 `param:"price"` CloseOnTrigger *bool `param:"close_on_trigger"` OrderLinkID *string `param:"order_link_id"` TakeProfit *float64 `param:"take_profit"` StopLoss *float64 `param:"stop_loss"` TpTrigger *TriggerPrice `param:"tp_trigger_by"` SlTrigger *TriggerPrice `param:"sl_trigger_by"` TriggerBy *TriggerPrice `param:"trigger_by"` }
Place Conditional Order (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-placecond)
func (*PlaceConditionalOrder) Do ¶
func (o *PlaceConditionalOrder) Do(client *Client) (ConditionalOrderCreated, error)
type PositionBase ¶
type PositionBase struct { ID int `json:"id"` UserID int `json:"user_id"` RiskID int `json:"risk_id"` Symbol string `json:"symbol"` Side Side `json:"side"` Size int `json:"size"` PositionValue transport.Float64 `json:"position_value"` EntryPrice transport.Float64 `json:"entry_price"` IsIsolated bool `json:"is_isolated"` AutoAddMargin int `json:"auto_add_margin"` Leverage transport.Float64 `json:"leverage"` EffectiveLeverage transport.Float64 `json:"effective_leverage"` PositionMargin transport.Float64 `json:"position_margin"` LiqPrice transport.Float64 `json:"liq_price"` BustPrice transport.Float64 `json:"bust_price"` OccClosingFee transport.Float64 `json:"occ_closing_fee"` OccFundingFee transport.Float64 `json:"occ_funding_fee"` TakeProfit transport.Float64 `json:"take_profit"` StopLoss transport.Float64 `json:"stop_loss"` TrailingStop transport.Float64 `json:"trailing_stop"` PositionStatus string `json:"position_status"` DeleverageIndicator int `json:"deleverage_indicator"` OcCalcData string `json:"oc_calc_data"` OrderMargin transport.Float64 `json:"order_margin"` WalletBalance transport.Float64 `json:"wallet_balance"` RealisedPnl transport.Float64 `json:"realised_pnl"` CumRealisedPnl transport.Float64 `json:"cum_realised_pnl"` CrossSeq int `json:"cross_seq"` PositionSeq int `json:"position_seq"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` }
type PositionData ¶
type PositionData struct { PositionBase PositionIdx PositionIdx `json:"position_idx"` Mode int `json:"mode"` UnrealisedPnl float64 `json:"unrealised_pnl"` TpSlMode TpSlMode `json:"tp_sl_mode"` }
type PositionIdx ¶
type PositionIdx int
const ( OneWay PositionIdx = 0 BuySide PositionIdx = 1 SellSide PositionIdx = 1 )
type PositionItem ¶
type PositionItem struct { Data PositionData `json:"data"` IsValid bool `json:"is_valid"` }
type PositionShot ¶
type PositionShot struct { UserID int `json:"user_id"` Symbol string `json:"symbol"` Size int `json:"size"` Side Side `json:"side"` PositionValue transport.Float64 `json:"position_value"` EntryPrice transport.Float64 `json:"entry_price"` LiqPrice transport.Float64 `json:"liq_price"` BustPrice transport.Float64 `json:"bust_price"` Leverage transport.Float64 `json:"leverage"` OrderMargin string `json:"order_margin"` PositionMargin string `json:"position_margin"` AvailableBalance transport.Float64 `json:"available_balance"` TakeProfit string `json:"take_profit"` StopLoss string `json:"stop_loss"` RealisedPnl transport.Float64 `json:"realised_pnl"` TrailingStop string `json:"trailing_stop"` TrailingActive string `json:"trailing_active"` WalletBalance transport.Float64 `json:"wallet_balance"` RiskID int `json:"risk_id"` OccClosingFee string `json:"occ_closing_fee"` OccFundingFee string `json:"occ_funding_fee"` AutoAddMargin int `json:"auto_add_margin"` CumRealisedPnl string `json:"cum_realised_pnl"` PositionStatus string `json:"position_status"` PositionSeq int `json:"position_seq"` IsIsolated bool `json:"is_isolated"` Mode int `json:"mode"` PositionIdx PositionIdx `json:"position_idx"` TpSlMode TpSlMode `json:"tp_sl_mode"` TpOrderNum int `json:"tp_order_num"` SlOrderNum int `json:"sl_order_num"` TpFreeSize int `json:"tp_free_size_x"` SlFreeSize int `json:"sl_free_size_x"` }
type Price ¶
type Price float64
Price (price) (https://bybit-exchange.github.io/docs/futuresV2/inverse/#price-price)
type PriceFilter ¶
type PublicTradingRecord ¶
type PublicTradingRecords ¶
Public Trading Records (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-publictradingrecords)
symbol Required string Symbol limit integer Limit for data size, max size is 1000. Default size is 500
func (PublicTradingRecords) Do ¶
func (o PublicTradingRecords) Do(client *Client) ([]PublicTradingRecord, error)
type Qty ¶
type Qty uint64
Quantity (qty) (https://bybit-exchange.github.io/docs/futuresV2/inverse/#quantity-qty)
type QueryKline ¶
type QueryKline struct { Symbol string `param:"symbol"` Interval KlineInterval `param:"interval"` From int64 `param:"from"` Limit *int `param:"limit"` }
Query Kline (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-querykline)
symbol Required string Symbol interval Required string Data refresh interval. Enum : 1 3 5 15 30 60 120 240 360 720 "D" "M" "W" from Required integer From timestamp in seconds limit integer Limit for data size per page, max size is 200. Default as showing 200 pieces of data per page
func (QueryKline) DoIndex ¶
func (o QueryKline) DoIndex(client *Client) ([]IndexKlineItem, error)
Query Index Price Kline (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-queryindexpricekline)
Index price kline. Tracks BTC spot prices, with a frequency of every second
func (QueryKline) DoMark ¶
func (o QueryKline) DoMark(client *Client) ([]MarkKlineItem, error)
Query Mark Price Kline (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-markpricekline)
Query mark price kline (like Query Kline but for mark price)
func (QueryKline) DoPremium ¶
func (o QueryKline) DoPremium(client *Client) ([]IndexKlineItem, error)
Query Premium Index Kline (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-querypremiumindexkline)
Premium index kline. Tracks the premium / discount of BTC perpetual contracts relative to the mark price per minute
type QueryOrder ¶
type QueryOrder struct { Symbol string `param:"symbol"` OrderID *string `param:"order_id"` OrderLinkID *string `param:"order_link_id"` }
Query Active Order (real-time) (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-queryactive)
Query real-time active order information. If only order_id or order_link_id are passed, a single order will be returned; otherwise, returns up to 500 unfilled orders.
func (QueryOrder) Do ¶
func (o QueryOrder) Do(client *Client) (l []Order, err error)
When only symbol is passed, the response uses a different structure.
func (QueryOrder) DoConditional ¶
func (o QueryOrder) DoConditional(client *Client) ([]ConditionalOrder, error)
Query Conditional Order (real-time) (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-querycond)
When only symbol is passed, the response uses a different structure.
func (QueryOrder) OnlySymbol ¶
func (o QueryOrder) OnlySymbol() bool
type ReplaceConditionalOrder ¶
type ReplaceConditionalOrder struct { Symbol string `param:"symbol"` OrderID *string `param:"stop_order_id"` OrderLinkID *string `param:"order_link_id"` Qty *int `param:"p_r_qty"` Price *string `param:"p_r_price"` TriggerPrice *string `param:"p_r_trigger_price"` TakeProfit *float64 `param:"take_profit"` StopLoss *float64 `param:"stop_loss"` TpTrigger *TriggerPrice `param:"tp_trigger_by"` SlTrigger *TriggerPrice `param:"sl_trigger_by"` }
Replace Conditional Order (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-replacecond)
type ReplaceOrder ¶
type ReplaceOrder struct { Symbol string `param:"symbol"` OrderID *string `param:"order_id"` OrderLinkID *string `param:"order_link_id"` Qty *int `param:"p_r_qty"` Price *string `param:"p_r_price"` TakeProfit *float64 `param:"take_profit"` StopLoss *float64 `param:"stop_loss"` TpTrigger *TriggerPrice `param:"tp_trigger_by"` SlTrigger *TriggerPrice `param:"sl_trigger_by"` }
Replace Active Order (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-replaceactive)
type RiskLimitItem ¶
type RiskLimitItem struct { ID int `json:"id"` Symbol string `json:"symbol"` Limit int `json:"limit"` MaintainMargin string `json:"maintain_margin"` StartingMargin string `json:"starting_margin"` Section []string `json:"section"` IsLowestRisk int `json:"is_lowest_risk"` CreatedAt string `json:"created_at"` UpdatedAt string `json:"updated_at"` MaxLeverage string `json:"max_leverage"` }
type SetLeverage ¶
type SetLeverage struct { Symbol string `param:"symbol"` Leverage int `param:"leverage"` LeverageOnly *bool `param:"leverage_only"` }
Set Leverage (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-setleverage)
type SetRiskLimit ¶
Set Risk Limit (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-setrisklimit)
symbol Required string Symbol risk_id Required integer Risk ID
type SetTradingStop ¶
type SetTradingStop struct { Symbol string `param:"symbol"` TakeProfit *int `param:"take_profit"` StopLoss *int `param:"stop_loss"` TrailingStop *int `param:"trailing_stop"` TpTrigger *TriggerPrice `param:"tp_trigger_by"` SlTrigger *TriggerPrice `param:"sl_trigger_by"` NewTrailingActive *int `param:"new_trailing_active"` SlSize *int `param:"sl_size"` TpSize *int `param:"tp_size"` }
Set Trading-Stop (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-tradingstop)
func (SetTradingStop) Do ¶
func (o SetTradingStop) Do(client *Client) (SetTradingStopResult, error)
type SetTradingStopExt ¶
type SetTradingStopResult ¶
type SetTradingStopResult struct { PositionBase CumCommission int `json:"cum_commission"` ExtFields SetTradingStopExt `json:"ext_fields"` }
type Side ¶
type Side string
Side (side) (https://bybit-exchange.github.io/docs/futuresV2/inverse/#side-side)
type SortOrder ¶
type SortOrder string
Order (order) (https://bybit-exchange.github.io/docs/futuresV2/inverse/#order-order)
This is used for sorting orders/trades in a specified direction.
type StopOrder ¶
type StopOrder string
Stop order type (stop_order_type) (https://bybit-exchange.github.io/docs/futuresV2/inverse/#stop-order-type-stop_order_type)
type StopOrderShot ¶
type StopOrderShot struct { OrderID string `json:"order_id"` OrderLinkID string `json:"order_link_id"` UserID int `json:"user_id"` Symbol string `json:"symbol"` Side Side `json:"side"` OrderType OrderType `json:"order_type"` Price float64 `json:"price"` CreateType CreateType `json:"create_type"` CancelType CancelType `json:"cancel_type"` OrderStatus OrderStatus `json:"order_status"` StopOrderType StopOrder `json:"stop_order_type"` TriggerBy TriggerPrice `json:"trigger_by"` TriggerPrice string `json:"trigger_price"` CloseOnTrigger bool `json:"close_on_trigger"` Timestamp string `json:"timestamp"` TakeProfit float64 `json:"take_profit"` StopLoss float64 `json:"stop_loss"` }
type Subscription ¶
func (*Subscription) String ¶
func (o *Subscription) String() string
type SubscriptionFunc ¶
type Subscriptions ¶
type Subscriptions map[string]SubscriptionFunc
type SymbolInfo ¶
type SymbolInfo struct { Name string `json:"name"` Alias string `json:"alias"` Status ContractStatus `json:"status"` BaseCurrency string `json:"base_currency"` QuoteCurrency string `json:"quote_currency"` PriceScale float64 `json:"price_scale"` TakerFee transport.Float64 `json:"taker_fee"` MakerFee transport.Float64 `json:"maker_fee"` FundingInterval float64 `json:"funding_interval"` LeverageFilter LeverageFilter `json:"leverage_filter"` PriceFilter PriceFilter `json:"price_filter"` LotSizeFilter LotSizeFilter `json:"lot_size_filter"` }
Query Symbol (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-querysymbol)
type SymbolLatestInformation ¶
type SymbolLatestInformation struct {
Symbol *string `param:"symbol"`
}
Latest Information for Symbol (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-latestsymbolinfo)
func (SymbolLatestInformation) Do ¶
func (o SymbolLatestInformation) Do(client *Client) ([]LatestInformation, error)
type TickDirection ¶
type TickDirection string
Tick direction type (tick_direction) (https://bybit-exchange.github.io/docs/futuresV2/inverse/#tick-direction-type-tick_direction)
It indicates price fluctuation relative to the last trade.
PlusTick - price rise ZeroPlusTick - trade occurs at the same price as the previous trade, which occurred at a price higher than that for the trade preceding it MinusTick - price drop ZeroMinusTick - trade occurs at the same price as the previous trade, which occurred at a price lower than that for the trade preceding it
const ( TickPlus TickDirection = "TickPlus" TickZeroPlus TickDirection = "TickZeroPlus" TickMinus TickDirection = "TickMinus" TickZeroMinus TickDirection = "TickZeroMinus" )
type TimeInForce ¶
type TimeInForce string
Time in force (time_in_force) (https://bybit-exchange.github.io/docs/futuresV2/inverse/#time-in-force-time_in_force)
const ( GoodTillCancel TimeInForce = "GoodTillCancel" ImmediateOrCancel TimeInForce = "ImmediateOrCancel" FillOrKill TimeInForce = "FillOrKill" PostOnly TimeInForce = "FillOrKill" )
type TopicMessage ¶
type TopicName ¶
type TopicName string
const ( TopicOrderBook25 TopicName = "orderBookL2_25" TopicOrderBook200 TopicName = "orderBook_200" TopicTrade TopicName = "trade" TopicInsurance TopicName = "insurance" TopicInstrument TopicName = "instrument_info" TopicKline TopicName = "klineV2" TopicLiquidation TopicName = "liquidation" )
public:
type TpSlMode ¶
type TpSlMode string
TP/SL mode (tp_sl_mode) (https://bybit-exchange.github.io/docs/futuresV2/inverse/#tp-sl-mode-tp_sl_mode)
Take profit/stop loss mode
Full - Full take profit/stop loss mode (a single TP order and a single SL order can be placed, covering the entire position) Partial - Partial take profit/stop loss mode (multiple TP and SL orders can be placed, covering portions of the position)
type TpSlModeSwitch ¶
type TpSlModeSwitch struct { Symbol string `param:"symbol"` TpSlMode *TpSlMode `param:"tp_sl_mode"` }
Full/Partial Position TP/SL Switch (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-switchmode)
Switch mode between Full or Partial
type TradeRecord ¶
type TradeRecord struct { ClosedSize int `json:"closed_size"` CrossSeq int `json:"cross_seq"` ExecFee string `json:"exec_fee"` ExecID string `json:"exec_id"` ExecPrice string `json:"exec_price"` ExecQty int `json:"exec_qty"` ExecTime int64 `json:"exec_time"` ExecType ExecType `json:"exec_type"` ExecValue string `json:"exec_value"` FeeRate string `json:"fee_rate"` LastLiquidity string `json:"last_liquidity_ind"` LeavesQty int `json:"leaves_qty"` NthFill int `json:"nth_fill"` OrderID string `json:"order_id"` OrderLinkID string `json:"order_link_id"` OrderPrice string `json:"order_price"` OrderQty int `json:"order_qty"` OrderType OrderType `json:"order_type"` Side Side `json:"side"` Symbol string `json:"symbol"` UserID int `json:"user_id"` TradeTime uint64 `json:"trade_time_ms"` }
type TradeRecords ¶
type TradeRecords struct { OrderID string `json:"order_id"` TradeRecords []TradeRecord `json:"trade_list"` }
type TradeShot ¶
type TradeShot struct { Timestamp string `json:"timestamp"` TradeTime uint64 `json:"trade_time_ms"` Symbol string `json:"symbol"` Side Side `json:"side"` Size int `json:"size"` Price float64 `json:"price"` TickDirection TickDirection `json:"tick_direction"` TradeID string `json:"trade_id"` CrossSeq uint64 `json:"cross_seq"` }
type TriggerPrice ¶
type TriggerPrice string
Trigger price type (trigger_by) (https://bybit-exchange.github.io/docs/futuresV2/inverse/#trigger-price-type-trigger_by)
const ( LastPrice TriggerPrice = "LastPrice" IndexPrice TriggerPrice = "IndexPrice" MarkPrice TriggerPrice = "MarkPrice" )
type WalletBalance ¶
type WalletBalance struct {
Currency *string `param:"coin"`
}
Get Wallet Balance (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-balance)
coin string Currency alias. Returns all wallet balances if not passed
type WalletFund ¶
type WalletFund string
Wallet fund type (wallet_fund_type/type) (https://bybit-exchange.github.io/docs/futuresV2/inverse/#wallet-fund-type-wallet_fund_type-type)
ReturnServiceCash - Refund of handling fee bonus Insurance - Insurance account transfer SubMember - Parent-child account transfer Coupon - Coupon interest AccountTransfer - Account transfer CashBack - Cash back
const ( FundDeposit WalletFund = "Deposit" FundWithdraw WalletFund = "Withdraw" FundRealisedPNL WalletFund = "RealisedPNL" FundCommission WalletFund = "Commission" FundRefund WalletFund = "Refund" FundPrize WalletFund = "Prize" FundExchangeOrderWithdraw WalletFund = "ExchangeOrderWithdraw" FundExchangeOrderDeposit WalletFund = "ExchangeOrderDeposit" FundReturnServiceCash WalletFund = "ReturnServiceCash" FundInsurance WalletFund = "Insurance" FundSubMember WalletFund = "SubMember" FundCoupon WalletFund = "Coupon" FundAccountTransfer WalletFund = "AccountTransfer" FundCashBack WalletFund = "CashBack" )
type WalletShot ¶
type Withdraw ¶
type Withdraw string
Withdraw status (status) (https://bybit-exchange.github.io/docs/futuresV2/inverse/#withdraw-status-status)
type WsClient ¶
type WsClient struct {
// contains filtered or unexported fields
}
func NewWsClient ¶
func NewWsClient() *WsClient
func (*WsClient) SetOnConnected ¶
func (o *WsClient) SetOnConnected(onConnected func())
func (*WsClient) SetOnDialError ¶
func (*WsClient) SetOnDisconnected ¶
func (o *WsClient) SetOnDisconnected(onDisconnected func())
func (*WsClient) WithByTickUrl ¶
type WsDeltaExecutor ¶
type WsDeltaExecutor[T any] struct { WsExecutor[T] }
func NewWsDeltaExecutor ¶
func NewWsDeltaExecutor[T any](section *WsSection, subscription Subscription) *WsDeltaExecutor[T]
func (*WsDeltaExecutor[T]) Instant ¶
func (o *WsDeltaExecutor[T]) Instant() *WsInstant[T]
func (*WsDeltaExecutor[T]) Subscribe ¶
func (o *WsDeltaExecutor[T]) Subscribe(onShot func(T))
func (*WsDeltaExecutor[T]) SubscribeWithDelta ¶
func (o *WsDeltaExecutor[T]) SubscribeWithDelta(onShot func(T), onDelta func(Delta))
type WsExecutor ¶
type WsExecutor[T any] struct { // contains filtered or unexported fields }
func NewWsExecutor ¶
func NewWsExecutor[T any](section *WsSection, subscription Subscription) *WsExecutor[T]
func (*WsExecutor[T]) Init ¶
func (o *WsExecutor[T]) Init(section *WsSection, subscription Subscription)
func (*WsExecutor[T]) Instant ¶
func (o *WsExecutor[T]) Instant() *WsInstant[T]
func (*WsExecutor[T]) Subscribe ¶
func (o *WsExecutor[T]) Subscribe(onShot func(T))
func (*WsExecutor[T]) Unsubscribe ¶
func (o *WsExecutor[T]) Unsubscribe()
type WsExecutorInterface ¶
type WsExecutorInterface[T any] interface { Subscribe(func(T)) Unsubscribe() }
type WsInstant ¶
type WsInstant[T any] struct { // contains filtered or unexported fields }
func NewWsInstant ¶
func NewWsInstant[T any](executor WsExecutorInterface[T]) *WsInstant[T]
func (*WsInstant[T]) Unsubscribe ¶
func (o *WsInstant[T]) Unsubscribe()
type WsPrivate ¶
type WsPrivate struct { WsSection // contains filtered or unexported fields }
func (WsPrivate) Execution ¶
func (o WsPrivate) Execution() *WsExecutor[[]ExecutionShot]
func (WsPrivate) Order ¶
func (o WsPrivate) Order() *WsExecutor[[]OrderShot]
func (WsPrivate) Position ¶
func (o WsPrivate) Position() *WsExecutor[[]PositionShot]
func (WsPrivate) StopOrder ¶
func (o WsPrivate) StopOrder() *WsExecutor[[]StopOrderShot]
func (WsPrivate) Wallet ¶
func (o WsPrivate) Wallet() *WsExecutor[[]WalletShot]
type WsPublic ¶
type WsPublic struct {
WsSection
}
func NewWsPublic ¶
func (WsPublic) Instrument ¶
func (o WsPublic) Instrument(symbol string) *WsDeltaExecutor[InstrumentShot]
func (WsPublic) Insurance ¶
func (o WsPublic) Insurance() *WsExecutor[[]InsuranceShot]
func (WsPublic) Kline ¶
func (o WsPublic) Kline(symbol string, interval KlineInterval) *WsExecutor[[]KlineShot]
func (WsPublic) Liquidation ¶
func (o WsPublic) Liquidation() *WsExecutor[LiquidationShot]
func (WsPublic) OrderBook200 ¶
func (o WsPublic) OrderBook200(symbol string) *WsDeltaExecutor[[]OrderBookShot]
func (WsPublic) OrderBook25 ¶
func (o WsPublic) OrderBook25(symbol string) *WsDeltaExecutor[[]OrderBookShot]
func (WsPublic) Trade ¶
func (o WsPublic) Trade() *WsExecutor[[]TradeShot]
Source Files ¶
- account.go
- account_active.go
- account_api.go
- account_conditional.go
- account_position.go
- account_risk.go
- api.go
- client.go
- enum.go
- error.go
- market.go
- market_advanced.go
- response.go
- wallet.go
- ws_client.go
- ws_delta.go
- ws_executor.go
- ws_func.go
- ws_instant.go
- ws_private.go
- ws_public.go
- ws_section.go
- ws_subscription.go
- ws_topic.go