Documentation
¶
Index ¶
- func ConnCmd(connected bool) tea.Cmd
- func LiqMsgFrom(l liquidation.Liq) tea.Msg
- func RenderFooter(s Styles, pairCount int, connected bool, termWidth int, btcPrice float64, ...) string
- func RenderHeader(s Styles, termWidth int, sortCol SortCol, sortAsc bool) string
- func RenderRow(s Styles, rank int, t ticker.Ticker, termWidth int, isCursor bool, ...) string
- func RenderSeparator(s Styles, termWidth int) string
- func TickerMsgFrom(t ticker.Ticker) tea.Msg
- type CryptoView
- func (c *CryptoView) BtcPrice() float64
- func (c *CryptoView) CapturesInput() bool
- func (c *CryptoView) Connected() bool
- func (c *CryptoView) CursorPos() int
- func (c *CryptoView) FilterMode() FilterMode
- func (c *CryptoView) Focused() bool
- func (c *CryptoView) FundingRate(symbol string) funding.Info
- func (c *CryptoView) GoToSymbol(sym string) bool
- func (c *CryptoView) Init() tea.Cmd
- func (c *CryptoView) IsSearching() bool
- func (c *CryptoView) KeyBindings() []tuikit.KeyBind
- func (c *CryptoView) PairCount() int
- func (c *CryptoView) PriceHistory(symbol string) []float64
- func (c *CryptoView) ReapplyConfig()
- func (c *CryptoView) SearchQuery() string
- func (c *CryptoView) SelectedTicker() (ticker.Ticker, bool)
- func (c *CryptoView) SetFilter(mode string) bool
- func (c *CryptoView) SetFocused(f bool)
- func (c *CryptoView) SetSize(w, h int)
- func (c *CryptoView) SetSort(col string) bool
- func (c *CryptoView) Update(msg tea.Msg) (tuikit.Component, tea.Cmd)
- func (c *CryptoView) View() string
- func (c *CryptoView) VisibleCount() int
- type FearGreedData
- type FilterMode
- type MarketPanel
- func (p *MarketPanel) Focused() bool
- func (p *MarketPanel) Init() tea.Cmd
- func (p *MarketPanel) KeyBindings() []tuikit.KeyBind
- func (p *MarketPanel) SetFearGreed(fg FearGreedData)
- func (p *MarketPanel) SetFocused(f bool)
- func (p *MarketPanel) SetFundingRates(fr map[string]funding.Info)
- func (p *MarketPanel) SetMarketStats(ms MarketStats)
- func (p *MarketPanel) SetRecentLiqs(liqs []liquidation.Liq)
- func (p *MarketPanel) SetSize(w, h int)
- func (p *MarketPanel) SetStyles(s Styles)
- func (p *MarketPanel) SetTickers(t map[string]ticker.Ticker)
- func (p *MarketPanel) Update(msg tea.Msg) (tuikit.Component, tea.Cmd)
- func (p *MarketPanel) View() string
- type MarketStats
- type SortCol
- type Styles
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LiqMsgFrom ¶ added in v0.3.0
func LiqMsgFrom(l liquidation.Liq) tea.Msg
LiqMsgFrom converts a liquidation.Liq into a liqMsg.
func RenderFooter ¶
func RenderFooter(s Styles, pairCount int, connected bool, termWidth int, btcPrice float64, filter FilterMode, searching bool, searchQuery string, cursorPos int, totalRows int) string
RenderFooter renders the bottom status bar.
func RenderHeader ¶
RenderHeader returns the column header row.
func RenderRow ¶
func RenderRow(s Styles, rank int, t ticker.Ticker, termWidth int, isCursor bool, sparkData []float64, starred bool, liqFlashing bool, corr float64) string
RenderRow renders a single ticker row.
func RenderSeparator ¶
RenderSeparator returns a full-width separator line.
Types ¶
type CryptoView ¶ added in v0.5.0
type CryptoView struct {
Cfg *config.Config
Watchlist *watchlist.Watchlist
Panel *MarketPanel
// contains filtered or unexported fields
}
CryptoView is the main crypto dashboard component. Implements tuikit.Component.
func NewCryptoView ¶ added in v0.5.0
func NewCryptoView(initial []ticker.Ticker, cfg *config.Config) *CryptoView
NewCryptoView creates a CryptoView pre-populated with initial ticker data.
func (*CryptoView) BtcPrice ¶ added in v0.6.1
func (c *CryptoView) BtcPrice() float64
BtcPrice returns the current BTC price.
func (*CryptoView) CapturesInput ¶ added in v0.6.1
func (c *CryptoView) CapturesInput() bool
func (*CryptoView) Connected ¶ added in v0.6.1
func (c *CryptoView) Connected() bool
Connected returns the current connection state.
func (*CryptoView) CursorPos ¶ added in v0.6.1
func (c *CryptoView) CursorPos() int
CursorPos returns the current cursor position.
func (*CryptoView) FilterMode ¶ added in v0.6.1
func (c *CryptoView) FilterMode() FilterMode
FilterMode returns the current filter mode.
func (*CryptoView) Focused ¶ added in v0.5.0
func (c *CryptoView) Focused() bool
func (*CryptoView) FundingRate ¶ added in v0.5.0
func (c *CryptoView) FundingRate(symbol string) funding.Info
FundingRate returns the funding info for a symbol.
func (*CryptoView) GoToSymbol ¶ added in v0.5.0
func (c *CryptoView) GoToSymbol(sym string) bool
GoToSymbol scrolls to a symbol in the sorted list. Returns true if found.
func (*CryptoView) Init ¶ added in v0.5.0
func (c *CryptoView) Init() tea.Cmd
func (*CryptoView) IsSearching ¶ added in v0.6.1
func (c *CryptoView) IsSearching() bool
IsSearching returns whether search mode is active.
func (*CryptoView) KeyBindings ¶ added in v0.5.0
func (c *CryptoView) KeyBindings() []tuikit.KeyBind
func (*CryptoView) PairCount ¶ added in v0.6.1
func (c *CryptoView) PairCount() int
PairCount returns the total number of tracked pairs.
func (*CryptoView) PriceHistory ¶ added in v0.5.0
func (c *CryptoView) PriceHistory(symbol string) []float64
PriceHistory returns the sparkline data for a symbol.
func (*CryptoView) ReapplyConfig ¶ added in v0.5.0
func (c *CryptoView) ReapplyConfig()
ReapplyConfig re-derives styles and state from the current config.
func (*CryptoView) SearchQuery ¶ added in v0.6.1
func (c *CryptoView) SearchQuery() string
SearchQuery returns the current search query.
func (*CryptoView) SelectedTicker ¶ added in v0.5.0
func (c *CryptoView) SelectedTicker() (ticker.Ticker, bool)
SelectedTicker returns the currently selected ticker, if any.
func (*CryptoView) SetFilter ¶ added in v0.5.0
func (c *CryptoView) SetFilter(mode string) bool
SetFilter changes the filter mode by name: all, gainers, losers.
func (*CryptoView) SetFocused ¶ added in v0.5.0
func (c *CryptoView) SetFocused(f bool)
func (*CryptoView) SetSize ¶ added in v0.5.0
func (c *CryptoView) SetSize(w, h int)
func (*CryptoView) SetSort ¶ added in v0.5.0
func (c *CryptoView) SetSort(col string) bool
SetSort changes the sort column by name: volume, price, change, symbol, correlation.
func (*CryptoView) View ¶ added in v0.5.0
func (c *CryptoView) View() string
View renders the full TUI frame as a string.
func (*CryptoView) VisibleCount ¶ added in v0.6.1
func (c *CryptoView) VisibleCount() int
VisibleCount returns the number of visible (filtered/sorted) rows.
type FearGreedData ¶ added in v0.6.1
FearGreedData holds the Fear & Greed index for display.
type FilterMode ¶
type FilterMode int
FilterMode controls which subset of tickers to display.
const ( FilterAll FilterMode = iota FilterGainers FilterLosers )
type MarketPanel ¶ added in v0.6.1
type MarketPanel struct {
// contains filtered or unexported fields
}
MarketPanel is the sidebar component showing market stats, funding, liquidations, and watchlist data. Implements tuikit.Component.
func NewMarketPanel ¶ added in v0.6.1
func NewMarketPanel(styles Styles) *MarketPanel
NewMarketPanel creates a MarketPanel with default state.
func (*MarketPanel) Focused ¶ added in v0.6.1
func (p *MarketPanel) Focused() bool
func (*MarketPanel) Init ¶ added in v0.6.1
func (p *MarketPanel) Init() tea.Cmd
func (*MarketPanel) KeyBindings ¶ added in v0.6.1
func (p *MarketPanel) KeyBindings() []tuikit.KeyBind
func (*MarketPanel) SetFearGreed ¶ added in v0.6.1
func (p *MarketPanel) SetFearGreed(fg FearGreedData)
SetFearGreed updates Fear & Greed index data.
func (*MarketPanel) SetFocused ¶ added in v0.6.1
func (p *MarketPanel) SetFocused(f bool)
func (*MarketPanel) SetFundingRates ¶ added in v0.6.1
func (p *MarketPanel) SetFundingRates(fr map[string]funding.Info)
SetFundingRates updates funding rate data.
func (*MarketPanel) SetMarketStats ¶ added in v0.6.1
func (p *MarketPanel) SetMarketStats(ms MarketStats)
SetMarketStats updates aggregate market stats.
func (*MarketPanel) SetRecentLiqs ¶ added in v0.6.1
func (p *MarketPanel) SetRecentLiqs(liqs []liquidation.Liq)
SetRecentLiqs updates recent liquidation events.
func (*MarketPanel) SetSize ¶ added in v0.6.1
func (p *MarketPanel) SetSize(w, h int)
func (*MarketPanel) SetStyles ¶ added in v0.6.1
func (p *MarketPanel) SetStyles(s Styles)
SetStyles updates the styles (e.g. after config change).
func (*MarketPanel) SetTickers ¶ added in v0.6.1
func (p *MarketPanel) SetTickers(t map[string]ticker.Ticker)
SetTickers updates the ticker map for reference price lookups.
func (*MarketPanel) View ¶ added in v0.6.1
func (p *MarketPanel) View() string
type MarketStats ¶ added in v0.2.0
type MarketStats struct {
TotalVolume float64
GainerCount int
LoserCount int
AvgChange float64
BtcDominance float64
TopGainers []ticker.Ticker
TopLosers []ticker.Ticker
VolSpikes []ticker.Ticker
Pinned []ticker.Ticker
}
MarketStats holds precomputed aggregate market data for the panel.
type Styles ¶
type Styles struct {
ColorGreen lipgloss.Color
ColorRed lipgloss.Color
ColorDim lipgloss.Color
ColorSep lipgloss.Color
ColorCursor lipgloss.Color
ColorStar lipgloss.Color
ColorFlashGreen lipgloss.Color
ColorFlashRed lipgloss.Color
Header lipgloss.Style
Positive lipgloss.Style
Negative lipgloss.Style
Neutral lipgloss.Style
FlashPositive lipgloss.Style
FlashNegative lipgloss.Style
CursorRow lipgloss.Style
Sep lipgloss.Style
Star lipgloss.Style
DotConnected lipgloss.Style
DotReconnecting lipgloss.Style
PanelBorder lipgloss.Style
PanelLabel lipgloss.Style
VolSpike lipgloss.Style
ColorVolSpike lipgloss.Color
LiqFlash lipgloss.Style
ColorLiq lipgloss.Color
}
Styles holds all computed lipgloss styles, derived from config.