cointop

package
v1.5.3 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2020 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CoinGecko = "coingecko"

CoinGecko is API choice

View Source
var CoinMarketCap = "coinmarketcap"

CoinMarketCap is API choice

View Source
var CryptocurrencyNames = map[string]string{
	"BTC": "Bitcoin",
	"ETH": "Ethereum",
}

CryptocurrencyNames is a map of cryptocurrency symbols to name

View Source
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$",
	"USD": "$",
	"VND": "₫",
	"ZAR": "R",
}

CurrencySymbolMap is map of fiat currency symbols to names. Keep these in alphabetical order.

View Source
var DefaultCacheDir = filecache.DefaultCacheDir

DefaultCacheDir ...

View Source
var DefaultColors = `` /* 1611-byte string literal not displayed */

DefaultColors is the default color scheme

View Source
var DefaultColorscheme = "cointop"

DefaultColorscheme ...

View Source
var DefaultConfigFilepath = pathutil.NormalizePath(":PREFERRED_CONFIG_HOME:/cointop/config.toml")

DefaultConfigFilepath ...

View Source
var DefaultPerPage uint = 100

DefaultPerPage ...

View Source
var ErrInvalidAPIChoice = errors.New("Invalid API choice")

ErrInvalidAPIChoice is error for invalid API choice

View Source
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",
	"USD": "US Dollar",
	"VND": "Vietnamese Dong",
	"ZAR": "South African Rand",
}

FiatCurrencyNames is a mpa of currency symbols to names. Keep these in alphabetical order.

Functions

func ActionsMap

func ActionsMap() map[string]bool

ActionsMap returns a map of all the available actions

func ChartRanges

func ChartRanges() []string

ChartRanges returns list of chart ranges available

func ChartRangesMap

func ChartRangesMap() map[string]time.Duration

ChartRangesMap returns map of chart range time ranges

func Clean

func Clean(config *CleanConfig) error

Clean removes cache files

func ColorschemeHelpString added in v1.5.2

func ColorschemeHelpString() string

ColorschemeHelpString ...

func CurrencySymbol

func CurrencySymbol(currency string) string

CurrencySymbol returns the symbol for the currency name

func DefaultShortcuts

func DefaultShortcuts() map[string]string

DefaultShortcuts is a map of the default shortcuts

func GetBytes

func GetBytes(key interface{}) ([]byte, error)

GetBytes returns the interface in bytes form

func HexToAnsi

func HexToAnsi(h string) (uint8, bool)

HexToAnsi converts a hex color string to a uint8 ansi code

func PrintBitcoinDominance added in v1.5.2

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 PrintVersion

func PrintVersion()

PrintVersion prints the version

func Reset

func Reset(config *ResetConfig) error

Reset removes configuration and cache files

func Slugify

func Slugify(s string) string

Slugify returns a slugified string

func TableColumnOrder

func TableColumnOrder() []string

TableColumnOrder returns the default order of the table columns

func Version

func Version() string

Version returns cointop version

Types

type APIKeys

type APIKeys struct {
	// contains filtered or unexported fields
}

APIKeys is api keys structure

type ChartView

type ChartView struct {
	*View
}

ChartView is structure for chart view

func NewChartView

func NewChartView() *ChartView

NewChartView returns a new chart view

type CleanConfig

type CleanConfig struct {
	Log      bool
	CacheDir string
}

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
	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 NewCointop

func NewCointop(config *Config) (*Cointop, error)

NewCointop initializes cointop

func (*Cointop) ActionExists

func (ct *Cointop) ActionExists(action string) bool

ActionExists returns true if action exists

func (*Cointop) ActiveViewName

func (ct *Cointop) ActiveViewName() string

ActiveViewName returns the name of the active view

func (*Cointop) AllCoins

func (ct *Cointop) AllCoins() []*Coin

AllCoins returns a slice of all the coins

func (*Cointop) CacheAllCoinsSlugMap

func (ct *Cointop) CacheAllCoinsSlugMap()

CacheAllCoinsSlugMap writes the coins map to the memory and disk cache

func (*Cointop) CacheKey

