symbols

package
v4.1.23 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIClient

type APIClient interface {
	ListAssets(status *string) ([]v1.Asset, error)
}

type JSONFileManager added in v4.1.16

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

JSONFileManager is a symbol manager that reads a json file to get the list of symbols.

func NewJSONFileManager added in v4.1.16

func NewJSONFileManager(hc *http.Client, stocksJSONURL, stocksJSONBasicAuth string) *JSONFileManager

NewJSONFileManager initializes the SymbolManager object with the specified parameters.

func (*JSONFileManager) GetAllSymbols added in v4.1.16

func (m *JSONFileManager) GetAllSymbols() []string

GetAllSymbols returns symbols for all the target exchanges.

func (*JSONFileManager) UpdateSymbols added in v4.1.16

func (m *JSONFileManager) UpdateSymbols()

UpdateSymbols gets a remote json file, store the symbols in the file to the symbols map.

type Manager

type Manager interface {
	GetAllSymbols() []string
	UpdateSymbols()
}

Manager manages symbols in the target stock exchanges. symbol(s) can be newly registered / removed from the exchange, so target symbols should be updated periodically.

type ManagerImpl

type ManagerImpl struct {
	APIClient APIClient
	// Key: exchange(e.g. "NYSE")
	TargetExchanges map[configs.Exchange]struct{}
	Symbols         []string
}

ManagerImpl is an implementation of the Manager.

func NewManager

func NewManager(apiClient APIClient, targetExchanges []configs.Exchange) *ManagerImpl

NewManager initializes the SymbolManager object with the specified parameters.

func (*ManagerImpl) GetAllSymbols

func (m *ManagerImpl) GetAllSymbols() []string

GetAllSymbols returns Symbols for all the target exchanges.

func (*ManagerImpl) UpdateSymbols

func (m *ManagerImpl) UpdateSymbols()

UpdateSymbols calls the ListSymbols endpoint, convert the symbols to the Symbols and store them to the Symbols map.

type Stocks added in v4.1.16

type Stocks struct {
	Data map[string]interface{} `json:"data"`
}

Jump to

Keyboard shortcuts

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