iperpetual

package
v0.4.10 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Account Data Endpoints (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-accountdata)

Active Orders (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-activeorders)

API Key Info (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-key)

Conditional Orders (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-conditionalorders)

Position (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-position)

Risk Limit (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-risklimit)

API Data Endpoints (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-api)

Inverse Perpetual (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-introduction)

Enums Definitions (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-enums)

Market Data Endpoints (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-marketdata)

Advanced Data (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-advanceddata)

WebSocket Data (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-websocket)

Index

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)

func WsDeltaApply

func WsDeltaApply[T any](v *T, delta Delta)

Apply delta

func WsDeltaSetValue

func WsDeltaSetValue[T any](s *T, name string, v any)

Set delta value by name in struct

func WsDeltaUpdate

func WsDeltaUpdate[T any](s *T, delta Delta)

Apply delta to struct

func WsFunc

func WsFunc[T any, F func(T)](m []byte, f F) error

func WsFuncDelta

func WsFuncDelta[T any, F func(T), TD any, FD func(TD)](m []byte, f F, delta bool, fd FD) error

Types

type Announcement

type Announcement struct {
	ID        int    `json:"id"`
	Title     string `json:"title"`
	Linkg     string `json:"link"`
	Summary   string `json:"summary"`
	CreatedAt string `json:"created_at"`
}

Announcement (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-announcement)

Get Bybit OpenAPI announcements in the last 30 days in reverse order.

type Balance

type Balance struct {
	Equity           float64 `json:"equity"`
	AvailableBalance float64 `json:"available_balance"`
	UsedMargin       float64 `json:"used_margin"`
	OrderMargin      float64 `json:"order_margin"`
	PositionMargin   float64 `json:"position_margin"`
	OccClosingFee    float64 `json:"occ_closing_fee"`
	OccFundingFee    float64 `json:"occ_funding_fee"`
	WalletBalance    float64 `json:"wallet_balance"`
	RealisedPnl      float64 `json:"realised_pnl"`
	UnrealisedPnl    float64 `json:"unrealised_pnl"`
	CumRealisedPnl   float64 `json:"cum_realised_pnl"`
	GivenCash        float64 `json:"given_cash"`
	ServiceCash      float64 `json:"service_cash"`
}

type CancelAllOrders

type CancelAllOrders struct {
	Symbol string `param:"symbol"`
}

Cancel All Active Orders (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-cancelallactive)

func (CancelAllOrders) Do

func (o CancelAllOrders) Do(client *Client) ([]CancelOrderItem, error)

func (CancelAllOrders) DoConditional

func (o CancelAllOrders) DoConditional(client *Client) ([]ConditionalCancelOrderItem, error)

Cancel All Conditional Orders (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-cancelallcond)

type CancelOrder

type CancelOrder struct {
	Symbol      string  `param:"symbol"`
	OrderId     *string `param:"order_id"`
	OrderLinkId *string `param:"order_link_id"`
}