func (ct *Cointop) CacheKey(key string) string

CacheKey returns cached value given key

func (*Cointop) CancelSearch

func (ct *Cointop) CancelSearch() error

CancelSearch closes the search field

func (*Cointop) ChartPoints

func (ct *Cointop) ChartPoints(symbol string, name string) error

ChartPoints calculates the the chart points

func (*Cointop) ClampedWidth

func (ct *Cointop) ClampedWidth() int

ClampedWidth returns the clamped width

func (*Cointop) CoinBySymbol

func (ct *Cointop) CoinBySymbol(symbol string) *Coin

CoinBySymbol returns the coin struct given the symbol

func (*Cointop) CoinHoldings

func (ct *Cointop) CoinHoldings(coin *Coin) float64

CoinHoldings returns portfolio coin holdings

func (*Cointop) ConfigDirPath

func (ct *Cointop) ConfigDirPath() string

ConfigDirPath returns the config directory path

func (*Cointop) ConfigFilePath

func (ct *Cointop) ConfigFilePath() string

ConfigFilePath return the config file path

func (*Cointop) CreateConfigIfNotExists

func (ct *Cointop) CreateConfigIfNotExists() error

CreateConfigIfNotExists creates config file if it doesn't exist

func (*Cointop) CurrencySymbol

func (ct *Cointop) CurrencySymbol() string

CurrencySymbol returns the symbol for the currency conversion

func (*Cointop) CurrentDisplayPage

func (ct *Cointop) CurrentDisplayPage() int

CurrentDisplayPage returns the current page in human readable format

func (*Cointop) CurrentPage

func (ct *Cointop) CurrentPage() int

CurrentPage returns the current page

func (*Cointop) CursorDown

func (ct *Cointop) CursorDown() error

CursorDown moves the cursor one row down

func (*Cointop) CursorDownOrNextPage

func (ct *Cointop) CursorDownOrNextPage() error

CursorDownOrNextPage moves the cursor down one row or goes to the next page if cursor is on the last row

func (*Cointop) CursorUp

func (ct *Cointop) CursorUp() error

CursorUp moves the cursor one row up

func (*Cointop) CursorUpOrPreviousPage

func (ct *Cointop) CursorUpOrPreviousPage() error

CursorUpOrPreviousPage moves the cursor up one row or goes to the previous page if cursor is on the first row

func (*Cointop) DoSearch

func (ct *Cointop) DoSearch() error

DoSearch triggers the search and sets views

func (*Cointop) EnlargeChart

func (ct *Cointop) EnlargeChart() error

EnlargeChart increases the chart height by one row

func (*Cointop) Exit

func (ct *Cointop) Exit()

Exit safely exits the program

func (*Cointop) FirstChartRange

func (ct *Cointop) FirstChartRange() error

FirstChartRange sets the chart to the first range option

func (*Cointop) FirstPage

func (ct *Cointop) FirstPage() error

FirstPage navigates to the first page

func (*Cointop) GetFavoritesSlice

func (ct *Cointop) GetFavoritesSlice() []*Coin

GetFavoritesSlice returns coin favorites as slice

func (*Cointop) GetListCount

func (ct *Cointop) GetListCount() int

GetListCount returns count of coins list

func (*Cointop) GetPortfolioSlice

func (ct *Cointop) GetPortfolioSlice() []*Coin

GetPortfolioSlice returns portfolio entries as a slice

func (*Cointop) GetPortfolioTotal

func (ct *Cointop) GetPortfolioTotal() float64

GetPortfolioTotal returns the total balance of portfolio entries

func (*Cointop) GetSortColIndex

func (ct *Cointop) GetSortColIndex() int

GetSortColIndex gets the sort column index

func (*Cointop) GetTableCoinsSlice

func (ct *Cointop) GetTableCoinsSlice() []*Coin

GetTableCoinsSlice returns a slice of the table rows

func (*Cointop) GoToGlobalIndex

func (ct *Cointop) GoToGlobalIndex(idx int) error

GoToGlobalIndex navigates to the selected row index of all page rows

