uperpetual

package
v0.3.21 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 27, 2024 License: MIT Imports: 12 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get[T any](c *Client, path string, param any) (T, error)

func GetPublic

func GetPublic[T any](c *Client, path string, param any) (T, error)

func Post

func Post[T any](c *Client, path string, param any) (T, error)

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) Do

func (this CancelAllOrders) Do(client *Client) ([]string, error)

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) Do

func (this CancelOrder) Do(client *Client) (string, error)

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 NewClient

func NewClient(client *transport.Client) *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 (this *Client) CancelAllConditionalOrders(symbol string) ([]string, error)

func (*Client) CancelAllOrders

func (this *Client) CancelAllOrders(symbol string) ([]string, error)

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) Get

func (this *Client) Get(path string, param any, ret any) 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) GetPublic

func (this *Client) GetPublic(path string, param any, ret any) 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) OrderList

func (this *Client) OrderList(v OrderList) (OrderListResult, 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) Post

func (this *Client) Post(path string, param any, ret any) 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

func (this *Client) ServerTime() (string, error)

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)

func (*Client) Transport

func (this *Client) Transport() *transport.Client

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

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 Error

type Error struct {
	transport.Err
}

type ExecType

type ExecType string

Exec type (exec_type) (https://bybit-exchange.github.io/docs/futuresV2/inverse_futures/#exec-type-exec_type)

const (
	Trade     ExecType = "Trade"
	AdlTrade  ExecType = "AdlTrade"
	Funding   ExecType = "Funding"
	BustTrade ExecType = "BustTrade"
	Settle    ExecType = "Settle"
)

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

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 IndexKlineItem struct {
	Symbol   string        `json:"symbol"`
	Interval KlineInterval `json:"period"`
	OpenTime uint64        `json:"open_time"`
	Open     string        `json:"open"`
	High     string        `json:"high"`
	Low      string        `json:"low"`
	Close    string        `json:"close"`
}

type InstrumentDelta

type InstrumentDelta struct {
	Delete []any `json:"delete"`
	Update []any `json:"update"`
	Insert []any `json:"insert"`
}

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 LastFundingRate struct {
	Symbol      string  `json:"symbol"`
	FundingRate float64 `json:"funding_rate"`
	Timestamp   string  `json:"funding_rate_timestamp"`
}

type LiquidationSnapshot

type LiquidationSnapshot struct {
	Symbol string `json:"symbol"`
	Side   Side   `json:"side"`
	Price  string `json:"price"`
	Qty    string `json:"qty"`
	Time   int64  `json:"time"`
}

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
const (
	LiquidityAdded   Liquidity = "AddedLiquidity"
	LiquidityRemoved Liquidity = "RemovedLiquidity"
)

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 MarkKlineItem struct {
	Symbol   string        `json:"symbol"`
	Interval KlineInterval `json:"period"`
	OpenTime uint64        `json:"start_at"`
	Open     int           `json:"open"`
	High     int           `json:"high"`
	Low      int           `json:"low"`
	Close    int           `json:"close"`
}

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 OrderBookDelta struct {
	Delete []any `json:"delete"`
	Update []any `json:"update"`
	Insert []any `json:"insert"`
}

type OrderBookSnapshot

type OrderBookSnapshot struct {
	Price  string  `json:"price"`
	Symbol string  `json:"symbol"`
	ID     string  `json:"id"`
	Side   Side    `json:"side"`
	Size   float64 `json:"size"`
}

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) Do

func (this OrderList) Do(client *Client) (OrderListResult, error)

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 OrderListResult struct {
	Items       []Order `json:"data"`
	CurrentPage int     `json:"current_page"`
}

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)

const (
	Limit  OrderType = "Limit"
	Market OrderType = "Market"
)

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

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 PublicTradingRecord

type PublicTradingRecord struct {
	ID           string  `json:"id"`
	Symbol       string  `json:"symbol"`
	Price        float64 `json:"price"`
	Qty          float64 `json:"qty"`
	Side         Side    `json:"side"`
	Time         string  `json:"time"`
	TradeTime    uint64  `json:"trade_time_ms"`
	IsBlockTrade bool    `json:"is_block_trade"`
}

type PublicTradingRecords

type PublicTradingRecords struct {
	Symbol string `param:"symbol"`
	Limit  *int   `param:"limit"`
}

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 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) Do