Cancel Active Order (https://bybit-exchange.github.io/docs/futuresV2/inverse_futures/#t-cancelactive)

func (CancelOrder) Do

func (o CancelOrder) Do(client *Client) (OrderCancelled, error)

func (CancelOrder) DoConditional

func (o CancelOrder) DoConditional(client *Client) (string, error)

Cancel Conditional Order (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-cancelcond)

type CancelOrderItem

type CancelOrderItem struct {
	OrderMain
	OrderID     string      `json:"clOrdID"`
	LeavesValue string      `json:"leaves_value"`
	CreateType  CreateType  `json:"create_type"`
	CancelType  CancelType  `json:"cancel_type"`
	CrossStatus OrderStatus `json:"cross_status"`
	CrossSeq    int         `json:"cross_seq"`
	OrderLinkID string      `оыщт:"order_link_id"`
}

type CancelType

type CancelType string

Cancel type (cancel_type) (https://bybit-exchange.github.io/docs/futuresV2/inverse/#cancel-type-cancel_type)

CancelByPrepareLiq, CancelAllBeforeLiq - canceled due to liquidation
CancelByPrepareAdl, CancelAllBeforeAdl - canceled due to ADL
CancelByTpSlTsClear - TP/SL order canceled successfully
CancelByPzSideCh - order has been canceled after TP/SL is triggered
const (
	CancelByUser        CancelType = "CancelByUser"
	CancelByReduceOnly  CancelType = "CancelByReduceOnly"
	CancelByPrepareLiq  CancelType = "CancelByPrepareLiq"
	CancelAllBeforeLiq  CancelType = "CancelAllBeforeLiq"
	CancelByPrepareAdl  CancelType = "CancelByPrepareAdl"
	CancelAllBeforeAdl  CancelType = "CancelAllBeforeAdl"
	CancelByAdmin       CancelType = "CancelByAdmin"
	CancelByTpSlTsClear CancelType = "CancelByTpSlTsClear"
	CancelByPzSideCh    CancelType = "CancelByPzSideCh"
)

type ChangeMargin

type ChangeMargin struct {
	Symbol string `param:"symbol"`
	Margin string `param:"margin"`
}

Change Margin (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-changemargin)

func (ChangeMargin) Do

func (o ChangeMargin) Do(client *Client) (float64, error)

type Client

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

Inverse Perpetual HTTP client

func NewClient

func NewClient(client *transport.Client) *Client

func (*Client) Announcement

func (o *Client) Announcement() ([]Announcement, error)

func (*Client) CancelAllConditionalOrders

func (o *Client) CancelAllConditionalOrders(symbol string) ([]ConditionalCancelOrderItem, error)

func (*Client) CancelAllOrders

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

func (*Client) CancelConditionalOrder

func (o *Client) CancelConditionalOrder(v CancelOrder) (string, error)

func (*Client) CancelOrder

func (o *Client) CancelOrder(v CancelOrder) (OrderCancelled, error)

func (*Client) ChangeMargin

func (o *Client) ChangeMargin(v ChangeMargin) (float64, error)

func (*Client) ClosedProfitLoss

func (o *Client) ClosedProfitLoss(v ClosedProfitLoss) (ClosedProfitLossResult, error)

func (*Client) ConditionalOrderList

func (o *Client) ConditionalOrderList(v OrderList) (ConditionalOrderListResult, error)

func (*Client) Get

func (o *Client) Get(path string, param any, ret any) error

func (*Client) GetAllPositions

func (o *Client) GetAllPositions() ([]PositionItem, error)

func (*Client) GetKeyInfo

func (o *Client) GetKeyInfo() ([]KeyInfo, error)

func (*Client) GetOnePosition

func (o *Client) GetOnePosition(symbol string) (i PositionItem, err error)

func (*Client) GetPosition

func (o *Client) GetPosition(symbol *string) ([]PositionItem, error)

func (*Client) GetPublic

func (o *Client) GetPublic(path string, param any, ret any) error

func (*Client) GetRiskLimit

func (o *Client) GetRiskLimit(symbol *string) ([]RiskLimitItem, error)

func (*Client) GetTradeRecords

func (o *Client) GetTradeRecords(v GetTradeRecords) (TradeRecords, error)

func (*Client) LatestBigDeal

func (this *Client) LatestBigDeal(v LatestBigDeal) ([]LatestBigDealItem, error)

func (*Client) LongShortRatio

func (this *Client) LongShortRatio(v LongShortRatio) ([]LongShortRatioItem, error)

func (*Client) MarginSwitch

func (o *Client) MarginSwitch(v MarginSwitch) error

func (*Client) OneSymbolLatestInformation

func (o *Client) OneSymbolLatestInformation(symbol string) (i LatestInformation, err error)

func (*Client) OpenInterest

func (this *Client) OpenInterest(v OpenInterest) ([]InterestItem, error)

func (*Client) OrderBook

func (o *Client) OrderBook(symbol string) ([]OrderBookItem, error)

func (*Client) OrderList

func (o *Client) OrderList(v OrderList) (OrderListResult, error)

func (*Client) PlaceActiveOrder

func (o *Client) PlaceActiveOrder(v PlaceActiveOrder) (OrderCreated, error)

func (*Client) PlaceConditionalOrder

func (o *Client) PlaceConditionalOrder(v PlaceConditionalOrder) (ConditionalOrderCreated, error)

func (*Client) Post

func (o *Client) Post(path string, param any, ret any) error

func (*Client) PublicTradingRecords

func (o *Client) PublicTradingRecords(v PublicTradingRecords) ([]PublicTradingRecord, error)

func (*Client) QueryConditionalOrder

func (o *Client) QueryConditionalOrder(v QueryOrder) ([]ConditionalOrder, error)

func (*Client) QueryIndexKline

func (o *Client) QueryIndexKline(v QueryKline) ([]IndexKlineItem, error)

func (*Client) QueryKline

func (o *Client) QueryKline(v QueryKline) ([]KlineItem, error)

func (*Client) QueryMarkKline

func (o *Client) QueryMarkKline(v QueryKline) ([]MarkKlineItem, error)

func (*Client) QueryOrder

func (o *Client) QueryOrder(v QueryOrder) ([]Order, error)

func (*Client) QueryOrderByID

func (o *Client) QueryOrderByID(symbol string, orderID string) (i Order, err error)

func (*Client) QueryOrderByLinkID added in v0.2.17

func (o *Client) QueryOrderByLinkID(symbol string, orderLinkID string) (i Order, err error)

func (*Client) QueryPremiumKline

func (o *Client) QueryPremiumKline(v QueryKline) ([]IndexKlineItem, error)

func (*Client) QuerySymbol

func (o *Client) QuerySymbol() ([]SymbolInfo, error)

func (*Client) QuerySymbolNames

func (o *Client) QuerySymbolNames() ([]string, error)

func (*Client) ReplaceConditionalOrder

func (o *Client) ReplaceConditionalOrder(v ReplaceConditionalOrder) (string, error)

func (*Client) ReplaceOrder

func (o *Client) ReplaceOrder(v ReplaceOrder) (string, error)

func (*Client) SetLeverage

func (o *Client) SetLeverage(v SetLeverage) (int, error)

func (*Client) SetRiskLimit

func (o *Client) SetRiskLimit(v SetRiskLimit) (int, error)

func (*Client) SetTradingStop

func (o *Client) SetTradingStop(v SetTradingStop) (SetTradingStopResult, error)

func (*Client) SymbolLatestInformation

func (o *Client) SymbolLatestInformation(symbol *string) ([]LatestInformation, error)

func (*Client) TpSlModeSwitch

func (o *Client) TpSlModeSwitch(v TpSlModeSwitch) (TpSlMode, error)

func (*Client) Transport

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

func (*Client) WalletBalance

func (o *Client) WalletBalance(currency *string) (map[string]Balance, error)

func (*Client) WithPreRateLimit

func (o *Client) WithPreRateLimit(preRateLimit int) *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/inverse/#t-closedprofitandloss)

func (ClosedProfitLoss) Do

type ClosedProfitLossResult

type ClosedProfitLossResult struct {
	CurrentPage int          `json:"current_page"`
	Data        []ClosedData `json:"data"`
}

type ConditionalCancelOrderItem

type ConditionalCancelOrderItem struct {
	ConditionalOrderProfitLoss
	OrderID           string      `json:"clOrdID"`
	CrossStatus       string      `json:"cross_status"`
	CrossSeq          int         `json:"cross_seq"`
	ExpectedDirection string      `json:"expected_direction"`
	CreateType        CreateType  `json:"create_type"`
	CancelType        CancelType  `json:"cancel_type"`
	OrderStatus       OrderStatus `json:"order_status"`
	LeavesQty         float64     `json:"leaves_qty"`
	LeavesValue       string      `json:"leaves_value"`
	StopOrderType     StopOrder   `json:"stop_order_type"`
}

type ConditionalOrder

type ConditionalOrder struct {
	ConditionalOrderProfitLoss
	CumExecQty   float64                   `json:"cum_exec_qty"`
	CumExecValue float64                   `json:"cum_exec_value"`
	CumExecFee   float64                   `json:"cum_exec_fee"`
	OrderID      string                    `json:"order_id"`
	RejectReason string                    `json:"reject_reason"`
	OrderStatus  OrderStatus               `json:"order_status"`
	LeavesQty    float64                   `json:"leaves_qty"`
	LeavesValue  string                    `json:"leaves_value"`
	CancelType   CancelType                `json:"cancel_type"`
	OrderLinkID  string                    `json:"order_link_id"`
	PositionIdx  PositionIdx               `json:"position_idx"`
	ExtFields    ConditionalOrderExtFields `json:"ext_fields"`
}

type ConditionalOrderBase

type ConditionalOrderBase struct {
	UserID      int          `json:"user_id"`
	Symbol      string       `json:"symbol"`
	Side        Side         `json:"side"`
	OrderType   OrderType    `json:"order_type"`
	Price       float64      `json:"price"`
	Qty         int          `json:"qty"`
	TimeInForce TimeInForce  `json:"time_in_force"`
	TriggerBy   TriggerPrice `json:"trigger_by"`
	StopPx      string       `json:"stop_px"`
	BasePrice   string       `json:"base_price"`
	CreatedAt   string       `json:"created_at"`
	UpdatedAt   string       `json:"updated_at"`
}

type ConditionalOrderCreated

type ConditionalOrderCreated struct {
	ConditionalOrderBase
	ConditionalOrderProfitLoss
	Remark       string  `json:"remark"`
	RejectReason string  `json:"reject_reason"`
	LeavesQty    float64 `json:"leaves_qty"`
	LeavesValue  string  `json:"leaves_value"`
	StopOrderID  string  `json:"stop_order_id"`
	OrderLinkID  string  `json:"order_link_id"`
}

type ConditionalOrderExtFields

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

type ConditionalOrderItem

type ConditionalOrderItem struct {
	ConditionalOrderProfitLoss
	StopOrderStatus OrderStatus `json:"stop_order_status"`
	StopOrderID     string      `json:"stop_order_id"`
	OrderLinkID     string      `json:"order_link_id"`
	StopOrderType   StopOrder   `json:"stop_order_type"`
	PositionIdx     PositionIdx `json:"position_idx"`
}

type ConditionalOrderListResult

type ConditionalOrderListResult struct {
	Items  []ConditionalOrderItem `json:"data"`
	Cursor string                 `json:"cursor"`
}

type ConditionalOrderProfitLoss

type ConditionalOrderProfitLoss struct {
	TakeProfit float64      `json:"take_profit"`
	StopLoss   float64      `json:"stop_loss"`
	TpTrigger  TriggerPrice `json:"tp_trigger_by"`
	SlTrigger  TriggerPrice `json:"sl_trigger_by"`
}

type ContractStatus

type ContractStatus string

Contract Status (status) (https://bybit-exchange.github.io/docs/futuresV2/inverse/#contract-status-status)

const (
	Trading  ContractStatus = "Trading"
	Settling ContractStatus = "Settling"
	Closed   ContractStatus = "Closed"
)

type ContractType

type ContractType string

Contract Type (contract_type) (https://bybit-exchange.github.io/docs/futuresV2/inverse/#contract-type-contract_type)

const (
	InversePerpetual ContractType = "InversePerpetual"
	LinearPerpetual  ContractType = "LinearPerpetual"
	InverseFutures   ContractType = "InverseFutures"
)

type CreateType

type CreateType string

Create type (create_type) (https://bybit-exchange.github.io/docs/futuresV2/inverse/#create-type-create_type)

CreateByLiq - Created by partial liquidation
CreateByAdl_PassThrough - Created by ADL
CreateByTakeOver_PassThrough - Created by liquidation takeover
const (
	CreateByUser                CreateType = "CreateByUser"
	CreateByClosing             CreateType = "CreateByClosing"
	CreateByAdminClosing        CreateType = "CreateByAdminClosing"
	CreateByStopOrder           CreateType = "CreateByStopOrder"
	CreateByTakeProfit          CreateType = "CreateByTakeProfit"
	CreateByStopLoss            CreateType = "CreateByStopLoss"
	CreateByPartialTakeProfit   CreateType = "CreateByPartialTakeProfit"
	CreateByPartialStopLoss     CreateType = "CreateByPartialStopLoss"
	CreateByTrailingStop        CreateType = "CreateByTrailingStop"
	CreateByLiq                 CreateType = "CreateByLiq"
	CreateByAdlPassThrough      CreateType = "CreateByAdl_PassThrough"
	CreateByTakeOverPassThrough CreateType = "CreateByTakeOver_PassThrough"
)

type Delta

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

func (*Delta) HasData

func (o *Delta) HasData() bool

type Direction

type Direction string
const (
	Prev Direction = "prev"
	Next Direction = "next"
)

type Error

type Error struct {
	transport.Err
}

func (*Error) ApiKeyExpired

func (o *Error) ApiKeyExpired() bool

func (*Error) ApiKeyInvalid

func (o *Error) ApiKeyInvalid() bool

func (*Error) InsufficientBalance

func (o *Error) InsufficientBalance() bool

func (*Error) KycNeeded

func (o *Error) KycNeeded() bool

func (*Error) Timeout

func (o *Error) Timeout() bool

func (*Error) TooManyVisits

func (o *Error) TooManyVisits() bool

func (*Error) UnmatchedIp

func (o *Error) UnmatchedIp() bool

type ExecType

type ExecType string

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

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

type ExecutionShot

type ExecutionShot struct {
	OrderID     string   `json:"order_id"`
	OrderLinkID string   `json:"order_link_id"`
	Symbol      string   `json:"symbol"`
	Side        Side     `json:"side"`
	ExecID      string   `json:"exec_id"`
	Price       string   `json:"price"`
	OrderQty    float64  `json:"order_qty"`
	ExecType    ExecType `json:"exec_type"`
	ExecQty     int      `json:"exec_qty"`
	ExecFee     string   `json:"exec_fee"`
	LeavesQty   float64  `json:"leaves_qty"`
	IsMaker     bool     `json:"is_maker"`
	TradeTime   string   `json:"trade_time"`
}

type GetKeyInfo

type GetKeyInfo struct {
}

func (GetKeyInfo) Do

func (o GetKeyInfo) Do(client *Client) ([]KeyInfo, error)

type GetPosition

type GetPosition struct {
	Symbol *string `param:"symbol"`
}

My Position (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-myposition)

func (GetPosition) Do

func (o GetPosition) Do(client *Client) ([]PositionItem, error)

type GetRiskLimit

type GetRiskLimit struct {
	Symbol *string `param:"symbol"`
}

Get Risk Limit (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-getrisklimit)

func (GetRiskLimit) Do

func (o GetRiskLimit) Do(client *Client) ([]RiskLimitItem, error)

type GetTradeRecords

type GetTradeRecords struct {
	Symbol    string     `param:"symbol"`
	OrderID   *string    `param:"order_id"`
	StartTime *int       `param:"start_time"`
	Page      *int       `param:"page"`
	Limit     *int       `param:"limit"`
	Order     *SortOrder `param:"order"`
}

Get User Trade Records (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-usertraderecords)

Get user's trading records. The results are ordered in ascending order (the first item is the oldest)

func (GetTradeRecords) Do

func (o GetTradeRecords) Do(client *Client) (TradeRecords, error)

type IndexKlineItem

type 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 InstrumentShot

type InstrumentShot struct {
	ID                     uint64        `json:"id"`
	Symbol                 string        `json:"symbol"`
	LastPriceE4            int64         `json:"last_price_e4"`
	LastPrice              string        `json:"last_price"`
	Bid1PriceE4            int64         `json:"bid1_price_e4"`
	Bid1Price              string        `json:"bid1_price"`
	Ask1PriceE4            int64         `json:"ask1_price_e4"`
	Ask1Price              string        `json:"ask1_price"`
	LastTickDirection      TickDirection `json:"last_tick_direction"`
	PrevPrice24hE4         int64         `json:"prev_price_24h_e4"`
	PrevPrice24h           string        `json:"prev_price_24h"`
	HighPrice24hE4         int64         `json:"high_price_24h_e4"`
	HighPrice24h           string        `json:"high_price_24h"`
	LowPrice24hE4          int64         `json:"low_price_24h_e4"`
	LowPrice24h            string        `json:"low_price_24h"`
	PrevPrice1hE4          int64         `json:"prev_price_1h_e4"`
	PrevPrice1h            string        `json:"prev_price_1h"`
	MarkPriceE4            int64         `json:"mark_price_e4"`
	MarkPrice              string        `json:"mark_price"`
	IndexPriceE4           int64         `json:"index_price_e4"`
	IndexPrice             string        `json:"index_price"`
	OpenInterest           int64         `json:"open_interest"`
	OpenValueE8            int64         `json:"open_value_e8"`
	TotalTurnoverE8        int64         `json:"total_turnover_e8"`
	Turnover24hE8          int64         `json:"turnover_24h_e8"`
	TotalVolume            int64         `json:"total_volume"`
	Volume24h              int64         `json:"volume_24h"`
	FundingRateE6          int64         `json:"funding_rate_e6"`
	PredictedFundingRateE6 int64         `json:"predicted_funding_rate_e6"`
	CrossSeq               uint64        `json:"cross_seq"`
	CreatedAt              string        `json:"created_at"`
	UpdatedAt              string        `json:"updated_at"`
	NextFundingTime        string        `json:"next_funding_time"`
	CountdownHour          uint64        `json:"countdown_hour"`
	FundingRateInterval    uint64        `json:"funding_rate_interval"`
	SettleTimeE9           uint64        `json:"settle_time_e9"`
	DelistingStatus        string        `json:"delisting_status"`
}

type InsuranceShot

type InsuranceShot struct {
	Currency      string `json:"currency"`
	Timestamp     string `json:"timestamp"`
	WalletBalance uint64 `json:"wallet_balance"`
}

type InterestItem

type InterestItem struct {
	Symbol       string `json:"symbol"`
	Timestamp    uint64 `json:"timestamp"`
	OpenInterest uint64 `json:"open_interest"`
}

type KeyInfo

type KeyInfo struct {
	ApiKey        string    `json:"api_key"`
	Type          string    `json:"type"`
	UserID        int       `json:"user_id"`
	InviterID     int       `json:"inviter_id"`
	Ips           []string  `json:"ips"`
	Note          string    `json:"note"`
	Permissions   []string  `json:"permissions"`
	CreatedAt     time.Time `json:"created_at"`
	ExpiredAt     time.Time `json:"expired_at"`
	ReadOnly      bool      `json:"read_only"`
	VipLevel      string    `json:"vip_level"`
	MktMakerLevel string    `json:"mkt_maker_level"`
	AffiliateID   int       `json:"affiliate_id"`
}

type KlineInterval

type KlineInterval string

Kline interval (interval) (https://bybit-exchange.github.io/docs/futuresV2/inverse/#kline-interval-interval)

1 - 1 minute
3 - 3 minutes
5 - 5 minutes
15 - 15 minutes
30 - 30 minutes
60 - 1 hour
120 - 2 hours
240 - 4 hours
360 - 6 hours
720 - 12 hours
D - 1 day
W - 1 week
M - 1 month
const (
	Interval1m  KlineInterval = "1"
	Interval3m  KlineInterval = "3"
	Interval5m  KlineInterval = "5"
	Interval15m KlineInterval = "15"
	Interval30m KlineInterval = "30"
	Interval1h  KlineInterval = "60"
	Interval2h  KlineInterval = "120"
	Interval4h  KlineInterval = "240"
	Interval6h  KlineInterval = "360"
	Interval12h KlineInterval = "720"
	Interval1d  KlineInterval = "D"
	Interval1w  KlineInterval = "W"
	Interval1M  KlineInterval = "M"
)

type KlineItem

type KlineItem struct {
	Symbol   string        `json:"symbol"`
	Interval KlineInterval `json:"interval"`
	OpenTime uint64        `json:"open_time"`
	Open     string        `json:"open"`
	High     string        `json:"high"`
	Low      string        `json:"low"`
	Close    string        `json:"close"`
	Volume   string        `json:"volume"`
	Turnover string        `json:"turnover"`
}

type KlineShot

type KlineShot struct {
	Start     uint64  `json:"start"`
	End       uint64  `json:"end"`
	Open      float64 `json:"open"`
	Close     float64 `json:"close"`
	High      float64 `json:"high"`
	Low       float64 `json:"low"`
	Volume    float64 `json:"volume"`
	Turnover  float64 `json:"turnover"`
	Confirm   bool    `json:"confirm"`
	CrossSeq  float64 `json:"cross_seq"`
	Timestamp uint64  `json:"timestamp"`
}

type LatestBigDeal

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

Latest Big Deal (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-marketbigdeal)

Obtain filled orders worth more than 500,000 USD within the last 24h. This endpoint may return orders which are over the maximum order qty for the symbol you call. For instance, the maximum order qty for BTCUSD is 1 million contracts, but in the event of the liquidation of a position larger than 1 million this endpoint returns this "impossible" order size.

symbol Required string Symbol
limit           int    Limit for data size per page, max size is 1000. Default as showing 500 pieces of data per page

func (LatestBigDeal) Do

func (this LatestBigDeal) Do(client *Client) ([]LatestBigDealItem, error)

type LatestBigDealItem

type LatestBigDealItem struct {
	Symbol    string  `json:"symbol"`
	Side      Side    `json:"side"`
	Timestamp uint64  `json:"timestamp"`
	Value     float64 `json:"value"`
}

type LatestInformation

type LatestInformation struct {
	Symbol                 string            `json:"symbol"`
	BidPrice               transport.Float64 `json:"bid_price"`
	AskPrice               transport.Float64 `json:"ask_price"`
	LastPrice              transport.Float64 `json:"last_price"`
	LastTickDirection      TickDirection     `json:"last_tick_direction"`
	PrevPrice24h           transport.Float64 `json:"prev_price_24h"`
	Price24hPcnt           transport.Float64 `json:"price_24h_pcnt"`
	HighPrice24h           transport.Float64 `json:"high_price_24h"`
	LowPrice24h            transport.Float64 `json:"low_price_24h"`
	PrevPrice1h            transport.Float64 `json:"prev_price_1h"`
	Price1hPcnt            transport.Float64 `json:"price_1h_pcnt"`
	MarkPrice              transport.Float64 `json:"mark_price"`
	IndexPrice             transport.Float64 `json:"index_price"`
	OpenInterest           float64           `json:"open_interest"`
	OpenValue              transport.Float64 `json:"open_value"`
	TotalTurnover          transport.Float64 `json:"total_turnover"`
	Turnover24h            transport.Float64 `json:"turnover_24h"`
	TotalVolume            float64           `json:"total_volume"`
	Volume24h              float64           `json:"volume_24h"`
	FundingRate            transport.Float64 `json:"funding_rate"`
	PredictedFundingRate   transport.Float64 `json:"predicted_funding_rate"`
	NextFundingTime        string            `json:"next_funding_time"`
	CountdownHour          int               `json:"countdown_hour"`
	DeliveryFeeRate        string            `json:"delivery_fee_rate"`
	PredictedDeliveryPrice string            `json:"predicted_delivery_price"`
	DeliveryTime           string            `json:"delivery_time"`
}

type LeverageFilter

type LeverageFilter struct {
	Min  int               `json:"min_leverage"`
	Max  int               `json:"max_leverage"`
	Step transport.Float64 `json:"leverage_step"`
}

type LiquidationShot

type LiquidationShot 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/#liquidity-type-last_liquidity_ind)

AddedLiquidity - liquidity maker
RemovedLiquidity - liquidity Taker
const (
	LiquidityAdded   Liquidity = "AddedLiquidity"
	LiquidityRemoved Liquidity = "RemovedLiquidity"
)

type LongShortRatio

type LongShortRatio struct {
	Symbol string `param:"symbol"`
	Period string `param:"period"`
	Limit  *int   `param:"limit"`
}

Long-Short Ratio (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-marketaccountratio)

Gets the Bybit user accounts' long-short ratio.

symbol Required string Symbol
period Required string Data recording period. 5min, 15min, 30min, 1h, 4h, 1d
limit           int    Limit for data size per page, max size is 500. Default as showing 50 pieces of data per page

func (LongShortRatio) Do

func (this LongShortRatio) Do(client *Client) ([]LongShortRatioItem, error)

type LongShortRatioItem

type LongShortRatioItem struct {
	Symbol    string  `json:"symbol"`
	BuyRatio  float64 `json:"buy_ratio"`
	SellRatio float64 `json:"sell_ratio"`
	Timestamp uint64  `json:"timestamp"`
}

type LotSizeFilter

type LotSizeFilter struct {
	MaxTradingQty         float64           `json:"max_trading_qty"`
	MinTradingQty         float64           `json:"min_trading_qty"`
	QtyStep               float64           `json:"qty_step"`
	PostOnlyMaxTradingQty transport.Float64 `json:"post_only_max_trading_qty"`
}

type MarginSwitch

type MarginSwitch struct {
	Symbol       string `param:"symbol"`
	IsIsolated   bool   `param:"is_isolated"`
	BuyLeverage  int    `param:"buy_leverage"`
	SellLeverage int    `param:"sell_leverage"`
}

Cross/Isolated Margin Switch (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-marginswitch)

Switch Cross/Isolated; must set leverage value when switching from Cross to Isolated

func (MarginSwitch) Do

func (o MarginSwitch) Do(client *Client) error

type MarkKlineItem

type 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 OpenInterest

type OpenInterest struct {
	Symbol string `param:"symbol"`
	Period string `param:"period"`
	Limit  *int   `param:"limit"`
}

Open Interest (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-marketopeninterest)

Gets the total amount of unsettled contracts. In other words, the total number of contracts held in open positions.

symbol Required string Symbol
period Required string Data recording period. 5min, 15min, 30min, 1h, 4h, 1d
limit           int    Limit for data size per page, max size is 200. Default as showing 50 pieces of data per page

func (OpenInterest) Do

func (this OpenInterest) Do(client *Client) ([]InterestItem, error)

type Order

type Order struct {
	OrderCancelled
	LeavesValue string         `json:"leaves_value"`
	PositionIdx PositionIdx    `json:"position_idx"`
	CancelType  CancelType     `json:"cancel_type"`
	ExtFields   OrderExtFields `json:"ext_fields"`
}

type OrderBase

type OrderBase struct {
	OrderMain
	OrderID      string            `json:"order_id"`
	OrderLinkID  string            `json:"order_link_id"`
	CumExecQty   transport.Float64 `json:"cum_exec_qty"`
	CumExecValue transport.Float64 `json:"cum_exec_value"`
	CumExecFee   transport.Float64 `json:"cum_exec_fee"`
	RejectReason string            `json:"reject_reason"`
}

type OrderBook

type OrderBook struct {
	Symbol string `param:"symbol"`
}

Order Book (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-orderbook)

func (OrderBook) Do

func (o OrderBook) Do(client *Client) ([]OrderBookItem, error)

type OrderBookItem

type OrderBookItem struct {
	Symbol string `json:"symbol"`
	Price  string `json:"price"`
	Size   int    `json:"size"`
	Side   Side   `json:"side"`
}

type OrderBookShot

type OrderBookShot struct {
	Price  string `json:"price"`
	Symbol string `json:"symbol"`
	ID     uint64 `json:"id"`
	Side   Side   `json:"side"`
	Size   int    `json:"size"`
}

type OrderCancelled

type OrderCancelled struct {
	OrderCreated
}

type OrderCreated

type OrderCreated struct {
	OrderBase
	OrderProfitLoss
	LastExecTime  transport.Float64 `json:"last_exec_time"`
	LastExecPrice transport.Float64 `json:"last_exec_price"`
}

type OrderExtFields

type OrderExtFields struct {
	XreqType string `json:"xreq_type"`
	// contains filtered or unexported fields
}

type OrderItem

type OrderItem struct {
	OrderBase
	OrderProfitLoss
	LeavesValue string      `json:"leaves_value"`
	PositionIdx PositionIdx `json:"position_idx"`
}

type OrderList

type OrderList struct {
	Symbol      string       `param:"symbol"`
	OrderStatus *OrderStatus `param:"order_status"`
	Direction   *Direction   `param:"direction"`
	Limit       *int         `param:"limit"`
	Cursor      *string      `param:"cursor"`
}

Get Active Order (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-getactive)

func (OrderList) Do

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

type OrderListResult

type OrderListResult struct {
	Items  []OrderItem `json:"data"`
	Cursor string      `json:"cursor"`
}

type OrderMain

type OrderMain struct {
	UserID      int               `json:"user_id"`
	Symbol      string            `json:"symbol"`
	Side        Side              `json:"side"`
	OrderType   OrderType         `json:"order_type"`
	Price       transport.Float64 `json:"price"`
	Qty         int               `json:"qty"`
	TimeInForce TimeInForce       `json:"time_in_force"`
	OrderStatus OrderStatus       `json:"order_status"`
	LeavesQty   float64           `json:"leaves_qty"`
	CreatedAt   time.Time         `json:"created_at"`
	UpdatedAt   time.Time         `json:"updated_at"`
}

type OrderProfitLoss

type OrderProfitLoss struct {
	TakeProfit string       `json:"take_profit"`
	StopLoss   string       `json:"stop_loss"`
	TpTrigger  TriggerPrice `json:"tp_trigger_by"`
	SlTrigger  TriggerPrice `json:"sl_trigger_by"`
}

type OrderShot

type OrderShot struct {
	OrderID        string            `json:"order_id"`
	OrderLinkID    string            `json:"order_link_id"`
	Symbol         string            `json:"symbol"`
	Side           Side              `json:"side"`
	OrderType      OrderType         `json:"order_type"`
	Price          transport.Float64 `json:"price"`
	Qty            transport.Float64 `json:"qty"`
	TimeInForce    TimeInForce       `json:"time_in_force"`
	CreateType     CreateType        `json:"create_type"`
	CancelType     CancelType        `json:"cancel_type"`
	OrderStatus    OrderStatus       `json:"order_status"`
	LeavesQty      float64           `json:"leaves_qty"`
	CumExecQty     float64           `json:"cum_exec_qty"`
	CumExecValue   transport.Float64 `json:"cum_exec_value"`
	CumExecFee     transport.Float64 `json:"cum_exec_fee"`
	Timestamp      time.Time         `json:"timestamp"`
	TakeProfit     transport.Float64 `json:"take_profit"`
	TpTrigger      TriggerPrice      `json:"tp_trigger_by"`
	SlTrigger      TriggerPrice      `json:"sl_trigger_by"`
	StopLoss       string            `json:"stop_loss"`
	TrailingStop   string            `json:"trailing_stop"`
	LastExecPrice  transport.Float64 `json:"last_exec_price"`
	ReduceOnly     bool              `json:"reduce_only"`
	CloseOnTrigger bool              `json:"close_on_trigger"`
}

type OrderStatus

type OrderStatus string

Order status (order_status/stop_order_status) (https://bybit-exchange.github.io/docs/futuresV2/inverse/#order-status-order_status-stop_order_status)

Created - order has been accepted by the system but not yet put through the matching engine
New - order has been placed successfully
PendingCancel - matching engine has received the cancelation request but it may not be canceled successfully
Only for conditional orders:
Untriggered - order yet to be triggered
Deactivated - order has been canceled by the user before being triggered
Triggered - order has been triggered by last traded price
Active - order has been triggered and the new active order has been successfully placed. Is the final state of a successful conditional order
const (
	Created         OrderStatus = "Created"
	New             OrderStatus = "New"
	Rejected        OrderStatus = "Rejected"
	PartiallyFilled OrderStatus = "PartiallyFilled"
	Filled          OrderStatus = "Filled"
	PendingCancel   OrderStatus = "PendingCancel"
	Cancelled       OrderStatus = "Cancelled"
	Untriggered     OrderStatus = "Untriggered"
	Deactivated     OrderStatus = "Deactivated"
	Triggered       OrderStatus = "Triggered"
	Active          OrderStatus = "Active"
)

type OrderType

type OrderType string

Order type (order_type) (https://bybit-exchange.github.io/docs/futuresV2/inverse/#order-type-order_type)

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            float64       `param:"qty"`
	TimeInForce    TimeInForce   `param:"time_in_force"`
	Price          *float64      `param:"price"`
	CloseOnTrigger *bool         `param:"close_on_trigger"`
	OrderLinkID    *string       `param:"order_link_id"`
	TakeProfit     *float64      `param:"take_profit"`
	StopLoss       *float64      `param:"stop_loss"`
	TpTrigger      *TriggerPrice `param:"tp_trigger_by"`
	SlTrigger      *TriggerPrice `param:"sl_trigger_by"`
	ReduceOnly     *bool         `param:"reduce_only"`
}

Place Active Order (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-placeactive)

func (PlaceActiveOrder) Do

func (o PlaceActiveOrder) Do(client *Client) (OrderCreated, error)

type PlaceConditionalOrder

type PlaceConditionalOrder struct {
	Side           Side          `param:"side"`
	Symbol         string        `param:"symbol"`
	OrderType      OrderType     `param:"order_type"`
	Qty            float64       `param:"qty"`
	TimeInForce    TimeInForce   `param:"time_in_force"`
	BasePrice      string        `param:"base_price"`
	StopPx         string        `param:"stop_px"`
	Price          *float64      `param:"price"`
	CloseOnTrigger *bool         `param:"close_on_trigger"`
	OrderLinkID    *string       `param:"order_link_id"`
	TakeProfit     *float64      `param:"take_profit"`
	StopLoss       *float64      `param:"stop_loss"`
	TpTrigger      *TriggerPrice `param:"tp_trigger_by"`
	SlTrigger      *TriggerPrice `param:"sl_trigger_by"`
	TriggerBy      *TriggerPrice `param:"trigger_by"`
}

Place Conditional Order (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-placecond)

func (*PlaceConditionalOrder) Do

type PositionBase

type PositionBase struct {
	ID                  int               `json:"id"`
	UserID              int               `json:"user_id"`
	RiskID              int               `json:"risk_id"`
	Symbol              string            `json:"symbol"`
	Side                Side              `json:"side"`
	Size                int               `json:"size"`
	PositionValue       transport.Float64 `json:"position_value"`
	EntryPrice          transport.Float64 `json:"entry_price"`
	IsIsolated          bool              `json:"is_isolated"`
	AutoAddMargin       int               `json:"auto_add_margin"`
	Leverage            transport.Float64 `json:"leverage"`
	EffectiveLeverage   transport.Float64 `json:"effective_leverage"`
	PositionMargin      transport.Float64 `json:"position_margin"`
	LiqPrice            transport.Float64 `json:"liq_price"`
	BustPrice           transport.Float64 `json:"bust_price"`
	OccClosingFee       transport.Float64 `json:"occ_closing_fee"`
	OccFundingFee       transport.Float64 `json:"occ_funding_fee"`
	TakeProfit          transport.Float64 `json:"take_profit"`
	StopLoss            transport.Float64 `json:"stop_loss"`
	TrailingStop        transport.Float64 `json:"trailing_stop"`
	PositionStatus      string            `json:"position_status"`
	DeleverageIndicator int               `json:"deleverage_indicator"`
	OcCalcData          string            `json:"oc_calc_data"`
	OrderMargin         transport.Float64 `json:"order_margin"`
	WalletBalance       transport.Float64 `json:"wallet_balance"`
	RealisedPnl         transport.Float64 `json:"realised_pnl"`
	CumRealisedPnl      transport.Float64 `json:"cum_realised_pnl"`
	CrossSeq            int               `json:"cross_seq"`
	PositionSeq         int               `json:"position_seq"`
	CreatedAt           time.Time         `json:"created_at"`
	UpdatedAt           time.Time         `json:"updated_at"`
}

type PositionData

type PositionData struct {
	PositionBase
	PositionIdx   PositionIdx `json:"position_idx"`
	Mode          int         `json:"mode"`
	UnrealisedPnl float64     `json:"unrealised_pnl"`
	TpSlMode      TpSlMode    `json:"tp_sl_mode"`
}

type PositionIdx

type PositionIdx int
const (
	OneWay   PositionIdx = 0
	BuySide  PositionIdx = 1
	SellSide PositionIdx = 1
)

type PositionItem

type PositionItem struct {
	Data    PositionData `json:"data"`
	IsValid bool         `json:"is_valid"`
}

type PositionShot

type PositionShot struct {
	UserID           int               `json:"user_id"`
	Symbol           string            `json:"symbol"`
	Size             int               `json:"size"`
	Side             Side              `json:"side"`
	PositionValue    transport.Float64 `json:"position_value"`
	EntryPrice       transport.Float64 `json:"entry_price"`
	LiqPrice         transport.Float64 `json:"liq_price"`
	BustPrice        transport.Float64 `json:"bust_price"`
	Leverage         transport.Float64 `json:"leverage"`
	OrderMargin      string            `json:"order_margin"`
	PositionMargin   string            `json:"position_margin"`
	AvailableBalance transport.Float64 `json:"available_balance"`
	TakeProfit       string            `json:"take_profit"`
	StopLoss         string            `json:"stop_loss"`
	RealisedPnl      transport.Float64 `json:"realised_pnl"`
	TrailingStop     string            `json:"trailing_stop"`
	TrailingActive   string            `json:"trailing_active"`
	WalletBalance    transport.Float64 `json:"wallet_balance"`
	RiskID           int               `json:"risk_id"`
	OccClosingFee    string            `json:"occ_closing_fee"`
	OccFundingFee    string            `json:"occ_funding_fee"`
	AutoAddMargin    int               `json:"auto_add_margin"`
	CumRealisedPnl   string            `json:"cum_realised_pnl"`
	PositionStatus   string            `json:"position_status"`
	PositionSeq      int               `json:"position_seq"`
	IsIsolated       bool              `json:"is_isolated"`
	Mode             int               `json:"mode"`
	PositionIdx      PositionIdx       `json:"position_idx"`
	TpSlMode         TpSlMode          `json:"tp_sl_mode"`
	TpOrderNum       int               `json:"tp_order_num"`
	SlOrderNum       int               `json:"sl_order_num"`
	TpFreeSize       int               `json:"tp_free_size_x"`
	SlFreeSize       int               `json:"sl_free_size_x"`
}

type PriceFilter

type PriceFilter struct {
	Min      transport.Float64 `json:"min_price"`
	Max      transport.Float64 `json:"max_price"`
	TickSize transport.Float64 `json:"tick_size"`
}

type PublicTradingRecord

type PublicTradingRecord struct {
	ID     int     `json:"id"`
	Symbol string  `json:"symbol"`
	Price  float64 `json:"price"`
	Qty    int     `json:"qty"`
	Side   Side    `json:"side"`
	Time   string  `json:"time"`
}

type PublicTradingRecords

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

Public Trading Records (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-publictradingrecords)

symbol Required string  Symbol
limit           integer Limit for data size, max size is 1000. Default size is 500

func (PublicTradingRecords) Do

type QueryKline

type QueryKline struct {
	Symbol   string        `param:"symbol"`
	Interval KlineInterval `param:"interval"`
	From     int64         `param:"from"`
	Limit    *int          `param:"limit"`
}

Query Kline (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-querykline)

symbol    Required string  Symbol
interval  Required string  Data refresh interval. Enum : 1 3 5 15 30 60 120 240 360 720 "D" "M" "W"
from      Required integer From timestamp in seconds
limit              integer Limit for data size per page, max size is 200. Default as showing 200 pieces of data per page

func (QueryKline) Do

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

func (QueryKline) DoIndex

func (o QueryKline) DoIndex(client *Client) ([]IndexKlineItem, error)

Query Index Price Kline (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-queryindexpricekline)

Index price kline. Tracks BTC spot prices, with a frequency of every second

func (QueryKline) DoMark

func (o QueryKline) DoMark(client *Client) ([]MarkKlineItem, error)

Query Mark Price Kline (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-markpricekline)

Query mark price kline (like Query Kline but for mark price)

func (QueryKline) DoPremium

func (o QueryKline) DoPremium(client *Client) ([]IndexKlineItem, error)

Query Premium Index Kline (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-querypremiumindexkline)

Premium index kline. Tracks the premium / discount of BTC perpetual contracts relative to the mark price per minute

type QueryOrder

type QueryOrder struct {
	Symbol      string  `param:"symbol"`
	OrderID     *string `param:"order_id"`
	OrderLinkID *string `param:"order_link_id"`
}

Query Active Order (real-time) (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-queryactive)

Query real-time active order information. If only order_id or order_link_id are passed, a single order will be returned; otherwise, returns up to 500 unfilled orders.

func (QueryOrder) Do

func (o QueryOrder) Do(client *Client) (l []Order, err error)

When only symbol is passed, the response uses a different structure.

func (QueryOrder) DoConditional

func (o QueryOrder) DoConditional(client *Client) ([]ConditionalOrder, error)

Query Conditional Order (real-time) (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-querycond)

When only symbol is passed, the response uses a different structure.

func (QueryOrder) OnlySymbol

func (o QueryOrder) OnlySymbol() bool

type ReplaceConditionalOrder

type ReplaceConditionalOrder struct {
	Symbol       string        `param:"symbol"`
	OrderID      *string       `param:"stop_order_id"`
	OrderLinkID  *string       `param:"order_link_id"`
	Qty          *int          `param:"p_r_qty"`
	Price        *string       `param:"p_r_price"`
	TriggerPrice *string       `param:"p_r_trigger_price"`
	TakeProfit   *float64      `param:"take_profit"`
	StopLoss     *float64      `param:"stop_loss"`
	TpTrigger    *TriggerPrice `param:"tp_trigger_by"`
	SlTrigger    *TriggerPrice `param:"sl_trigger_by"`
}

Replace Conditional Order (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-replacecond)

func (ReplaceConditionalOrder) Do

func (o 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/inverse/#t-replaceactive)

func (ReplaceOrder) Do

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

type Request

type Request struct {
	Name 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"`
	RateLimitStatus int    `json:"rate_limit_status"`
	RateLimit       int    `json:"rate_limit"`
}

type RiskLimitItem

type RiskLimitItem struct {
	ID             int      `json:"id"`
	Symbol         string   `json:"symbol"`
	Limit          int      `json:"limit"`
	MaintainMargin string   `json:"maintain_margin"`
	StartingMargin string   `json:"starting_margin"`
	Section        []string `json:"section"`
	IsLowestRisk   int      `json:"is_lowest_risk"`
	CreatedAt      string   `json:"created_at"`
	UpdatedAt      string   `json:"updated_at"`
	MaxLeverage    string   `json:"max_leverage"`
}

type SetLeverage

type SetLeverage struct {
	Symbol       string `param:"symbol"`
	Leverage     int    `param:"leverage"`
	LeverageOnly *bool  `param:"leverage_only"`
}

Set Leverage (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-setleverage)

func (SetLeverage) Do

func (o SetLeverage) Do(client *Client) (int, error)

type SetRiskLimit

type SetRiskLimit struct {
	Symbol string `param:"symbol"`
	RiskID int    `param:"risk_id"`
}

Set Risk Limit (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-setrisklimit)

symbol  Required string  Symbol
risk_id Required integer Risk ID

func (SetRiskLimit) Do

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

type SetTradingStop

type SetTradingStop struct {
	Symbol            string        `param:"symbol"`
	TakeProfit        *int          `param:"take_profit"`
	StopLoss          *int          `param:"stop_loss"`
	TrailingStop      *int          `param:"trailing_stop"`
	TpTrigger         *TriggerPrice `param:"tp_trigger_by"`
	SlTrigger         *TriggerPrice `param:"sl_trigger_by"`
	NewTrailingActive *int          `param:"new_trailing_active"`
	SlSize            *int          `param:"sl_size"`
	TpSize            *int          `param:"tp_size"`
}

Set Trading-Stop (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-tradingstop)

func (SetTradingStop) Do

type SetTradingStopExt

type SetTradingStopExt struct {
	TrailingActive string `json:"trailing_active"`
	SlTrigger      string `json:"sl_trigger_by"`
	TpTrigger      string `json:"tp_trigger_by"`
	V              int    `json:"v"`
	Mm             int    `json:"mm"`
}

type SetTradingStopResult

type SetTradingStopResult struct {
	PositionBase
	CumCommission int               `json:"cum_commission"`
	ExtFields     SetTradingStopExt `json:"ext_fields"`
}

type Side

type Side string

Side (side) (https://bybit-exchange.github.io/docs/futuresV2/inverse/#side-side)

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

type SortOrder

type SortOrder string

Order (order) (https://bybit-exchange.github.io/docs/futuresV2/inverse/#order-order)

This is used for sorting orders/trades in a specified direction.

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/#stop-order-type-stop_order_type)

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

type StopOrderShot

type StopOrderShot struct {
	OrderID        string       `json:"order_id"`
	OrderLinkID    string       `json:"order_link_id"`
	UserID         int          `json:"user_id"`
	Symbol         string       `json:"symbol"`
	Side           Side         `json:"side"`
	OrderType      OrderType    `json:"order_type"`
	Price          float64      `json:"price"`
	CreateType     CreateType   `json:"create_type"`
	CancelType     CancelType   `json:"cancel_type"`
	OrderStatus    OrderStatus  `json:"order_status"`
	StopOrderType  StopOrder    `json:"stop_order_type"`
	TriggerBy      TriggerPrice `json:"trigger_by"`
	TriggerPrice   string       `json:"trigger_price"`
	CloseOnTrigger bool         `json:"close_on_trigger"`
	Timestamp      string       `json:"timestamp"`
	TakeProfit     float64      `json:"take_profit"`
	StopLoss       float64      `json:"stop_loss"`
}

type Subscription

type Subscription struct {
	Topic    TopicName
	Interval string
	Symbol   string
}

func (*Subscription) String

func (o *Subscription) String() string

type SubscriptionFunc

type SubscriptionFunc func(m []byte, delta bool) error

type Subscriptions

type Subscriptions map[string]SubscriptionFunc

type SymbolInfo

type SymbolInfo struct {
	Name            string            `json:"name"`
	Alias           string            `json:"alias"`
	Status          ContractStatus    `json:"status"`
	BaseCurrency    string            `json:"base_currency"`
	QuoteCurrency   string            `json:"quote_currency"`
	PriceScale      float64           `json:"price_scale"`
	TakerFee        transport.Float64 `json:"taker_fee"`
	MakerFee        transport.Float64 `json:"maker_fee"`
	FundingInterval float64           `json:"funding_interval"`
	LeverageFilter  LeverageFilter    `json:"leverage_filter"`
	PriceFilter     PriceFilter       `json:"price_filter"`
	LotSizeFilter   LotSizeFilter     `json:"lot_size_filter"`
}

Query Symbol (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-querysymbol)

type SymbolLatestInformation

type SymbolLatestInformation struct {
	Symbol *string `param:"symbol"`
}

Latest Information for Symbol (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-latestsymbolinfo)

func (SymbolLatestInformation) Do

type TickDirection

type TickDirection string

Tick direction type (tick_direction) (https://bybit-exchange.github.io/docs/futuresV2/inverse/#tick-direction-type-tick_direction)

It indicates price fluctuation relative to the last trade.

PlusTick - price rise
ZeroPlusTick - trade occurs at the same price as the previous trade, which occurred at a price higher than that for the trade preceding it
MinusTick - price drop
ZeroMinusTick - trade occurs at the same price as the previous trade, which occurred at a price lower than that for the trade preceding it
const (
	TickPlus      TickDirection = "TickPlus"
	TickZeroPlus  TickDirection = "TickZeroPlus"
	TickMinus     TickDirection = "TickMinus"
	TickZeroMinus TickDirection = "TickZeroMinus"
)

type TimeInForce

type TimeInForce string

Time in force (time_in_force) (https://bybit-exchange.github.io/docs/futuresV2/inverse/#time-in-force-time_in_force)

const (
	GoodTillCancel    TimeInForce = "GoodTillCancel"
	ImmediateOrCancel TimeInForce = "ImmediateOrCancel"
	FillOrKill        TimeInForce = "FillOrKill"
	PostOnly          TimeInForce = "FillOrKill"
)

type Topic

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

type TopicMessage

type TopicMessage struct {
	Topic string
	Delta bool
	Bin   []byte
}

type TopicName

type TopicName string
const (
	TopicOrderBook25  TopicName = "orderBookL2_25"
	TopicOrderBook200 TopicName = "orderBook_200"
	TopicTrade        TopicName = "trade"
	TopicInsurance    TopicName = "insurance"
	TopicInstrument   TopicName = "instrument_info"
	TopicKline        TopicName = "klineV2"
	TopicLiquidation  TopicName = "liquidation"
)

public:

const (
	TopicPosition  TopicName = "position"
	TopicExecution TopicName = "execution"
	TopicOrder     TopicName = "order"
	TopicStopOrder TopicName = "stop_order"
	TopicWallet    TopicName = "wallet"
)

private:

type TpSlMode

type TpSlMode string

TP/SL mode (tp_sl_mode) (https://bybit-exchange.github.io/docs/futuresV2/inverse/#tp-sl-mode-tp_sl_mode)

Take profit/stop loss mode

Full - Full take profit/stop loss mode (a single TP order and a single SL order can be placed, covering the entire position)
Partial - Partial take profit/stop loss mode (multiple TP and SL orders can be placed, covering portions of the position)
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/inverse/#t-switchmode)

Switch mode between Full or Partial

func (TpSlModeSwitch) Do

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

type TradeRecord

type TradeRecord struct {
	ClosedSize    int       `json:"closed_size"`
	CrossSeq      int       `json:"cross_seq"`
	ExecFee       string    `json:"exec_fee"`
	ExecID        string    `json:"exec_id"`
	ExecPrice     string    `json:"exec_price"`
	ExecQty       int       `json:"exec_qty"`
	ExecTime      int64     `json:"exec_time"`
	ExecType      ExecType  `json:"exec_type"`
	ExecValue     string    `json:"exec_value"`
	FeeRate       string    `json:"fee_rate"`
	LastLiquidity string    `json:"last_liquidity_ind"`
	LeavesQty     int       `json:"leaves_qty"`
	NthFill       int       `json:"nth_fill"`
	OrderID       string    `json:"order_id"`
	OrderLinkID   string    `json:"order_link_id"`
	OrderPrice    string    `json:"order_price"`
	OrderQty      int       `json:"order_qty"`
	OrderType     OrderType `json:"order_type"`
	Side          Side      `json:"side"`
	Symbol        string    `json:"symbol"`
	UserID        int       `json:"user_id"`
	TradeTime     uint64    `json:"trade_time_ms"`
}

type TradeRecords

type TradeRecords struct {
	OrderID      string        `json:"order_id"`
	TradeRecords []TradeRecord `json:"trade_list"`
}

type TradeShot

type TradeShot struct {
	Timestamp     string        `json:"timestamp"`
	TradeTime     uint64        `json:"trade_time_ms"`
	Symbol        string        `json:"symbol"`
	Side          Side          `json:"side"`
	Size          int           `json:"size"`
	Price         float64       `json:"price"`
	TickDirection TickDirection `json:"tick_direction"`
	TradeID       string        `json:"trade_id"`
	CrossSeq      uint64        `json:"cross_seq"`
}

type TriggerPrice

type TriggerPrice string

Trigger price type (trigger_by) (https://bybit-exchange.github.io/docs/futuresV2/inverse/#trigger-price-type-trigger_by)

const (
	LastPrice  TriggerPrice = "LastPrice"
	IndexPrice TriggerPrice = "IndexPrice"
	MarkPrice  TriggerPrice = "MarkPrice"
)

type WalletBalance

type WalletBalance struct {
	Currency *string `param:"coin"`
}

Get Wallet Balance (https://bybit-exchange.github.io/docs/futuresV2/inverse/#t-balance)

coin string Currency alias. Returns all wallet balances if not passed

func (WalletBalance) Do

func (o WalletBalance) Do(client *Client) (map[string]Balance, error)

type WalletFund

type WalletFund string

Wallet fund type (wallet_fund_type/type) (https://bybit-exchange.github.io/docs/futuresV2/inverse/#wallet-fund-type-wallet_fund_type-type)

ReturnServiceCash - Refund of handling fee bonus
Insurance - Insurance account transfer
SubMember - Parent-child account transfer
Coupon - Coupon interest
AccountTransfer - Account transfer
CashBack - Cash back
const (
	FundDeposit               WalletFund = "Deposit"
	FundWithdraw              WalletFund = "Withdraw"
	FundRealisedPNL           WalletFund = "RealisedPNL"
	FundCommission            WalletFund = "Commission"
	FundRefund                WalletFund = "Refund"
	FundPrize                 WalletFund = "Prize"
	FundExchangeOrderWithdraw WalletFund = "ExchangeOrderWithdraw"
	FundExchangeOrderDeposit  WalletFund = "ExchangeOrderDeposit"
	FundReturnServiceCash     WalletFund = "ReturnServiceCash"
	FundInsurance             WalletFund = "Insurance"
	FundSubMember             WalletFund = "SubMember"
	FundCoupon                WalletFund = "Coupon"
	FundAccountTransfer       WalletFund = "AccountTransfer"
	FundCashBack              WalletFund = "CashBack"
)

type WalletShot

type WalletShot 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/inverse/#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() *WsClient

func (*WsClient) Conf

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

func (*WsClient) Connected

func (o *WsClient) Connected() bool

func (*WsClient) Private

func (o *WsClient) Private() *WsPrivate

func (*WsClient) Public

func (o *WsClient) Public() *WsPublic

func (*WsClient) Ready

func (o *WsClient) Ready() bool

func (*WsClient) Run

func (o *WsClient) Run()

func (*WsClient) SetOnAuth

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

func (*WsClient) SetOnConnected

func (o *WsClient) SetOnConnected(onConnected func())

func (*WsClient) SetOnDialError

func (o *WsClient) SetOnDialError(onDialError func(error) bool)

func (*WsClient) SetOnDisconnected

func (o *WsClient) SetOnDisconnected(onDisconnected func())

func (*WsClient) Shutdown

func (o *WsClient) Shutdown()

func (*WsClient) WithAuth

func (o *WsClient) WithAuth(key string, secret string) *WsClient

func (*WsClient) WithByTickUrl

func (o *WsClient) WithByTickUrl() *WsClient

func (*WsClient) WithLog

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

func (*WsClient) WithProxy

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

func (*WsClient) WithUrl

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

type WsDeltaExecutor

type WsDeltaExecutor[T any] struct {
	WsExecutor[T]
}

func NewWsDeltaExecutor

func NewWsDeltaExecutor[T any](section *WsSection, subscription Subscription) *WsDeltaExecutor[T]

func (*WsDeltaExecutor[T]) Instant

func (o *WsDeltaExecutor[T]) Instant() *WsInstant[T]

func (*WsDeltaExecutor[T]) Subscribe

func (o *WsDeltaExecutor[T]) Subscribe(onShot func(T))

func (*WsDeltaExecutor[T]) SubscribeWithDelta

func (o *WsDeltaExecutor[T]) SubscribeWithDelta(onShot func(T), onDelta func(Delta))

type WsExecutor

type WsExecutor[T any] struct {
	// contains filtered or unexported fields
}

func NewWsExecutor

func NewWsExecutor[T any](section *WsSection, subscription Subscription) *WsExecutor[T]

func (*WsExecutor[T]) Init

func (o *WsExecutor[T]) Init(section *WsSection, subscription Subscription)

func (*WsExecutor[T]) Instant

func (o *WsExecutor[T]) Instant() *WsInstant[T]

func (*WsExecutor[T]) Subscribe

func (o *WsExecutor[T]) Subscribe(onShot func(T))

func (*WsExecutor[T]) Unsubscribe

func (o *WsExecutor[T]) Unsubscribe()

type WsExecutorInterface

type WsExecutorInterface[T any] interface {
	Subscribe(func(T))
	Unsubscribe()
}

type WsInstant

type WsInstant[T any] struct {
	// contains filtered or unexported fields
}

func NewWsInstant

func NewWsInstant[T any](executor WsExecutorInterface[T]) *WsInstant[T]

func (*WsInstant[T]) Empty

func (o *WsInstant[T]) Empty() bool

func (*WsInstant[T]) Has

func (o *WsInstant[T]) Has() bool

func (*WsInstant[T]) OnUpdate

func (o *WsInstant[T]) OnUpdate(onUpdate func(T))

func (*WsInstant[T]) Unsubscribe

func (o *WsInstant[T]) Unsubscribe()

func (*WsInstant[T]) Value

func (o *WsInstant[T]) Value() T

type WsPrivate

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

func NewWsPrivate

func NewWsPrivate(client *WsClient, key string, secret string) *WsPrivate

func (WsPrivate) Execution

func (o WsPrivate) Execution() *WsExecutor[[]ExecutionShot]

func (WsPrivate) Order

func (o WsPrivate) Order() *WsExecutor[[]OrderShot]

func (WsPrivate) Position

func (o WsPrivate) Position() *WsExecutor[[]PositionShot]

func (WsPrivate) StopOrder

func (o WsPrivate) StopOrder() *WsExecutor[[]StopOrderShot]

func (WsPrivate) Wallet

func (o WsPrivate) Wallet() *WsExecutor[[]WalletShot]

type WsPublic

type WsPublic struct {
	WsSection
}

func NewWsPublic

func NewWsPublic(client *WsClient) *WsPublic

func (WsPublic) Instrument

func (o WsPublic) Instrument(symbol string) *WsDeltaExecutor[InstrumentShot]

func (WsPublic) Insurance

func (o WsPublic) Insurance() *WsExecutor[[]InsuranceShot]

func (WsPublic) Kline

func (o WsPublic) Kline(symbol string, interval KlineInterval) *WsExecutor[[]KlineShot]

func (WsPublic) Liquidation

func (o WsPublic) Liquidation() *WsExecutor[LiquidationShot]

func (WsPublic) OrderBook200

func (o WsPublic) OrderBook200(symbol string) *WsDeltaExecutor[[]OrderBookShot]

func (WsPublic) OrderBook25

func (o WsPublic) OrderBook25(symbol string) *WsDeltaExecutor[[]OrderBookShot]

func (WsPublic) Trade

func (o WsPublic) Trade() *WsExecutor[[]TradeShot]

type WsSection

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

Jump to

Keyboard shortcuts

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