func (*Cointop) GoToPageRowIndex

func (ct *Cointop) GoToPageRowIndex(idx int) error

GoToPageRowIndex navigates to the selected row index of the page

func (*Cointop) HideConvertMenu

func (ct *Cointop) HideConvertMenu() error

HideConvertMenu hides the convert menu view

func (*Cointop) HideHelp

func (ct *Cointop) HideHelp() error

HideHelp hides the help view

func (*Cointop) HidePortfolioUpdateMenu

func (ct *Cointop) HidePortfolioUpdateMenu() error

HidePortfolioUpdateMenu hides the portfolio update menu

func (*Cointop) HighlightRow

func (ct *Cointop) HighlightRow(idx int) error

HighlightRow highlights the row at index

func (*Cointop) HighlightedPageRowIndex

func (ct *Cointop) HighlightedPageRowIndex() int

HighlightedPageRowIndex returns the index of page row of the highlighted row

func (*Cointop) HighlightedRowCoin

func (ct *Cointop) HighlightedRowCoin() *Coin

HighlightedRowCoin returns the coin at the index of the highlighted row

func (*Cointop) HighlightedRowIndex

func (ct *Cointop) HighlightedRowIndex() int

HighlightedRowIndex returns the index of the highlighted row

func (*Cointop) IsFirstPage

func (ct *Cointop) IsFirstPage() bool

IsFirstPage returns true if cursor is on the first page

func (*Cointop) IsFirstRow

func (ct *Cointop) IsFirstRow() bool

IsFirstRow returns true if cursor is on first row

func (*Cointop) IsLastPage

func (ct *Cointop) IsLastPage() bool

IsLastPage returns true if cursor is on the last page

func (*Cointop) IsLastRow

func (ct *Cointop) IsLastRow() bool

IsLastRow returns true if cursor is on last row

func (*Cointop) IsPageFirstLine

func (ct *Cointop) IsPageFirstLine() bool

IsPageFirstLine returns true if the cursor is on the visible first row

func (*Cointop) IsPageLastLine

func (ct *Cointop) IsPageLastLine() bool

IsPageLastLine returns true if the cursor is on the visible last row

func (*Cointop) IsPageMiddleLine

func (ct *Cointop) IsPageMiddleLine() bool

IsPageMiddleLine returns true if the cursor is on the visible middle row

func (*Cointop) IsRunning added in v1.5.2

func (ct *Cointop) IsRunning() bool

IsRunning returns true if cointop is running

func (*Cointop) Keybindings

func (ct *Cointop) Keybindings(g *gocui.Gui) error

Keybindings sets keyboard shortcut key bindings

func (*Cointop) Keyfn

func (ct *Cointop) Keyfn(fn func() error) func(g *gocui.Gui, v *gocui.View) error

Keyfn returns the keybinding function as a wrapped gocui view function

func (*Cointop) LastChartRange

func (ct *Cointop) LastChartRange() error

LastChartRange sets the chart to the last range option

func (*Cointop) LastPage

func (ct *Cointop) LastPage() error

LastPage navigates to the last page

func (*Cointop) NavigateFirstLine

func (ct *Cointop) NavigateFirstLine() error

NavigateFirstLine moves the cursor to the first row of the table

func (*Cointop) NavigateLastLine

func (ct *Cointop) NavigateLastLine() error

NavigateLastLine moves the cursor to the last row of the table

func (*Cointop) NavigatePageFirstLine

func (ct *Cointop) NavigatePageFirstLine() error

NavigatePageFirstLine moves the cursor to the visible first row of the table

func (*Cointop) NavigatePageMiddleLine

func (ct *Cointop) NavigatePageMiddleLine() error

NavigatePageMiddleLine moves the cursor to the visible middle row of the table

func (*Cointop) NextChartRange

func (ct *Cointop) NextChartRange() error

NextChartRange sets the chart to the next range option

func (*Cointop) NextPage

func (ct *Cointop) NextPage() error

NextPage navigates to the next page

func (*Cointop) Noop

func (ct *Cointop) Noop() error

Noop is a no-operation function

