stockboard

package
v0.0.81 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2022 License: GPL-3.0 Imports: 26 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 {
	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"`
	OnTimes            []string     `json:"onTimes"`
	OffTimes           []string     `json:"offTimes"`
	UseLogos           *atomic.Bool `json:"useLogos"`
	MaxChartWidthRatio float64      `json:"maxChartWidthRatio"`
	// 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 Server added in v0.0.63

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

Server ...

func (*Server) GetStatus added in v0.0.63

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

GetStatus ...

func (*Server) SetStatus added in v0.0.63

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) 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) GetRPCHandler added in v0.0.63

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

GetRPCHandler ...

func (*StockBoard) InBetween added in v0.0.74

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

Jump to

Keyboard shortcuts

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