spot

package
v0.3.21 Latest Latest
Warning

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

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

Documentation

Overview

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

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

Spot (https://bybit-exchange.github.io/docs/spot/v1)

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

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

Wallet Data Endpoints (https://bybit-exchange.github.io/docs/spot/v1/#t-wallet)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Delete

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

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 GetQuote

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

func Post

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

Types

type Balance

type Balance struct {
	Coin     string `json:"coin"`
	CoinID   string `json:"coinId"`
	CoinName string `json:"coinName"`
	Total    string `json:"total"`
	Free     string `json:"free"`
	Locked   string `json:"locked"`
}

Get Wallet Balance (https://bybit-exchange.github.io/docs/spot/v1/#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/v1/#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

func (BatchCancelOrder) Do

func (this BatchCancelOrder) Do(client *Client) (bool, error)

type BatchCancelOrderByID

type BatchCancelOrderByID struct {
	ID []string `param:"orderIds"`
}

Batch Cancel Active Order By IDs (https://bybit-exchange.github.io/docs/spot/v1/#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 BatchFastCancelOrder

type BatchFastCancelOrder struct {
	Symbol string     `param:"symbol"`
	Side   *Side      `param:"side"`
	Type   *OrderType `param:"orderTypes"`
}

Batch Fast Cancel Active Order (https://bybit-exchange.github.io/docs/spot/v1/#t-batchfastcancelactiveorder)

func (BatchFastCancelOrder) Do

func (this BatchFastCancelOrder) Do(client *Client) (bool, error)

type BestBidAskPrice

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

Best Bid/Ask Price (https://bybit-exchange.github.io/docs/spot/v1/#t-bestbidask)

func (BestBidAskPrice) Do

func (this BestBidAskPrice) Do(client *Client) (BestBidAskPriceResult, error)

type BestBidAskPriceResult

type BestBidAskPriceResult struct {
	Symbol   string `json:"symbol"`
	BidPrice string `json:"bidPrice"`
	BidQty   string `json:"bidQty"`
	AskPrice string `json:"askPrice"`
	AskQty   string `json:"askQty"`
	Time     uint64 `json:"time"`
}

type CancelOrder

type CancelOrder struct {
	OrderID     *string `param:"orderId"`
	OrderLinkID *string `param:"orderLinkId"`
}

Cancel Active Order (https://bybit-exchange.github.io/docs/spot/v1/#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 CancelOrderID struct {
	OrderID string `json:"orderId"`
	Code    int    `json:"code"`
}

type Client

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

Spot HTTP client

func NewClient

func NewClient(client *transport.Client) *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) BatchFastCancelOrder

func (this *Client) BatchFastCancelOrder(v BatchFastCancelOrder) (bool, 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) Delete

func (this *Client) Delete(path string, param any, ret any) error

func (*Client) FastCancelOrder

func (this *Client) FastCancelOrder(v FastCancelOrder) (bool, error)

func (*Client) Get

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

func (*Client) GetOrder

func (this *Client) GetOrder(v GetOrder) (Order, error)

func (*Client) GetPublic

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

func (*Client) GetQuote

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

func (this *Client) OpenOrders(v OpenOrders) ([]OrderBase, error)

func (*Client) OrderBook

func (this *Client) OrderBook(v OrderBook) (OrderBookResult, error)

func (*Client) OrderHistory

func (this *Client) OrderHistory(v OrderHistory) ([]OrderHistoryResult, error)

func (*Client) PlaceOrder

func (this *Client) PlaceOrder(v PlaceOrder) (OrderCreated, error)

func (*Client) Post

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

func (*Client) PublicTradingRecords

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

func (*Client) QueryKline

func (this *Client) QueryKline(v QueryKline) ([][]any, error)

func (*Client) QuerySymbol

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

func (*Client) QuerySymbolNames

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

func (*Client) ServerTime

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

Server Time (https://bybit-exchange.github.io/docs/spot/v1/#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) Transport

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

func (*Client) WalletBalance

func (this *Client) WalletBalance() ([]Balance, error)

type Error

type Error struct {
	transport.Err
}

type FastCancelOrder

type FastCancelOrder struct {
	Symbol      string  `param:"symbolId"`
	OrderID     *string `param:"orderId"`
	OrderLinkID *string `param:"orderLinkId"`
}

Fast Cancel Active Order (https://bybit-exchange.github.io/docs/spot/v1/#t-fastcancelactiveorder)

symbolId    Required string Name of the trading pair
orderId              string Order ID. Required if not passing orderLinkId
orderLinkId          string Unique user-set order ID. Required if not passing orderId

func (FastCancelOrder) Do

func (this FastCancelOrder) Do(client *Client) (bool, error)

type GetOrder

type GetOrder struct {
	OrderID     *string `param:"orderId"`
	OrderLinkID *string `param:"orderLinkId"`
}

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

orderId     string Order ID. Required if not passing orderLinkId
orderLinkId string Unique user-set order ID. Required if not passing orderId

func (GetOrder) Do

func (this GetOrder) Do(client *Client) (Order, error)

type KlineInterval

type KlineInterval string

Kline interval (interval) (https://bybit-exchange.github.io/docs/spot/v1/#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 LastTradedPrice

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

Last Traded Price (https://bybit-exchange.github.io/docs/spot/v1/#t-lasttradedprice)

func (LastTradedPrice) Do

func (this LastTradedPrice) Do(client *Client) (SymbolPrice, error)

type LatestInformation

type LatestInformation struct {
	Time         uint64 `json:"time"`
	Symbol       string `json:"symbol"`
	BestBidPrice string `json:"bestBidPrice"`
	BestAskPrice string `json:"bestAskPrice"`
	Volume       string `json:"volume"`
	QuoteVolume  string `json:"quoteVolume"`
	LastPrice    string `json:"lastPrice"`
	HighPrice    string `json:"highPrice"`
	LowPrice     string `json:"lowPrice"`
	OpenPrice    string `json:"openPrice"`
}

type LtOrderStatus

type LtOrderStatus string

LT order status (orderStatus) (https://bybit-exchange.github.io/docs/spot/v1/#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/v1/#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/v1/#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/v1/#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/v1/#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

func (OpenOrders) Do

func (this OpenOrders) Do(client *Client) ([]OrderBase, error)

type Order

type Order struct {
	OrderHistoryResult
	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"`
	SymbolName  string      `json:"symbolName"`
	Price       string      `json:"price"`
	OrigQty     string      `json:"origQty"`
	ExecutedQty string      `json:"executedQty"`
	OrderType   OrderType   `json:"type"`
	OrderStatus OrderStatus `json:"status"`
	TimeInForce TimeInForce `json:"timeInForce"`
}

type OrderBook

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

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

symbol Required string  Name of the trading pair
limit           integer Default value is 100

func (OrderBook) Do

func (this OrderBook) Do(client *Client) (OrderBookResult, error)

type OrderBookResult

type OrderBookResult struct {
	Time uint64 `json:"time"`
	Bids [][]string
	Asks [][]string
}

type OrderCancelled

type OrderCancelled struct {
	OrderCreated
	Side string `json:"side"`
}

type OrderCreated

type OrderCreated struct {
	OrderBase
	TransactTime string `json:"transactTime"`
}

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/v1/#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) ([]OrderHistoryResult, error)

type OrderHistoryResult

type OrderHistoryResult struct {
	OrderBase
	ExchangeId          string `json:"exchangeId"`
	CummulativeQuoteQty string `json:"cummulativeQuoteQty"`
	AvgPrice            string `json:"avgPrice"`
	StopPrice           string `json:"stopPrice"`
	IcebergQty          string `json:"icebergQty"`
	Time                string `json:"time"`
	UpdateTime          string `json:"updateTime"`
	IsWorking           bool   `json:"isWorking"`
}

type OrderStatus

type OrderStatus string

Order status (status) (https://bybit-exchange.github.io/docs/spot/v1/#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"
	// The below status for tp/sl order only
	OrderNew      OrderStatus = "ORDER_NEW"
	OrderCanceled OrderStatus = "ORDER_CANCELED"
	OrderFilled   OrderStatus = "ORDER_FILLED"
	OrderFailed   OrderStatus = "ORDER_FAILED"
)

type OrderType

type OrderType string

Order type (type/orderTypes) (https://bybit-exchange.github.io/docs/spot/v1/#order-type-type-ordertypes)

const (
	Limit       OrderType = "LIMIT"
	Market      OrderType = "MARKET"
	LimitMarket OrderType = "LIMIT_MAKER"
)

type PlaceOrder

type PlaceOrder struct {
	Symbol      string       `param:"symbol"`
	Qty         int          `param:"qty"`
	Side        Side         `param:"side"`
	Type        OrderType    `param:"type"`
	TimeInForce *TimeInForce `param:"timeInForce"`
	Price       *Price       `param:"price"`
	OrderLinkID *string      `param:"orderLinkId"`
}

Place Active Order (https://bybit-exchange.github.io/docs/spot/v1/#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 PublicTradingRecord struct {
	Price        string `json:"price"`
	Time         uint64 `json:"time"`
	Qty          string `json:"qty"`
	IsBuyerMaker bool   `json:"isBuyerMaker"`
}

type PublicTradingRecords

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

Public Trading Records (https://bybit-exchange.github.io/docs/spot/v1/#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 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/v1/#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

func (QueryKline) Do

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

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"`
	TimeNow string `json:"time_now"`
	Result  T      `json:"result"`
}

type Side

type Side string

Side (side) (https://bybit-exchange.github.io/docs/spot/v1/#side-side)

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

type SymbolInfo

type SymbolInfo struct {
	Name              string `json:"name"`
	Alias             string `json:"alias"`
	BaseCurrency      string `json:"baseCurrency"`
	QuoteCurrency     string `json:"quoteCurrency"`
	BasePrecision     string `json:"basePrecision"`
	QuotePrecision    string `json:"quotePrecision"`
	MinTradeQuantity  string `json:"minTradeQuantity"`
	MinTradeAmount    string `json:"minTradeAmount"`
	MaxTradeQuantity  string `json:"maxTradeQuantity"`
	MaxTradeAmount    string `json:"maxTradeAmount"`
	MinPricePrecision string `json:"minPricePrecision"`
	Category          int    `json:"category"`
	ShowStatus        bool   `json:"showStatus"`
	Innovation        bool   `json:"innovation"`
}

Query Symbol (https://bybit-exchange.github.io/docs/spot/v1/#t-spot_querysymbol)

type SymbolLatestInformation

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

Latest Information for Symbol (https://bybit-exchange.github.io/docs/spot/v1/#t-spot_latestsymbolinfo)

func (SymbolLatestInformation) Do

func (this SymbolLatestInformation) Do(client *Client) ([]LatestInformation, error)

type SymbolPrice

type SymbolPrice struct {
	Symbol string `json:"symbol"`
	Price  string `json:"price"`
}

type TimeInForce

type TimeInForce string

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

GTC - Good Till Canceled
FOK - Fill or Kill
IOC - Immediate or Cancel
const (
	GoodTillCanceled  TimeInForce = "GTC"
	FillOrKill        TimeInForce = "FOK"
	ImmediateOrCancel TimeInForce = "IOC"
)

type Topic

type Topic struct {
	Name   TopicName   `json:"topic"`
	Params TopicParams `json:"params"`
	Event  TopicEvent  `json:"event"`
}

type TopicDataBookTicker

type TopicDataBookTicker struct {
	Symbol    string `json:"s"`        // Trading pair
	BidPrice  string `json:"bidPrice"` // Best bid price
	BidQty    string `json:"bidQty"`   // Bid quantity
	AskPrice  string `json:"askPrice"` // Best ask price
	AskQty    string `json:"askQty"`   // Ask quantity
	Timestamp uint64 `json:"time"`     // Timestamp (last update time of the order book)
}

type TopicDataDepth

type TopicDataDepth struct {
	Timestamp uint64     `json:"t"` // Timestamp (last update time of the order book)
	Symbol    string     `json:"s"` // Trading pair
	Version   string     `json:"v"` // Version
	Bids      [][]string `json:"b"` // Best bid price, quantity
	Asks      [][]string `json:"a"` // Best ask price, quantity
}

type TopicDataKline

type TopicDataKline struct {
	Timestamp     uint64 `json:"t"`  // Starting time
	Symbol        string `json:"s"`  // Trading pair
	SymbolName    string `json:"sn"` // 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 TopicDataRealtimes

type TopicDataRealtimes struct {
	Timestamp          uint64 `json:"t"`  // Timestamp (trading time in the match box)
	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
	TradingQuoteVolume string `json:"qv"` // Trading quote volume
	Change             string `json:"m"`  // Change
}

type TopicDataTrade

type TopicDataTrade struct {
	TradeID   string `json:"v"` // Trade ID
	Timestamp uint64 `json:"t"` // Timestamp (trading time in the match box)
	Price     string `json:"p"` // Price
	Quantity  string `json:"q"` // Quantity
	M         bool   `json:"m"` // True indicates buy side is taker, false indicates sell side is taker
}

type TopicEvent

type TopicEvent string
const (
	TopicEventSub    TopicEvent = "sub"
	TopicEventCancel TopicEvent = "cancel"
)

type TopicName

type TopicName string
const (
	TopicDepth      TopicName = "depth"
	TopicKline      TopicName = "kline"
	TopicTrade      TopicName = "trade"
	TopicBookTicker TopicName = "bookTicker"
	TopicRealtimes  TopicName = "realtimes"
)

type TopicNotification

type TopicNotification[T any] struct {
	Topic  TopicName   `json:"topic"`
	Params TopicParams `json:"params"`
	Data   T           `json:"data"`
}

type TopicParams

type TopicParams struct {
	Symbol     string        `json:"symbol"`
	Binary     string        `json:"binary"`
	SymbolName string        `json:"symbolName"`
	KlineType  KlineInterval `json:"klineType"`
}

type TopicSubscribtion

type TopicSubscribtion struct {
	Topic
	Code    string `json:"code"`
	Message string `json:"msg"`
}

func (*TopicSubscribtion) HasCode

func (this *TopicSubscribtion) HasCode() bool

func (*TopicSubscribtion) Ok

func (this *TopicSubscribtion) Ok() bool

type Trade

type Trade struct {
	ID              string   `json:"id"`
	Symbol          string   `json:"symbol"`
	SymbolName      string   `json:"symbolName"`
	OrderID         string   `json:"orderId"`
	TicketID        string   `json:"ticketId"`
	MatchOrderID    string   `json:"matchOrderId"`
	Price           string   `json:"price"`
	Qty             string   `json:"qty"`
	Commission      string   `json:"commission"`
	CommissionAsset string   `json:"commissionAsset"`
	Time            string   `json:"time"`
	IsBuyer         bool     `json:"isBuyer"`
	IsMaker         bool     `json:"isMaker"`
	Fee             TradeFee `json:"fee"`
	FeeTokenID      string   `json:"feeTokenId"`
	FeeAmount       string   `json:"feeAmount"`
	MakerRebate     string   `json:"makerRebate"`
	ExecutionTime   string   `json:"executionTime"`
}

type TradeFee

type TradeFee struct {
	TokenID   string `json:"feeTokenId"`
	TokenName string `json:"feeTokenName"`
	Fee       string `json:"fee"`
}

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/v1/#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

func (TradeHistory) Do

func (this TradeHistory) Do(client *Client) ([]Trade, error)

type WsPrivate

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

func NewWsPrivate

func NewWsPrivate(url string, key string, secret string) *WsPrivate

func (*WsPrivate) Conf

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

func (*WsPrivate) Run

func (this *WsPrivate) Run()

func (*WsPrivate) SetOnAuth

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

func (*WsPrivate) Shutdown

func (this *WsPrivate) Shutdown()

func (*WsPrivate) WithLog

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

func (*WsPrivate) WithProxy

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

type WsPublic

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

func NewWsPublic

func NewWsPublic(url string) *WsPublic

func (*WsPublic) Conf

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

func (*WsPublic) Run

func (this *WsPublic) Run()

func (*WsPublic) Shutdown

func (this *WsPublic) Shutdown()

func (*WsPublic) Subscribe

func (this *WsPublic) Subscribe(topic TopicName, symbol string)

func (*WsPublic) Unsubscribe

func (this *WsPublic) Unsubscribe(topic TopicName, symbol string)

func (*WsPublic) WithLog

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

func (*WsPublic) WithProxy

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

type WsPublicTiny

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

func NewWsPublicTiny

func NewWsPublicTiny(url string) *WsPublicTiny

func (*WsPublicTiny) Conf

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

func (*WsPublicTiny) Connected

func (this *WsPublicTiny) Connected() bool

func (*WsPublicTiny) Run

func (this *WsPublicTiny) Run()

func (*WsPublicTiny) SetOnConnected

func (this *WsPublicTiny) SetOnConnected(onConnected func())

func (*WsPublicTiny) Shutdown

func (this *WsPublicTiny) Shutdown()

func (*WsPublicTiny) Subscribe

func (this *WsPublicTiny) Subscribe(topic TopicName, symbol string) bool

func (*WsPublicTiny) Unsubscribe

func (this *WsPublicTiny) Unsubscribe(topic TopicName, symbol string) bool

func (*WsPublicTiny) WithLog

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

func (*WsPublicTiny) WithProxy

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

Jump to

Keyboard shortcuts

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