func (ct *Cointop) OpenLink() error

OpenLink opens the url in a browser

func (*Cointop) PageDown

func (ct *Cointop) PageDown() error

PageDown moves the cursor one page down

func (*Cointop) PageUp

func (ct *Cointop) PageUp() error

PageUp moves the cursor one page up

func (*Cointop) ParseKeys

func (ct *Cointop) ParseKeys(s string) (interface{}, gocui.Modifier)

ParseKeys returns string keyboard key as gocui key type

func (*Cointop) PortfolioChart

func (ct *Cointop) PortfolioChart() error

PortfolioChart renders the portfolio chart

func (*Cointop) PortfolioEntriesCount

func (ct *Cointop) PortfolioEntriesCount() int

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

func (ct *Cointop) PortfolioEntryExists(c *Coin) bool

PortfolioEntryExists returns true if portfolio entry exists

func (*Cointop) PrevChartRange

func (ct *Cointop) PrevChartRange() error

PrevChartRange sets the chart to the prevous range option

func (*Cointop) PrevPage

func (ct *Cointop) PrevPage() error

PrevPage navigates to the previous page

func (*Cointop) PrevPageTop

func (ct *Cointop) PrevPageTop() error

PrevPageTop navigates to the first row of the previous page

func (*Cointop) PrintHoldingsTable added in v1.5.2

func (ct *Cointop) PrintHoldingsTable(options *TablePrintOptions) error

PrintHoldingsTable prints the holdings in an ASCII table

func (*Cointop) PrintTotalHoldings added in v1.5.2

func (ct *Cointop) PrintTotalHoldings(options *TablePrintOptions) error

PrintTotalHoldings prints the total holdings amount

func (*Cointop) Quit

func (ct *Cointop) Quit() error

Quit quites the program

func (*Cointop) QuitView

func (ct *Cointop) QuitView() error

QuitView exists the current view

func (*Cointop) ReadAPIKeyFromStdin

func (ct *Cointop) ReadAPIKeyFromStdin(name string) (string, error)

ReadAPIKeyFromStdin reads the user inputed API from the stdin prompt

func (*Cointop) Refresh

func (ct *Cointop) Refresh() error

Refresh triggers a force refresh of coin data

func (*Cointop) RefreshAll

func (ct *Cointop) RefreshAll() error

RefreshAll triggers a force refresh of all data

func (*Cointop) RefreshPortfolioCoins added in v1.5.2

func (ct *Cointop) RefreshPortfolioCoins() error

RefreshPortfolioCoins refreshes portfolio entry coin data

func (ct *Cointop) RefreshRowLink() error

RefreshRowLink updates the row link in the statusbar

func (*Cointop) RefreshTable

func (ct *Cointop) RefreshTable() error

RefreshTable refreshes the table

func (*Cointop) RemovePortfolioEntry

func (ct *Cointop) RemovePortfolioEntry(coin string)

RemovePortfolioEntry removes a portfolio entry

func (*Cointop) RowChanged

func (ct *Cointop) RowChanged()

RowChanged is called when the row is updated

func (ct *Cointop) RowLink() string

RowLink returns the row url link

func (*Cointop) RowLinkShort

func (ct *Cointop) RowLinkShort() string

RowLinkShort returns a shortened version of the row url link

func (*Cointop) Run

func (ct *Cointop) Run() error

Run runs cointop

func (*Cointop) Save

func (ct *Cointop) Save() error

Save saves the cointop settings to the config file

func (*Cointop) SaveConfig

func (ct *Cointop) SaveConfig() error

SaveConfig writes settings to the config file

func (*Cointop) Search

func (ct *Cointop) Search(q string) error

Search performs the search and filtering

func (*Cointop) SelectedCoinName

func (ct *Cointop) SelectedCoinName() string

SelectedCoinName returns the selected coin name

func (*Cointop) SelectedCoinSymbol

func (ct *Cointop) SelectedCoinSymbol() string

SelectedCoinSymbol returns the selected coin symbol

func (*Cointop) SetActiveView

func (ct *Cointop) SetActiveView(v string) error

