Documentation
¶
Index ¶
- Variables
- func Confirm(message string) bool
- func CreateProgressBar(description string, total int64) *progressbar.ProgressBar
- func DisplayConfigSummary(strategy, exchange, pair, timeframe string)
- func DisplayDryRun(strategy, exchange, pair, timeframe string)
- func DisplayError(title, reason string, fixes []string)
- func DisplayOverrides(overrides map[string]string)
- func DisplayResults(results *BacktestResults)
- func Error(message string)
- func FormatPnL(value float64) string
- func GetAvailableThemes() []string
- func Info(message string)
- func LoadThemeFromPreferences() error
- func RegisterTheme(theme *Theme)
- func RenderProgressBar(percent float64, width int) string
- func SavePreferences(prefs *Preferences) error
- func Section(title string)
- func SelectFromList(prompt string, options []string) (string, error)
- func SetTheme(name string) error
- func ShowBanner()
- func ShowNextSteps(steps []string)
- func Success(message string)
- func TextInput(prompt string, defaultValue string) string
- func Warning(message string)
- type BacktestResults
- type BaseModel
- type ColorPalette
- type Preferences
- type Theme
Constants ¶
This section is empty.
Variables ¶
var ( // Primary colors ColorPrimary = lipgloss.Color("#00D9FF") // Cyan - primary brand color ColorSecondary = lipgloss.Color("#7C3AED") // Purple - secondary accents ColorSuccess = lipgloss.Color("#10B981") // Green - success states ColorWarning = lipgloss.Color("#F59E0B") // Orange - warning states ColorDanger = lipgloss.Color("#EF4444") // Red - danger/error states ColorMuted = lipgloss.Color("#6B7280") // Gray - muted text ColorText = lipgloss.Color("#D1D5DB") // Light gray - normal text ColorWhite = lipgloss.Color("#FFFFFF") // White - high contrast text // Background colors ColorBgDark = lipgloss.Color("#1F2937") ColorBgMedium = lipgloss.Color("#374151") ColorBgLight = lipgloss.Color("#4B5563") ColorBgSelected = lipgloss.Color("#1E293B") )
Color palette - centralized color definitions for the entire TUI. These colors define the visual identity of the WISP CLI.
var ( // TitleStyle is used for main view titles (e.g., "STRATEGIES", "SETTINGS") TitleStyle = lipgloss.NewStyle(). Foreground(ColorPrimary). Bold(true). Padding(1, 2). MarginBottom(1) // TitleCenteredStyle is used for centered titles in dialogs TitleCenteredStyle = lipgloss.NewStyle(). Foreground(ColorPrimary). Bold(true). PaddingTop(1). PaddingBottom(1). Align(lipgloss.Center) // SectionHeaderStyle is used for section headers within a view SectionHeaderStyle = lipgloss.NewStyle(). Foreground(ColorSecondary). Bold(true). PaddingTop(1) // SubtitleStyle is used for secondary text below titles SubtitleStyle = lipgloss.NewStyle(). Foreground(ColorMuted). Italic(true) // BoxStyle is the standard container box with primary border BoxStyle = lipgloss.NewStyle(). Border(lipgloss.RoundedBorder()). BorderForeground(ColorPrimary). Padding(1, 2). Width(70) // MenuBoxStyle is used for main menu and selection dialogs MenuBoxStyle = lipgloss.NewStyle(). Border(lipgloss.RoundedBorder()). BorderForeground(ColorSecondary). Padding(2, 4). Width(50) // DetailBoxStyle is used for detailed information displays DetailBoxStyle = lipgloss.NewStyle(). Border(lipgloss.RoundedBorder()). BorderForeground(ColorPrimary). Padding(1, 2). Width(68) // ErrorBoxStyle is used for error messages ErrorBoxStyle = lipgloss.NewStyle(). Foreground(ColorDanger). Bold(true). Border(lipgloss.RoundedBorder()). BorderForeground(ColorDanger). Padding(1, 2) // ConfirmBoxStyle is used for dangerous confirmation dialogs ConfirmBoxStyle = lipgloss.NewStyle(). Border(lipgloss.ThickBorder()). BorderForeground(ColorDanger). Padding(2, 4). Width(70) // ItemStyle is used for unselected list items ItemStyle = lipgloss.NewStyle(). PaddingLeft(2) // SelectedItemStyle is used for selected list items with cursor SelectedItemStyle = lipgloss.NewStyle(). Foreground(ColorPrimary). Bold(true). PaddingLeft(0) // StrategyItemStyle is used for strategy list items (legacy, consider using ItemStyle) StrategyItemStyle = lipgloss.NewStyle(). Padding(1, 2). MarginBottom(1). Border(lipgloss.RoundedBorder()). BorderForeground(ColorBgLight). Width(70) // StrategyItemSelectedStyle is used for selected strategy items StrategyItemSelectedStyle = lipgloss.NewStyle(). Padding(1, 2). MarginBottom(1). Border(lipgloss.RoundedBorder()). BorderForeground(ColorPrimary). Background(ColorBgSelected). Width(70) // StrategyNameStyle is used for strategy names StrategyNameStyle = lipgloss.NewStyle(). Foreground(ColorPrimary). Bold(true) // StrategyNameSelectedStyle is used for selected strategy names StrategyNameSelectedStyle = lipgloss.NewStyle(). Foreground(ColorSuccess). Bold(true) // StrategyDescStyle is used for strategy descriptions StrategyDescStyle = lipgloss.NewStyle(). Foreground(ColorMuted). Italic(true) // StrategyMetaStyle is used for strategy metadata StrategyMetaStyle = lipgloss.NewStyle(). Foreground(ColorSecondary). MarginTop(1) // LabelStyle is used for field labels in forms and details LabelStyle = lipgloss.NewStyle(). Foreground(ColorMuted). Width(15) // ValueStyle is used for field values ValueStyle = lipgloss.NewStyle(). Foreground(ColorPrimary). Bold(true) // DescriptionStyle is used for descriptive text DescriptionStyle = lipgloss.NewStyle(). Foreground(ColorMuted). PaddingLeft(4). Width(60) // CommandStyle is used for command names in help CommandStyle = lipgloss.NewStyle(). Foreground(ColorPrimary). Bold(true) // TextStyle is used for regular text content TextStyle = lipgloss.NewStyle(). Foreground(ColorText) // MutedStyle is used for de-emphasized text MutedStyle = lipgloss.NewStyle(). Foreground(ColorMuted). Italic(true) // StatusReadyStyle indicates a ready/enabled/success state StatusReadyStyle = lipgloss.NewStyle(). Foreground(ColorSuccess). Bold(true) // StatusRunningStyle indicates a running/active/warning state StatusRunningStyle = lipgloss.NewStyle(). Foreground(ColorWarning). Bold(true) // StatusDangerStyle indicates a danger/critical state StatusDangerStyle = lipgloss.NewStyle(). Foreground(ColorDanger). Bold(true) // StatusDisabledStyle indicates a disabled/inactive state StatusDisabledStyle = lipgloss.NewStyle(). Foreground(ColorMuted). Bold(true) // StatusErrorStyle is used for error messages StatusErrorStyle = lipgloss.NewStyle(). Foreground(ColorDanger). MarginTop(1) // NetworkBadgeStyle is used for network indicators (mainnet/testnet) NetworkBadgeStyle = lipgloss.NewStyle(). Foreground(ColorSecondary) // NetworkBadgeWarningStyle is used for testnet badges NetworkBadgeWarningStyle = lipgloss.NewStyle(). Foreground(ColorWarning) // InputStyle is used for input fields and user text entry InputStyle = lipgloss.NewStyle(). Foreground(ColorSuccess). Bold(true) // HelpStyle is used for help text at bottom of views HelpStyle = lipgloss.NewStyle(). Foreground(ColorMuted). Padding(1, 2). MarginTop(1) // KeyHintStyle is used for keyboard shortcut hints KeyHintStyle = lipgloss.NewStyle(). Foreground(ColorPrimary). Bold(true) // ConfirmTitleStyle is used for confirmation dialog titles ConfirmTitleStyle = lipgloss.NewStyle(). Foreground(ColorDanger). Bold(true). Align(lipgloss.Center) // ConfirmFieldStyle is used for field names in confirmations ConfirmFieldStyle = lipgloss.NewStyle(). Foreground(ColorPrimary). Bold(true) // ConfirmValueStyle is used for values in confirmations ConfirmValueStyle = lipgloss.NewStyle(). Foreground(ColorWhite) // ConfirmWarningStyle is used for warning text in confirmations ConfirmWarningStyle = lipgloss.NewStyle(). Foreground(ColorWarning). Bold(true). Align(lipgloss.Center). MarginTop(1). MarginBottom(1) // PnLProfitStyle is used for positive profit values PnLProfitStyle = lipgloss.NewStyle(). Foreground(ColorSuccess). Bold(true) // PnLLossStyle is used for negative loss values PnLLossStyle = lipgloss.NewStyle(). Foreground(ColorDanger). Bold(true) // PnLNeutralStyle is used for zero PnL values PnLNeutralStyle = lipgloss.NewStyle(). Foreground(ColorMuted) )
Style definitions - reusable lipgloss styles for consistent UI components. All handlers should use these styles instead of creating inline styles.
Functions ¶
func CreateProgressBar ¶
func CreateProgressBar(description string, total int64) *progressbar.ProgressBar
CreateProgressBar creates a progress bar for backtest execution
func DisplayConfigSummary ¶
func DisplayConfigSummary(strategy, exchange, pair, timeframe string)
DisplayConfigSummary shows a summary of the configuration
func DisplayDryRun ¶
func DisplayDryRun(strategy, exchange, pair, timeframe string)
DisplayDryRun shows what would run in dry-run mode
func DisplayError ¶
DisplayError shows a formatted error with helpful hints
func DisplayOverrides ¶
DisplayOverrides shows config overrides
func DisplayResults ¶
func DisplayResults(results *BacktestResults)
DisplayResults shows backtest results in a beautiful table
func FormatPnL ¶
FormatPnL formats a profit/loss value with appropriate styling. Positive values are green, negative are red, zero is muted.
func GetAvailableThemes ¶
func GetAvailableThemes() []string
GetAvailableThemes returns list of theme names
func LoadThemeFromPreferences ¶
func LoadThemeFromPreferences() error
LoadThemeFromPreferences loads and applies the theme from saved preferences
func RegisterTheme ¶
func RegisterTheme(theme *Theme)
RegisterTheme adds a theme to the available themes
func RenderProgressBar ¶
RenderProgressBar creates a styled progress bar with the given percentage and width. Used for compilation progress, loading indicators, etc.
func SavePreferences ¶
func SavePreferences(prefs *Preferences) error
SavePreferences saves user preferences to disk
func SelectFromList ¶
SelectFromList shows an interactive list selection
func ShowNextSteps ¶
func ShowNextSteps(steps []string)
ShowNextSteps displays next steps after init
Types ¶
type BacktestResults ¶
type BacktestResults struct {
TotalPnL float64
WinRate float64
TotalTrades int
AvgTradePnL float64
SharpeRatio float64
MaxDrawdown float64
ProfitFactor float64
Duration time.Duration
ResultsFile string
}
BacktestResults represents the results of a backtest
type BaseModel ¶
type BaseModel struct {
// Set to true if this is a root-level view (launched from main menu)
IsRoot bool
}
BaseModel provides common keyboard handling for all views Embed this in your models to get consistent quit/back behavior
type ColorPalette ¶
type ColorPalette struct {
// Primary colors
Primary string // Main brand/accent color
Secondary string // Secondary accents
Success string // Success states (green)
Warning string // Warning states (orange)
Danger string // Error/danger states (red)
Muted string // De-emphasized text
Text string // Normal text
White string // High contrast text
// Background colors
BgDark string // Darkest background
BgMedium string // Medium background
BgLight string // Light background
BgSelected string // Selected item background
}
ColorPalette defines all semantic colors used in the UI
type Preferences ¶
type Preferences struct {
Theme string `yaml:"theme"`
}
Preferences stores user UI preferences
func LoadPreferences ¶
func LoadPreferences() (*Preferences, error)
LoadPreferences loads user preferences from disk
type Theme ¶
type Theme struct {
Name string
Description string
Colors ColorPalette
}
Theme represents a complete color palette for the TUI