Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Completer ¶
type Completer interface { // Returns all completions for the given prompt, up to the given limit (or all if limit < 0). GetCompletions(prompt string, limit int) []Completion GetAll() []Completion }
TickerCompleter is the interface for getting ticker completions.
type Completion ¶
type Completion struct { Ticker string `json:"ticker"` // Ticker symbol of the instrument Name string `json:"name"` // Name of the instrument's security Type string `json:"type,omitempty"` // Type of the instrument (e.g. "stock", "etf", "index") Region string `json:"region,omitempty"` // Region of the instrument Market string `json:"exch,omitempty"` // Exchange where the instrument is listed }
Completion is the ticker and metadata returned by a Completer
type CompletionSource ¶
type CompletionSource struct { RefreshFrequency time.Duration RetryFrequency time.Duration LastError error // this seems a little hacky but its the only way to communicate the error to the web request // contains filtered or unexported fields }
func NewCompletionSource ¶
func NewCompletionSource(factory func() (Completer, error)) *CompletionSource
func (*CompletionSource) GetCompleter ¶
func (ch *CompletionSource) GetCompleter() Completer
GetCompleter returns the current completer. It is safe to call this concurrently. It is possible that nil will be returned if the completer has never successfully loaded.
func (*CompletionSource) Refresh ¶
func (ch *CompletionSource) Refresh() error
Refresh refreshes the completer and returns it. Exposed for testing.
Click to show internal directories.
Click to hide internal directories.