SetActiveView sets the active view

func (*Cointop) SetCurrencyConverstionFn

func (ct *Cointop) SetCurrencyConverstionFn(convert string) func() error

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) SetPage

func (ct *Cointop) SetPage(page int) int

SetPage navigates to the selected page

func (*Cointop) SetPortfolioEntry

func (ct *Cointop) SetPortfolioEntry(coin string, holdings float64) error

SetPortfolioEntry sets a portfolio entry

func (*Cointop) SetPortfolioHoldings

func (ct *Cointop) SetPortfolioHoldings() error

SetPortfolioHoldings sets portfolio entry holdings from inputed value

func (*Cointop) SetSavingStatus

func (ct *Cointop) SetSavingStatus()

SetSavingStatus sets the saving indicator in the statusbar

func (*Cointop) SetViewOnBottom

func (ct *Cointop) SetViewOnBottom(v string) error

SetViewOnBottom sets the view to the bottom layer

func (*Cointop) SetupConfig

func (ct *Cointop) SetupConfig() error

SetupConfig loads config file

func (*Cointop) ShortenChart

func (ct *Cointop) ShortenChart() error

ShortenChart decreases the chart height by one row

func (*Cointop) ShowChartLoader

func (ct *Cointop) ShowChartLoader() error

ShowChartLoader shows chart loading indicator

func (*Cointop) ShowConvertMenu

func (ct *Cointop) ShowConvertMenu() error

ShowConvertMenu shows the convert menu view

func (*Cointop) ShowHelp

func (ct *Cointop) ShowHelp() error

ShowHelp shows the help view

func (*Cointop) ShowPortfolioUpdateMenu

func (ct *Cointop) ShowPortfolioUpdateMenu() error

ShowPortfolioUpdateMenu shows the portfolio update menu

func (*Cointop) Sort

func (ct *Cointop) Sort(sortBy string, desc bool, list []*Coin, renderHeaders bool)

Sort sorts the list of coins

func (*Cointop) SortAsc

func (ct *Cointop) SortAsc() error

SortAsc sorts list of coins in ascending order

func (*Cointop) SortDesc

func (ct *Cointop) SortDesc() error

SortDesc sorts list of coins in descending order

func (*Cointop) SortNextCol

func (ct *Cointop) SortNextCol() error

SortNextCol sorts the next column

func (*Cointop) SortPrevCol

func (ct *Cointop) SortPrevCol() error

SortPrevCol sorts the previous column

func (*Cointop) SortToggle

func (ct *Cointop) SortToggle(sortBy string, desc bool) error

SortToggle toggles the sort order

func (*Cointop) SortedSupportedCurrencyConversions

func (ct *Cointop) SortedSupportedCurrencyConversions() []string

SortedSupportedCurrencyConversions returns sorted list of supported currencies for conversion

func (*Cointop) Sortfn

func (ct *Cointop) Sortfn(sortBy string, desc bool) func(g *gocui.Gui, v *gocui.View) error

Sortfn returns the sort function as a wrapped gocui keybinding function

func (*Cointop) SupportedCryptoCurrencyConversions

func (ct *Cointop) SupportedCryptoCurrencyConversions() map[string]string

SupportedCryptoCurrencyConversions returns map of supported cryptocurrencies for conversion

func (*Cointop) SupportedCurrencyConversions

func (ct *Cointop) SupportedCurrencyConversions() map[string]string

SupportedCurrencyConversions returns a map of all supported currencies for conversion

func (*Cointop) SupportedFiatCurrencyConversions

func (ct *Cointop) SupportedFiatCurrencyConversions() map[string]string

SupportedFiatCurrencyConversions returns map of supported fiat currencies for conversion

func (*Cointop) ToggleCoinChart

func (ct *Cointop) ToggleCoinChart() error

ToggleCoinChart toggles between the global chart and the coin chart

func (*Cointop) ToggleConvertMenu

func (ct *Cointop) ToggleConvertMenu() error

ToggleConvertMenu toggles the convert menu view

func (*Cointop) ToggleFavorite

func (ct *Cointop) ToggleFavorite() error

