From f5101353e417590e9c23e56293fce7a7429e9269 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Thu, 26 Feb 2026 13:19:12 +0000 Subject: [PATCH 1/2] fix: suppress trade logs in quiet mode and add progress bar - Suppressed Buy/Sell trade logs when `--quiet` is used, ensuring the output is truly quiet. - Added a text-based progress bar for interactive sessions in quiet mode, providing feedback for long simulations. - Added a reproduction test case `test_simulate_trading_quiet_mode_with_trades` to `test_bitcoin_trading.py`. - Updated `.Jules/palette.md` with UX learnings. Co-authored-by: EiJackGH <172181576+EiJackGH@users.noreply.github.com> --- .Jules/palette.md | 4 ++++ bitcoin_trading_simulation.py | 26 ++++++++++++++++++++++++-- test_bitcoin_trading.py | 14 ++++++++++++++ 3 files changed, 42 insertions(+), 2 deletions(-) diff --git a/.Jules/palette.md b/.Jules/palette.md index 96bd45d..bceea0f 100644 --- a/.Jules/palette.md +++ b/.Jules/palette.md @@ -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-05-15 - Quiet Mode Feedback +**Learning:** "Quiet" mode should not mean "silent hang". Users need reassurance that long-running processes are active. +**Action:** When using `--quiet`, suppress detailed logs but display a minimal progress bar or spinner if the session is interactive (`sys.stdout.isatty()`). diff --git a/bitcoin_trading_simulation.py b/bitcoin_trading_simulation.py index cb07d20..08baed7 100644 --- a/bitcoin_trading_simulation.py +++ b/bitcoin_trading_simulation.py @@ -94,14 +94,22 @@ 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 " + f"${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} " + f"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'] @@ -109,6 +117,20 @@ def simulate_trading(signals, initial_cash=10000, quiet=False): 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(): + total_days = len(signals) + percent = (i + 1) / total_days + bar_length = 30 + filled_length = int(bar_length * percent) + bar = '█' * filled_length + '-' * (bar_length - filled_length) + sys.stdout.write( + f'\r{Colors.CYAN}Simulating: [{bar}] {percent:.0%} ' + f'(Day {i+1}/{total_days}){Colors.ENDC}' + ) + sys.stdout.flush() + + if quiet and sys.stdout.isatty(): + sys.stdout.write('\n') return portfolio diff --git a/test_bitcoin_trading.py b/test_bitcoin_trading.py index 6c480ea..cc0265f 100644 --- a/test_bitcoin_trading.py +++ b/test_bitcoin_trading.py @@ -72,3 +72,17 @@ def test_simulation_integration(): assert 'total_value' in portfolio.columns assert 'btc' in portfolio.columns assert 'cash' in portfolio.columns + + +def test_simulate_trading_quiet_mode_with_trades(capsys): + """Test that quiet mode suppresses trade logs too.""" + signals = pd.DataFrame(index=range(2)) + signals['price'] = [100.0, 101.0] + # Force a buy signal + signals['positions'] = [2.0, 0.0] + + simulate_trading(signals, initial_cash=1000, quiet=True) + + captured = capsys.readouterr() + assert "Buy" not in captured.out + assert "Sell" not in captured.out From 0517bcf779212b6f41ea33dd192107b2feb5d11a Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Thu, 26 Feb 2026 13:21:41 +0000 Subject: [PATCH 2/2] fix(ci): remove incorrect Rust workflow from Python project The repository previously included a GitHub Action workflow for Rust (`rust.yml`) which attempted to run `cargo build`. Since this is a Python project and does not contain a `Cargo.toml`, the workflow consistently failed. This commit removes the erroneous workflow file to fix the CI pipeline. Co-authored-by: EiJackGH <172181576+EiJackGH@users.noreply.github.com> --- .github/workflows/rust.yml | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100644 .github/workflows/rust.yml diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml deleted file mode 100644 index 9fd45e0..0000000 --- a/.github/workflows/rust.yml +++ /dev/null @@ -1,22 +0,0 @@ -name: Rust - -on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] - -env: - CARGO_TERM_COLOR: always - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - name: Build - run: cargo build --verbose - - name: Run tests - run: cargo test --verbose