stocks

package
v1.9.9 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Screener

type Screener struct{}

Screener is a struct to fetch all available Stocks from external API.

func (*Screener) FetchFromNasdaq

func (f *Screener) FetchFromNasdaq(ctx context.Context) (*StockMap, error)

FetchFromNasdaq fetches all available Stocks from nasdaq API and returns them as a map of `ticker` -> Stock. ! NOTE: nasdaq is not available in EU region yet.

func (*Screener) FetchFromString

func (f *Screener) FetchFromString(str string) *StockMap

FetchFromString fetches all available Stocks from string (env STOCK_SYMBOLS) separated with | (pipe) and returns them as a map of `ticker` -> Stock. ! NOTE: string only contains tickers, no other data. So expect empty Stock structs for now.

type Stock

type Stock struct {
	Name      string `json:"name"`
	MarketCap string `json:"marketCap"`
	Country   string `json:"country"`
	Industry  string `json:"industry"`
	Sector    string `json:"sector"`
}

type StockMap

type StockMap map[string]Stock

StockMap is a map of `ticker` -> Stock.

Jump to

Keyboard shortcuts

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