ToggleFavorite toggles coin as favorite

func (*Cointop) ToggleHelp

func (ct *Cointop) ToggleHelp() error

ToggleHelp toggles the help view

func (*Cointop) TogglePortfolio

func (ct *Cointop) TogglePortfolio() error

TogglePortfolio toggles the portfolio view

func (*Cointop) TogglePortfolioUpdateMenu

func (ct *Cointop) TogglePortfolioUpdateMenu() error

TogglePortfolioUpdateMenu toggles the portfolio update menu

func (*Cointop) ToggleShowFavorites

func (ct *Cointop) ToggleShowFavorites() error

ToggleShowFavorites toggles the favorites view

func (*Cointop) ToggleShowPortfolio

func (ct *Cointop) ToggleShowPortfolio() error

ToggleShowPortfolio shows the portfolio view

func (*Cointop) ToggleTableFullscreen

func (ct *Cointop) ToggleTableFullscreen() error

ToggleTableFullscreen toggles the table fullscreen mode

func (*Cointop) TotalPages

func (ct *Cointop) TotalPages() int

TotalPages returns the number of total pages

func (*Cointop) TotalPagesDisplay

func (ct *Cointop) TotalPagesDisplay() int

TotalPagesDisplay returns the number of total pages in human readable format

func (*Cointop) TotalPerPage

func (ct *Cointop) TotalPerPage() int

TotalPerPage returns the number max rows per page

func (*Cointop) Update

func (ct *Cointop) Update(f func() error)

Update takes a callback which updates the view

func (*Cointop) UpdateChart

func (ct *Cointop) UpdateChart() error

UpdateChart updates the chart view

func (*Cointop) UpdateCoins

func (ct *Cointop) UpdateCoins() error

UpdateCoins updates coins view

func (*Cointop) UpdateConvertMenu

func (ct *Cointop) UpdateConvertMenu()

UpdateConvertMenu updates the convert menu

func (*Cointop) UpdateHelp

func (ct *Cointop) UpdateHelp()

UpdateHelp updates the help views

func (*Cointop) UpdateMarketbar

func (ct *Cointop) UpdateMarketbar() error

UpdateMarketbar updates the market bar view

func (*Cointop) UpdatePortfolioUpdateMenu

func (ct *Cointop) UpdatePortfolioUpdateMenu()

UpdatePortfolioUpdateMenu updates the portfolio update menu view

func (*Cointop) UpdateStatusbar

func (ct *Cointop) UpdateStatusbar(s string) error

UpdateStatusbar updates the statusbar view

func (*Cointop) UpdateTable

func (ct *Cointop) UpdateTable() error

UpdateTable updates the table

func (*Cointop) UpdateTableHeader

func (ct *Cointop) UpdateTableHeader()

UpdateTableHeader renders the table header

func (*Cointop) Version

func (ct *Cointop) Version() string

Version returns the cointop version

type Colorscheme

type Colorscheme struct {
	// contains filtered or unexported fields
}

Colorscheme is the struct for colorscheme

func NewColorscheme

func NewColorscheme(colors colorschemeColors) *Colorscheme

NewColorscheme ...

func (*Colorscheme) BaseBg

func (c *Colorscheme) BaseBg() gocui.Attribute

BaseBg ...

func (*Colorscheme) BaseFg

func (c *Colorscheme) BaseFg() gocui.Attribute

BaseFg ...

func (*Colorscheme) Chart

func (c *Colorscheme) Chart(a ...interface{}) string

Chart ...

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) Menu

func (c *Colorscheme) Menu(a ...interface{}) string

Menu ...

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) SetViewActiveColor

func (c *Colorscheme) SetViewActiveColor(view *gocui.View, name string)

SetViewActiveColor ...

func (*Colorscheme) SetViewColor

func (c *Colorscheme) SetViewColor(view *gocui.View, name string)

SetViewColor ...

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) TableRow

func (c *Colorscheme) TableRow(a ...interface{}) string

TableRow ...

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
	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 ConvertMenuView

type ConvertMenuView struct {
	*View
}

