diff --git a/.Jules/palette.md b/.Jules/palette.md index 8ee612f..891d0dc 100644 --- a/.Jules/palette.md +++ b/.Jules/palette.md @@ -12,3 +12,7 @@ ## 2025-03-23 - Game Key Scrolling **Learning:** Browsers natively scroll the page when users press Space or Arrow keys. When building a web-based game, this creates a frustrating UX where the game viewport jumps around while playing. **Action:** Always call `e.preventDefault()` on keydown events for typical game controls ("Space", "ArrowUp", etc.) when the focus is on a game container or the body. + +## 2025-03-23 - Cognitive Load in CLI Financial Outputs +**Learning:** Large numbers without thousands separators in CLI outputs significantly increase cognitive load and reduce readability for users. +**Action:** Always use thousands separators (e.g., `:,2f`) when formatting large financial or numerical values in console output to improve accessibility and parsing speed. diff --git a/bitcoin_trading_simulation.py b/bitcoin_trading_simulation.py index 0d46e73..7e9b423 100644 --- a/bitcoin_trading_simulation.py +++ b/bitcoin_trading_simulation.py @@ -102,7 +102,7 @@ def simulate_trading(signals, initial_cash=10000, quiet=False): portfolio.loc[i, 'btc'] += btc_to_buy portfolio.loc[i, 'cash'] -= btc_to_buy * row['price'] if not quiet: - print(f"{Colors.GREEN}🟢 Day {i}: Buy {btc_to_buy:.4f} BTC at ${row['price']:.2f}{Colors.ENDC}") + print(f"{Colors.GREEN}🟢 Day {i}: Buy {btc_to_buy:,.4f} BTC at ${row['price']:,.2f}{Colors.ENDC}") # Sell signal elif row['positions'] == -2.0: @@ -110,14 +110,14 @@ def simulate_trading(signals, initial_cash=10000, quiet=False): cash_received = portfolio.loc[i, 'btc'] * row['price'] portfolio.loc[i, 'cash'] += cash_received if not quiet: - print(f"{Colors.FAIL}🔴 Day {i}: Sell {portfolio.loc[i, 'btc']:.4f} BTC at ${row['price']:.2f}{Colors.ENDC}") + print(f"{Colors.FAIL}🔴 Day {i}: Sell {portfolio.loc[i, 'btc']:,.4f} BTC at ${row['price']:,.2f}{Colors.ENDC}") portfolio.loc[i, 'btc'] = 0 portfolio.loc[i, 'total_value'] = portfolio.loc[i, 'cash'] + portfolio.loc[i, 'btc'] * row['price'] if not quiet: - print(f"Day {i}: Portfolio Value: ${portfolio.loc[i, 'total_value']:.2f}, " - f"Cash: ${portfolio.loc[i, 'cash']:.2f}, BTC: {portfolio.loc[i, 'btc']:.4f}") + print(f"Day {i}: Portfolio Value: ${portfolio.loc[i, 'total_value']:,.2f}, " + f"Cash: ${portfolio.loc[i, 'cash']:,.2f}, BTC: {portfolio.loc[i, 'btc']:,.4f}") if quiet and sys.stdout.isatty(): print() diff --git a/requirements.txt b/requirements.txt index cfaa995..4ad1501 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,3 @@ numpy pandas requests -venv