Documentation ¶
Overview ¶
Account Data Endpoints (https://bybit-exchange.github.io/docs/spot/v3/#t-accountdata)
API Data Endpoints (https://bybit-exchange.github.io/docs/futuresV2/linear/#t-api)
Spot v3 (https://bybit-exchange.github.io/docs/spot/v3)
Enums Definitions (https://bybit-exchange.github.io/docs/spot/v3/#t-enums)
Market Data Endpoints (https://bybit-exchange.github.io/docs/spot/v3/#t-marketdata)
Wallet Data Endpoints (https://bybit-exchange.github.io/docs/spot/v3/#t-wallet)
Index ¶
- func Get[T any](c *Client, path string, param any) (T, error)
- func GetPublic[T any](c *Client, path string, param any) (T, error)
- func Post[T any](c *Client, path string, param any) (T, error)
- func WsFunc[T any, F func(T)](m []byte, f F) error
- type Balance
- type BatchCancelOrder
- type BatchCancelOrderByID
- type BestBidAskPrice
- type BestBidAskPriceResult
- type BookTickerShot
- type CancelOrder
- type CancelOrderID
- type Client
- func (this *Client) BatchCancelOrder(v BatchCancelOrder) (bool, error)
- func (this *Client) BatchCancelOrderByID(ID []string) ([]CancelOrderID, error)
- func (this *Client) BestBidAskPrice(symbol string) (BestBidAskPriceResult, error)
- func (this *Client) CancelOrder(v CancelOrder) (OrderCancelled, error)
- func (this *Client) Get(path string, param any, ret any) error
- func (this *Client) GetOrder(v GetOrder) (Order, error)
- func (this *Client) GetPublic(path string, param any, ret any) error
- func (this *Client) LastTradedPrice(symbol string) (SymbolPrice, error)
- func (this *Client) MergedOrderBook(v MergedOrderBook) (OrderBookResult, error)
- func (this *Client) OneSymbolLatestInformation(symbol string) (i LatestInformation, err error)
- func (this *Client) OpenOrders(v OpenOrders) ([]any, error)
- func (this *Client) OrderBook(v OrderBook) (OrderBookResult, error)
- func (this *Client) OrderHistory(v OrderHistory) ([]OpenedOrder, error)
- func (this *Client) PlaceOrder(v PlaceOrder) (OrderCreated, error)
- func (this *Client) Post(path string, param any, ret any) error
- func (this *Client) PublicTradingRecords(v PublicTradingRecords) ([]PublicTradingRecord, error)
- func (this *Client) QueryKline(v QueryKline) ([]KlineData, error)
- func (this *Client) QuerySymbol() ([]SymbolInfo, error)
- func (this *Client) QuerySymbolNames() ([]string, error)
- func (this *Client) ServerTime() (string, error)
- func (this *Client) SymbolLatestInformation(symbol *string) ([]LatestInformation, error)
- func (this *Client) TradeHistory(v TradeHistory) ([]Trade, error)
- func (this *Client) Transport() *transport.Client
- func (this *Client) WalletBalance() ([]Balance, error)
- type DepthShot
- type Error
- type GetOrder
- type KlineData
- type KlineInterval
- type KlineShot
- type LastTradedPrice
- type LatestInformation
- type LtOrderStatus
- type LtOrderType
- type LtStatus
- type MergedOrderBook
- type OpenOrders
- type OpenedOrder
- type Order
- type OrderBase
- type OrderBook
- type OrderBookResult
- type OrderCancelled
- type OrderCreated
- type OrderHistory
- type OrderShot
- type OrderStatus
- type OrderType
- type OutboundItem
- type OutboundShot
- type PlaceOrder
- type PublicTradingRecord
- type PublicTradingRecords
- type Qty
- type QueryKline
- type Request
- type Responce
- type Response
- type Side
- type StopOrderShot
- type Subscription
- type SubscriptionFunc
- type Subscriptions
- type SymbolInfo
- type SymbolLatestInformation
- type SymbolPrice
- type TickersShot
- type TicketShot
- type TimeInForce
- type Topic
- type TopicMessage
- type TopicName
- type Trade
- type TradeHistory
- type TradeShot
- type WsClient
- func (o *WsClient) Conf() *transport.WsConf
- func (o *WsClient) Connected() bool
- func (o *WsClient) Run()
- func (o *WsClient) Send(cmd any) bool
- func (o *WsClient) SetOnAuth(onAuth func(bool))
- func (o *WsClient) SetOnConnected(onConnected func())
- func (o *WsClient) SetOnDialError(onDialError func(error) bool)
- func (o *WsClient) SetOnDisconnected(onConnected func())
- func (o *WsClient) SetOnTopicMessage(onTopicMessage func(TopicMessage) error)
- func (o *WsClient) Shutdown()
- func (o *WsClient) Subscribe(s Subscription) bool
- func (o *WsClient) Unsubscribe(s Subscription) bool
- func (o *WsClient) WithByTickUrl() *WsClient
- func (o *WsClient) WithLog(log *ulog.Log) *WsClient
- func (o *WsClient) WithProxy(proxy string) *WsClient
- func (o *WsClient) WithUrl(url string) *WsClient
- type WsExecutor
- type WsPrivate
- func (o *WsPrivate) Conf() *transport.WsConf
- func (o *WsPrivate) Connected() bool
- func (o *WsPrivate) Order() *WsExecutor[[]OrderShot]
- func (o *WsPrivate) Outbound() *WsExecutor[[]OutboundShot]
- func (o *WsPrivate) Ready() bool
- func (o *WsPrivate) Run()
- func (o *WsPrivate) SetOnDialError(onDialError func(error) bool)
- func (o *WsPrivate) Shutdown()
- func (o *WsPrivate) StopOrder() *WsExecutor[[]StopOrderShot]
- func (o *WsPrivate) Ticket() *WsExecutor[[]TicketShot]
- func (o *WsPrivate) WithByTickUrl() *WsPrivate
- func (o *WsPrivate) WithLog(log *ulog.Log) *WsPrivate
- func (o *WsPrivate) WithProxy(proxy string) *WsPrivate
- type WsPublic
- func (o *WsPublic) BookTicker(symbol string) *WsExecutor[BookTickerShot]
- func (o *WsPublic) Conf() *transport.WsConf
- func (o *WsPublic) Connected() bool
- func (o *WsPublic) Depth(symbol string) *WsExecutor[DepthShot]
- func (o *WsPublic) Kline(symbol string, interval KlineInterval) *WsExecutor[KlineShot]
- func (o *WsPublic) Ready() bool
- func (o *WsPublic) Run()
- func (o *WsPublic) SetOnDialError(onDialError func(error) bool)
- func (o *WsPublic) Shutdown()
- func (o *WsPublic) Tickers(symbol string) *WsExecutor[TickersShot]
- func (o *WsPublic) Trade(symbol string) *WsExecutor[TradeShot]
- func (o *WsPublic) WithByTickUrl() *WsPublic
- func (o *WsPublic) WithLog(log *ulog.Log) *WsPublic
- func (o *WsPublic) WithProxy(proxy string) *WsPublic
- type WsSection
- type WsSectionClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Balance ¶
type Balance struct { Coin string `json:"coin"` CoinID string `json:"coinId"` CoinName string `json:"coinName"` Total transport.Float64 `json:"total"` Free transport.Float64 `json:"free"` Locked string `json:"locked"` }
Get Wallet Balance (https://bybit-exchange.github.io/docs/spot/v3/#t-balance)
type BatchCancelOrder ¶
type BatchCancelOrder struct { Symbol string `param:"symbol"` Side *Side `param:"side"` Type *OrderType `param:"orderTypes"` }
Batch Cancel Active Order (https://bybit-exchange.github.io/docs/spot/v3/#t-batchcancelactiveorder)
symbol Required string Name of the trading pair side string Order direction orderTypes string Order type. Use commas to indicate multiple order types, eg LIMIT,LIMIT_MAKER. Default: LIMIT
type BatchCancelOrderByID ¶
type BatchCancelOrderByID struct {
ID []string `param:"orderIds"`
}
Batch Cancel Active Order By IDs (https://bybit-exchange.github.io/docs/spot/v3/#t-batchcancelactiveorderbyids)
orderIds Required string Order ID, use commas to indicate multiple orderIds. Maximum of 100 ids.
func (BatchCancelOrderByID) Do ¶
func (this BatchCancelOrderByID) Do(client *Client) ([]CancelOrderID, error)
type BestBidAskPrice ¶
type BestBidAskPrice struct {
Symbol string `param:"symbol"`
}
Best Bid/Ask Price (https://bybit-exchange.github.io/docs/spot/v3/#t-bestbidask)
func (BestBidAskPrice) Do ¶
func (this BestBidAskPrice) Do(client *Client) (BestBidAskPriceResult, error)
type BestBidAskPriceResult ¶
type BookTickerShot ¶
type BookTickerShot struct { Symbol string `json:"s"` // Trading pair BestBidPrice transport.Float64 `json:"bp"` // Best bid price BidQuantity transport.Float64 `json:"bq"` // Bid quantity BestAskPrice transport.Float64 `json:"qp"` // Best ask price AskQuantity transport.Float64 `json:"qq"` // Ask quantity Timestamp uint64 `json:"t"` // The time that message is sent out }
type CancelOrder ¶
type CancelOrder struct { OrderID *string `param:"orderId"` OrderLinkID *string `param:"orderLinkId"` }
Cancel Active Order (https://bybit-exchange.github.io/docs/spot/v3/#t-cancelactive)
orderId string Order ID. Required if not passing orderLinkId orderLinkId string Unique user-set order ID. Required if not passing orderId
func (CancelOrder) Do ¶
func (this CancelOrder) Do(client *Client) (OrderCancelled, error)
type CancelOrderID ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Spotv3 HTTP client
func (*Client) BatchCancelOrder ¶
func (this *Client) BatchCancelOrder(v BatchCancelOrder) (bool, error)
func (*Client) BatchCancelOrderByID ¶
func (this *Client) BatchCancelOrderByID(ID []string) ([]CancelOrderID, error)
func (*Client) BestBidAskPrice ¶
func (this *Client) BestBidAskPrice(symbol string) (BestBidAskPriceResult, error)
func (*Client) CancelOrder ¶
func (this *Client) CancelOrder(v CancelOrder) (OrderCancelled, error)
func (*Client) LastTradedPrice ¶
func (this *Client) LastTradedPrice(symbol string) (SymbolPrice, error)
func (*Client) MergedOrderBook ¶
func (this *Client) MergedOrderBook(v MergedOrderBook) (OrderBookResult, error)
func (*Client) OneSymbolLatestInformation ¶
func (this *Client) OneSymbolLatestInformation(symbol string) (i LatestInformation, err error)
func (*Client) OpenOrders ¶
func (this *Client) OpenOrders(v OpenOrders) ([]any, error)
func (*Client) OrderHistory ¶
func (this *Client) OrderHistory(v OrderHistory) ([]OpenedOrder, error)
func (*Client) PlaceOrder ¶
func (this *Client) PlaceOrder(v PlaceOrder) (OrderCreated, error)
func (*Client) PublicTradingRecords ¶
func (this *Client) PublicTradingRecords(v PublicTradingRecords) ([]PublicTradingRecord, error)
func (*Client) QueryKline ¶
func (this *Client) QueryKline(v QueryKline) ([]KlineData, error)
func (*Client) QuerySymbol ¶
func (this *Client) QuerySymbol() ([]SymbolInfo, error)
func (*Client) QuerySymbolNames ¶
func (*Client) ServerTime ¶
Server Time (https://bybit-exchange.github.io/docs/spot/v3/#t-servertime)
func (*Client) SymbolLatestInformation ¶
func (this *Client) SymbolLatestInformation(symbol *string) ([]LatestInformation, error)
func (*Client) TradeHistory ¶
func (this *Client) TradeHistory(v TradeHistory) ([]Trade, error)
func (*Client) WalletBalance ¶
type Error ¶
func (*Error) InsufficientBalance ¶
type GetOrder ¶
type GetOrder struct { OrderID *string `param:"orderId"` OrderLinkID *string `param:"orderLinkId"` }
Get Active Order (https://bybit-exchange.github.io/docs/spot/v3/#t-getactive)
orderId string Order ID. Required if not passing orderLinkId orderLinkId string Unique user-set order ID. Required if not passing orderId
type KlineInterval ¶
type KlineInterval string
Kline interval (interval) (https://bybit-exchange.github.io/docs/spot/v3/#kline-interval-interval)
1m - 1 minute 3m - 3 minutes 5m - 5 minutes 15m - 15 minutes 30m - 30 minutes 1h - 1 hour 2h - 2 hours 4h - 4 hours 6h - 6 hours 12h - 12 hours 1d - 1 day 1w - 1 week 1M - 1 month
const ( Interval1m KlineInterval = "1m" Interval3m KlineInterval = "3m" Interval5m KlineInterval = "5m" Interval15m KlineInterval = "15m" Interval30m KlineInterval = "30m" Interval1h KlineInterval = "1h" Interval2h KlineInterval = "2h" Interval4h KlineInterval = "4h" Interval6h KlineInterval = "6h" Interval12h KlineInterval = "12h" Interval1d KlineInterval = "1d" Interval1w KlineInterval = "1w" Interval1M KlineInterval = "1M" )
type KlineShot ¶
type KlineShot struct { Timestamp uint64 `json:"t"` // Starting time Symbol string `json:"s"` // Trading pair ClosePrice string `json:"c"` // Close price HighPrice string `json:"h"` // High price LowPrice string `json:"l"` // Low price OpenPrice string `json:"o"` // Open price TradingVolume string `json:"v"` // Trading volume }
type LastTradedPrice ¶
type LastTradedPrice struct {
Symbol string `param:"symbol"`
}
Last Traded Price (https://bybit-exchange.github.io/docs/spot/v3/#t-lasttradedprice)
func (LastTradedPrice) Do ¶
func (this LastTradedPrice) Do(client *Client) (SymbolPrice, error)
type LatestInformation ¶
type LatestInformation struct { Time uint64 `json:"t"` Symbol string `json:"s"` LastTradedPrice transport.Float64 `json:"lp"` HighPrice string `json:"h"` LowPrice string `json:"l"` OpenPrice string `json:"o"` BestBidPrice transport.Float64 `json:"bp"` BestAskPrice transport.Float64 `json:"ap"` TradingVolume string `json:"v"` TradingQuoteVolume string `json:"qv"` }
type LtOrderStatus ¶
type LtOrderStatus string
LT order status (orderStatus) (https://bybit-exchange.github.io/docs/spot/v3/#lt-order-status-orderstatus)
1 - Completed 2 - In progress 3 - Failed
const ( Completed LtOrderStatus = "1" InProgress LtOrderStatus = "2" Failed LtOrderStatus = "3" )
type LtOrderType ¶
type LtOrderType string
LT order type (orderType) (https://bybit-exchange.github.io/docs/spot/v3/#lt-order-type-ordertype)
1 - Purchase 2 - Redemption
const ( Purchase LtOrderType = "1" Redemption LtOrderType = "2" )
type LtStatus ¶
type LtStatus string
LT status (status) (https://bybit-exchange.github.io/docs/spot/v3/#lt-status-status)
1 - ETP can be purchased and redeemed 2 - ETP can be purchased, but not redeemed 3 - ETP can be redeemed, but not purchased 4 - ETP cannot be purchased nor redeemed
type MergedOrderBook ¶
type MergedOrderBook struct { Symbol string `param:"symbol"` Scale *int `param:"scale"` Limit *int `param:"limit"` }
Merged Order Book (https://bybit-exchange.github.io/docs/spot/v3/#t-mergedorderbook)
symbol Required string Name of the trading pair scale int Precision of the merged orderbook, 1 means 1 digit limit integer Default value is 100
func (MergedOrderBook) Do ¶
func (this MergedOrderBook) Do(client *Client) (OrderBookResult, error)
type OpenOrders ¶
type OpenOrders struct { Symbol *string `param:"symbol"` OrderID *string `param:"orderId"` Limit *int `param:"limit"` }
Open Orders (https://bybit-exchange.github.io/docs/spot/v3/#t-openorders)
symbol string Name of the trading pair orderId string Specify orderId to return all the orders that orderId of which are smaller than this particular one for pagination purpose limit integer Default value is 500, max 500
type OpenedOrder ¶
type OpenedOrder struct { OrderBase ExecQty string `json:"execQty"` CummulativeQuoteQty string `json:"cummulativeQuoteQty"` AvgPrice string `json:"avgPrice"` StopPrice string `json:"stopPrice"` IcebergQty string `json:"icebergQty"` UpdateTime string `json:"updateTime"` IsWorking string `json:"isWorking"` }
type Order ¶
type Order struct { OpenedOrder Locked string `json:"locked"` }
type OrderBase ¶
type OrderBase struct { AccountID string `json:"accountId"` OrderID string `json:"orderId"` OrderLinkID string `json:"orderLinkId"` Symbol string `json:"symbol"` CreatedTime transport.TimeMs `json:"createTime"` Price transport.Float64 `json:"orderPrice"` OrderQty transport.Float64 `json:"orderQty"` OrderType OrderType `json:"orderType"` Side Side `json:"side"` OrderStatus OrderStatus `json:"status"` TimeInForce TimeInForce `json:"timeInForce"` ExecQty string `json:"execQty"` OrderCategory int `json:"orderCategory"` }
type OrderBook ¶
Order Book (https://bybit-exchange.github.io/docs/spot/v3/#t-orderbook)
symbol Required string Name of the trading pair limit integer Default value is 100
type OrderBookResult ¶
type OrderCancelled ¶
type OrderCreated ¶
type OrderHistory ¶
type OrderHistory struct { Symbol *string `param:"symbol"` OrderID *string `param:"orderId"` Limit *int `param:"limit"` StartTime *uint64 `param:"startTime"` EndTime *uint64 `param:"endTime"` }
Order History (https://bybit-exchange.github.io/docs/spot/v3/#t-orderhistory)
symbol string Name of the trading pair orderId string Specify orderId to return all the orders that orderId of which are smaller than this particular one for pagination purpose limit integer Default value is 500, max 500 startTime long Start time, unit in millisecond endTime long End time, unit in millisecond
func (OrderHistory) Do ¶
func (this OrderHistory) Do(client *Client) ([]OpenedOrder, error)
type OrderShot ¶
type OrderShot struct { EventType string `json:"e"` // Event type EventTime transport.TimeMs `json:"E"` // Event time Symbol string `json:"s"` // Trading pair UserOrderID string `json:"c"` // User-generated order ID Side Side `json:"S"` // BUY indicates buy order, SELL indicates sell order OrderType OrderType `json:"o"` // Order type, LIMIT/MARKET_OF_QUOTE/MARKET_OF_BASE TimeInForce TimeInForce `json:"f"` // Time in force Quantity transport.Float64 `json:"q"` // Quantity Price transport.Float64 `json:"p"` // Price OrderStatus OrderStatus `json:"X"` // Order status OrderID string `json:"i"` // Order ID OrderIDofOpponent string `json:"M"` // Order ID of the opponent trader LastFilledQuantity string `json:"l"` // Last filled quantity TotalFilledQuantity string `json:"z"` // Total filled quantity LastTradedPrice string `json:"L"` // Last traded price TradingFee transport.Float64 `json:"n"` // Trading fee (for a single fill) AssetType string `json:"N"` // Asset type in which fee is paid IsNormalTrade bool `json:"u"` // Is normal trade. False if self-trade. IsWorking bool `json:"w"` // Is working IsLimitMaker bool `json:"m"` // Is LIMIT_MAKER OrderCreationTime transport.TimeMs `json:"O"` // Order creation time TotalFilledValue string `json:"Z"` // Total filled value AccountID string `json:"A"` // Account ID of the opponent trader IsClose bool `json:"C"` // Is close Leverage string `json:"v"` // Leverage Liquidation string `json:"d"` // NO_LIQ indicates that it is not a liquidation order. IOC indicates that it is a liquidation order. TradeID string `json:"t"` // Trade ID }
type OrderStatus ¶
type OrderStatus string
Order status (status) (https://bybit-exchange.github.io/docs/spot/v3/#order-status-status)
ORDER_NEW Untriggered ORDER_FILLED Triggered ORDER_FAILED fail to trigger
const ( New OrderStatus = "NEW" PartiallyFilled OrderStatus = "PARTIALLY_FILLED" Filled OrderStatus = "FILLED" Canceled OrderStatus = "CANCELED" PendingCancel OrderStatus = "PENDING_CANCEL" PendingNew OrderStatus = "PENDING_NEW" Rejected OrderStatus = "REJECTED" )
type OrderType ¶
type OrderType string
Order type (type/orderTypes) (https://bybit-exchange.github.io/docs/spot/v3/#order-type-type-ordertypes)
type OutboundItem ¶
type OutboundShot ¶
type OutboundShot struct { EventType string `json:"e"` // Event type Timestamp string `json:"E"` // Timestamp AllowTrade bool `json:"T"` // Allow trade AllowWithdraw bool `json:"W"` // Allow withdraw AllowDeposit bool `json:"D"` // Allow deposit WalletBalanceChange []OutboundItem `json:"B"` // Wallet balance change }
type PlaceOrder ¶
type PlaceOrder struct { Symbol string `json:"symbol"` Qty float64 `json:"orderQty"` Side Side `json:"side"` Type OrderType `json:"orderType"` TimeInForce *TimeInForce `json:"timeInForce"` Price *float64 `json:"orderPrice"` OrderLinkID *string `json:"orderLinkId"` OrderCategory *int `json:"orderCategory"` TriggerPrice *string `json:"triggerPrice"` }
Place Active Order (https://bybit-exchange.github.io/docs/spot/v3/#t-placeactive)
symbol Required string Name of the trading pair qty Required number Order quantity (for market orders: when side is Buy, this is in the quote currency. Otherwise, qty is in the base currency. For example, on BTCUSDT a Buy order is in USDT, otherwise it's in BTC. For limit orders, the qty is always in the base currency.) side Required string Order direction type Required string Order type timeInForce string Time in force price number Order price. When the type field is MARKET, the price field is optional. When the type field is LIMIT or LIMIT_MAKER, the price field is required orderLinkId string User-generated order ID
func (PlaceOrder) Do ¶
func (this PlaceOrder) Do(client *Client) (OrderCreated, error)
type PublicTradingRecord ¶
type PublicTradingRecords ¶
Public Trading Records (https://bybit-exchange.github.io/docs/spot/v3/#t-publictradingrecords)
symbol Required string Name of the trading pair limit integer Default value is 60, max 60
func (PublicTradingRecords) Do ¶
func (this PublicTradingRecords) Do(client *Client) ([]PublicTradingRecord, error)
type Qty ¶
type Qty uint64
Quantity (qty) (https://bybit-exchange.github.io/docs/spot/v3/#quantity-qty)
type QueryKline ¶
type QueryKline struct { Symbol string `param:"symbol"` Interval KlineInterval `param:"interval"` Limit *int `param:"limit"` StartTime *int `param:"startTime"` EndTime *int `param:"endTime"` }
Query Kline (https://bybit-exchange.github.io/docs/spot/v3/#t-querykline)
symbol Required string Name of the trading pair interval Required string Chart interval limit integer Default value is 1000, max 1000 startTime number Start time, unit in millisecond endTime number End time, unit in millisecond
type Responce ¶
type StopOrderShot ¶
type StopOrderShot struct { EventType string `json:"e"` // Event type EventTime string `json:"E"` // Event time Symbol string `json:"s"` // Trading pair UserOrderID string `json:"c"` // User-generated order ID Side string `json:"S"` // BUY indicates buy order, SELL indicates sell order OrderType string `json:"o"` // Order type, LIMIT/MARKET_OF_QUOTE/MARKET_OF_BASE TimeInForce string `json:"f"` // Time in force Quantity string `json:"q"` // Quantity Price string `json:"p"` // Price OrderStatus string `json:"X"` // Order status OrderID string `json:"i"` // Order ID OrderCreationTime string `json:"T"` // Order creation time OrderTriggeredTime string `json:"t"` // Order triggered time OrderUpdatedTime string `json:"C"` // Order updated time }
type Subscription ¶
func (*Subscription) Request ¶
func (o *Subscription) Request(operation string) Request
func (*Subscription) String ¶
func (o *Subscription) String() string
type SubscriptionFunc ¶
type Subscriptions ¶
type Subscriptions map[string]SubscriptionFunc
type SymbolInfo ¶
type SymbolInfo struct { Name string `json:"name"` Alias string `json:"alias"` BaseCoin string `json:"baseCoin"` QuoteCoin string `json:"quoteCoin"` BasePrecision transport.Float64 `json:"basePrecision"` QuotePrecision transport.Float64 `json:"quotePrecision"` MinTradeQty transport.Float64 `json:"minTradeQty"` MinTradeAmt transport.Float64 `json:"minTradeAmt"` MaxTradeQty transport.Float64 `json:"maxTradeQty"` MaxTradeAmt transport.Float64 `json:"maxTradeAmt"` MinPricePrecision transport.Float64 `json:"minPricePrecision"` Category string `json:"category"` ShowStatus string `json:"showStatus"` Innovation string `json:"innovation"` }
Query Symbol (https://bybit-exchange.github.io/docs/spot/v3/#t-spot_querysymbol)
type SymbolLatestInformation ¶
type SymbolLatestInformation struct {
Symbol *string `param:"symbol"`
}
Latest Information for Symbol (https://bybit-exchange.github.io/docs/spot/v3/#t-spot_latestsymbolinfo)
func (SymbolLatestInformation) Do ¶
func (this SymbolLatestInformation) Do(client *Client) ([]LatestInformation, error)
type SymbolPrice ¶
type TickersShot ¶
type TickersShot struct { Timestamp uint64 `json:"t"` // Starting time Symbol string `json:"s"` // Trading pair OpenPrice string `json:"o"` // Open price HighPrice string `json:"h"` // High price LowPrice string `json:"l"` // Low price ClosePrice string `json:"c"` // Close price TradingVolume string `json:"v"` // Trading volume TradingQuoteVolume string `json:"qv"` // Trading quote volume Change string `json:"m"` // Change }
type TicketShot ¶
type TicketShot struct { EventType string `json:"e"` // Event type EventTime string `json:"E"` // Event time Symbol string `json:"s"` // Trading pair Quantity string `json:"q"` // Quantity Timestamp string `json:"t"` // Timestamp Price string `json:"p"` // Price TradeID string `json:"T"` // Trade ID OrderID string `json:"o"` // Order ID OrderIDofOpponent string `json:"O"` // Order ID of the opponent trader AccountID string `json:"a"` // Account ID AccountIDofOpponent string `json:"A"` // Account ID of the opponent trader IsLimitMaker bool `json:"m"` // Is LIMIT_MAKER Side string `json:"S"` // BUY indicates buy order, SELL indicates sell order }
type TimeInForce ¶
type TimeInForce string
Time in force (time_in_force) (https://bybit-exchange.github.io/docs/spot/v3/#time-in-force-timeinforce)
GTC - Good Till Canceled FOK - Fill or Kill IOC - Immediate or Cancel
const ( GoodTillCanceled TimeInForce = "GTC" FillOrKill TimeInForce = "FOK" ImmediateOrCancel TimeInForce = "IOC" )
type TopicMessage ¶
type TopicName ¶
type TopicName string
const ( // public TopicDepth TopicName = "orderbook" TopicTrade TopicName = "trade" TopicKline TopicName = "kline" TopicTickers TopicName = "tickers" TopicBookTicker TopicName = "bookticker" // private TopicOrder TopicName = "order" TopicStopOrder TopicName = "stopOrder" TopicTicket TopicName = "ticketInfo" TopicOutbound TopicName = "outboundAccountInfo" )
type Trade ¶
type Trade struct { ID string `json:"id"` Symbol string `json:"symbol"` OrderID string `json:"orderId"` TradeID string `json:"tradeId"` Price string `json:"orderPrice"` Qty string `json:"orderQty"` ExecFee string `json:"execFee"` FeeTokenId string `json:"feeTokenId"` CreatedTime string `json:"createdTime"` IsBuyer string `json:"isBuyer"` IsMaker string `json:"isMaker"` MatchOrderID string `json:"matchOrderId"` MakerRebate string `json:"makerRebate"` ExecutionTime string `json:"executionTime"` }
type TradeHistory ¶
type TradeHistory struct { Symbol *string `param:"symbol"` Limit *int `param:"limit"` FromTicketID *int `param:"fromTicketId"` ToTicketID *int `param:"toTicketId"` OrderID *string `param:"orderId"` StartTime *uint64 `param:"startTime"` EndTime *uint64 `param:"endTime"` }
Trade History (https://bybit-exchange.github.io/docs/spot/v3/#t-tradehistory)
symbol string Name of the trading pair limit integer Default value is 50, max 50 fromTicketId integer Query greater than the trade ID. (fromTicketId < trade ID) toTicketId integer Query smaller than the trade ID. (trade ID < toTicketId) orderId integer Order ID startTime long Start time, unit in millisecond endTime long End time, unit in millisecond
type WsClient ¶
type WsClient struct {
// contains filtered or unexported fields
}
func NewWsClient ¶
func (*WsClient) SetOnConnected ¶
func (o *WsClient) SetOnConnected(onConnected func())
func (*WsClient) SetOnDialError ¶
func (*WsClient) SetOnDisconnected ¶
func (o *WsClient) SetOnDisconnected(onConnected func())
func (*WsClient) SetOnTopicMessage ¶
func (o *WsClient) SetOnTopicMessage(onTopicMessage func(TopicMessage) error)
func (*WsClient) Subscribe ¶
func (o *WsClient) Subscribe(s Subscription) bool
func (*WsClient) Unsubscribe ¶
func (o *WsClient) Unsubscribe(s Subscription) bool
func (*WsClient) WithByTickUrl ¶
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]) Subscribe ¶
func (o *WsExecutor[T]) Subscribe(onShot func(T))
func (*WsExecutor[T]) Unsubscribe ¶
func (o *WsExecutor[T]) Unsubscribe()
type WsPrivate ¶
type WsPrivate struct {
// contains filtered or unexported fields
}
func NewWsPrivate ¶
func (*WsPrivate) Order ¶
func (o *WsPrivate) Order() *WsExecutor[[]OrderShot]
func (*WsPrivate) Outbound ¶
func (o *WsPrivate) Outbound() *WsExecutor[[]OutboundShot]
func (*WsPrivate) SetOnDialError ¶
func (*WsPrivate) StopOrder ¶
func (o *WsPrivate) StopOrder() *WsExecutor[[]StopOrderShot]
func (*WsPrivate) Ticket ¶
func (o *WsPrivate) Ticket() *WsExecutor[[]TicketShot]
func (*WsPrivate) WithByTickUrl ¶
type WsPublic ¶
type WsPublic struct {
// contains filtered or unexported fields
}
func NewWsPublic ¶
func NewWsPublic() *WsPublic
func (*WsPublic) BookTicker ¶
func (o *WsPublic) BookTicker(symbol string) *WsExecutor[BookTickerShot]
func (*WsPublic) Kline ¶
func (o *WsPublic) Kline(symbol string, interval KlineInterval) *WsExecutor[KlineShot]
func (*WsPublic) SetOnDialError ¶
func (*WsPublic) Tickers ¶
func (o *WsPublic) Tickers(symbol string) *WsExecutor[TickersShot]
func (*WsPublic) WithByTickUrl ¶
type WsSection ¶
type WsSection struct {
// contains filtered or unexported fields
}
func NewWsSection ¶
func NewWsSection(ws WsSectionClient) *WsSection
type WsSectionClient ¶
type WsSectionClient interface { Ready() bool // contains filtered or unexported methods }