Documentation ¶
Index ¶
- Constants
- Variables
- func ActionsMap() map[string]bool
- func ChartRanges() []string
- func ChartRangesMap() map[string]time.Duration
- 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 Slugify(s string) 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) Clean(config *CleanConfig) error
- func (ct *Cointop) ClearSyncMap(syncMap *sync.Map)
- func (ct *Cointop) CoinByID(id string) *Coin
- func (ct *Cointop) CoinByName(name string) *Coin
- func (ct *Cointop) CoinBySymbol(symbol string) *Coin
- func (ct *Cointop) CoinHoldings(coin *Coin) float64
- func (ct *Cointop) CompositeCacheKey(symbol string, name string, convert string, chartRange string) string
- func (ct *Cointop) ConfigDirPath() string
- func (ct *Cointop) ConfigFilePath() string
- func (ct *Cointop) ConfigToToml() ([]byte, error)
- func (ct *Cointop) Convert(convertFrom, convertTo string, amount float64) (float64, error)
- 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) DeleteKeybinding(shortcutKey string) error
- func (ct *Cointop) DeleteKeybindingMod(key interface{}, mod gocui.Modifier, view string) error
- func (ct *Cointop) DoSearch() error
- func (ct *Cointop) EnlargeChart() error
- func (ct *Cointop) EnterKeyPressHandler() error
- func (ct *Cointop) Exit()
- func (ct *Cointop) FavoritesLen() int
- func (ct *Cointop) FirstChartRange() error
- func (ct *Cointop) FirstPage() error
- func (ct *Cointop) FormatPrice(price float64) string
- func (ct *Cointop) GetActiveTableHeaders() []string
- func (ct *Cointop) GetActiveTableSlice() []*Coin
- func (ct *Cointop) GetCoinRowIndex(coin *Coin) int
- func (ct *Cointop) GetCoinsTable() *table.Table
- func (ct *Cointop) GetCoinsTableHeaders() []string
- func (ct *Cointop) GetColorschemeColors() (map[string]interface{}, error)
- func (ct *Cointop) GetFavoritesSlice() []*Coin
- func (ct *Cointop) GetFavoritesTableHeaders() []string
- func (ct *Cointop) GetGlobalCoinIndex(coin *Coin) int
- func (ct *Cointop) GetLabel(h *HeaderColumn) string
- func (ct *Cointop) GetLastPortfolioRowIndex() int
- func (ct *Cointop) GetLastSelectedRowCoinIndex() int
- func (ct *Cointop) GetListCount() int
- func (ct *Cointop) GetPortfolioCoinIndex(coin *Coin) 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) Height() int
- 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) IsActiveTableCompactNotation() bool
- 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) 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) MakeConfigDir() error
- func (ct *Cointop) MakeConfigFile() 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) NavigateToFirstPageFirstRow() error
- func (ct *Cointop) NextChartRange() error
- func (ct *Cointop) NextPage() error
- func (ct *Cointop) Noop() error
- func (ct *Cointop) OpenLink() error
- func (ct *Cointop) OpenSearch() error
- func (ct *Cointop) PageDown() error
- func (ct *Cointop) PageUp() error
- func (ct *Cointop) ParseConfig() 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) PortfolioLen() int
- func (ct *Cointop) PrevChartRange() error
- func (ct *Cointop) PrevPage() error
- func (ct *Cointop) PrevPageTop() error
- func (ct *Cointop) PriceAlertWatcher() error
- func (ct *Cointop) PrintHoldings24HChange(options *TablePrintOptions) error
- func (ct *Cointop) PrintHoldingsTable(options *TablePrintOptions) error
- func (ct *Cointop) PrintHoldingsTotal(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) error
- func (ct *Cointop) RemovePriceAlert(id string) error
- func (ct *Cointop) Reset(config *ResetConfig) error
- 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) SetKeybindingAction(shortcutKey string, action string) error
- func (ct *Cointop) SetKeybindingMod(key interface{}, mod gocui.Modifier, ...) error
- func (ct *Cointop) SetKeybindings() error
- func (ct *Cointop) SetPage(page int) int
- func (ct *Cointop) SetPortfolioEntry(coin string, holdings float64, buyPrice float64, buyCurrency string) 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) Size() (int, int)
- 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) TableCoinsLen() int
- func (ct *Cointop) TableRowsLen() int
- func (ct *Cointop) TableScrollLeft() error
- func (ct *Cointop) TableScrollRight() error
- func (ct *Cointop) ToggleChartFullscreen() 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) TogglePortfolioBalances() 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) UpdateCurrentPageCoins() error
- func (ct *Cointop) UpdateHelp()
- func (ct *Cointop) UpdateMarketbar() error
- func (ct *Cointop) UpdatePortfolioUpdateMenu() error
- func (ct *Cointop) UpdatePriceAlertsUpdateMenu(isNew bool, coin *Coin) 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
- func (ct *Cointop) Width() int
- type ColorCache
- type Colorscheme
- func (c *Colorscheme) BaseBg() gocui.Attribute
- func (c *Colorscheme) BaseFg() gocui.Attribute
- func (c *Colorscheme) Chart(a ...interface{}) string
- func (c *Colorscheme) Color(name string, a ...interface{}) string
- func (c *Colorscheme) Default(a ...interface{}) string
- func (c *Colorscheme) GocuiBgColor(name string) gocui.Attribute
- func (c *Colorscheme) GocuiFgColor(name string) gocui.Attribute
- 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
- func (c *Colorscheme) ToBgAttr(v string) (fcolor.Attribute, bool)
- func (c *Colorscheme) ToBoldAttr(v bool) (fcolor.Attribute, bool)
- func (c *Colorscheme) ToFgAttr(v string) (fcolor.Attribute, bool)
- func (c *Colorscheme) ToGocuiAttr(v string) (gocui.Attribute, bool)
- func (c *Colorscheme) ToSprintf(name string) ISprintf
- func (c *Colorscheme) ToUnderlineAttr(v bool) (fcolor.Attribute, bool)
- type ColorschemeColors
- type Config
- type ConfigFileConfig
- type DominanceConfig
- type HeaderColumn
- type ISprintf
- type InputView
- type MarketbarView
- type MenuView
- type Portfolio
- type PortfolioEntry
- type PriceAlert
- type PriceAlerts
- type PriceConfig
- type PriceData
- 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 BgColorschemeColorsMap = map[string]fcolor.Attribute{ "black": fcolor.BgBlack, "blue": fcolor.BgBlue, "cyan": fcolor.BgCyan, "green": fcolor.BgGreen, "magenta": fcolor.BgMagenta, "red": fcolor.BgRed, "white": fcolor.BgWhite, "yellow": fcolor.BgYellow, }
var CryptocurrencyNames = map[string]string{
"BTC": "Bitcoin",
"ETH": "Ethereum",
"SATS": "Satoshi",
}
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$",
"SATS": "丰",
"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 DefaultChartHeight = 10
DefaultChartHeight ...
var DefaultChartRange = "1Y"
DefaultChartRange ...
var DefaultCoinTableHeaders = []string{
"rank",
"name",
"symbol",
"price",
"1h_change",
"24h_change",
"7d_change",
"24h_volume",
"market_cap",
"available_supply",
"total_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 DefaultCompactNotation = false
DefaultCompactNotation ...
var DefaultConfigFilepath = pathutil.NormalizePath(":PREFERRED_CONFIG_HOME:/cointop/config.toml")
DefaultConfigFilepath ...
var DefaultCurrency = "USD"
DefaultCurrency ...
var DefaultEnableMouse = true
DefaultEnableMouse ...
var DefaultFavoriteChar = "*"
DefaultFavoriteChar ...
var DefaultMaxChartWidth = 175
DefaultMaxChartWidth ...
var DefaultMaxPages = uint(10)
DefaultMaxPages ...
var DefaultPerPage = uint(100)
DefaultPerPage ...
var DefaultPortfolioTableHeaders = []string{
"rank",
"name",
"symbol",
"price",
"holdings",
"balance",
"1h_change",
"24h_change",
"7d_change",
"percent_holdings",
"cost_price",
"cost",
"pnl",
"pnl_percent",
"last_updated",
}
DefaultPortfolioTableHeaders are the default portfolio table header columns
var DefaultSortBy = "rank"
DefaultSortBy ...
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 FgColorschemeColorsMap = map[string]fcolor.Attribute{ "black": fcolor.FgBlack, "blue": fcolor.FgBlue, "cyan": fcolor.FgCyan, "green": fcolor.FgGreen, "magenta": fcolor.FgMagenta, "red": fcolor.FgRed, "white": fcolor.FgWhite, "yellow": fcolor.FgYellow, }
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 map of currency symbols to names. Keep these in alphabetical order.
var FilePerm = os.FileMode(0644)
FilePerm is the default file permissions
var GocuiColorschemeColorsMap = map[string]gocui.Attribute{ "black": gocui.ColorBlack, "blue": gocui.ColorBlue, "cyan": gocui.ColorCyan, "green": gocui.ColorGreen, "magenta": gocui.ColorMagenta, "red": gocui.ColorRed, "white": gocui.ColorWhite, "yellow": gocui.ColorYellow, }
var HeaderColumns = map[string]*HeaderColumn{
"rank": {
Slug: "rank",
Label: "[r]ank",
PlainLabel: "rank",
},
"name": {
Slug: "name",
Label: "[n]ame",
PlainLabel: "name",
},
"symbol": {
Slug: "symbol",
Label: "[s]ymbol",
PlainLabel: "symbol",
},
"target_price": {
Slug: "target_price",
Label: "[t]target price",
PlainLabel: "target price",
},
"price": {
Slug: "price",
Label: "[p]rice",
PlainLabel: "price",
},
"frequency": {
Slug: "frequency",
Label: "frequency",
PlainLabel: "frequency",
},
"holdings": {
Slug: "holdings",
Label: "[h]oldings",
PlainLabel: "holdings",
},
"balance": {
Slug: "balance",
Label: "[b]alance",
PlainLabel: "balance",
},
"market_cap": {
Slug: "market_cap",
Label: "[m]arket cap",
ShortLabel: "[m]cap",
PlainLabel: "market cap",
},
"24h_volume": {
Slug: "24h_volume",
Label: "24H [v]olume",
ShortLabel: "24[v]",
PlainLabel: "24H volume",
},
"1h_change": {
Slug: "1h_change",
Label: "[1]H%",
PlainLabel: "1H%",
},
"24h_change": {
Slug: "24h_change",
Label: "[2]4H%",
PlainLabel: "24H%",
},
"7d_change": {
Slug: "7d_change",
Label: "[7]D%",
PlainLabel: "7D%",
},
"30d_change": {
Slug: "30d_change",
Label: "[3]0D%",
PlainLabel: "30D%",
},
"1y_change": {
Slug: "1y_change",
Label: "1[y]%",
PlainLabel: "1Y%",
},
"total_supply": {
Slug: "total_supply",
Label: "[t]otal supply",
ShortLabel: "[t]ot",
PlainLabel: "total supply",
},
"available_supply": {
Slug: "available_supply",
Label: "[a]vailable supply",
ShortLabel: "[a]vl",
PlainLabel: "available supply",
},
"percent_holdings": {
Slug: "percent_holdings",
Label: "[%]holdings",
PlainLabel: "%holdings",
},
"last_updated": {
Slug: "last_updated",
Label: "last [u]pdated",
PlainLabel: "last updated",
},
"cost_price": {
Slug: "cost_price",
Label: "cost price",
PlainLabel: "cost price",
},
"cost": {
Slug: "cost",
Label: "[!]cost",
PlainLabel: "cost",
},
"pnl": {
Slug: "pnl",
Label: "[@]PNL",
PlainLabel: "PNL",
},
"pnl_percent": {
Slug: "pnl_percent",
Label: "[#]PNL%",
PlainLabel: "PNL%",
},
}
HeaderColumns are the header column widths
var HiddenBalanceChars = "********"
HiddenBalanceChars are the characters to show when hidding balances
var PossibleConfigPaths = []string{
":PREFERRED_CONFIG_HOME:/cointop/config.toml",
":HOME:/.config/cointop/config.toml",
":HOME:/.config/cointop/config",
":HOME:/.cointop/config",
":HOME:/.cointop/config.toml",
}
PossibleConfigPaths are the possible config file paths. NOTE: this is to support previous default config filepaths
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",
"1y_change",
"24h_volume",
"market_cap",
"available_supply",
"total_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",
"1y_change",
"percent_holdings",
"last_updated",
"cost_price",
"cost",
"pnl",
"pnl_percent",
}
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 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 PercentChange1Y float64 LastUpdated string // for favorites Favorite bool // for portfolio Holdings float64 Balance float64 BuyPrice float64 BuyCurrency string }
Coin is the row structure
type Cointop ¶
type Cointop struct { ActionsMap map[string]bool State *State 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 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) Clean ¶
func (ct *Cointop) Clean(config *CleanConfig) error
Clean removes cache files
func (*Cointop) ClearSyncMap ¶
ClearSyncMap clears a sync.Map
func (*Cointop) CoinByName ¶
CoinByName returns the coin struct given the name
func (*Cointop) CoinBySymbol ¶
CoinBySymbol returns the coin struct given the symbol
func (*Cointop) CoinHoldings ¶
CoinHoldings returns portfolio coin holdings
func (*Cointop) CompositeCacheKey ¶
func (ct *Cointop) CompositeCacheKey(symbol string, name string, convert string, chartRange string) string
CompositeCacheKey returns a CacheKey for a coin (or globaldata)
func (*Cointop) ConfigDirPath ¶
ConfigDirPath returns the config directory path
func (*Cointop) ConfigFilePath ¶
ConfigFilePath return the config file path
func (*Cointop) ConfigToToml ¶
ConfigToToml encodes config struct to TOML
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) DeleteKeybinding ¶
DeleteKeybinding ...
func (*Cointop) DeleteKeybindingMod ¶
DeleteKeybindingMod ...
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) FavoritesLen ¶
FavoritesLen returns the number of favorite coins
func (*Cointop) FirstChartRange ¶
FirstChartRange sets the chart to the first range option
func (*Cointop) FormatPrice ¶
FormatPrice formats the coin price number of decimals and currency format
func (*Cointop) GetActiveTableHeaders ¶
GetActiveTableHeaders returns the list of active table headers
func (*Cointop) GetActiveTableSlice ¶
GetActiveTableSlice returns the rows slice for the active table
func (*Cointop) GetCoinRowIndex ¶
GetCoinRowIndex returns the index of the coin in from the visible coins list
func (*Cointop) GetCoinsTable ¶
GetCoinsTable returns the table for diplaying the coins
func (*Cointop) GetCoinsTableHeaders ¶
GetCoinsTableHeaders returns the coins table headers
func (*Cointop) GetColorschemeColors ¶
GetColorschemeColors loads colors from colorscheme file to struct
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 gloal coins list
func (*Cointop) GetLabel ¶
func (ct *Cointop) GetLabel(h *HeaderColumn) string
GetLabel fetch the label to use for the heading (depends on configuration)
func (*Cointop) GetLastPortfolioRowIndex ¶
func (*Cointop) GetLastSelectedRowCoinIndex ¶
GetLastSelectedRowCoinIndex returns the index of the last selected row coin
func (*Cointop) GetListCount ¶
GetListCount returns count of coins list
func (*Cointop) GetPortfolioCoinIndex ¶
GetPortfolioCoinIndex returns the row index of coin in portfolio
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) IsActiveTableCompactNotation ¶
GetActiveTableHeaders returns the list of active table headers
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) LastChartRange ¶
LastChartRange sets the chart to the last range option
func (*Cointop) MakeConfigDir ¶
MakeConfigDir creates the directory for the config file
func (*Cointop) MakeConfigFile ¶
MakeConfigFile creates a new config file
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) NavigateToFirstPageFirstRow ¶ added in v1.6.10
NavigateToFirstPageFirstRow navigates to the first row on the first page
func (*Cointop) NextChartRange ¶
NextChartRange sets the chart to the next range option
func (*Cointop) OpenSearch ¶
OpenSearch opens the search field
func (*Cointop) ParseConfig ¶
ParseConfig decodes the toml config file
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) PortfolioLen ¶
PortfolioLen returns the number of portfolio entries
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) PrintHoldings24HChange ¶
func (ct *Cointop) PrintHoldings24HChange(options *TablePrintOptions) error
PrintHoldings24HChange prints the total holdings amount
func (*Cointop) PrintHoldingsTable ¶
func (ct *Cointop) PrintHoldingsTable(options *TablePrintOptions) error
PrintHoldingsTable prints the holdings in an ASCII table
func (*Cointop) PrintHoldingsTotal ¶
func (ct *Cointop) PrintHoldingsTotal(options *TablePrintOptions) error
PrintHoldingsTotal 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) RemovePriceAlert ¶
RemovePriceAlert removes a price alert entry
func (*Cointop) Reset ¶
func (ct *Cointop) Reset(config *ResetConfig) error
Reset removes configuration and cache files
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) SetKeybindingAction ¶
SetKeybindingAction maps a shortcut key to an action
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) SetKeybindings ¶
SetKeybindings sets keyboard shortcut key bindings
func (*Cointop) SetPortfolioEntry ¶
func (ct *Cointop) SetPortfolioEntry(coin string, holdings float64, buyPrice float64, buyCurrency string) error
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) TableCoinsLen ¶
TableCoinsLen returns the number of coins in coins table
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 table to the right
func (*Cointop) ToggleChartFullscreen ¶
ToggleChartFullscreen toggles the chart fullscreen mode
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) TogglePortfolioBalances ¶
TogglePortfolioBalances toggles hide/show portfolio balances. Useful for keeping balances secret when sharing screen or taking screenshots.
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) UpdateCurrentPageCoins ¶ added in v1.6.10
UpdateCurrentPageCoins updates all the coins in the current page
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 ColorCache ¶
ColorCache is a map of color string names to sprintf functions
type Colorscheme ¶
type Colorscheme struct {
// contains filtered or unexported fields
}
Colorscheme is the struct for colorscheme
func (*Colorscheme) Color ¶
func (c *Colorscheme) Color(name string, a ...interface{}) string
func (*Colorscheme) GocuiBgColor ¶
func (c *Colorscheme) GocuiBgColor(name string) gocui.Attribute
func (*Colorscheme) GocuiFgColor ¶
func (c *Colorscheme) GocuiFgColor(name string) gocui.Attribute
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 ...
func (*Colorscheme) ToBoldAttr ¶
func (c *Colorscheme) ToBoldAttr(v bool) (fcolor.Attribute, bool)
ToBoldAttr converts a boolean to an Attribute type
func (*Colorscheme) ToGocuiAttr ¶
func (c *Colorscheme) ToGocuiAttr(v string) (gocui.Attribute, bool)
ToGocuiAttr converts a color string name to a gocui Attribute type
func (*Colorscheme) ToSprintf ¶
func (c *Colorscheme) ToSprintf(name string) ISprintf
func (*Colorscheme) ToUnderlineAttr ¶
func (c *Colorscheme) ToUnderlineAttr(v bool) (fcolor.Attribute, bool)
ToUnderlineAttr converts a boolean to an Attribute type
type ColorschemeColors ¶
type ColorschemeColors map[string]interface{}
ColorschemeColors is a map of color string names to Attribute types
type Config ¶
type Config struct { APIChoice string CacheDir string ColorsDir string Colorscheme string ConfigFilepath string CoinMarketCapAPIKey string NoPrompts bool HideMarketbar bool HideChart bool HideTable bool HideStatusbar bool HidePortfolioBalances bool NoCache bool OnlyTable bool OnlyChart bool RefreshRate *uint PerPage uint MaxPages uint }
Config config options
type ConfigFileConfig ¶
type ConfigFileConfig struct { Shortcuts map[string]interface{} `toml:"shortcuts"` Favorites map[string]interface{} `toml:"favorites"` Portfolio map[string]interface{} `toml:"portfolio"` PriceAlerts map[string]interface{} `toml:"price_alerts"` Currency interface{} `toml:"currency"` DefaultView interface{} `toml:"default_view"` DefaultChartRange interface{} `toml:"default_chart_range"` CoinMarketCap map[string]interface{} `toml:"coinmarketcap"` API interface{} `toml:"api"` Colorscheme interface{} `toml:"colorscheme"` RefreshRate interface{} `toml:"refresh_rate"` CacheDir interface{} `toml:"cache_dir"` CompactNotation interface{} `toml:"compact_notation"` EnableMouse interface{} `toml:"enable_mouse"` Table map[string]interface{} `toml:"table"` Chart map[string]interface{} `toml:"chart"` }
ConfigFileConfig is the config file structure
type DominanceConfig ¶
DominanceConfig is the config options for the dominance command
type HeaderColumn ¶
type HeaderColumn struct { Slug string Label string ShortLabel string // only columns with a ShortLabel can be scaled? PlainLabel string }
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 PriceData ¶
type PriceData struct {
// contains filtered or unexported fields
}
PriceData is the time-series data for a Coin used when building a Portfolio view for chart
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 Cols []string Convert string NoHeader bool PercentChange24H bool HideBalances bool }
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