ConvertMenuView is structure for convert menu view

func NewConvertMenuView

func NewConvertMenuView() *ConvertMenuView

NewConvertMenuView returns a new convert menu view

type DominanceConfig added in v1.5.2

type DominanceConfig struct {
	Currency  string
	APIChoice string
}

DominanceConfig is the config options for the dominance command

type HelpView

type HelpView struct {
	*View
}

HelpView is structure for help view

func NewHelpView

func NewHelpView() *HelpView

NewHelpView returns a new help view

type ISprintf

type ISprintf func(...interface{}) string

ISprintf is a sprintf interface

type IView

type IView interface {
	Backing() *gocui.View
	SetBacking(gocuiView *gocui.View)
	Name() string
}

IView is a cointop view

type InputView

type InputView struct {
	*View
}

InputView is structure for help view

func NewInputView

func NewInputView() *InputView

NewInputView returns a new help view

type MarketbarView

type MarketbarView struct {
	*View
}

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

type PortfolioEntry struct {
	Coin     string
	Holdings float64
}

PortfolioEntry is portfolio entry

type PortfolioUpdateMenuView

type PortfolioUpdateMenuView struct {
	*View
}

PortfolioUpdateMenuView is structure for portfolio update menu view

func NewPortfolioUpdateMenuView

func NewPortfolioUpdateMenuView() *PortfolioUpdateMenuView

NewPortfolioUpdateMenuView returns a new portfolio update menu view

type PriceConfig

type PriceConfig struct {
	Coin      string
	Currency  string
	APIChoice string
}

PriceConfig is the config options for the price command

type ResetConfig

type ResetConfig struct {
	Log      bool
	CacheDir string
}

ResetConfig is the config for the reset function

type SearchFieldView

type SearchFieldView struct {
	*View
}

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

type StatusbarView struct {
	*View
}

StatusbarView is structure for statusbar view

func NewStatusbarView

func NewStatusbarView() *StatusbarView

NewStatusbarView returns a new statusbar view

func (*StatusbarView) Update

func (statusbar *StatusbarView) Update(str string) error

Update updates the content of the statusbar

type TableHeaderView

type TableHeaderView struct {
	*View
}

TableHeaderView is structure for table header view

func NewTableHeaderView

func NewTableHeaderView() *TableHeaderView

NewTableHeaderView returns a new table header view

type TablePrintOptions added in v1.5.2

type TablePrintOptions struct {
	SortBy        string
	SortDesc      bool
	HumanReadable bool
	Format        string
	Filter        []string
}

TablePrintOptions are options for ascii table output.

type TableView

type TableView struct {
	*View
}

TableView is structure for table view

func NewTableView

func NewTableView() *TableView

NewTableView returns a new table view

type View

type View struct {
	// contains filtered or unexported fields
}

View is a cointop view

func NewView

func NewView(name string) *View

NewView creates a new view

func (*View) Backing

func (view *View) Backing() *gocui.View

Backing returns the backing gocui view

func (*View) Height

func (view *View) Height() int

Height returns the view height

func (*View) Name

func (view *View) Name() string

Name returns the view's name

func (*View) SetBacking

func (view *View) SetBacking(gocuiView *gocui.View)

SetBacking sets the backing gocui view

func (*View) Width

func (view *View) Width() int

Width returns the view width

type Views

type Views struct {
	Chart               *ChartView
	Table               *TableView
	TableHeader         *TableHeaderView
	Marketbar           *MarketbarView
	SearchField         *SearchFieldView
	Statusbar           *StatusbarView
	Help                *HelpView
	ConvertMenu         *ConvertMenuView
	Input               *InputView
	PortfolioUpdateMenu *PortfolioUpdateMenuView
}

Views are all views in cointop

Directories

Path Synopsis
api
coingecko/v3
Package coingecko is forked from https://github.com/superoo7/go-gecko
Package coingecko is forked from https://github.com/superoo7/go-gecko
common
api
gizak/termui
Package termui is a library designed for creating command line UI.
Package termui is a library designed for creating command line UI.
pad

Jump to

Keyboard shortcuts

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