func (this QueryKline) Do(client *Client) ([]KlineItem, error)

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)

func (ReplaceConditionalOrder) Do

func (this ReplaceConditionalOrder) Do(client *Client) (string, error)

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)

func (ReplaceOrder) Do

func (this ReplaceOrder) Do(client *Client) (string, error)

type Request

type Request struct {
	Operation string   `json:"op"`
	Args      []string `json:"args"`
}

type Responce

type Responce struct {
	Success bool    `json:"success"`
	RetMsg  string  `json:"ret_msg"`
	ConnID  string  `json:"conn_id"`
	Request Request `json:"request"`
}

type Response

type Response[T any] struct {
	RetCode int    `json:"ret_code"`
	RetMsg  string `json:"ret_msg"`
	ExtCode string `json:"ext_code"`
	ExtInfo string `json:"ext_info"`
	Result  T      `json:"result"`
	TimeNow string `json:"time_now"`
}

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

func (SetRiskLimit) Do

func (this SetRiskLimit) Do(client *Client) (int, error)

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)

const (
	None Side = "None"
	Buy  Side = "Buy"
	Sell Side = "Sell"
)

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

const (
	Desc SortOrder = "desc"
	Asc  SortOrder = "asc"
)

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)

const (
	TakeProfit   StopOrder = "TakeProfit"
	StopLoss     StopOrder = "StopLoss"
	TrailingStop StopOrder = "TrailingStop"
	Stop         StopOrder = "Stop"
)

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

type Subscription struct {
	Topic    TopicName
	Interval string
	Symbol   *string
}

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 Topic

type Topic[T any] struct {
	Name string `json:"topic"`
	Data T      `json:"data"`
}

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)
const (
	TpSlFull    TpSlMode = "Full"
	TpSlPartial TpSlMode = "Partial"
)

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

func (TpSlModeSwitch) Do

func (this TpSlModeSwitch) Do(client *Client) (TpSlMode, error)

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 WalletSnapshot struct {
	UserID           uint64 `json:"user_id"`
	Coin             string `json:"coin"`
	AvailableBalance string `json:"available_balance"`
	WalletBalance    string `json:"wallet_balance"`
}

type Withdraw

type Withdraw string

