Documentation
¶
Index ¶
- type Client
- func (c *Client) ConnectedCh() <-chan struct{}
- func (c *Client) Destroy()
- func (c *Client) IsConnected() bool
- func (c *Client) RequestContractDetails(ctx context.Context, opts models.ContractDetailsRequestOptions) (*models.ContractDetailsResponse, error)
- func (c *Client) RequestCurrentTime(ctx context.Context) (time.Time, error)
- func (c *Client) RequestHistoricalData(ctx context.Context, opts models.HistoricalDataRequestOptions) (*models.HistoricalDataResponse, error)
- func (c *Client) RequestHistoricalTicks(ctx context.Context, opts models.HistoricalTicksRequestOptions) (*models.HistoricalTicksResponse, error)
- func (c *Client) RequestManagedAccounts(ctx context.Context) ([]string, error)
- func (c *Client) RequestMarketDataType(_ context.Context, opts models.MarketDataTypeRequestOptions) error
- func (c *Client) RequestMarketDepthData(_ context.Context, opts models.MarketDepthDataRequestOptions) (*models.MarketDepthDataResponse, error)
- func (c *Client) RequestMatchingSymbols(ctx context.Context, opts models.MatchingSymbolsRequestOptions) (*models.MatchingSymbolsResponse, error)
- func (c *Client) RequestTopMarketData(_ context.Context, opts models.TopMarketDataRequestOptions) (*models.TopMarketDataResponse, error)
- func (c *Client) ServerVersion() int
- type Events
- type EventsLogger
- type EventsLoggerCallback
- type NonIdRequestList
- type Options
- type Request
- type RequestCompleteCallback
- type RequestError
- type RequestManager
- type RequestOptions
- type RequestType
- type WithRequestWithIdCallback
- type WithRequestWithTickerIdCallback
- type WithRequestWithoutIdCallback
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
NewClient creates a new client object and establishes a connection to the given server.
func (*Client) ConnectedCh ¶
func (c *Client) ConnectedCh() <-chan struct{}
ConnectedCh returns a channel closed if the connection goes down.
func (*Client) Destroy ¶
func (c *Client) Destroy()
Destroy shuts down the current connection, cancels all pending requests and destroys the client object.
func (*Client) IsConnected ¶
IsConnected returns true if the connection to the server is alive.
func (*Client) RequestContractDetails ¶
func (c *Client) RequestContractDetails(ctx context.Context, opts models.ContractDetailsRequestOptions) (*models.ContractDetailsResponse, error)
RequestContractDetails retrieves all details for contracts matching the provided input.
func (*Client) RequestCurrentTime ¶
RequestCurrentTime asks the current system time on the server side.
func (*Client) RequestHistoricalData ¶
func (c *Client) RequestHistoricalData(ctx context.Context, opts models.HistoricalDataRequestOptions) (*models.HistoricalDataResponse, error)
RequestHistoricalData retrieves historical market data.
func (*Client) RequestHistoricalTicks ¶
func (c *Client) RequestHistoricalTicks(ctx context.Context, opts models.HistoricalTicksRequestOptions) (*models.HistoricalTicksResponse, error)
RequestHistoricalTicks retrieves historical market ticks.
func (*Client) RequestManagedAccounts ¶
RequestManagedAccounts requests the list of managed accounts.
func (*Client) RequestMarketDataType ¶
func (*Client) RequestMarketDepthData ¶
func (c *Client) RequestMarketDepthData(_ context.Context, opts models.MarketDepthDataRequestOptions) (*models.MarketDepthDataResponse, error)
func (*Client) RequestMatchingSymbols ¶
func (c *Client) RequestMatchingSymbols(ctx context.Context, opts models.MatchingSymbolsRequestOptions) (*models.MatchingSymbolsResponse, error)
RequestMatchingSymbols retrieves all details for contracts matching the provided input.
func (*Client) RequestTopMarketData ¶
func (c *Client) RequestTopMarketData(_ context.Context, opts models.TopMarketDataRequestOptions) (*models.TopMarketDataResponse, error)
func (*Client) ServerVersion ¶
ServerVersion returns the version of the server.
type Events ¶
type Events interface {
ConnectionClosed(err error)
ReceivedUnknownMessage(id uint32)
Error(ts time.Time, code int, message string, advancedOrderRejectJson string)
}
func NewIncomingMessageLogger ¶
func NewIncomingMessageLogger(cb EventsLoggerCallback) Events
type EventsLogger ¶
type EventsLogger struct {
// contains filtered or unexported fields
}
func (*EventsLogger) ConnectionClosed ¶
func (el *EventsLogger) ConnectionClosed(err error)
func (*EventsLogger) ReceivedUnknownMessage ¶
func (el *EventsLogger) ReceivedUnknownMessage(id uint32)
type EventsLoggerCallback ¶
type EventsLoggerCallback func(msg string)
type NonIdRequestList ¶
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
func (*Request) CompleteCh ¶
func (req *Request) CompleteCh() <-chan struct{}
func (*Request) Type ¶
func (req *Request) Type() RequestType
type RequestCompleteCallback ¶
type RequestError ¶
type RequestError struct {
Timestamp time.Time
Code int
Message string
AdvancedOrderRejectJson string
}
func (*RequestError) Error ¶
func (r *RequestError) Error() string
type RequestManager ¶
type RequestManager struct {
// contains filtered or unexported fields
}
type RequestOptions ¶
type RequestOptions struct {
Type RequestType
MsgCode int
Response interface{}
CompleteCB RequestCompleteCallback
}
type RequestType ¶
type RequestType int
const ( RequestTypeRequestWithID RequestType = iota RequestTypeRequestWithoutID RequestTypeRequestWithTickerID )
type WithRequestWithoutIdCallback ¶
type WithRequestWithoutIdCallback func(resp interface{}) (err error)