Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .Jules/palette.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@
## 2025-02-28 - Structured CLI Reports
**Learning:** Dense numerical data in CLI output is hard to parse. Using ASCII box-drawing characters and alignment to create a "dashboard" or "invoice" style summary significantly improves readability and perceived quality.
**Action:** When summarizing simulation or batch job results, always format the final report as a structured table or box rather than a list of print statements.

## 2025-03-05 - CLI Progress Indicators
**Learning:** Running long CLI simulations with `--quiet` leads to confusing silence before the final output. Users might think the program froze. Using `\r` (carriage return) for a text-based progress bar, conditionally rendered if `sys.stdout.isatty()`, provides necessary visibility without cluttering standard output logs or CI/CD systems.
**Action:** Always add dynamic text-based progress indicators (`\r` loops) for long operations in CLI tools that suppress verbose logging. Check `sys.stdout.isatty()` to prevent log pollution.
22 changes: 0 additions & 22 deletions .github/workflows/rust.yml

This file was deleted.

93 changes: 0 additions & 93 deletions .github/workflows/terraform.yml

This file was deleted.

15 changes: 13 additions & 2 deletions bitcoin_trading_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,21 +94,32 @@ def simulate_trading(signals, initial_cash=10000, quiet=False):
btc_to_buy = portfolio.loc[i, 'cash'] / row['price']
portfolio.loc[i, 'btc'] += btc_to_buy
portfolio.loc[i, 'cash'] -= btc_to_buy * row['price']
print(f"{Colors.GREEN}🟢 Day {i}: Buy {btc_to_buy:.4f} BTC at ${row['price']:.2f}{Colors.ENDC}")
if not quiet:
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:
if portfolio.loc[i, 'btc'] > 0:
cash_received = portfolio.loc[i, 'btc'] * row['price']
portfolio.loc[i, 'cash'] += cash_received
print(f"{Colors.FAIL}🔴 Day {i}: Sell {portfolio.loc[i, 'btc']:.4f} BTC at ${row['price']:.2f}{Colors.ENDC}")
if not quiet:
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}")
elif sys.stdout.isatty():
progress = (signals.index.get_loc(i) + 1) / len(signals)
bar_length = 30
filled_length = int(bar_length * progress)
bar = 'â–ˆ' * filled_length + '-' * (bar_length - filled_length)
print(f"\r{Colors.CYAN}Simulating: |{bar}| {progress:.1%}{Colors.ENDC}", end='', flush=True)

if quiet and sys.stdout.isatty():
print()

return portfolio

Expand Down