Withdraw status (status) (https://bybit-exchange.github.io/docs/futuresV2/linear/#withdraw-status-status)

const (
	WithdrawToBeConfirmed Withdraw = "ToBeConfirmed"
	WithdrawUnderReview   Withdraw = "UnderReview"
	WithdrawPending       Withdraw = "Pending"
	WithdrawSuccess       Withdraw = "Success"
	WithdrawCancelByUser  Withdraw = "CancelByUser"
	WithdrawReject        Withdraw = "Reject"
	WithdrawExpire        Withdraw = "Expire"
)

type WsClient

type WsClient struct {
	// contains filtered or unexported fields
}

func NewWsClient

func NewWsClient(name string, url string) *WsClient

func (*WsClient) Conf

func (this *WsClient) Conf() *transport.WsConf

func (*WsClient) Connected

func (this *WsClient) Connected() bool

func (*WsClient) Run

func (this *WsClient) Run()

func (*WsClient) Send

func (this *WsClient) Send(cmd any) bool

func (*WsClient) SetOnAuth

func (this *WsClient) SetOnAuth(onAuth func(bool))

func (*WsClient) SetOnConnected

func (this *WsClient) SetOnConnected(onConnected func())

func (*WsClient) SetOnDisconnected

func (this *WsClient) SetOnDisconnected(onConnected func())

func (*WsClient) Shutdown

func (this *WsClient) Shutdown()

func (*WsClient) Subscribe

func (this *WsClient) Subscribe(s Subscription) bool

func (*WsClient) Unsubscribe

func (this *WsClient) Unsubscribe(s Subscription) bool

func (*WsClient) WithByTickUrl

func (o *WsClient) WithByTickUrl() *WsClient

func (*WsClient) WithLog

func (this *WsClient) WithLog(log *ulog.Log) *WsClient

func (*WsClient) WithProxy

func (this *WsClient) WithProxy(proxy string) *WsClient

func (*WsClient) WithUrl

func (o *WsClient) WithUrl(url string) *WsClient

type WsPrivate

type WsPrivate struct {
	// contains filtered or unexported fields
}

func NewWsPrivate

func NewWsPrivate(key string, secret string) *WsPrivate

func (*WsPrivate) Conf

func (this *WsPrivate) Conf() *transport.WsConf

func (*WsPrivate) Connected

func (this *WsPrivate) Connected() bool

func (*WsPrivate) Run

func (this *WsPrivate) Run()

func (*WsPrivate) SetOnAuth

func (this *WsPrivate) SetOnAuth(onAuth func(bool))

func (*WsPrivate) Shutdown

func (this *WsPrivate) Shutdown()

func (*WsPrivate) SubscribeExecution

func (this *WsPrivate) SubscribeExecution() bool

func (*WsPrivate) SubscribeOrder

func (this *WsPrivate) SubscribeOrder() bool

func (*WsPrivate) SubscribePosition

func (this *WsPrivate) SubscribePosition() bool

func (*WsPrivate) SubscribeStopOrder

func (this *WsPrivate) SubscribeStopOrder() bool

func (*WsPrivate) SubscribeWallet

func (this *WsPrivate) SubscribeWallet() bool

func (*WsPrivate) UnsubcribeExecution

func (this *WsPrivate) UnsubcribeExecution() bool

func (*WsPrivate) UnsubscribeOrder

func (this *WsPrivate) UnsubscribeOrder() bool

func (*WsPrivate) UnsubscribePosition

func (this *WsPrivate) UnsubscribePosition() bool

func (*WsPrivate) UnsubscribeStopOrder

func (this *WsPrivate) UnsubscribeStopOrder() bool

func (*WsPrivate) UnsubscribeWallet

func (this *WsPrivate) UnsubscribeWallet() bool

func (*WsPrivate) WithLog

func (this *WsPrivate) WithLog(log *ulog.Log) *WsPrivate

func (*WsPrivate) WithProxy

func (this *WsPrivate) WithProxy(proxy string) *WsPrivate

type WsPublic

type WsPublic struct {
	// contains filtered or unexported fields
}

func NewWsPublic

func NewWsPublic() *WsPublic

func (*WsPublic) Conf

func (this *WsPublic) Conf() *transport.WsConf

func (*WsPublic) Connected

func (this *WsPublic) Connected() bool

func (*WsPublic) Run

func (this *WsPublic) Run()

func (*WsPublic) SetOnConnected

func (this *WsPublic) SetOnConnected(onConnected func())

func (*WsPublic) Shutdown

func (this *WsPublic) Shutdown()

func (*WsPublic) SubscribeInstrument

func (this *WsPublic) SubscribeInstrument(symbol string) bool

func (*WsPublic) SubscribeKline

func (this *WsPublic) SubscribeKline(symbol string, interval KlineInterval) bool

func (*WsPublic) SubscribeLiquidation

func (this *WsPublic) SubscribeLiquidation(symbol string) bool

func (*WsPublic) SubscribeOrderBook200

func (this *WsPublic) SubscribeOrderBook200(symbol string) bool

func (*WsPublic) SubscribeOrderBook25

func (this *WsPublic) SubscribeOrderBook25(symbol string) bool

func (*WsPublic) SubscribeTrade

func (this *WsPublic) SubscribeTrade(symbol string) bool

func (*WsPublic) UnsubscribeInstrument

func (this *WsPublic) UnsubscribeInstrument(symbol string) bool

func (*WsPublic) UnsubscribeKline

func (this *WsPublic) UnsubscribeKline(symbol string, interval KlineInterval) bool

func (*WsPublic) UnsubscribeLiquidation

func (this *WsPublic) UnsubscribeLiquidation(symbol string) bool

func (*WsPublic) UnsubscribeOrderBook200

func (this *WsPublic) UnsubscribeOrderBook200(symbol string) bool

func (*WsPublic) UnsubscribeOrderBook25

func (this *WsPublic) UnsubscribeOrderBook25(symbol string) bool

func (*WsPublic) UnsubscribeTrade

func (this *WsPublic) UnsubscribeTrade(symbol string) bool

func (*WsPublic) WithLog

func (this *WsPublic) WithLog(log *ulog.Log) *WsPublic

func (*WsPublic) WithProxy

func (this *WsPublic) WithProxy(proxy string) *WsPublic

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL