Documentation
Index ¶
- Constants
- Variables
- func ActionsMap() map[string]bool
- func ChartRanges() []string
- func ChartRangesMap() map[string]time.Duration
- func Clean(config *CleanConfig) error
- func ColorschemeHelpString() string
- func CurrencySymbol(currency string) string
- func DefaultShortcuts() map[string]string
- func GetBytes(key interface{}) ([]byte, error)
- func GetCoinPrices(config *PricesConfig) ([]string, error)
- func HexToAnsi(h string) (uint8, bool)
- func PrintBitcoinDominance(config *DominanceConfig) error
- func PrintPrice(config *PriceConfig) error
- func PrintPrices(config *PricesConfig) error
- func PrintVersion()
- func Reset(config *ResetConfig) error
- func Slugify(s string) string
- func TableColumnOrder() []string
- func TruncateString(value string, maxLen int) string
- func Version() string
- type APIKeys
- type ChartView
- type CleanConfig
- type Coin
- type Cointop
- func (ct *Cointop) ActionExists(action string) bool
- func (ct *Cointop) ActivePriceAlerts() []*PriceAlert
- func (ct *Cointop) ActivePriceAlertsLen() int
- func (ct *Cointop) AllCoins() []*Coin
- func (ct *Cointop) CacheAllCoinsSlugMap()
- func (ct *Cointop) CacheKey(key string) string
- func (ct *Cointop) CancelSearch() error
- func (ct *Cointop) ChartPoints(symbol string, name string) error
- func (ct *Cointop) ChartWidth() int
- func (ct *Cointop) CheckPriceAlert(alert *PriceAlert) error
- func (ct *Cointop) ClampedWidth() int
- func (ct *Cointop) ClearSyncMap(syncMap sync.Map)
- func (ct *Cointop) CoinBySymbol(symbol string) *Coin
- func (ct *Cointop) CoinHoldings(coin *Coin) float64
- func (ct *Cointop) ConfigDirPath() string
- func (ct *Cointop) ConfigFilePath() string
- func (ct *Cointop) CreateConfigIfNotExists() error
- func (ct *Cointop) CreatePriceAlert() error
- func (ct *Cointop) CurrencySymbol() string
- func (ct *Cointop) CurrentDisplayPage() int
- func (ct *Cointop) CurrentPage() int
- func (ct *Cointop) CursorDown() error
- func (ct *Cointop) CursorDownOrNextPage() error
- func (ct *Cointop) CursorUp() error
- func (ct *Cointop) CursorUpOrPreviousPage() error
- func (ct *Cointop) DoSearch() error
- func (ct *Cointop) EnlargeChart() error
- func (ct *Cointop) EnterKeyPressHandler() error
- func (ct *Cointop) Exit()
- func (ct *Cointop) FirstChartRange() error
- func (ct *Cointop) FirstPage() error
- func (ct *Cointop) GetCoinsTable() *table.Table
- func (ct *Cointop) GetCoinsTableHeaders() []string
- func (ct *Cointop) GetFavoritesSlice() []*Coin
- func (ct *Cointop) GetFavoritesTableHeaders() []string
- func (ct *Cointop) GetGlobalCoinIndex(coin *Coin) int
- func (ct *Cointop) GetListCount() int
- func (ct *Cointop) GetPortfolioSlice() []*Coin
- func (ct *Cointop) GetPortfolioTable() *table.Table
- func (ct *Cointop) GetPortfolioTableHeaders() []string
- func (ct *Cointop) GetPortfolioTotal() float64
- func (ct *Cointop) GetPriceAlertsTable() *table.Table
- func (ct *Cointop) GetPriceAlertsTableHeaders() []string
- func (ct *Cointop) GetSortColIndex() int
- func (ct *Cointop) GetTableCoinsSlice() []*Coin
- func (ct *Cointop) GetTableColumnAlignLeft(header string) bool
- func (ct *Cointop) GetTableColumnWidth(header string) int
- func (ct *Cointop) GoToCoinRow(coin *Coin) error
- func (ct *Cointop) GoToGlobalIndex(idx int) error
- func (ct *Cointop) GoToPageRowIndex(idx int) error
- func (ct *Cointop) HideConvertMenu() error
- func (ct *Cointop) HideHelp() error
- func (ct *Cointop) HideMenu() error
- func (ct *Cointop) HidePortfolioUpdateMenu() error
- func (ct *Cointop) HidePriceAlertsUpdateMenu() error
- func (ct *Cointop) HighlightRow(pageRowIndex int) error
- func (ct *Cointop) HighlightedPageRowIndex() int
- func (ct *Cointop) HighlightedRowCoin() *Coin
- func (ct *Cointop) HighlightedRowIndex() int
- func (ct *Cointop) InterfaceToFloat64(value interface{}) (float64, error)
- func (ct *Cointop) IsFavoritesVisible() bool
- func (ct *Cointop) IsFirstPage() bool
- func (ct *Cointop) IsFirstRow() bool
- func (ct *Cointop) IsLastPage() bool
- func (ct *Cointop) IsLastRow() bool
- func (ct *Cointop) IsPageFirstLine() bool
- func (ct *Cointop) IsPageLastLine() bool
- func (ct *Cointop) IsPageMiddleLine() bool
- func (ct *Cointop) IsPortfolioVisible() bool
- func (ct *Cointop) IsPriceAlertsVisible() bool
- func (ct *Cointop) IsRunning() bool
- func (ct *Cointop) IsSupportedCurrencyConversion(convert string) bool
- func (ct *Cointop) Keybindings(g *gocui.Gui) error
- func (ct *Cointop) Keyfn(fn func() error) func(g *gocui.Gui, v *gocui.View) error
- func (ct *Cointop) LastChartRange() error
- func (ct *Cointop) LastPage() error
- func (ct *Cointop) MouseLeftClick() error
- func (ct *Cointop) MouseMiddleClick() error
- func (ct *Cointop) MouseRelease() error
- func (ct *Cointop) MouseRightClick() error
- func (ct *Cointop) MouseWheelDown() error
- func (ct *Cointop) MouseWheelUp() error
- func (ct *Cointop) NavigateFirstLine() error
- func (ct *Cointop) NavigateLastLine() error
- func (ct *Cointop) NavigatePageFirstLine() error
- func (ct *Cointop) NavigatePageMiddleLine() error
- func (ct *Cointop) NextChartRange() error
- func (ct *Cointop) NextPage() error
- func (ct *Cointop) Noop() error
- func (ct *Cointop) OpenLink() error
- func (ct *Cointop) PageDown() error
- func (ct *Cointop) PageUp() error
- func (ct *Cointop) ParseKeys(s string) (interface{}, gocui.Modifier)
- func (ct *Cointop) ParsePriceAlertInput(value string) (string, float64, error)
- func (ct *Cointop) PortfolioChart() error
- func (ct *Cointop) PortfolioEntriesCount() int
- func (ct *Cointop) PortfolioEntry(c *Coin) (*PortfolioEntry, bool)
- func (ct *Cointop) PortfolioEntryExists(c *Coin) bool
- func (ct *Cointop) PrevChartRange() error
- func (ct *Cointop) PrevPage() error
- func (ct *Cointop) PrevPageTop() error
- func (ct *Cointop) PriceAlertWatcher() error
- func (ct *Cointop) PrintHoldingsTable(options *TablePrintOptions) error
- func (ct *Cointop) PrintTotalHoldings(options *TablePrintOptions) error
- func (ct *Cointop) Quit() error
- func (ct *Cointop) QuitView() error
- func (ct *Cointop) ReadAPIKeyFromStdin(name string) (string, error)
- func (ct *Cointop) ReadAndParsePriceAlertInput() (string, float64, error)
- func (ct *Cointop) Refresh() error
- func (ct *Cointop) RefreshAll() error
- func (ct *Cointop) RefreshPortfolioCoins() error
- func (ct *Cointop) RefreshRowLink() error
- func (ct *Cointop) RefreshTable() error
- func (ct *Cointop) RemovePortfolioEntry(coin string)
- func (ct *Cointop) RowChanged()
- func (ct *Cointop) RowLink() string
- func (ct *Cointop) RowLinkShort() string
- func (ct *Cointop) Run() error
- func (ct *Cointop) Save() error
- func (ct *Cointop) SaveConfig() error
- func (ct *Cointop) Search(q string) error
- func (ct *Cointop) SelectedCoinName() string
- func (ct *Cointop) SelectedCoinSymbol() string
- func (ct *Cointop) SetActiveView(v string) error
- func (ct *Cointop) SetCurrencyConverstion(convert string) error
- func (ct *Cointop) SetCurrencyConverstionFn(convert string) func() error
- func (ct *Cointop) SetKeybindingMod(key interface{}, mod gocui.Modifier, ...) error
- func (ct *Cointop) SetPage(page int) int
- func (ct *Cointop) SetPortfolioEntry(coin string, holdings float64) error
- func (ct *Cointop) SetPortfolioHoldings() error
- func (ct *Cointop) SetPriceAlert(coinName string, operator string, targetPrice float64) error
- func (ct *Cointop) SetSavingStatus()
- func (ct *Cointop) SetSelectedView(viewName string)
- func (ct *Cointop) SetTableColumnAlignLeft(header string, alignLeft bool)
- func (ct *Cointop) SetTableColumnWidth(header string, width int)
- func (ct *Cointop) SetTableColumnWidthFromString(header string, text string)
- func (ct *Cointop) SetupConfig() error
- func (ct *Cointop) ShortenChart() error
- func (ct *Cointop) ShowChartLoader() error
- func (ct *Cointop) ShowConvertMenu() error
- func (ct *Cointop) ShowHelp() error
- func (ct *Cointop) ShowPortfolioUpdateMenu() error
- func (ct *Cointop) ShowPriceAlertsAddMenu() error
- func (ct *Cointop) ShowPriceAlertsUpdateMenu() error
- func (ct *Cointop) Sort(sortBy string, desc bool, list []*Coin, renderHeaders bool)
- func (ct *Cointop) SortAsc() error
- func (ct *Cointop) SortDesc() error
- func (ct *Cointop) SortNextCol() error
- func (ct *Cointop) SortPrevCol() error
- func (ct *Cointop) SortToggle(sortBy string, desc bool) error
- func (ct *Cointop) SortedSupportedCurrencyConversions() []string
- func (ct *Cointop) Sortfn(sortBy string, desc bool) func(g *gocui.Gui, v *gocui.View) error
- func (ct *Cointop) SupportedCryptoCurrencyConversions() map[string]string
- func (ct *Cointop) SupportedCurrencyConversions() map[string]string
- func (ct *Cointop) SupportedFiatCurrencyConversions() map[string]string
- func (ct *Cointop) TableRowsLen() int
- func (ct *Cointop) TableScrollLeft() error
- func (ct *Cointop) TableScrollRight() error
- func (ct *Cointop) ToggleCoinChart() error
- func (ct *Cointop) ToggleConvertMenu() error
- func (ct *Cointop) ToggleFavorite() error
- func (ct *Cointop) ToggleFavorites() error
- func (ct *Cointop) ToggleHelp() error
- func (ct *Cointop) TogglePortfolio() error
- func (ct *Cointop) TogglePortfolioUpdateMenu() error
- func (ct *Cointop) TogglePriceAlerts() error
- func (ct *Cointop) ToggleSelectedView(viewName string)
- func (ct *Cointop) ToggleShowFavorites() error
- func (ct *Cointop) ToggleShowPortfolio() error
- func (ct *Cointop) ToggleTableFullscreen() error
- func (ct *Cointop) TotalPages() int
- func (ct *Cointop) TotalPagesDisplay() int
- func (ct *Cointop) TotalPerPage() int
- func (ct *Cointop) UpdateChart() error
- func (ct *Cointop) UpdateCoins() error
- func (ct *Cointop) UpdateConvertMenu() error
- func (ct *Cointop) UpdateHelp()
- func (ct *Cointop) UpdateMarketbar() error
- func (ct *Cointop) UpdatePortfolioUpdateMenu() error
- func (ct *Cointop) UpdatePriceAlertsUpdateMenu(isNew bool) error
- func (ct *Cointop) UpdateStatusbar(s string) error
- func (ct *Cointop) UpdateTable() error
- func (ct *Cointop) UpdateTableHeader() error
- func (ct *Cointop) UpdateUI(f func() error)
- func (ct *Cointop) ValidCoinsTableHeader(name string) bool
- func (ct *Cointop) ValidPortfolioTableHeader(name string) bool
- func (ct *Cointop) Version() string
- func (ct *Cointop) ViewWidth(view string) int
- type Colorscheme
- func (c *Colorscheme) BaseBg() gocui.Attribute
- func (c *Colorscheme) BaseFg() gocui.Attribute
- func (c *Colorscheme) Chart(a ...interface{}) string
- func (c *Colorscheme) Default(a ...interface{}) string
- func (c *Colorscheme) MarketBarLabelActive(a ...interface{}) string
- func (c *Colorscheme) Marketbar(a ...interface{}) string
- func (c *Colorscheme) MarketbarChangeDownSprintf() ISprintf
- func (c *Colorscheme) MarketbarChangeSprintf() ISprintf
- func (c *Colorscheme) MarketbarChangeUpSprintf() ISprintf
- func (c *Colorscheme) MarketbarSprintf() ISprintf
- func (c *Colorscheme) Menu(a ...interface{}) string
- func (c *Colorscheme) MenuHeader(a ...interface{}) string
- func (c *Colorscheme) MenuLabel(a ...interface{}) string
- func (c *Colorscheme) MenuLabelActive(a ...interface{}) string
- func (c *Colorscheme) Searchbar(a ...interface{}) string
- func (c *Colorscheme) Statusbar(a ...interface{}) string
- func (c *Colorscheme) TableColumnChange(a ...interface{}) string
- func (c *Colorscheme) TableColumnChangeDown(a ...interface{}) string
- func (c *Colorscheme) TableColumnChangeDownSprintf() ISprintf
- func (c *Colorscheme) TableColumnChangeSprintf() ISprintf
- func (c *Colorscheme) TableColumnChangeUp(a ...interface{}) string
- func (c *Colorscheme) TableColumnChangeUpSprintf() ISprintf
- func (c *Colorscheme) TableColumnPrice(a ...interface{}) string
- func (c *Colorscheme) TableColumnPriceSprintf() ISprintf
- func (c *Colorscheme) TableHeader(a ...interface{}) string
- func (c *Colorscheme) TableHeaderColumnActive(a ...interface{}) string
- func (c *Colorscheme) TableHeaderColumnActiveSprintf() ISprintf
- func (c *Colorscheme) TableHeaderSprintf() ISprintf
- func (c *Colorscheme) TableRow(a ...interface{}) string
- func (c *Colorscheme) TableRowActive(a ...interface{}) string
- func (c *Colorscheme) TableRowFavorite(a ...interface{}) string
- func (c *Colorscheme) TableRowFavoriteSprintf() ISprintf
- func (c *Colorscheme) TableRowSprintf() ISprintf
- type Config
- type DominanceConfig
- type HeaderColumn
- type ISprintf
- type InputView
- type MarketbarView
- type MenuView
- type Portfolio
- type PortfolioEntry
- type PriceAlert
- type PriceAlerts
- type PriceConfig
- type PricesConfig
- type ResetConfig
- type SearchFieldView
- type State
- type StatusbarView
- type TableHeaderView
- type TablePrintOptions
- type TableView
- type Views
Constants ¶
const CoinGecko = "coingecko"
CoinGecko is API choice
const CoinMarketCap = "coinmarketcap"
CoinMarketCap is API choice
const CoinsView = "coins"
CoinsView is coins table constant
const FavoritesView = "favorites"
FavoritesView is favorites table constant
const PortfolioView = "portfolio"
PortfolioView is portfolio table constant
const PriceAlertsView = "price_alerts"
PriceAlertsView is price alerts table constant
Variables ¶
var ArrowDown = "▼"
ArrowDown is down arrow unicode character
var ArrowUp = "▲"
ArrowUp is up arrow unicode character
var CryptocurrencyNames = map[string]string{
"BTC": "Bitcoin",
"ETH": "Ethereum",
}
CryptocurrencyNames is a map of cryptocurrency symbols to name
var CurrencySymbolMap = map[string]string{
"AUD": "$",
"BGN": "Лв.",
"BRL": "R$",
"BTC": "Ƀ",
"CAD": "$",
"CFH": "₣",
"CLP": "$",
"CNY": "¥",
"CZK": "Kč",
"DKK": "Kr",
"ETH": "Ξ",
"EUR": "€",
"GBP": "£",
"HKD": "$",
"HRK": "kn",
"HUF": "Ft",
"IDR": "Rp.",
"ILS": "₪",
"INR": "₹",
"ISK": "kr",
"JPY": "¥",
"KRW": "₩",
"MXN": "$",
"MYR": "RM",
"NOK": "kr",
"NZD": "$",
"PHP": "₱",
"PKR": "₨",
"PLN": "zł",
"RON": "lei",
"RUB": "Ꝑ",
"SEK": "kr",
"SGD": "S$",
"THB": "฿",
"TRY": "₺",
"TWD": "NT$",
"UAH": "₴",
"USD": "$",
"VND": "₫",
"ZAR": "R",
}
CurrencySymbolMap is map of fiat currency symbols to names. Keep these in alphabetical order.
var DefaultCacheDir = filecache.DefaultCacheDir
DefaultCacheDir ...
var DefaultCoinTableHeaders = []string{
"rank",
"name",
"symbol",
"price",
"1h_change",
"24h_change",
"7d_change",
"24h_volume",
"market_cap",
"total_supply",
"available_supply",
"last_updated",
}
DefaultCoinTableHeaders are the default coin table header columns
var DefaultColors = `` /* 1611-byte string literal not displayed */
DefaultColors is the default color scheme
var DefaultColorsDir = fmt.Sprintf("%s/colors", DefaultConfigFilepath)
DefaultColorsDir ...
var DefaultColorscheme = "cointop"
DefaultColorscheme ...
var DefaultConfigFilepath = pathutil.NormalizePath(":PREFERRED_CONFIG_HOME:/cointop/config.toml")
DefaultConfigFilepath ...
var DefaultPerPage uint = 100
DefaultPerPage ...
var DefaultPortfolioTableHeaders = []string{
"rank",
"name",
"symbol",
"price",
"holdings",
"balance",
"1h_change",
"24h_change",
"7d_change",
"percent_holdings",
"last_updated",
}
DefaultPortfolioTableHeaders are the default portfolio table header columns
var ErrCoinNameOrSymbolRequired = errors.New("coin name or symbol is required")
ErrCoinNameOrSymbolRequired is error for when coin name or symbol is required
var ErrInvalidAPIChoice = errors.New("invalid API choice")
ErrInvalidAPIChoice is error for invalid API choice
var ErrInvalidPriceAlert = errors.New("invalid price alert value")
ErrInvalidPriceAlert is error for invalid price alert value
var FiatCurrencyNames = map[string]string{
"AUD": "Australian Dollar",
"BGN": "Bulgarian lev",
"BRL": "Brazilian Real",
"CAD": "Canadian Dollar",
"CFH": "Swiss Franc",
"CLP": "Chilean Peso",
"CNY": "Chinese Yuan",
"CZK": "Czech Koruna",
"DKK": "Danish Krone",
"EUR": "Euro",
"GBP": "British Pound",
"HKD": "Hong Kong Dollar",
"HRK": "Croatian kuna",
"HUF": "Hungarian Forint",
"IDR": "Indonesian Rupiah",
"ILS": "Israeli New Shekel",
"INR": "Indian Rupee",
"ISK": "Icelandic króna",
"JPY": "Japanese Yen",
"KRW": "South Korean Won",
"MXN": "Mexican Peso",
"MYR": "Malaysian Ringgit",
"NOK": "Norwegian Krone",
"NZD": "New Zealand Dollar",
"PHP": "Philippine Peso",
"PKR": "Pakistani Rupe",
"PLN": "Polish złoty",
"RON": "Romanian leu",
"RUB": "Russian Ruble",
"SEK": "Swedish Krona",
"SGD": "Singapore Dollar",
"THB": "Thai Baht",
"TRY": "Turkish lira",
"TWD": "New Taiwan Dollar",
"UAH": "Ukrainian hryvnia",
"USD": "US Dollar",
"VND": "Vietnamese Dong",
"ZAR": "South African Rand",
}
FiatCurrencyNames is a mpa of currency symbols to names. Keep these in alphabetical order.
var HeaderColumns = map[string]*HeaderColumn{ "rank": &HeaderColumn{ Slug: "rank", Label: "[r]ank", PlainLabel: "rank", }, "name": &HeaderColumn{ Slug: "name", Label: "[n]ame", PlainLabel: "name", }, "symbol": &HeaderColumn{ Slug: "symbol", Label: "[s]ymbol", PlainLabel: "symbol", }, "target_price": &HeaderColumn{ Slug: "target_price", Label: "[t]target price", PlainLabel: "target price", }, "price": &HeaderColumn{ Slug: "price", Label: "[p]rice", PlainLabel: "price", }, "frequency": &HeaderColumn{ Slug: "frequency", Label: "frequency", PlainLabel: "frequency", }, "holdings": &HeaderColumn{ Slug: "holdings", Label: "[h]oldings", PlainLabel: "holdings", }, "balance": &HeaderColumn{ Slug: "balance", Label: "[b]alance", PlainLabel: "balance", }, "market_cap": &HeaderColumn{ Slug: "market_cap", Label: "[m]arket cap", PlainLabel: "market cap", }, "24h_volume": &HeaderColumn{ Slug: "24h_volume", Label: "24H [v]olume", PlainLabel: "24H volume", }, "1h_change": &HeaderColumn{ Slug: "1h_change", Label: "[1]H%", PlainLabel: "1H%", }, "24h_change": &HeaderColumn{ Slug: "24h_change", Label: "[2]4H%", PlainLabel: "24H%", }, "7d_change": &HeaderColumn{ Slug: "7d_change", Label: "[7]D%", PlainLabel: "7D%", }, "30d_change": &HeaderColumn{ Slug: "30d_change", Label: "[3]0D%", PlainLabel: "30D%", }, "total_supply": &HeaderColumn{ Slug: "total_supply", Label: "[t]otal supply", PlainLabel: "total supply", }, "available_supply": &HeaderColumn{ Slug: "available_supply", Label: "[a]vailable supply", PlainLabel: "available supply", }, "percent_holdings": &HeaderColumn{ Slug: "percent_holdings", Label: "[%]holdings", PlainLabel: "%holdings", }, "last_updated": &HeaderColumn{ Slug: "last_updated", Label: "last [u]pdated", PlainLabel: "last updated", }, }
HeaderColumns are the header column widths
var PriceAlertFrequencyMap = map[string]bool{ "once": true, "reoccurring": true, }
PriceAlertFrequencyMap is map of valid price alert frequency values
var PriceAlertOperatorMap = map[string]string{
">": ">",
"<": "<",
">=": "≥",
"<=": "≤",
"=": "=",
}
PriceAlertOperatorMap is map of valid price alert operator symbols
var SupportedCoinTableHeaders = []string{
"rank",
"name",
"symbol",
"price",
"1h_change",
"24h_change",
"7d_change",
"30d_change",
"24h_volume",
"market_cap",
"total_supply",
"available_supply",
"last_updated",
}
SupportedCoinTableHeaders are all the supported coin table header columns
var SupportedPortfolioTableHeaders = []string{
"rank",
"name",
"symbol",
"price",
"holdings",
"balance",
"1h_change",
"24h_change",
"7d_change",
"30d_change",
"percent_holdings",
"last_updated",
}
SupportedPortfolioTableHeaders are all the supported portfolio table header columns
Functions ¶
func ActionsMap ¶
ActionsMap returns a map of all the available actions
func ChartRangesMap ¶
ChartRangesMap returns map of chart range time ranges
func CurrencySymbol ¶
CurrencySymbol returns the symbol for the currency name
func DefaultShortcuts ¶
DefaultShortcuts is a map of the default shortcuts
func GetCoinPrices ¶
func GetCoinPrices(config *PricesConfig) ([]string, error)
GetCoinPrices returns the current price of the specified coins
func PrintBitcoinDominance ¶
func PrintBitcoinDominance(config *DominanceConfig) error
PrintBitcoinDominance outputs the dominance percentage of bitcoin
func PrintPrice ¶
func PrintPrice(config *PriceConfig) error
PrintPrice outputs the current price of the coin
func PrintPrices ¶
func PrintPrices(config *PricesConfig) error
PrintPrices outputs the current price of the coins
func TableColumnOrder ¶
func TableColumnOrder() []string
TableColumnOrder returns the default order of the table columns
func TruncateString ¶
TruncateString returns a truncated string
Types ¶
type APIKeys ¶
type APIKeys struct {
// contains filtered or unexported fields
}
APIKeys is api keys structure
type CleanConfig ¶
CleanConfig is the config for the clean function
type Coin ¶
type Coin struct { ID string Name string Slug string Symbol string Rank int Price float64 Volume24H float64 MarketCap float64 AvailableSupply float64 TotalSupply float64 PercentChange1H float64 PercentChange24H float64 PercentChange7D float64 PercentChange30D float64 LastUpdated string // for favorites Favorite bool // for portfolio Holdings float64 Balance float64 }
Coin is the row structure
type Cointop ¶
type Cointop struct { ActionsMap map[string]bool State *State TableColumnOrder []string Views *Views // contains filtered or unexported fields }
Cointop cointop
func (*Cointop) ActionExists ¶
ActionExists returns true if action exists
func (*Cointop) ActivePriceAlerts ¶
func (ct *Cointop) ActivePriceAlerts() []*PriceAlert
ActivePriceAlerts returns the active price alerts
func (*Cointop) ActivePriceAlertsLen ¶
ActivePriceAlertsLen returns the number of active price alerts
func (*Cointop) CacheAllCoinsSlugMap ¶
func (ct *Cointop) CacheAllCoinsSlugMap()
CacheAllCoinsSlugMap writes the coins map to the memory and disk cache
func (*Cointop) CancelSearch ¶
CancelSearch closes the search field
func (*Cointop) ChartPoints ¶
ChartPoints calculates the the chart points
func (*Cointop) ChartWidth ¶
ChartWidth returns the width for chart
func (*Cointop) CheckPriceAlert ¶
func (ct *Cointop) CheckPriceAlert(alert *PriceAlert) error
CheckPriceAlert checks the price alert
func (*Cointop) ClampedWidth ¶
ClampedWidth returns the clamped width
func (*Cointop) ClearSyncMap ¶
ClearSyncMap clears a sync.Map
func (*Cointop) CoinBySymbol ¶
CoinBySymbol returns the coin struct given the symbol
func (*Cointop) CoinHoldings ¶
CoinHoldings returns portfolio coin holdings
func (*Cointop) ConfigDirPath ¶
ConfigDirPath returns the config directory path
func (*Cointop) ConfigFilePath ¶
ConfigFilePath return the config file path
func (*Cointop) CreateConfigIfNotExists ¶
CreateConfigIfNotExists creates config file if it doesn't exist
func (*Cointop) CreatePriceAlert ¶
CreatePriceAlert sets price from inputed value
func (*Cointop) CurrencySymbol ¶
CurrencySymbol returns the symbol for the currency conversion
func (*Cointop) CurrentDisplayPage ¶
CurrentDisplayPage returns the current page in human readable format
func (*Cointop) CurrentPage ¶
CurrentPage returns the current page
func (*Cointop) CursorDown ¶
CursorDown moves the cursor one row down
func (*Cointop) CursorDownOrNextPage ¶
CursorDownOrNextPage moves the cursor down one row or goes to the next page if cursor is on the last row
func (*Cointop) CursorUpOrPreviousPage ¶
CursorUpOrPreviousPage moves the cursor up one row or goes to the previous page if cursor is on the first row
func (*Cointop) EnlargeChart ¶
EnlargeChart increases the chart height by one row
func (*Cointop) EnterKeyPressHandler ¶
EnterKeyPressHandler is the key press handle for update menus
func (*Cointop) FirstChartRange ¶
FirstChartRange sets the chart to the first range option
func (*Cointop) GetCoinsTable ¶
GetCoinsTable returns the table for diplaying the coins
func (*Cointop) GetCoinsTableHeaders ¶
GetCoinsTableHeaders returns the coins table headers
func (*Cointop) GetFavoritesSlice ¶
GetFavoritesSlice returns coin favorites as slice
func (*Cointop) GetFavoritesTableHeaders ¶
GetFavoritesTableHeaders returns the favorites table headers
func (*Cointop) GetGlobalCoinIndex ¶
GetGlobalCoinIndex returns the index of the coin in from the coins list
func (*Cointop) GetListCount ¶
GetListCount returns count of coins list
func (*Cointop) GetPortfolioSlice ¶
GetPortfolioSlice returns portfolio entries as a slice
func (*Cointop) GetPortfolioTable ¶
GetPortfolioTable returns the table for displaying portfolio holdings
func (*Cointop) GetPortfolioTableHeaders ¶
GetPortfolioTableHeaders returns the portfolio table headers
func (*Cointop) GetPortfolioTotal ¶
GetPortfolioTotal returns the total balance of portfolio entries
func (*Cointop) GetPriceAlertsTable ¶
GetPriceAlertsTable returns the table for displaying alerts
func (*Cointop) GetPriceAlertsTableHeaders ¶
GetPriceAlertsTableHeaders returns the alerts table headers
func (*Cointop) GetSortColIndex ¶
GetSortColIndex gets the sort column index
func (*Cointop) GetTableCoinsSlice ¶
GetTableCoinsSlice returns a slice of the table rows
func (*Cointop) GetTableColumnAlignLeft ¶
GetTableColumnAlignLeft gets the column alignment direction for header
func (*Cointop) GetTableColumnWidth ¶
GetTableColumnWidth gets the column width for header
func (*Cointop) GoToCoinRow ¶
GoToCoinRow navigates to the row of the matched coin
func (*Cointop) GoToGlobalIndex ¶
GoToGlobalIndex navigates to the selected row index of all page rows
func (*Cointop) GoToPageRowIndex ¶
GoToPageRowIndex navigates to the selected row index of the page
func (*Cointop) HideConvertMenu ¶
HideConvertMenu hides the convert menu view
func (*Cointop) HidePortfolioUpdateMenu ¶
HidePortfolioUpdateMenu hides the portfolio update menu
func (*Cointop) HidePriceAlertsUpdateMenu ¶
HidePriceAlertsUpdateMenu hides the alerts update menu
func (*Cointop) HighlightRow ¶
HighlightRow highlights the row at index within page
func (*Cointop) HighlightedPageRowIndex ¶
HighlightedPageRowIndex returns the index of page row of the highlighted row
func (*Cointop) HighlightedRowCoin ¶
HighlightedRowCoin returns the coin at the index of the highlighted row
func (*Cointop) HighlightedRowIndex ¶
HighlightedRowIndex returns the index of the highlighted row within the per-page limit
func (*Cointop) InterfaceToFloat64 ¶
InterfaceToFloat64 attempts to convert interface to float64
func (*Cointop) IsFavoritesVisible ¶
IsFavoritesVisible returns true if favorites view is visible
func (*Cointop) IsFirstPage ¶
IsFirstPage returns true if cursor is on the first page
func (*Cointop) IsFirstRow ¶
IsFirstRow returns true if cursor is on first row
func (*Cointop) IsLastPage ¶
IsLastPage returns true if cursor is on the last page
func (*Cointop) IsPageFirstLine ¶
IsPageFirstLine returns true if the cursor is on the visible first row
func (*Cointop) IsPageLastLine ¶
IsPageLastLine returns true if the cursor is on the visible last row
func (*Cointop) IsPageMiddleLine ¶
IsPageMiddleLine returns true if the cursor is on the visible middle row
func (*Cointop) IsPortfolioVisible ¶
IsPortfolioVisible returns true if portfolio view is visible
func (*Cointop) IsPriceAlertsVisible ¶
IsPriceAlertsVisible returns true if alerts view is visible
func (*Cointop) IsSupportedCurrencyConversion ¶
IsSupportedCurrencyConversion returns true if it's a supported currency conversion
func (*Cointop) Keybindings ¶
Keybindings sets keyboard shortcut key bindings
func (*Cointop) LastChartRange ¶
LastChartRange sets the chart to the last range option
func (*Cointop) MouseLeftClick ¶
MouseLeftClick is called on mouse left click event
func (*Cointop) MouseMiddleClick ¶
MouseMiddleClick is called on mouse middle click event
func (*Cointop) MouseRelease ¶
MouseRelease is called on mouse releae event
func (*Cointop) MouseRightClick ¶
MouseRightClick is called on mouse right click event
func (*Cointop) MouseWheelDown ¶
MouseWheelDown is called on mouse wheel down event
func (*Cointop) MouseWheelUp ¶
MouseWheelUp is called on mouse wheel up event
func (*Cointop) NavigateFirstLine ¶
NavigateFirstLine moves the cursor to the first row of the table
func (*Cointop) NavigateLastLine ¶
NavigateLastLine moves the cursor to the last row of the table
func (*Cointop) NavigatePageFirstLine ¶
NavigatePageFirstLine moves the cursor to the visible first row of the table
func (*Cointop) NavigatePageMiddleLine ¶
NavigatePageMiddleLine moves the cursor to the visible middle row of the table
func (*Cointop) NextChartRange ¶
NextChartRange sets the chart to the next range option
func (*Cointop) ParsePriceAlertInput ¶
ParsePriceAlertInput parses price alert input field value
func (*Cointop) PortfolioChart ¶
PortfolioChart renders the portfolio chart
func (*Cointop) PortfolioEntriesCount ¶
PortfolioEntriesCount returns the count of portfolio entries
func (*Cointop) PortfolioEntry ¶
func (ct *Cointop) PortfolioEntry(c *Coin) (*PortfolioEntry, bool)
PortfolioEntry returns a portfolio entry
func (*Cointop) PortfolioEntryExists ¶
PortfolioEntryExists returns true if portfolio entry exists
func (*Cointop) PrevChartRange ¶
PrevChartRange sets the chart to the prevous range option
func (*Cointop) PrevPageTop ¶
PrevPageTop navigates to the first row of the previous page
func (*Cointop) PriceAlertWatcher ¶
PriceAlertWatcher starts the price alert watcher
func (*Cointop) PrintHoldingsTable ¶
func (ct *Cointop) PrintHoldingsTable(options *TablePrintOptions) error
PrintHoldingsTable prints the holdings in an ASCII table
func (*Cointop) PrintTotalHoldings ¶
func (ct *Cointop) PrintTotalHoldings(options *TablePrintOptions) error
PrintTotalHoldings prints the total holdings amount
func (*Cointop) ReadAPIKeyFromStdin ¶
ReadAPIKeyFromStdin reads the user inputed API from the stdin prompt
func (*Cointop) ReadAndParsePriceAlertInput ¶
ReadAndParsePriceAlertInput reads and parses price alert input field value
func (*Cointop) RefreshAll ¶
RefreshAll triggers a force refresh of all data
func (*Cointop) RefreshPortfolioCoins ¶
RefreshPortfolioCoins refreshes portfolio entry coin data
func (*Cointop) RefreshRowLink ¶
RefreshRowLink updates the row link in the statusbar
func (*Cointop) RefreshTable ¶
RefreshTable refreshes the table
func (*Cointop) RemovePortfolioEntry ¶
RemovePortfolioEntry removes a portfolio entry
func (*Cointop) RowChanged ¶
func (ct *Cointop) RowChanged()
RowChanged is called when the row is updated
func (*Cointop) RowLinkShort ¶
RowLinkShort returns a shortened version of the row url link
func (*Cointop) SaveConfig ¶
SaveConfig writes settings to the config file
func (*Cointop) SelectedCoinName ¶
SelectedCoinName returns the selected coin name
func (*Cointop) SelectedCoinSymbol ¶
SelectedCoinSymbol returns the selected coin symbol
func (*Cointop) SetActiveView ¶
SetActiveView sets the active view
func (*Cointop) SetCurrencyConverstion ¶
SetCurrencyConverstion sets the currency conversion
func (*Cointop) SetCurrencyConverstionFn ¶
SetCurrencyConverstionFn sets the currency conversion function
func (*Cointop) SetKeybindingMod ¶
func (ct *Cointop) SetKeybindingMod(key interface{}, mod gocui.Modifier, callback func(g *gocui.Gui, v *gocui.View) error, view string) error
SetKeybindingMod sets the keybinding modifier key
func (*Cointop) SetPortfolioEntry ¶
SetPortfolioEntry sets a portfolio entry
func (*Cointop) SetPortfolioHoldings ¶
SetPortfolioHoldings sets portfolio entry holdings from inputed value
func (*Cointop) SetPriceAlert ¶
SetPriceAlert sets a price alert
func (*Cointop) SetSavingStatus ¶
func (ct *Cointop) SetSavingStatus()
SetSavingStatus sets the saving indicator in the statusbar
func (*Cointop) SetSelectedView ¶
SetSelectedView sets the active table view
func (*Cointop) SetTableColumnAlignLeft ¶
SetTableColumnAlignLeft sets the column alignment direction for header
func (*Cointop) SetTableColumnWidth ¶
SetTableColumnWidth sets the column width for header
func (*Cointop) SetTableColumnWidthFromString ¶
SetTableColumnWidthFromString sets the column width for header given size of string
func (*Cointop) ShortenChart ¶
ShortenChart decreases the chart height by one row
func (*Cointop) ShowChartLoader ¶
ShowChartLoader shows chart loading indicator
func (*Cointop) ShowConvertMenu ¶
ShowConvertMenu shows the convert menu view
func (*Cointop) ShowPortfolioUpdateMenu ¶
ShowPortfolioUpdateMenu shows the portfolio update menu
func (*Cointop) ShowPriceAlertsAddMenu ¶
ShowPriceAlertsAddMenu shows the alert add menu
func (*Cointop) ShowPriceAlertsUpdateMenu ¶
ShowPriceAlertsUpdateMenu shows the alerts update menu
func (*Cointop) SortNextCol ¶
SortNextCol sorts the next column
func (*Cointop) SortPrevCol ¶
SortPrevCol sorts the previous column
func (*Cointop) SortToggle ¶
SortToggle toggles the sort order
func (*Cointop) SortedSupportedCurrencyConversions ¶
SortedSupportedCurrencyConversions returns sorted list of supported currencies for conversion
func (*Cointop) SupportedCryptoCurrencyConversions ¶
SupportedCryptoCurrencyConversions returns map of supported cryptocurrencies for conversion
func (*Cointop) SupportedCurrencyConversions ¶
SupportedCurrencyConversions returns a map of all supported currencies for conversion
func (*Cointop) SupportedFiatCurrencyConversions ¶
SupportedFiatCurrencyConversions returns map of supported fiat currencies for conversion
func (*Cointop) TableRowsLen ¶
TableRowsLen returns the number of table row entries
func (*Cointop) TableScrollLeft ¶
TableScrollLeft scrolls the table to the left
func (*Cointop) TableScrollRight ¶
TableScrollRight scrolls the the table to the right
func (*Cointop) ToggleCoinChart ¶
ToggleCoinChart toggles between the global chart and the coin chart
func (*Cointop) ToggleConvertMenu ¶
ToggleConvertMenu toggles the convert menu view
func (*Cointop) ToggleFavorite ¶
ToggleFavorite toggles coin as favorite
func (*Cointop) ToggleFavorites ¶
ToggleFavorites toggles the favorites view
func (*Cointop) TogglePortfolio ¶
TogglePortfolio toggles the portfolio view
func (*Cointop) TogglePortfolioUpdateMenu ¶
TogglePortfolioUpdateMenu toggles the portfolio update menu
func (*Cointop) TogglePriceAlerts ¶
TogglePriceAlerts toggles the price alerts view
func (*Cointop) ToggleSelectedView ¶
ToggleSelectedView toggles between current table view and last selected table view
func (*Cointop) ToggleShowFavorites ¶
ToggleShowFavorites shows the favorites view
func (*Cointop) ToggleShowPortfolio ¶
ToggleShowPortfolio shows the portfolio view
func (*Cointop) ToggleTableFullscreen ¶
ToggleTableFullscreen toggles the table fullscreen mode
func (*Cointop) TotalPages ¶
TotalPages returns the number of total pages
func (*Cointop) TotalPagesDisplay ¶
TotalPagesDisplay returns the number of total pages in human readable format
func (*Cointop) TotalPerPage ¶
TotalPerPage returns the number max rows per page
func (*Cointop) UpdateChart ¶
UpdateChart updates the chart view
func (*Cointop) UpdateConvertMenu ¶
UpdateConvertMenu updates the convert menu
func (*Cointop) UpdateMarketbar ¶
UpdateMarketbar updates the market bar view
func (*Cointop) UpdatePortfolioUpdateMenu ¶
UpdatePortfolioUpdateMenu updates the portfolio update menu view
func (*Cointop) UpdatePriceAlertsUpdateMenu ¶
UpdatePriceAlertsUpdateMenu updates the alerts update menu view
func (*Cointop) UpdateStatusbar ¶
UpdateStatusbar updates the statusbar view
func (*Cointop) UpdateTableHeader ¶
UpdateTableHeader renders the table header
func (*Cointop) ValidCoinsTableHeader ¶
ValidCoinsTableHeader returns true if it's a valid table header name
func (*Cointop) ValidPortfolioTableHeader ¶
ValidPortfolioTableHeader returns the portfolio table headers
type Colorscheme ¶
type Colorscheme struct {
// contains filtered or unexported fields
}
Colorscheme is the struct for colorscheme
func (*Colorscheme) MarketBarLabelActive ¶
func (c *Colorscheme) MarketBarLabelActive(a ...interface{}) string
MarketBarLabelActive ...
func (*Colorscheme) Marketbar ¶
func (c *Colorscheme) Marketbar(a ...interface{}) string
Marketbar ...
func (*Colorscheme) MarketbarChangeDownSprintf ¶
func (c *Colorscheme) MarketbarChangeDownSprintf() ISprintf
MarketbarChangeDownSprintf ...
func (*Colorscheme) MarketbarChangeSprintf ¶
func (c *Colorscheme) MarketbarChangeSprintf() ISprintf
MarketbarChangeSprintf ...
func (*Colorscheme) MarketbarChangeUpSprintf ¶
func (c *Colorscheme) MarketbarChangeUpSprintf() ISprintf
MarketbarChangeUpSprintf ...
func (*Colorscheme) MarketbarSprintf ¶
func (c *Colorscheme) MarketbarSprintf() ISprintf
MarketbarSprintf ...
func (*Colorscheme) MenuHeader ¶
func (c *Colorscheme) MenuHeader(a ...interface{}) string
MenuHeader ...
func (*Colorscheme) MenuLabel ¶
func (c *Colorscheme) MenuLabel(a ...interface{}) string
MenuLabel ...
func (*Colorscheme) MenuLabelActive ¶
func (c *Colorscheme) MenuLabelActive(a ...interface{}) string
MenuLabelActive ...
func (*Colorscheme) Searchbar ¶
func (c *Colorscheme) Searchbar(a ...interface{}) string
Searchbar ...
func (*Colorscheme) Statusbar ¶
func (c *Colorscheme) Statusbar(a ...interface{}) string
Statusbar ...
func (*Colorscheme) TableColumnChange ¶
func (c *Colorscheme) TableColumnChange(a ...interface{}) string
TableColumnChange ...
func (*Colorscheme) TableColumnChangeDown ¶
func (c *Colorscheme) TableColumnChangeDown(a ...interface{}) string
TableColumnChangeDown ...
func (*Colorscheme) TableColumnChangeDownSprintf ¶
func (c *Colorscheme) TableColumnChangeDownSprintf() ISprintf
TableColumnChangeDownSprintf ...
func (*Colorscheme) TableColumnChangeSprintf ¶
func (c *Colorscheme) TableColumnChangeSprintf() ISprintf
TableColumnChangeSprintf ...
func (*Colorscheme) TableColumnChangeUp ¶
func (c *Colorscheme) TableColumnChangeUp(a ...interface{}) string
TableColumnChangeUp ...
func (*Colorscheme) TableColumnChangeUpSprintf ¶
func (c *Colorscheme) TableColumnChangeUpSprintf() ISprintf
TableColumnChangeUpSprintf ...
func (*Colorscheme) TableColumnPrice ¶
func (c *Colorscheme) TableColumnPrice(a ...interface{}) string
TableColumnPrice ...
func (*Colorscheme) TableColumnPriceSprintf ¶
func (c *Colorscheme) TableColumnPriceSprintf() ISprintf
TableColumnPriceSprintf ...
func (*Colorscheme) TableHeader ¶
func (c *Colorscheme) TableHeader(a ...interface{}) string
TableHeader ...
func (*Colorscheme) TableHeaderColumnActive ¶
func (c *Colorscheme) TableHeaderColumnActive(a ...interface{}) string
TableHeaderColumnActive ...
func (*Colorscheme) TableHeaderColumnActiveSprintf ¶
func (c *Colorscheme) TableHeaderColumnActiveSprintf() ISprintf
TableHeaderColumnActiveSprintf ...
func (*Colorscheme) TableHeaderSprintf ¶
func (c *Colorscheme) TableHeaderSprintf() ISprintf
TableHeaderSprintf ...
func (*Colorscheme) TableRowActive ¶
func (c *Colorscheme) TableRowActive(a ...interface{}) string
TableRowActive ...
func (*Colorscheme) TableRowFavorite ¶
func (c *Colorscheme) TableRowFavorite(a ...interface{}) string
TableRowFavorite ...
func (*Colorscheme) TableRowFavoriteSprintf ¶
func (c *Colorscheme) TableRowFavoriteSprintf() ISprintf
TableRowFavoriteSprintf ...
func (*Colorscheme) TableRowSprintf ¶
func (c *Colorscheme) TableRowSprintf() ISprintf
TableRowSprintf ...
type Config ¶
type Config struct { APIChoice string CacheDir string ColorsDir string Colorscheme string ConfigFilepath string CoinMarketCapAPIKey string NoPrompts bool HideMarketbar bool HideChart bool HideStatusbar bool NoCache bool OnlyTable bool RefreshRate *uint PerPage uint }
Config config options
type DominanceConfig ¶
DominanceConfig is the config options for the dominance command
type HeaderColumn ¶
HeaderColumn is header column struct
type MarketbarView ¶
MarketbarView is structure for marketbar view
func NewMarketbarView ¶
func NewMarketbarView() *MarketbarView
NewMarketbarView returns a new marketbar view
type Portfolio ¶
type Portfolio struct {
Entries map[string]*PortfolioEntry
}
Portfolio is portfolio structure
type PortfolioEntry ¶
PortfolioEntry is portfolio entry
type PriceAlert ¶
type PriceAlert struct { ID string CoinName string TargetPrice float64 Operator string Frequency string CreatedAt string Expired bool }
PriceAlert is price alert structure
type PriceAlerts ¶
type PriceAlerts struct { Entries []*PriceAlert SoundEnabled bool }
PriceAlerts is price alerts structure
type PriceConfig ¶
PriceConfig is the config options for the coin price method
type PricesConfig ¶
PricesConfig is the config options for the coin prices method
type ResetConfig ¶
ResetConfig is the config for the reset function
type SearchFieldView ¶
SearchFieldView is structure for search field view
func NewSearchFieldView ¶
func NewSearchFieldView() *SearchFieldView
NewSearchFieldView returns a new search field view
type State ¶
type State struct {
// contains filtered or unexported fields
}
State is the state preferences of cointop
type StatusbarView ¶
StatusbarView is structure for statusbar view
func NewStatusbarView ¶
func NewStatusbarView() *StatusbarView
NewStatusbarView returns a new statusbar view
type TableHeaderView ¶
TableHeaderView is structure for table header view
func NewTableHeaderView ¶
func NewTableHeaderView() *TableHeaderView
NewTableHeaderView returns a new table header view
type TablePrintOptions ¶
type TablePrintOptions struct { SortBy string SortDesc bool HumanReadable bool Format string Filter []string Convert string }
TablePrintOptions are options for ascii table output.
type Views ¶
type Views struct { Chart *ChartView Table *TableView TableHeader *TableHeaderView Marketbar *MarketbarView SearchField *SearchFieldView Statusbar *StatusbarView Menu *MenuView Input *InputView }
Views are all views in cointop
Source Files
- actions.go
- active_view.go
- cache.go
- chart.go
- coin.go
- coins_table.go
- cointop.go
- colorscheme.go
- config.go
- constants.go
- conversion.go
- debug.go
- default_colors.go
- default_shortcuts.go
- dominance.go
- error.go
- events.go
- favorites.go
- help.go
- keybindings.go
- layout.go
- list.go
- marketbar.go
- menu.go
- navigation.go
- portfolio.go
- price.go
- price_alerts.go
- quit.go
- refresh.go
- save.go
- search.go
- selection.go
- size.go
- sort.go
- statusbar.go
- stdin.go
- table.go
- table_header.go
- update.go
- util.go
- version.go