Documentation ¶
Overview ¶
Account Data Endpoints (https://bybit-exchange.github.io/docs/futuresV2/linear/#t-accountdata)
Active Orders (https://bybit-exchange.github.io/docs/futuresV2/linear/#t-activeorders)
Conditional Orders (https://bybit-exchange.github.io/docs/futuresV2/linear/#t-conditionalorders)
Position (https://bybit-exchange.github.io/docs/futuresV2/linear/#t-position)
Risk Limit (https://bybit-exchange.github.io/docs/futuresV2/linear/#t-risklimit)
API Data Endpoints (https://bybit-exchange.github.io/docs/futuresV2/linear/#t-api)
USDT Perpetual (https://bybit-exchange.github.io/docs/futuresV2/linear/#t-introduction)
Enums Definitions (https://bybit-exchange.github.io/docs/futuresV2/linear/#t-enums)
Market Data Endpoints (https://bybit-exchange.github.io/docs/futuresV2/linear/#t-marketdata)
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)
- type AddReduceMargin
- type AddReduceMarginResult
- type CancelAllOrders
- type CancelOrder
- type CancelType
- type Client
- func (this *Client) AddReduceMargin(v AddReduceMargin) (AddReduceMarginResult, error)
- func (this *Client) Announcement() ([]iperpetual.Announcement, error)
- func (this *Client) CancelAllConditionalOrders(symbol string) ([]string, error)
- func (this *Client) CancelAllOrders(symbol string) ([]string, error)
- func (this *Client) CancelConditionalOrder(v CancelOrder) (string, error)
- func (this *Client) CancelOrder(v CancelOrder) (string, error)
- func (this *Client) ClosedProfitLoss(v ClosedProfitLoss) (ClosedProfitLossResult, error)
- func (this *Client) ConditionalOrderList(v OrderList) (ConditionalOrderListResult, error)
- func (this *Client) Get(path string, param any, ret any) error
- func (this *Client) GetExtendedTradeRecords(v GetExtendedTradeRecords) (ExtendedTradeRecords, error)
- func (this *Client) GetLastFundingRate(symbol string) (LastFundingRate, error)
- func (this *Client) GetPosition(symbol string) ([]PositionData, error)
- func (this *Client) GetPositionAll() ([]PositionItem, error)
- func (this *Client) GetPublic(path string, param any, ret any) error
- func (this *Client) GetRiskLimit(symbol *string) ([]RiskLimitItem, error)
- func (this *Client) GetTradeRecords(v GetTradeRecords) (TradeRecords, error)
- func (this *Client) MarginSwitch(v MarginSwitch) error
- func (this *Client) OrderList(v OrderList) (OrderListResult, error)
- func (this *Client) PlaceActiveOrder(v PlaceActiveOrder) (OrderCreated, error)
- func (this *Client) PlaceConditionalOrder(v PlaceConditionalOrder) (ConditionalOrderCreated, error)
- func (this *Client) PositionModeSwitch(v PositionModeSwitch) error
- func (this *Client) Post(path string, param any, ret any) error
- func (this *Client) PublicTradingRecords(v PublicTradingRecords) ([]PublicTradingRecord, error)
- func (this *Client) QueryConditionalOrder(v QueryOrder) ([]ConditionalOrder, error)
- func (this *Client) QueryIndexKline(v QueryKline) ([]IndexKlineItem, error)
- func (this *Client) QueryKline(v QueryKline) ([]KlineItem, error)
- func (this *Client) QueryMarkKline(v QueryKline) ([]MarkKlineItem, error)
- func (this *Client) QueryOrder(v QueryOrder) ([]Order, error)
- func (this *Client) QueryPremiumKline(v QueryKline) ([]IndexKlineItem, error)
- func (this *Client) ReplaceConditionalOrder(v ReplaceConditionalOrder) (string, error)
- func (this *Client) ReplaceOrder(v ReplaceOrder) (string, error)
- func (this *Client) ServerTime() (string, error)
- func (this *Client) SetAutoAddMargin(v SetAutoAddMargin) error
- func (this *Client) SetLeverage(v SetLeverage) error
- func (this *Client) SetRiskLimit(v SetRiskLimit) (int, error)
- func (this *Client) SetTradingStop(v SetTradingStop) error
- func (this *Client) TpSlModeSwitch(v TpSlModeSwitch) (TpSlMode, error)
- func (this *Client) Transport() *transport.Client
- type ClosedData
- type ClosedProfitLoss
- type ClosedProfitLossResult
- type ConditionalOrder
- type ConditionalOrderCreated
- type ConditionalOrderItem
- type ConditionalOrderListResult
- type ContractStatus
- type ContractType
- type CreateType
- type Error
- type ExecType
- type ExecutionSnapshot
- type ExtendedTradeRecords
- type GetExtendedTradeRecords
- type GetLastFundingRate
- type GetPosition
- type GetPositionAll
- type GetRiskLimit
- type GetTradeRecords
- type IndexKlineItem
- type InstrumentDelta
- type InstrumentSnapshot
- type KlineInterval
- type KlineItem
- type KlineSnapshot
- type LastFundingRate
- type LiquidationSnapshot
- type Liquidity
- type MarginSwitch
- type MarkKlineItem
- type Order
- type OrderBookDelta
- type OrderBookSnapshot
- type OrderCreated
- type OrderList
- type OrderListResult
- type OrderSnapshot
- type OrderStatus
- type OrderType
- type PlaceActiveOrder
- type PlaceConditionalOrder
- type PositionData
- type PositionIdx
- type PositionItem
- type PositionListResult
- type PositionMode
- type PositionModeSwitch
- type PositionSnapshot
- type Price
- type PublicTradingRecord
- type PublicTradingRecords
- type Qty
- type QueryKline
- type QueryOrder
- type ReplaceConditionalOrder
- type ReplaceOrder
- type Request
- type Responce
- type Response
- type RiskLimitItem
- type SetAutoAddMargin
- type SetLeverage
- type SetRiskLimit
- type SetTradingStop
- type Side
- type SortOrder
- type StopOrder
- type StopOrderSnapshot
- type Subscription
- type TickDirection
- type TimeInForce
- type Topic
- type TopicName
- type TpSlMode
- type TpSlModeSwitch
- type TradeRecord
- type TradeRecords
- type TradeSnapshot
- type TriggerPrice
- type WalletFund
- type WalletSnapshot
- type Withdraw
- type WsClient
- func (this *WsClient) Conf() *transport.WsConf
- func (this *WsClient) Connected() bool
- func (this *WsClient) Run()
- func (this *WsClient) Send(cmd any) bool
- func (this *WsClient) SetOnAuth(onAuth func(bool))
- func (this *WsClient) SetOnConnected(onConnected func())
- func (this *WsClient) SetOnDisconnected(onConnected func())
- func (this *WsClient) Shutdown()
- func (this *WsClient) Subscribe(s Subscription) bool
- func (this *WsClient) Unsubscribe(s Subscription) bool
- func (o *WsClient) WithByTickUrl() *WsClient
- func (this *WsClient) WithLog(log *ulog.Log) *WsClient
- func (this *WsClient) WithProxy(proxy string) *WsClient
- func (o *WsClient) WithUrl(url string) *WsClient
- type WsPrivate
- func (this *WsPrivate) Conf() *transport.WsConf
- func (this *WsPrivate) Connected() bool
- func (this *WsPrivate) Run()
- func (this *WsPrivate) SetOnAuth(onAuth func(bool))
- func (this *WsPrivate) Shutdown()
- func (this *WsPrivate) SubscribeExecution() bool
- func (this *WsPrivate) SubscribeOrder() bool
- func (this *WsPrivate) SubscribePosition() bool
- func (this *WsPrivate) SubscribeStopOrder() bool
- func (this *WsPrivate) SubscribeWallet() bool
- func (this *WsPrivate) UnsubcribeExecution() bool
- func (this *WsPrivate) UnsubscribeOrder() bool
- func (this *WsPrivate) UnsubscribePosition() bool
- func (this *WsPrivate) UnsubscribeStopOrder() bool
- func (this *WsPrivate) UnsubscribeWallet() bool
- func (this *WsPrivate) WithLog(log *ulog.Log) *WsPrivate
- func (this *WsPrivate) WithProxy(proxy string) *WsPrivate
- type WsPublic
- func (this *WsPublic) Conf() *transport.WsConf
- func (this *WsPublic) Connected() bool
- func (this *WsPublic) Run()
- func (this *WsPublic) SetOnConnected(onConnected func())
- func (this *WsPublic) Shutdown()
- func (this *WsPublic) SubscribeInstrument(symbol string) bool
- func (this *WsPublic) SubscribeKline(symbol string, interval KlineInterval) bool
- func (this *WsPublic) SubscribeLiquidation(symbol string) bool
- func (this *WsPublic) SubscribeOrderBook200(symbol string) bool
- func (this *WsPublic) SubscribeOrderBook25(symbol string) bool
- func (this *WsPublic) SubscribeTrade(symbol string) bool
- func (this *WsPublic) UnsubscribeInstrument(symbol string) bool
- func (this *WsPublic) UnsubscribeKline(symbol string, interval KlineInterval) bool
- func (this *WsPublic) UnsubscribeLiquidation(symbol string) bool
- func (this *WsPublic) UnsubscribeOrderBook200(symbol string) bool
- func (this *WsPublic) UnsubscribeOrderBook25(symbol string) bool
- func (this *WsPublic) UnsubscribeTrade(symbol string) bool
- func (this *WsPublic) WithLog(log *ulog.Log) *WsPublic
- func (this *WsPublic) WithProxy(proxy string) *WsPublic
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AddReduceMargin ¶
type AddReduceMargin struct { Symbol string `param:"symbol"` Side Side `param:"side"` Margin int `param:"margin"` PositionIdx *PositionIdx `param:"position_idx"` }
Add/Reduce Margin (https://bybit-exchange.github.io/docs/futuresV2/linear/#t-addmargin)
func (AddReduceMargin) Do ¶
func (this AddReduceMargin) Do(client *Client) (AddReduceMarginResult, error)
type AddReduceMarginResult ¶
type AddReduceMarginResult struct { Position PositionListResult `json:"PositionListResult"` WalletBalance float64 `json:"wallet_balance"` AvailableBalance float64 `json:"available_balance"` }
type CancelAllOrders ¶
type CancelAllOrders struct {
Symbol string `param:"symbol"`
}
Cancel All Active Orders (https://bybit-exchange.github.io/docs/futuresV2/linear/#t-cancelallactive)
func (CancelAllOrders) DoConditional ¶
func (this CancelAllOrders) DoConditional(client *Client) ([]string, error)
Cancel All Conditional Orders (https://bybit-exchange.github.io/docs/futuresV2/linear/#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/linear/#t-cancelactive)
func (CancelOrder) DoConditional ¶
func (this CancelOrder) DoConditional(client *Client) (string, error)
Cancel Conditional Order (https://bybit-exchange.github.io/docs/futuresV2/linear/#t-cancelcond)
type CancelType ¶
type CancelType string
[Cancel type (cancel_type)] https://bybit-exchange.github.io/docs/futuresV2/inverse_futures/#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 Client ¶
type Client struct {
// contains filtered or unexported fields
}
USDT Perpetual HTTP client
func (*Client) AddReduceMargin ¶
func (this *Client) AddReduceMargin(v AddReduceMargin) (AddReduceMarginResult, error)
func (*Client) Announcement ¶
func (this *Client) Announcement() ([]iperpetual.Announcement, error)
Announcement (https://bybit-exchange.github.io/docs/futuresV2/linear/#t-announcement)
Get Bybit OpenAPI announcements in the last 30 days in reverse order
func (*Client) CancelAllConditionalOrders ¶
func (*Client) CancelAllOrders ¶
func (*Client) CancelConditionalOrder ¶
func (this *Client) CancelConditionalOrder(v CancelOrder) (string, error)
func (*Client) CancelOrder ¶
func (this *Client) CancelOrder(v CancelOrder) (string, error)
func (*Client) ClosedProfitLoss ¶
func (this *Client) ClosedProfitLoss(v ClosedProfitLoss) (ClosedProfitLossResult, error)
func (*Client) ConditionalOrderList ¶
func (this *Client) ConditionalOrderList(v OrderList) (ConditionalOrderListResult, error)
func (*Client) GetExtendedTradeRecords ¶
func (this *Client) GetExtendedTradeRecords(v GetExtendedTradeRecords) (ExtendedTradeRecords, error)
func (*Client) GetLastFundingRate ¶
func (this *Client) GetLastFundingRate(symbol string) (LastFundingRate, error)
func (*Client) GetPosition ¶
func (this *Client) GetPosition(symbol string) ([]PositionData, error)
func (*Client) GetPositionAll ¶
func (this *Client) GetPositionAll() ([]PositionItem, error)
func (*Client) GetRiskLimit ¶
func (this *Client) GetRiskLimit(symbol *string) ([]RiskLimitItem, error)
func (*Client) GetTradeRecords ¶
func (this *Client) GetTradeRecords(v GetTradeRecords) (TradeRecords, error)
func (*Client) MarginSwitch ¶
func (this *Client) MarginSwitch(v MarginSwitch) error
func (*Client) PlaceActiveOrder ¶
func (this *Client) PlaceActiveOrder(v PlaceActiveOrder) (OrderCreated, error)
func (*Client) PlaceConditionalOrder ¶
func (this *Client) PlaceConditionalOrder(v PlaceConditionalOrder) (ConditionalOrderCreated, error)
func (*Client) PositionModeSwitch ¶
func (this *Client) PositionModeSwitch(v PositionModeSwitch) error
func (*Client) PublicTradingRecords ¶
func (this *Client) PublicTradingRecords(v PublicTradingRecords) ([]PublicTradingRecord, error)
func (*Client) QueryConditionalOrder ¶
func (this *Client) QueryConditionalOrder(v QueryOrder) ([]ConditionalOrder, error)
func (*Client) QueryIndexKline ¶
func (this *Client) QueryIndexKline(v QueryKline) ([]IndexKlineItem, error)
func (*Client) QueryKline ¶
func (this *Client) QueryKline(v QueryKline) ([]KlineItem, error)
func (*Client) QueryMarkKline ¶
func (this *Client) QueryMarkKline(v QueryKline) ([]MarkKlineItem, error)
func (*Client) QueryOrder ¶
func (this *Client) QueryOrder(v QueryOrder) ([]Order, error)
func (*Client) QueryPremiumKline ¶
func (this *Client) QueryPremiumKline(v QueryKline) ([]IndexKlineItem, error)
func (*Client) ReplaceConditionalOrder ¶
func (this *Client) ReplaceConditionalOrder(v ReplaceConditionalOrder) (string, error)
func (*Client) ReplaceOrder ¶
func (this *Client) ReplaceOrder(v ReplaceOrder) (string, error)
func (*Client) ServerTime ¶
Server Time (https://bybit-exchange.github.io/docs/futuresV2/linear/#t-servertime)
func (*Client) SetAutoAddMargin ¶
func (this *Client) SetAutoAddMargin(v SetAutoAddMargin) error
func (*Client) SetLeverage ¶
func (this *Client) SetLeverage(v SetLeverage) error
func (*Client) SetRiskLimit ¶
func (this *Client) SetRiskLimit(v SetRiskLimit) (int, error)
func (*Client) SetTradingStop ¶
func (this *Client) SetTradingStop(v SetTradingStop) error
func (*Client) TpSlModeSwitch ¶
func (this *Client) TpSlModeSwitch(v TpSlModeSwitch) (TpSlMode, error)
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/linear/#t-closedprofitandloss)
func (ClosedProfitLoss) Do ¶
func (this ClosedProfitLoss) Do(client *Client) (ClosedProfitLossResult, error)
type ClosedProfitLossResult ¶
type ClosedProfitLossResult struct { CurrentPage int `json:"current_page"` Data []ClosedData `json:"data"` }
type ConditionalOrder ¶
type ConditionalOrder struct { ConditionalOrderItem ReduceOnly bool `json:"reduce_only"` CloseOnTrigger bool `json:"close_on_trigger"` }
type ConditionalOrderCreated ¶
type ConditionalOrderCreated struct { ConditionalOrder PositionIdx PositionIdx `json:"position_idx"` }
type ConditionalOrderItem ¶
type ConditionalOrderItem struct { OrderID string `json:"stop_order_id"` 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"` OrderStatus OrderStatus `json:"order_status"` TriggerPrice float64 `json:"trigger_price"` OrderLinkID string `json:"order_link_id"` CreatedTime string `json:"created_time"` UpdatedTime string `json:"updated_time"` BasePrice float64 `json:"base_price"` TriggerBy TriggerPrice `json:"trigger_by"` TpTrigger TriggerPrice `json:"tp_trigger_by"` SlTrigger TriggerPrice `json:"sl_trigger_by"` TakeProfit float64 `json:"take_profit"` StopLoss float64 `json:"stop_loss"` }
type ConditionalOrderListResult ¶
type ConditionalOrderListResult struct { Items []ConditionalOrderItem `json:"data"` CurrentPage int `json:"current_page"` }
type ContractStatus ¶
type ContractStatus string
Contract Status (status) (https://bybit-exchange.github.io/docs/futuresV2/linear/#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/linear/#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_futures/#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 ExecType ¶
type ExecType string
Exec type (exec_type) (https://bybit-exchange.github.io/docs/futuresV2/inverse_futures/#exec-type-exec_type)
type ExecutionSnapshot ¶
type ExecutionSnapshot 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 ExtendedTradeRecords ¶
type ExtendedTradeRecords struct { PageToken string `json:"page_token"` Data []TradeRecord `json:"data"` }
type GetExtendedTradeRecords ¶
type GetExtendedTradeRecords struct { Symbol string `param:"symbol"` StartTime *int `param:"start_time"` EndTime *int `param:"end_time"` ExecType *ExecType `json:"exec_type"` Limit *int `param:"limit"` // contains filtered or unexported fields }
Extended User Trade Records (https://bybit-exchange.github.io/docs/futuresV2/linear/#t-userhistorytraderecords)
Get user's trading records
func (GetExtendedTradeRecords) Do ¶
func (this GetExtendedTradeRecords) Do(client *Client) (ExtendedTradeRecords, error)
type GetLastFundingRate ¶
type GetLastFundingRate struct {
Symbol string `param:"symbol"`
}
Get the Last Funding Rate (https://bybit-exchange.github.io/docs/futuresV2/linear/#t-fundingrate)
The funding rate is generated every 8 hours at 00:00 UTC, 08:00 UTC and 16:00 UTC. For example, if a request is sent at 12:00 UTC, the funding rate generated earlier that day at 08:00 UTC will be sent
func (GetLastFundingRate) Do ¶
func (this GetLastFundingRate) Do(client *Client) (LastFundingRate, error)
type GetPosition ¶
type GetPosition struct {
Symbol string `param:"symbol"`
}
func (GetPosition) Do ¶
func (this GetPosition) Do(client *Client) ([]PositionData, error)
type GetPositionAll ¶
type GetPositionAll struct { }
My Position (https://bybit-exchange.github.io/docs/futuresV2/inverse_futures/#t-myposition)
func (GetPositionAll) Do ¶
func (this GetPositionAll) Do(client *Client) ([]PositionItem, error)
type GetRiskLimit ¶
type GetRiskLimit struct {
Symbol *string `param:"symbol"`
}
Get Risk Limit (https://bybit-exchange.github.io/docs/futuresV2/linear/#t-getrisklimit)
func (GetRiskLimit) Do ¶
func (this GetRiskLimit) Do(client *Client) ([]RiskLimitItem, error)
type GetTradeRecords ¶
type GetTradeRecords struct { Symbol string `param:"symbol"` StartTime *int `param:"start_time"` EndTime *int `param:"end_time"` ExecType *ExecType `json:"exec_type"` Page *int `param:"page"` Limit *int `param:"limit"` }
Get User Trade Records (https://bybit-exchange.github.io/docs/futuresV2/linear/#t-usertraderecords)
Get user's trading records
func (GetTradeRecords) Do ¶
func (this GetTradeRecords) Do(client *Client) (TradeRecords, error)
type IndexKlineItem ¶
type InstrumentDelta ¶
type InstrumentSnapshot ¶
type InstrumentSnapshot struct { ID uint64 `json:"id"` Symbol string `json:"symbol"` LastPriceE4 string `json:"last_price_e4"` LastPrice string `json:"last_price"` Bid1PriceE4 string `json:"bid1_price_e4"` Bid1Price string `json:"bid1_price"` Ask1PriceE4 string `json:"ask1_price_e4"` Ask1Price string `json:"ask1_price"` LastTickDirection TickDirection `json:"last_tick_direction"` PrevPrice24hE4 string `json:"prev_price_24h_e4"` PrevPrice24h string `json:"prev_price_24h"` HighPrice24hE4 string `json:"high_price_24h_e4"` HighPrice24h string `json:"high_price_24h"` LowPrice24hE4 string `json:"low_price_24h_e4"` LowPrice24h string `json:"low_price_24h"` PrevPrice1hE4 string `json:"prev_price_1h_e4"` PrevPrice1h string `json:"prev_price_1h"` MarkPriceE4 string `json:"mark_price_e4"` MarkPrice string `json:"mark_price"` IndexPriceE4 string `json:"index_price_e4"` IndexPrice string `json:"index_price"` OpenInterest string `json:"open_interest"` OpenValueE8 string `json:"open_value_e8"` TotalTurnoverE8 string `json:"total_turnover_e8"` Turnover24hE8 string `json:"turnover_24h_e8"` TotalVolume string `json:"total_volume"` Volume24h string `json:"volume_24h"` FundingRateE6 string `json:"funding_rate_e6"` PredictedFundingRateE6 string `json:"predicted_funding_rate_e6"` CrossSeq string `json:"cross_seq"` CreatedAt string `json:"created_at"` UpdatedAt string `json:"updated_at"` NextFundingTime string `json:"next_funding_time"` CountdownHour string `json:"countdown_hour"` FundingRateInterval string `json:"funding_rate_interval"` SettleTimeE9 string `json:"settle_time_e9"` DelistingStatus string `json:"delisting_status"` }
type KlineInterval ¶
type KlineInterval string
Kline interval (interval) (https://bybit-exchange.github.io/docs/futuresV2/inverse_futures/#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 KlineItem ¶
type KlineItem struct { ID int `json:"id"` Symbol string `json:"symbol"` Period KlineInterval `json:"period"` StartAt uint64 `json:"start_at"` Volume float64 `json:"volume"` Open string `json:"open"` High string `json:"high"` Low string `json:"low"` Close string `json:"close"` Interval KlineInterval `json:"interval"` OpenTime uint64 `json:"open_time"` Turnover string `json:"turnover"` }
type KlineSnapshot ¶
type KlineSnapshot struct { Start uint64 `json:"start"` End uint64 `json:"end"` Period KlineInterval `json:"period"` Open float64 `json:"open"` Close float64 `json:"close"` High float64 `json:"high"` Low float64 `json:"low"` Volume string `json:"volume"` Turnover string `json:"turnover"` Confirm bool `json:"confirm"` CrossSeq float64 `json:"cross_seq"` Timestamp uint64 `json:"timestamp"` }
type LastFundingRate ¶
type LiquidationSnapshot ¶
type Liquidity ¶
type Liquidity string
Liquidity type (last_liquidity_ind) (https://bybit-exchange.github.io/docs/futuresV2/inverse_futures/#liquidity-type-last_liquidity_ind)
AddedLiquidity - liquidity maker RemovedLiquidity - liquidity Taker
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/linear/#t-marginswitch)
Switch Cross/Isolated; must set leverage value when switching from Cross to Isolated
func (MarginSwitch) Do ¶
func (this MarginSwitch) Do(client *Client) error
type MarkKlineItem ¶
type Order ¶
type Order struct { OrderID string `json:"order_id"` 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"` OrderStatus OrderStatus `json:"order_status"` LastExecPrice string `json:"last_exec_price"` CumExecQty float64 `json:"cum_exec_qty"` CumExecValue float64 `json:"cum_exec_value"` CumExecFee float64 `json:"cum_exec_fee"` ReduceOnly bool `json:"reduce_only"` CloseOnTrigger bool `json:"close_on_trigger"` OrderLinkID string `json:"order_link_id"` CreatedTime string `json:"created_time"` UpdatedTime string `json:"updated_time"` TakeProfit float64 `json:"take_profit"` StopLoss float64 `json:"stop_loss"` TpTrigger TriggerPrice `json:"tp_trigger_by"` SlTrigger TriggerPrice `json:"sl_trigger_by"` }
type OrderBookDelta ¶
type OrderBookSnapshot ¶
type OrderCreated ¶
type OrderCreated struct { Order PositionIdx PositionIdx `json:"position_idx"` }
type OrderList ¶
type OrderList struct { Symbol string `param:"symbol"` OrderID *string `param:"order_id"` OrderLinkID *string `param:"order_link_id"` Order *SortOrder `param:"order"` Page *int `param:"page"` Limit *int `param:"limit"` OrderStatus *OrderStatus `param:"order_status"` }
Get Active Order (https://bybit-exchange.github.io/docs/futuresV2/linear/#t-getactive)
func (OrderList) DoConditional ¶
func (this OrderList) DoConditional(client *Client) (ConditionalOrderListResult, error)
Get Conditional Order (https://bybit-exchange.github.io/docs/futuresV2/linear/#t-getcond)
type OrderListResult ¶
type OrderSnapshot ¶
type OrderSnapshot 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 float64 `json:"price"` Qty string `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 string `json:"cum_exec_value"` CumExecFee string `json:"cum_exec_fee"` Timestamp string `json:"timestamp"` TakeProfit float64 `json:"take_profit"` TpTrigger TriggerPrice `json:"tp_trigger_by"` SlTrigger TriggerPrice `json:"sl_trigger_by"` StopLoss float64 `json:"stop_loss"` TrailingStop string `json:"trailing_stop"` LastExecPrice string `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_futures/#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/linear/#order-type-order_type)
type PlaceActiveOrder ¶
type PlaceActiveOrder struct { Side Side `param:"side"` Symbol string `param:"symbol"` OrderType OrderType `param:"order_type"` Qty int `param:"qty"` TimeInForce TimeInForce `param:"time_in_force"` ReduceOnly bool `param:"reduce_only"` CloseOnTrigger bool `param:"close_on_trigger"` Price *float64 `param:"price"` 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"` PositionIdx *PositionIdx `param:"position_idx"` }
Place Active Order (https://bybit-exchange.github.io/docs/futuresV2/linear/#t-placeactive)
func (*PlaceActiveOrder) Do ¶
func (this *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 int `param:"qty"` BasePrice string `param:"base_price"` StopPx string `param:"stop_px"` TimeInForce TimeInForce `param:"time_in_force"` TriggerBy TriggerPrice `param:"trigger_by"` ReduceOnly bool `param:"reduce_only"` CloseOnTrigger bool `param:"close_on_trigger"` Price *float64 `param:"price"` 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"` PositionIdx *PositionIdx `param:"position_idx"` }
Place Conditional Order (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-placecond)
func (*PlaceConditionalOrder) Do ¶
func (this *PlaceConditionalOrder) Do(client *Client) (ConditionalOrderCreated, error)
type PositionData ¶
type PositionData struct { UserID int `json:"user_id"` Symbol string `json:"symbol"` Side Side `json:"side"` Size int `json:"size"` PositionValue float64 `json:"position_value"` EntryPrice float64 `json:"entry_price"` LiqPrice float64 `json:"liq_price"` BustPrice float64 `json:"bust_price"` Leverage float64 `json:"leverage"` AutoAddMargin int `json:"auto_add_margin"` IsIsolated bool `json:"is_isolated"` PositionMargin float64 `json:"position_margin"` OccClosingFee float64 `json:"occ_closing_fee"` RealisedPnl float64 `json:"realised_pnl"` CumRealisedPnl float64 `json:"cum_realised_pnl"` FreeQty float64 `json:"free_qty"` TpSlMode TpSlMode `json:"tp_sl_mode"` UnrealisedPnl int `json:"unrealised_pnl"` DeleverageIndicator int `json:"deleverage_indicator"` RiskID int `json:"risk_id"` StopLoss float64 `json:"stop_loss"` TakeProfit float64 `json:"take_profit"` TrailingStop float64 `json:"trailing_stop"` PositionIdx PositionIdx `json:"position_idx"` Mode string `json:"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 PositionListResult ¶
type PositionListResult struct { PositionData TpTrigger TriggerPrice `json:"tp_trigger_by"` SlTrigger TriggerPrice `json:"sl_trigger_by"` }
type PositionMode ¶
type PositionMode string
const ( MergedSingle PositionMode = "MergedSingle" BothSide PositionMode = "BothSide" )
type PositionModeSwitch ¶
type PositionModeSwitch struct { Mode PositionMode `param:"mode"` Symbol *string `param:"symbol"` Currency *string `param:"coin"` }
Position Mode Switch (https://bybit-exchange.github.io/docs/futuresV2/linear/#t-switchpositionmode)
func (PositionModeSwitch) Do ¶
func (this PositionModeSwitch) Do(client *Client) error
type PositionSnapshot ¶
type PositionSnapshot struct { UserID int `json:"user_id"` Symbol string `json:"symbol"` Size int `json:"size"` Side Side `json:"side"` PositionValue string `json:"position_value"` EntryPrice string `json:"entry_price"` LiqPrice string `json:"liq_price"` BustPrice string `json:"bust_price"` Leverage string `json:"leverage"` OrderMargin string `json:"order_margin"` PositionMargin string `json:"position_margin"` AvailableBalance string `json:"available_balance"` TakeProfit string `json:"take_profit"` StopLoss string `json:"stop_loss"` RealisedPnl string `json:"realised_pnl"` TrailingStop string `json:"trailing_stop"` TrailingActive string `json:"trailing_active"` WalletBalance string `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/linear/#price-price)
type PublicTradingRecord ¶
type PublicTradingRecords ¶
Public Trading Records (https://bybit-exchange.github.io/docs/futuresV2/linear/#t-publictradingrecords)
symbol Required string Symbol limit integer Limit for data size, max size is 1000. Default size is 500
func (PublicTradingRecords) Do ¶
func (this PublicTradingRecords) Do(client *Client) ([]PublicTradingRecord, error)
type Qty ¶
type Qty uint64
Quantity (qty) (https://bybit-exchange.github.io/docs/futuresV2/linear/#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/linear/#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 (this QueryKline) DoIndex(client *Client) ([]IndexKlineItem, error)
Query Index Price Kline (https://bybit-exchange.github.io/docs/futuresV2/linear/#t-queryindexpricekline)
Index price kline. Tracks BTC spot prices, with a frequency of every second
func (QueryKline) DoMark ¶
func (this QueryKline) DoMark(client *Client) ([]MarkKlineItem, error)
Query Mark Price Kline (https://bybit-exchange.github.io/docs/futuresV2/linear/#t-markpricekline)
Query mark price kline (like Query Kline but for mark price)
func (QueryKline) DoPremium ¶
func (this QueryKline) DoPremium(client *Client) ([]IndexKlineItem, error)
Query Premium Index Kline (https://bybit-exchange.github.io/docs/futuresV2/linear/#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/linear/#t-queryactive)
func (QueryOrder) Do ¶
func (this QueryOrder) Do(client *Client) ([]Order, error)
When only symbol is passed, the response uses a different structure.
func (QueryOrder) DoConditional ¶
func (this QueryOrder) DoConditional(client *Client) ([]ConditionalOrder, error)
Query Conditional Order (real-time) (https://bybit-exchange.github.io/docs/futuresV2/linear/#t-querycond)
When only symbol is passed, the response uses a different structure.
func (QueryOrder) OnlySymbol ¶
func (this 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/linear/#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/linear/#t-replaceactive)
type RiskLimitItem ¶
type RiskLimitItem struct { ID int `json:"id"` Symbol string `json:"symbol"` Limit int `json:"limit"` MaintainMargin float64 `json:"maintain_margin"` StartingMargin float64 `json:"starting_margin"` Section []string `json:"section"` IsLowestRisk int `json:"is_lowest_risk"` CreatedAt string `json:"created_at"` UpdatedAt string `json:"updated_at"` MaxLeverage float64 `json:"max_leverage"` }
type SetAutoAddMargin ¶
type SetAutoAddMargin struct { Symbol string `param:"symbol"` Side Side `param:"side"` AutoAddMargin bool `param:"auto_add_margin"` PositionIdx *PositionIdx `param:"position_idx"` }
Set Auto Add Margin (https://bybit-exchange.github.io/docs/futuresV2/linear/#t-setautoaddmargin)
func (SetAutoAddMargin) Do ¶
func (this SetAutoAddMargin) Do(client *Client) error
type SetLeverage ¶
type SetLeverage struct { Symbol string `param:"symbol"` BuyLeverage int `param:"buy_leverage"` SellLeverage int `param:"sell_leverage"` }
Set Leverage (https://bybit-exchange.github.io/docs/futuresV2/linear/#t-setleverage)
func (SetLeverage) Do ¶
func (this SetLeverage) Do(client *Client) error
type SetRiskLimit ¶
type SetRiskLimit struct { Symbol string `param:"symbol"` Side Side `param:"side"` RiskID int `param:"risk_id"` PositionIdx *PositionIdx `param:"position_idx"` }
Set Risk Limit (https://bybit-exchange.github.io/docs/futuresV2/linear/#t-setrisklimit)
symbol Required string Symbol risk_id Required integer Risk ID
type SetTradingStop ¶
type SetTradingStop struct { Symbol string `param:"symbol"` Side Side `param:"side"` 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"` SlSize *int `param:"sl_size"` TpSize *int `param:"tp_size"` PositionIdx *PositionIdx `param:"position_idx"` }
Set Trading-Stop (https://bybit-exchange.github.io/docs/futuresV2/linear/#t-tradingstop)
func (SetTradingStop) Do ¶
func (this SetTradingStop) Do(client *Client) error
type Side ¶
type Side string
Side (side) (https://bybit-exchange.github.io/docs/futuresV2/linear/#side-side)
type SortOrder ¶
type SortOrder string
Order (order) (https://bybit-exchange.github.io/docs/futuresV2/linear/#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_futures/#stop-order-type-stop_order_type)
type StopOrderSnapshot ¶
type StopOrderSnapshot 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) Request ¶
func (this *Subscription) Request(operation string) Request
func (*Subscription) String ¶
func (this *Subscription) String() string
type TickDirection ¶
type TickDirection string
Tick direction type (tick_direction) (https://bybit-exchange.github.io/docs/futuresV2/inverse_futures/#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/linear/#time-in-force-time_in_force)
const ( GoodTillCancel TimeInForce = "GoodTillCancel" ImmediateOrCancel TimeInForce = "ImmediateOrCancel" FillOrKill TimeInForce = "FillOrKill" PostOnly TimeInForce = "FillOrKill" )
type TopicName ¶
type TopicName string
const ( // public: TopicOrderBook25 TopicName = "orderBookL2_25" TopicOrderBook200 TopicName = "orderBook_200" TopicTrade TopicName = "trade" TopicInstrument TopicName = "instrument_info" TopicKline TopicName = "candle" TopicLiquidation TopicName = "liquidation" // private: TopicPosition TopicName = "position" TopicExecution TopicName = "execution" TopicOrder TopicName = "order" TopicStopOrder TopicName = "stop_order" TopicWallet TopicName = "wallet" )
type TpSlMode ¶
type TpSlMode string
TP/SL mode (tp_sl_mode) (https://bybit-exchange.github.io/docs/futuresV2/inverse_futures/#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/linear/#t-switchmode)
Switch mode between Full or Partial
type TradeRecord ¶
type TradeRecord struct { OrderID string `json:"order_id"` OrderLinkID string `json:"order_link_id"` Side Side `json:"side"` Symbol string `json:"symbol"` ExecID string `json:"exec_id"` OrderPrice string `json:"order_price"` OrderQty int `json:"order_qty"` OrderType OrderType `json:"order_type"` FeeRate string `json:"fee_rate"` ExecPrice string `json:"exec_price"` ExecType ExecType `json:"exec_type"` ExecQty int `json:"exec_qty"` ExecFee string `json:"exec_fee"` ExecValue string `json:"exec_value"` LeavesQty int `json:"leaves_qty"` ClosedSize int `json:"closed_size"` LastLiquidity string `json:"last_liquidity_ind"` TradeTime string `json:"trade_time"` TradeTimeMs uint64 `json:"trade_time_ms"` }
type TradeRecords ¶
type TradeRecords struct { CurrentPage int `json:"current_page"` Data []TradeRecord `json:"data"` }
type TradeSnapshot ¶
type TradeSnapshot struct { Timestamp string `json:"timestamp"` TradeTime string `json:"trade_time_ms"` Symbol string `json:"symbol"` Side Side `json:"side"` Size float64 `json:"size"` Price string `json:"price"` TickDirection TickDirection `json:"tick_direction"` TradeID string `json:"trade_id"` IsBlockTrade string `json:"is_block_trade"` }
type TriggerPrice ¶
type TriggerPrice string
Trigger price type (trigger_by) (https://bybit-exchange.github.io/docs/futuresV2/linear/#trigger-price-type-trigger_by)
const ( LastPrice TriggerPrice = "LastPrice" IndexPrice TriggerPrice = "IndexPrice" MarkPrice TriggerPrice = "MarkPrice" )
type WalletFund ¶
type WalletFund string
Wallet fund type (wallet_fund_type/type) (https://bybit-exchange.github.io/docs/futuresV2/linear/#wallet-fund-type-wallet_fund_type-type)
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" )
type WalletSnapshot ¶
type Withdraw ¶
type Withdraw string
Withdraw status (status) (https://bybit-exchange.github.io/docs/futuresV2/linear/#withdraw-status-status)
type WsClient ¶
type WsClient struct {
// contains filtered or unexported fields
}
func NewWsClient ¶
func (*WsClient) SetOnConnected ¶
func (this *WsClient) SetOnConnected(onConnected func())
func (*WsClient) SetOnDisconnected ¶
func (this *WsClient) SetOnDisconnected(onConnected func())
func (*WsClient) Subscribe ¶
func (this *WsClient) Subscribe(s Subscription) bool
func (*WsClient) Unsubscribe ¶
func (this *WsClient) Unsubscribe(s Subscription) bool
func (*WsClient) WithByTickUrl ¶
type WsPrivate ¶
type WsPrivate struct {
// contains filtered or unexported fields
}
func NewWsPrivate ¶
func (*WsPrivate) SubscribeExecution ¶
func (*WsPrivate) SubscribeOrder ¶
func (*WsPrivate) SubscribePosition ¶
func (*WsPrivate) SubscribeStopOrder ¶
func (*WsPrivate) SubscribeWallet ¶
func (*WsPrivate) UnsubcribeExecution ¶
func (*WsPrivate) UnsubscribeOrder ¶
func (*WsPrivate) UnsubscribePosition ¶
func (*WsPrivate) UnsubscribeStopOrder ¶
func (*WsPrivate) UnsubscribeWallet ¶
type WsPublic ¶
type WsPublic struct {
// contains filtered or unexported fields
}
func NewWsPublic ¶
func NewWsPublic() *WsPublic
func (*WsPublic) SetOnConnected ¶
func (this *WsPublic) SetOnConnected(onConnected func())
func (*WsPublic) SubscribeInstrument ¶
func (*WsPublic) SubscribeKline ¶
func (this *WsPublic) SubscribeKline(symbol string, interval KlineInterval) bool
func (*WsPublic) SubscribeLiquidation ¶
func (*WsPublic) SubscribeOrderBook200 ¶
func (*WsPublic) SubscribeOrderBook25 ¶
func (*WsPublic) SubscribeTrade ¶
func (*WsPublic) UnsubscribeInstrument ¶
func (*WsPublic) UnsubscribeKline ¶
func (this *WsPublic) UnsubscribeKline(symbol string, interval KlineInterval) bool