stockboard

package
v0.0.112 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2023 License: GPL-3.0 Imports: 27 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)
	TradingOpen() (time.Time, error)
	TradingClose() (time.Time, error)
	CacheClear()
}

API interface for getting stock data

type Config

type Config struct {
	StartEnabled       *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"`
	OnTimes            []string     `json:"onTimes"`
	OffTimes           []string     `json:"offTimes"`
	UseLogos           *atomic.Bool `json:"useLogos"`
	MaxChartWidthRatio float64      `json:"maxChartWidthRatio"`
	SymbolFont         *FontConfig  `json:"symbolFont"`
	PriceFont          *FontConfig  `json:"priceFont"`
	// contains filtered or unexported fields
}

Config for a StockBoard

func (*Config) SetDefaults

func (c *Config) SetDefaults()

SetDefaults ...

type FontConfig added in v0.0.107

type FontConfig struct {
	Size float64 `json:"size"`
}

type Price

type Price struct {
	Time  time.Time
	Price float64
}

Price represents a price of a stock at a particular time

type Server

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

Server ...

func (*Server) GetStatus

func (s *Server) GetStatus(ctx context.Context, req *emptypb.Empty) (*pb.StatusResp, error)

GetStatus ...

func (*Server) SetStatus

func (s *Server) SetStatus(ctx context.Context, req *pb.SetStatusReq) (*emptypb.Empty, error)

SetStatus ...

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, config *Config, log *zap.Logger) (*StockBoard, error)

New ...

func (*StockBoard) Enabler

func (s *StockBoard) Enabler() board.Enabler

func (*StockBoard) GetHTTPHandlers

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

GetHTTPHandlers ...

func (*StockBoard) GetRPCHandler

func (s *StockBoard) GetRPCHandler() (string, http.Handler)

GetRPCHandler ...

func (*StockBoard) InBetween

func (s *StockBoard) InBetween() bool

InBetween ...

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 ...

func (*StockBoard) ScrollRender

func (s *StockBoard) ScrollRender(ctx context.Context, canvas board.Canvas, padding int) (board.Canvas, error)

ScrollRender ...

Jump to

Keyboard shortcuts

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