stockboard

package
v0.0.54 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2021 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API interface {
	Get(ctx context.Context, symbols []string, interval time.Duration) ([]*Stock, error)
	CacheClear()
}

API interface for getting stock data

type Config

type Config struct {
	Enabled            *atomic.Bool `json:"enabled"`
	Symbols            []string     `json:"symbols"`
	ChartResolution    int          `json:"chartResolution"`
	BoardDelay         string       `json:"boardDelay"`
	UpdateInterval     string       `json:"updateInterval"`
	ScrollMode         *atomic.Bool `json:"scrollMode"`
	TightScrollPadding int          `json:"tightScrollPadding"`
	ScrollDelay        string       `json:"scrollDelay"`
	// contains filtered or unexported fields
}

Config for a StockBoard

func (*Config) SetDefaults

func (c *Config) SetDefaults()

SetDefaults ...

type Price

type Price struct {
	Time  time.Time
	Price float64
}

Price represents a price of a stock at a particular time

type Stock

type Stock struct {
	Symbol    string
	OpenPrice float64
	Price     float64
	Prices    []*Price
	Change    float64
}

Stock ...

type StockBoard

type StockBoard struct {
	sync.Mutex
	// contains filtered or unexported fields
}

StockBoard displays stocks

func New

func New(api API, cfg *Config, log *zap.Logger) (*StockBoard, error)

New ...

func (*StockBoard) Disable

func (s *StockBoard) Disable()

Disable ...

func (*StockBoard) Enable

func (s *StockBoard) Enable()

Enable ...

func (*StockBoard) Enabled

func (s *StockBoard) Enabled() bool

Enabled ...

func (*StockBoard) GetHTTPHandlers

func (s *StockBoard) GetHTTPHandlers() ([]*board.HTTPHandler, error)

GetHTTPHandlers ...

func (*StockBoard) Name

func (s *StockBoard) Name() string

Name ...

func (*StockBoard) Render

func (s *StockBoard) Render(ctx context.Context, canvas board.Canvas) error

Render ...

func (*StockBoard) ScrollMode

func (s *StockBoard) ScrollMode() bool

ScrollMode ...

Jump to

Keyboard shortcuts

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