Documentation ¶
Index ¶
- Constants
- func AsyncListener(c *websocket.Conn, out chan Message, onConnect func(m Message), ...)
- func Listener(c *Client)
- func SubscribeToPositions(ctx context.Context, wsClient *bybit.WebSocketClient, lg *zap.Logger, ...) (<-chan exchanges.PositionEvent, error)
- func SubscribeToPrices(ctx context.Context, wsClient *bybit.WebSocketClient, lg *zap.Logger, ...) (<-chan exchanges.PriceEvent, error)
- func SubscribeToPricesInverse(ctx context.Context, wsClient *bybit.WebSocketClient, lg *zap.Logger, ...) (<-chan exchanges.PriceEvent, error)
- func SubscribeToPricesLinear(ctx context.Context, wsClient *bybit.WebSocketClient, lg *zap.Logger, ...) (<-chan exchanges.PriceEvent, error)
- type AsyncClient
- func (c *AsyncClient) Connect() (err error)
- func (c *AsyncClient) CreateWebsocket(url string, events chan Message) (*websocket.Conn, error)
- func (c *AsyncClient) FindContract(name string) (int64, error)
- func (c *AsyncClient) SendAsync(socketId string, endpoint string, queryParams string, body string) (id int64, err error)
- func (c *AsyncClient) SendAuthorization(socketId string, accessToken string) error
- func (c *AsyncClient) SendPriceSubscription(symbol string) error
- type AuthorizationResponse
- type Chart
- type ChartDescription
- type ChartRequest
- type Client
- func (c *Client) CancelHistoricalTickData(id int) error
- func (c *Client) ConnectWebsocket() (err error)
- func (c *Client) FindContract(name string) (Contract, error)
- func (c *Client) GetAccessToken() error
- func (c *Client) GetExchanges() error
- func (c *Client) GetFilledOrders() error
- func (c *Client) GetHistoricalTickData(symbol string, start time.Time, end time.Time) (Subscription, error)
- func (c *Client) GetOrders() error
- func (c *Client) Send(endpoint string, queryParams string, body string, timeout int) (*Message, error)
- func (c *Client) SendAsync(endpoint string, queryParams string, body string) (int64, error)
- func (c *Client) SendAuthorization() error
- func (c *Client) UnsubscribeRealtimeData(id int) error
- type Connection
- type Contract
- type Message
- type OrderHistoryResponse
- type RateLimitError
- type RequestMetadata
- type ResultResponse
- type Subscription
- type SymbolFilter
- type Tick
- type Time
- type TimeRange
- type TradovateResponse
Constants ¶
View Source
const ( GetOrderHistoryPath = "/v5/order/history" TradovateBaseURL = "https://demo.tradovateapi.com/v1" )
View Source
const ( AUTHORIZE = "authorize" CANCEL_CHART = "md/cancelchart" CONNECT_WEBSOCKET = "/websocket" FIND_CONTRACT = "contract/find" GET_ACCESS_TOKEN = "/auth/accesstokenrequest" GET_CHART = "md/getchart" UNSUBSCRIBE_QOUTE = "md/unsubscribeQuote" GET_ORDERS = "order/list" GET_FILLED_ORDERS = "fill/list" GET_EXCHANGE_LIST = "exchange/list" )
Variables ¶
This section is empty.
Functions ¶
func AsyncListener ¶
func SubscribeToPositions ¶
func SubscribeToPrices ¶
func SubscribeToPricesLinear ¶
Types ¶
type AsyncClient ¶
type AsyncClient struct { AppName string AppVersion string HttpHost string WebsocketHost string MarketDataHost string Username string Password string ClientId string ApiKey string DeviceId string WebsocketConnected bool WebsocketAuthorized bool WebsocketConnection *websocket.Conn MarketDataConnected bool MarketDataAuthorized bool MarketDataConnection *websocket.Conn Events chan Message Connected bool AccessToken string TokenExpiration time.Time HeartbeatTicker *time.Ticker LastHeartbeatResponse time.Time PenaltyTicket string RequestPool map[int64]RequestMetadata LastRequestId int64 MarketData map[string][]Tick }
func NewAsyncClient ¶
func (*AsyncClient) Connect ¶
func (c *AsyncClient) Connect() (err error)
func (*AsyncClient) CreateWebsocket ¶
func (*AsyncClient) FindContract ¶
func (c *AsyncClient) FindContract(name string) (int64, error)
func (*AsyncClient) SendAuthorization ¶
func (c *AsyncClient) SendAuthorization(socketId string, accessToken string) error
func (*AsyncClient) SendPriceSubscription ¶
func (c *AsyncClient) SendPriceSubscription(symbol string) error
type AuthorizationResponse ¶
type ChartDescription ¶
type ChartDescription struct { // Tick, DailyBar, MinuteBar, Custom, DOM UnderlyingType string `json:"underlyingType,omitempty"` ElementSize int `json:"elementSize,omitempty"` // Volume, Range, UnderlyingUnits, Renko, MomentumRange, PointAndFigure, OFARange ElementSizeUnit string `json:"elementSizeUnit,omitempty"` WithHistogram bool `json:"withHistogram,omitempty"` }
type ChartRequest ¶
type ChartRequest struct { Symbol string `json:"symbol"` ChartDescription ChartDescription `json:"chartDescription"` TimeRange TimeRange `json:"timeRange"` }
type Client ¶
type Client struct { AppName string AppVersion string HttpHost string WebsocketHost string Username string Password string ClientId string ApiKey string DeviceId string ConnectionMutex sync.Mutex Connection *websocket.Conn Connected bool AccessToken string TokenExpiration time.Time HeartbeatTicker *time.Ticker LastHeartbeatResponse time.Time PenaltyTicket string RequestPool map[int64]chan Message LastRequestId int64 MarketData map[string][]Tick }
func (*Client) CancelHistoricalTickData ¶
func (*Client) ConnectWebsocket ¶
func (*Client) GetAccessToken ¶
func (*Client) GetExchanges ¶
func (*Client) GetFilledOrders ¶
func (*Client) GetHistoricalTickData ¶
func (*Client) SendAuthorization ¶
func (*Client) UnsubscribeRealtimeData ¶
type Connection ¶
type Message ¶
type Message struct { Id int64 `json:"i,omitempty"` Status int `json:"s,omitempty"` EventType string `json:"e,omitempty"` Data json.RawMessage `json:"d,omitempty"` }
type OrderHistoryResponse ¶
type RateLimitError ¶
type RateLimitError struct { PenaltyTicket string PenaltyTime int64 PenaltyExpiration time.Time PenaltyCaptcha bool }
func (*RateLimitError) Error ¶
func (e *RateLimitError) Error() string
type RequestMetadata ¶
type ResultResponse ¶
type ResultResponse struct { NextPageCursor string `json:"nextPageCursor"` Category string `json:"category"` List []OrderHistoryResponse `json:"list"` }
type Subscription ¶
type SymbolFilter ¶
type SymbolFilter struct { LotSizeFilter struct { BasePrecision string `json:"basePrecision"` QuotePrecision string `json:"quotePrecision"` MaxOrderQty string `json:"maxOrderQty"` MinOrderQty string `json:"minOrderQty"` MinOrderAmt string `json:"minOrderAmt"` MaxOrderAmt string `json:"maxOrderAmt"` } `json:"lotSizeFilter"` PriceFilter struct { TickSize string `json:"tickSize"` } `json:"priceFilter"` }
type TradovateResponse ¶
type TradovateResponse struct { RetCode int `json:"retCode"` RetMsg string `json:"retMsg"` Result ResultResponse `json:"result"` }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.