Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var DurationMap map[string]string = 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 = 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 ¶
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)
type ChangePercentageDurationTable ¶
func NewChangePercentPage ¶
func NewChangePercentPage() *ChangePercentageDurationTable
NewCurrencyPage 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)
type CurrencyIDMap ¶
CurrencyIDMap maps a currency Id to it's symbol and price in USD
func NewCurencyIDMap ¶
func NewCurencyIDMap() 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)
func (*CurrencyTable) UpdateRows ¶
func (c *CurrencyTable) UpdateRows(allCurrencies bool)
UpdateAll fetches rates of all currencies and updates them as rows in the table
type PortfolioTable ¶
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)
func (*PortfolioTable) UpdateRows ¶
func (p *PortfolioTable) UpdateRows(portfolio map[string]float64, currency string, currencyVal float64)
Update Portfolio data