Documentation
¶
Overview ¶
Account Data Endpoints (https://bybit-exchange.github.io/docs/futuresV2/inverse_futures/#t-accountdata)
Active Orders (https://bybit-exchange.github.io/docs/futuresV2/inverse_futures/#t-activeorders)
Conditional Orders (https://bybit-exchange.github.io/docs/futuresV2/inverse_futures/#t-conditionalorders)
Position (https://bybit-exchange.github.io/docs/futuresV2/inverse_futures/#t-position)
Risk Limit (https://bybit-exchange.github.io/docs/futuresV2/inverse_futures/#t-risklimit)
API Data Endpoints (https://bybit-exchange.github.io/docs/futuresV2/inverse_futures/#t-api)
Inverse Futures (https://bybit-exchange.github.io/docs/futuresV2/inverse_futures)
Enums Definitions (https://bybit-exchange.github.io/docs/futuresV2/inverse_futures/#t-enums)
Index ¶
- func Get[T any](c *Client, path string, param any) (T, error)
- func Post[T any](c *Client, path string, param any) (T, error)
- type CancelAllOrders
- type CancelOrder
- type CancelOrderItem
- type CancelType
- type ChangeMargin
- type Client
- func (this *Client) Announcement() ([]iperpetual.Announcement, error)
- func (this *Client) CancelAllConditionalOrders(symbol string) ([]ConditionalCancelOrderItem, error)
- func (this *Client) CancelAllOrders(symbol string) ([]CancelOrderItem, error)
- func (this *Client) CancelConditionalOrder(v CancelOrder) (string, error)
- func (this *Client) CancelOrder(v CancelOrder) (OrderCancelled, error)
- func (this *Client) ChangeMargin(v ChangeMargin) (float64, 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) GetPosition(symbol *string) ([]PositionItem, 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) QueryConditionalOrder(v QueryOrder) ([]ConditionalOrder, error)
- func (this *Client) QueryOrder(v QueryOrder) ([]Order, 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) SetLeverage(v SetLeverage) (int, error)
- func (this *Client) SetRiskLimit(v SetRiskLimit) (int, error)
- func (this *Client) SetTradingStop(v SetTradingStop) (SetTradingStopResult, error)
- func (this *Client) TpSlModeSwitch(v TpSlModeSwitch) (TpSlMode, error)
- func (this *Client) Transport() *transport.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 Direction
- type Error
- type ExecType
- type GetPosition
- type GetTradeRecords
- type KlineInterval
- type Liquidity
- type MarginSwitch
- type Order
- type OrderBase
- type OrderCancelled
- type OrderCreated
- type OrderExtFields
- type OrderItem
- type OrderList
- type OrderListResult
- type OrderMain
- type OrderProfitLoss
- type OrderStatus
- type OrderType
- type PlaceActiveOrder
- type PlaceConditionalOrder
- type PositionBase
- type PositionData
- type PositionIdx
- type PositionItem
- type PositionMode
- type PositionModeSwitch
- type Price
- type Qty
- type QueryOrder
- type ReplaceConditionalOrder
- type ReplaceOrder
- type Response
- type SetLeverage
- type SetRiskLimit
- type SetTradingStop
- type SetTradingStopExt
- type SetTradingStopResult
- type Side
- type SortOrder
- type StopOrder
- type TickDirection
- type TimeInForce
- type TpSlMode
- type TpSlModeSwitch
- type TradeRecord
- type TradeRecords
- type TriggerPrice
- type WalletFund
- type Withdraw
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CancelAllOrders ¶
type CancelAllOrders struct {
Symbol string `param:"symbol"`
}
Cancel All Active Orders (https://bybit-exchange.github.io/docs/futuresV2/inverse_futures/#t-cancelallactive)
func (CancelAllOrders) Do ¶
func (this CancelAllOrders) Do(client *Client) ([]CancelOrderItem, error)
func (CancelAllOrders) DoConditional ¶
func (this CancelAllOrders) DoConditional(client *Client) ([]ConditionalCancelOrderItem, error)
Cancel All Conditional Orders (https://bybit-exchange.github.io/docs/futuresV2/inverse_futures/#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 (this CancelOrder) Do(client *Client) (OrderCancelled, error)
func (CancelOrder) DoConditional ¶
func (this CancelOrder) DoConditional(client *Client) (string, error)
Cancel Conditional Order (https://bybit-exchange.github.io/docs/futuresV2/inverse_futures/#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"` }
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 ChangeMargin ¶
type ChangeMargin struct { Symbol string `param:"symbol"` PositionIdx PositionIdx `param:"position_idx"` Margin string `param:"margin"` }
Change Margin (https://bybit-exchange.github.io/docs/futuresV2/inverse_futures/#t-changemargin)
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Inverse Futures HTTP client
func (*Client) Announcement ¶
func (this *Client) Announcement() ([]iperpetual.Announcement, error)
Announcement (https://bybit-exchange.github.io/docs/futuresV2/inverse_futures/#t-announcement)
Get Bybit OpenAPI announcements in the last 30 days in reverse order.
func (*Client) CancelAllConditionalOrders ¶
func (this *Client) CancelAllConditionalOrders(symbol string) ([]ConditionalCancelOrderItem, error)
func (*Client) CancelAllOrders ¶
func (this *Client) CancelAllOrders(symbol string) ([]CancelOrderItem, error)
func (*Client) CancelConditionalOrder ¶
func (this *Client) CancelConditionalOrder(v CancelOrder) (string, error)
func (*Client) CancelOrder ¶
func (this *Client) CancelOrder(v CancelOrder) (OrderCancelled, error)
func (*Client) ChangeMargin ¶
func (this *Client) ChangeMargin(v ChangeMargin) (float64, 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) GetPosition ¶
func (this *Client) GetPosition(symbol *string) ([]PositionItem, 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) QueryConditionalOrder ¶
func (this *Client) QueryConditionalOrder(v QueryOrder) ([]ConditionalOrder, error)
func (*Client) QueryOrder ¶
func (this *Client) QueryOrder(v QueryOrder) ([]Order, 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/inverse_futures/#t-servertime)
func (*Client) SetLeverage ¶
func (this *Client) SetLeverage(v SetLeverage) (int, error)
func (*Client) SetRiskLimit ¶
func (this *Client) SetRiskLimit(v SetRiskLimit) (int, error)
func (*Client) SetTradingStop ¶
func (this *Client) SetTradingStop(v SetTradingStop) (SetTradingStopResult, 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/inverse_futures/#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 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 { 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_futures/#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_futures/#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 GetPosition ¶
type GetPosition struct {
Symbol *string `param:"symbol"`
}
My Position (https://bybit-exchange.github.io/docs/futuresV2/inverse_futures/#t-myposition)
func (GetPosition) Do ¶
func (this GetPosition) Do(client *Client) ([]PositionItem, 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_futures/#t-usertraderecords)
Get user's trading records. The results are ordered in ascending order (the first item is the oldest).
func (GetTradeRecords) Do ¶
func (this GetTradeRecords) Do(client *Client) (TradeRecords, error)
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 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/inverse_futures/#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 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 OrderCancelled ¶
type OrderCreated ¶
type OrderCreated struct { OrderCancelled OrderProfitLoss }
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_futures/#t-getactive)
symbol Required string Name of the trading pair order_status string Queries orders of all statuses if order_status not provided. If you want to query orders with specific statuses, you can pass the order_status split by ',' (eg Filled,New). direction string Search direction. prev: prev page, next: next page. Defaults to next limit integer Limit for data size per page, max size is 50. Default as showing 20 pieces of data per page cursor string Page turning mark. Use return cursor. Sign using origin data, in request please use urlencode
func (OrderList) DoConditional ¶
func (this OrderList) DoConditional(client *Client) (ConditionalOrderListResult, error)
Get Conditional Order (https://bybit-exchange.github.io/docs/futuresV2/inverse_futures/#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 float64 `json:"price"` Qty int `json:"qty"` TimeInForce TimeInForce `json:"time_in_force"` OrderStatus OrderStatus `json:"order_status"` LeavesQty float64 `json:"leaves_qty"` CreatedAt string `json:"created_at"` UpdatedAt string `json:"updated_at"` }
type OrderProfitLoss ¶
type OrderProfitLoss struct { TakeProfit float64 `json:"take_profit"` StopLoss float64 `json:"stop_loss"` TpTrigger TriggerPrice `json:"tp_trigger_by"` SlTrigger TriggerPrice `json:"sl_trigger_by"` }
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/inverse_futures/#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"` PositionIdx *PositionIdx `param:"position_idx"` 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_futures/#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"` TimeInForce TimeInForce `param:"time_in_force"` BasePrice string `param:"base_price"` StopPx string `param:"stop_px"` PositionIdx *PositionIdx `param:"position_idx"` 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_futures/#t-placecond)
func (*PlaceConditionalOrder) Do ¶
func (this *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 string `json:"position_value"` EntryPrice string `json:"entry_price"` IsIsolated bool `json:"is_isolated"` AutoAddMargin int `json:"auto_add_margin"` Leverage string `json:"leverage"` EffectiveLeverage string `json:"effective_leverage"` PositionMargin string `json:"position_margin"` LiqPrice string `json:"liq_price"` BustPrice string `json:"bust_price"` OccClosingFee string `json:"occ_closing_fee"` OccFundingFee string `json:"occ_funding_fee"` TakeProfit string `json:"take_profit"` StopLoss string `json:"stop_loss"` TrailingStop string `json:"trailing_stop"` PositionStatus string `json:"position_status"` DeleverageIndicator int `json:"deleverage_indicator"` OcCalcData string `json:"oc_calc_data"` OrderMargin string `json:"order_margin"` WalletBalance string `json:"wallet_balance"` RealisedPnl string `json:"realised_pnl"` CumRealisedPnl string `json:"cum_realised_pnl"` CrossSeq int `json:"cross_seq"` PositionSeq int `json:"position_seq"` CreatedAt string `json:"created_at"` UpdatedAt string `json:"updated_at"` }
type PositionData ¶
type PositionData struct { PositionBase PositionIdx PositionIdx `json:"position_idx"` Mode int `json:"mode"` UnrealisedPnl int `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 PositionMode ¶
type PositionMode int
const ( PositionOneWay PositionMode = 0 PositionHedge PositionMode = 3 )
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/inverse_futures/#t-switchpositionmode)
func (PositionModeSwitch) Do ¶
func (this PositionModeSwitch) Do(client *Client) error
type Price ¶
type Price float64
Price (price) (https://bybit-exchange.github.io/docs/futuresV2/inverse_futures/#price-price)
type Qty ¶
type Qty uint64
Quantity (qty) (https://bybit-exchange.github.io/docs/futuresV2/inverse_futures/#quantity-qty)
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_futures/#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 (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/inverse_futures/#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/inverse_futures/#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_futures/#t-replaceactive)
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/inverse_futures/#t-setleverage)
type SetRiskLimit ¶
type SetRiskLimit struct { Symbol string `param:"symbol"` RiskID int `param:"risk_id"` PositionIdx *PositionIdx `param:"position_idx"` }
Set Risk Limit (https://bybit-exchange.github.io/docs/futuresV2/inverse_futures/#t-setrisklimit)
symbol Required string Symbol risk_id Required integer Risk ID position_idx integer Position idx, used to identify positions in different position modes
type SetTradingStop ¶
type SetTradingStop struct { Symbol string `param:"symbol"` PositionIdx PositionIdx `param:"position_idx"` 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_futures/#t-tradingstop)
func (SetTradingStop) Do ¶
func (this 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_futures/#side-side)
type SortOrder ¶
type SortOrder string
Order (order) (https://bybit-exchange.github.io/docs/futuresV2/inverse_futures/#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 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/inverse_futures/#time-in-force-time_in_force)
const ( GoodTillCancel TimeInForce = "GoodTillCancel" ImmediateOrCancel TimeInForce = "ImmediateOrCancel" FillOrKill TimeInForce = "FillOrKill" PostOnly TimeInForce = "FillOrKill" )
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/inverse_futures/#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 string `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 TriggerPrice ¶
type TriggerPrice string
Trigger price type (trigger_by) (https://bybit-exchange.github.io/docs/futuresV2/inverse_futures/#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/inverse_futures/#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 Withdraw ¶
type Withdraw string
Withdraw status (status) (https://bybit-exchange.github.io/docs/futuresV2/inverse_futures/#withdraw-status-status)