common

package
v4.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2024 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Asset

type Asset struct {
	Name          string
	Symbol        string
	Class         AssetClass
	Currency      Currency
	Holding       Holding
	QuotePrice    QuotePrice
	QuoteExtended QuoteExtended
	QuoteSource   QuoteSource
	Exchange      Exchange
	Meta          Meta
}

type AssetClass

type AssetClass int
const (
	AssetClassCash AssetClass = iota
	AssetClassStock
	AssetClassCryptocurrency
	AssetClassPrivateSecurity
	AssetClassUnknown
)

type AssetGroup

type AssetGroup struct {
	ConfigAssetGroup
	SymbolsBySource []AssetGroupSymbolsBySource
}

type AssetGroupQuote

type AssetGroupQuote struct {
	AssetGroup  AssetGroup
	AssetQuotes []AssetQuote
}

type AssetGroupSymbolsBySource

type AssetGroupSymbolsBySource struct {
	Symbols []string
	Source  QuoteSource
}

type AssetQuote

type AssetQuote struct {
	Name          string
	Symbol        string
	Class         AssetClass
	Currency      Currency
	QuotePrice    QuotePrice
	QuoteExtended QuoteExtended
	QuoteSource   QuoteSource
	Exchange      Exchange
	Meta          Meta
}

AssetQuote represents a price quote and related attributes for a single security

type Config

type Config struct {
	RefreshInterval                   int                `yaml:"interval"`
	Watchlist                         []string           `yaml:"watchlist"`
	Lots                              []Lot              `yaml:"lots"`
	Separate                          bool               `yaml:"show-separator"`
	ExtraInfoExchange                 bool               `yaml:"show-tags"`
	ExtraInfoFundamentals             bool               `yaml:"show-fundamentals"`
	ShowSummary                       bool               `yaml:"show-summary"`
	ShowHoldings                      bool               `yaml:"show-holdings"`
	Proxy                             string             `yaml:"proxy"`
	Sort                              string             `yaml:"sort"`
	Currency                          string             `yaml:"currency"`
	CurrencyConvertSummaryOnly        bool               `yaml:"currency-summary-only"`
	CurrencyDisableUnitCostConversion bool               `yaml:"currency-disable-unit-cost-conversion"`
	ColorScheme                       ConfigColorScheme  `yaml:"colors"`
	AssetGroup                        []ConfigAssetGroup `yaml:"groups"`
}

Config represents user defined configuration

type ConfigAssetGroup

type ConfigAssetGroup struct {
	Name      string   `yaml:"name"`
	Watchlist []string `yaml:"watchlist"`
	Holdings  []Lot    `yaml:"holdings"`
}

type ConfigColorScheme

type ConfigColorScheme struct {
	Text          string `yaml:"text"`
	TextLight     string `yaml:"text-light"`
	TextLabel     string `yaml:"text-label"`
	TextLine      string `yaml:"text-line"`
	TextTag       string `yaml:"text-tag"`
	BackgroundTag string `yaml:"background-tag"`
}

ConfigColorScheme represents user defined color scheme

type Context

type Context struct {
	Config    Config
	Groups    []AssetGroup
	Reference Reference
}

Context represents user defined configuration and derived reference configuration

type Currency

type Currency struct {
	// Code is the original currency code of the asset
	FromCurrencyCode string
	// CodeConverted is the currency code that pricing and values have been converted into
	ToCurrencyCode string
}

Currency is the original and converted currency if applicable

type CurrencyRate

type CurrencyRate struct {
	FromCurrency string
	ToCurrency   string
	Rate         float64
}

CurrencyRate represents a single currency conversion pair

type CurrencyRates

type CurrencyRates map[string]CurrencyRate

CurrencyRates is a map of currency rates for lookup by currency that needs to be converted

type Dependencies

type Dependencies struct {
	Fs          afero.Fs
	HttpClients DependenciesHttpClients //nolint:golint,stylecheck,revive
}

Dependencies represents references to external dependencies

type DependenciesHttpClients

type DependenciesHttpClients struct {
	Default      *resty.Client
	Yahoo        *resty.Client
	YahooSession *resty.Client
}

type Exchange

type Exchange struct {
	Name                    string
	Delay                   float64
	State                   ExchangeState
	IsActive                bool
	IsRegularTradingSession bool
}

type ExchangeState

type ExchangeState int
const (
	ExchangeStateOpen ExchangeState = iota
	ExchangeStatePremarket
	ExchangeStatePostmarket
	ExchangeStateClosed
)

type Holding

type Holding struct {
	Value       float64
	Cost        float64
	Quantity    float64
	UnitValue   float64
	UnitCost    float64
	DayChange   HoldingChange
	TotalChange HoldingChange
	Weight      float64
}

type HoldingChange

type HoldingChange struct {
	Amount  float64
	Percent float64
}

type Lot

type Lot struct {
	Symbol    string  `yaml:"symbol"`
	UnitCost  float64 `yaml:"unit_cost"`
	Quantity  float64 `yaml:"quantity"`
	FixedCost float64 `yaml:"fixed_cost"`
}

Lot represents a cost basis lot

type Meta

type Meta struct {
	IsVariablePrecision bool
	OrderIndex          int
}

type QuoteExtended

type QuoteExtended struct {
	FiftyTwoWeekHigh float64
	FiftyTwoWeekLow  float64
	MarketCap        float64
	Volume           float64
}

type QuotePrice

type QuotePrice struct {
	Price          float64
	PricePrevClose float64
	PriceOpen      float64
	PriceDayHigh   float64
	PriceDayLow    float64
	Change         float64
	ChangePercent  float64
}

type QuoteSource

type QuoteSource int
const (
	QuoteSourceYahoo QuoteSource = iota
	QuoteSourceUserDefined
	QuoteSourceCoingecko
	QuoteSourceUnknown
	QuoteSourceCoinCap
	QuoteSourceCoinbase
)

type Reference

type Reference struct {
	CurrencyRates CurrencyRates
	Styles        Styles
}

Reference represents derived configuration for internal use from user defined configuration

type StyleFn

type StyleFn func(string) string

StyleFn is a function that styles text

type Styles

type Styles struct {
	Text      StyleFn
	TextLight StyleFn
	TextLabel StyleFn
	TextBold  StyleFn
	TextLine  StyleFn
	TextPrice func(float64, string) string
	Tag       StyleFn
}

Styles represents style functions for components of the UI

Jump to

Keyboard shortcuts

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