Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DurationMap = map[string]string{
"1 Hour": "1h",
"24 Hours": "24h",
"7 Days": "7d",
"14 Days": "14d",
"30 Days": "30d",
"200 Days": "200d",
"1 Year": "1y",
}
DurationMap maps duration strings to the format required by coinGecko API
var IntervalMap = map[string]string{
"24 Hours": "24hr",
"7 Days": "7d",
"14 Days": "14d",
"30 Days": "30d",
"90 Days": "90d",
"180 Days": "180d",
"1 Year": "1yr",
"5 Years": "5yr",
}
IntervalMap maps given interval string to format required by CoinGecko API
Functions ¶
This section is empty.
Types ¶
type AllCurrencyData ¶
type AllCurrencyData struct { Data []SingleCurrency `json:"data"` Timestamp uint `json:"timestamp"` }
AllCurrencyData holds details of currencies when all are fetched from the API
type ChangeIntervalDurationTable ¶
ChangeIntervalDurationTable holds a table to help user change duration intervals
func NewChangeIntervalPage ¶
func NewChangeIntervalPage() *ChangeIntervalDurationTable
NewChangeIntervalPage returns a pointer to an instance of ChangeIntervalDurationTable
func (*ChangeIntervalDurationTable) Draw ¶
func (c *ChangeIntervalDurationTable) Draw(buf *ui.Buffer)
Draw puts the required text into the widget
func (*ChangeIntervalDurationTable) Resize ¶
func (c *ChangeIntervalDurationTable) Resize(termWidth, termHeight int)
Resize helps resize the ChangeIntervalDurationTable according to terminal dimensions
type ChangePercentageDurationTable ¶
ChangePercentageDurationTable holds a table which helps change percentage duration values
func NewChangePercentPage ¶
func NewChangePercentPage() *ChangePercentageDurationTable
NewChangePercentPage creates, initialises and returns a pointer to an instance of CurrencyTable
func (*ChangePercentageDurationTable) Draw ¶
func (c *ChangePercentageDurationTable) Draw(buf *ui.Buffer)
Draw puts the required text into the widget
func (*ChangePercentageDurationTable) Resize ¶
func (c *ChangePercentageDurationTable) Resize(termWidth, termHeight int)
Resize helps rresize the ChangePercentageDurationTable according to terminal dimensions
type CurrencyIDMap ¶
type CurrencyIDMap map[string]CurrencyValue
CurrencyIDMap maps a currency Id to it's symbol and price in USD
func NewCurrencyIDMap ¶ added in v1.0.1
func NewCurrencyIDMap() CurrencyIDMap
NewCurrencyIDMap creates and returns an instance of CurrencyIDMap
func (CurrencyIDMap) Populate ¶
func (c CurrencyIDMap) Populate()
Populate fetches currency rates and populates the map
type CurrencyTable ¶
type CurrencyTable struct { *widgets.Table IDMap *CurrencyIDMap }
CurrencyTable is a widget used to display currencyies, symbols and rates
func NewCurrencyPage ¶
func NewCurrencyPage() *CurrencyTable
NewCurrencyPage creates, initialises and returns a pointer to an instance of CurrencyTable
func (*CurrencyTable) Draw ¶
func (c *CurrencyTable) Draw(buf *ui.Buffer)
Draw puts the required text into the widget
func (*CurrencyTable) Get ¶
func (c *CurrencyTable) Get(currencyID string) (string, string, float64)
Get returns the symbol and USD rate for a given currency ID If the given currency ID does not exist in the Map, values for US Dollar are returned
func (*CurrencyTable) Resize ¶
func (c *CurrencyTable) Resize(termWidth, termHeight int)
Resize resizes the Currency Table as per given terminal dimensions
func (*CurrencyTable) UpdateRows ¶
func (c *CurrencyTable) UpdateRows(allCurrencies bool)
UpdateRows fetches rates of all currencies and updates them as rows in the table
type CurrencyValue ¶ added in v1.1.0
Currency holds information of a single currency, it used to populate currencyIDMaps
type PortfolioTable ¶
PortfolioTable holds a table which helps display a mini portfolio
func NewPortfolioPage ¶
func NewPortfolioPage() *PortfolioTable
NewPortfolioPage creates, initialises and returns a pointer to an instance of PortfolioTable
func (*PortfolioTable) Draw ¶
func (p *PortfolioTable) Draw(buf *ui.Buffer)
Draw puts the required text into the widget
func (*PortfolioTable) Resize ¶
func (p *PortfolioTable) Resize(termWidth, termHeight int)
Resize helps resize the PortfolioTable according to terminal dimensions
func (*PortfolioTable) UpdateRows ¶
func (p *PortfolioTable) UpdateRows(portfolio map[string]float64, currency string, currencyVal float64)
UpdateRows data