ticker_autocomplete

package module
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: MIT Imports: 2 Imported by: 0

README

ticker_autocomplete

This project is under active development and is not yet ready for production use. There is scant documentation and the interfaces may change.

ticker_autocomplete is a Golang-based library for auto-completion of financial symbols ("tickers"). It is part of the Nimble.Markets platform.

Examples

You can build the example programs with Taskfile. For a list of tasks, run the list task:

$ task list 
task: [list] task --list-all
task: Available tasks for this project:
* build:                       Build all
* build-cassette:              Build vhs cassette gifs
* clean:                       Clean
* default:                     Default task is "build"
* go-tidy:                     Tidy all
* go-update:                   Update Go dependencies
* list:                        Lists available tasks
* publish-cassette:            Publish vhs cassette gifs to Charm
* you-tickercomplete-me:       Build you-tickercomplete-me
you-tickercomplete-me

you-tickercomplete-me is a simple BubbleTea program illustrating usage of the library. It is still a work in progress towards a full-fledged widget.

you-tickercomplete-me example
$ task
task: [go-tidy] go mod tidy
task: [you-tickercomplete-me] go build -o bin/you-tickercomplete-me cmd/you-tickercomplete-me/*.go

$ ./bin/you-tickercomplete-me

Feedback

Contributions are welcome!

Please submit a PR or open an issue to discuss features.

License

All specifications and data are owned by their respective organizations and are subject to change. This project is not affiliated with these organization.

Released under the MIT License, see LICENSE.txt.

Copyright (c) 2024 Neomantra BV. All rights reserved.


Made with ❤ and 🔥 by the team behind Nimble.Markets. Stay Nimble!

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.

Directories

Path Synopsis
cmd
internal
sources

Jump to

Keyboard shortcuts

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