Skip to content
Open
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-01 - Progress Visualizations
**Learning:** For long-running CLI processes, particularly those that suppress verbose logging (e.g., `--quiet`), users can be left wondering if the program has stalled. Adding an interactive, dynamic progress bar using `\r` provides critical system status visibility without polluting standard output logs.
**Action:** When creating CLI tools with potentially long execution times or loops over large data structures (like Pandas DataFrames), implement a simple dynamic progress bar, conditional on `sys.stdout.isatty()`.
4 changes: 2 additions & 2 deletions .github/workflows/terraform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:

# Install the latest version of Terraform CLI and configure the Terraform CLI configuration file with a Terraform Cloud user API token
- name: Setup Terraform
uses: hashicorp/setup-terraform@v1
uses: hashicorp/setup-terraform@v3
with:
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}

Expand All @@ -89,5 +89,5 @@ jobs:
# On push to "main", build or change infrastructure according to Terraform configuration files
# Note: It is recommended to set up a required "strict" status check in your repository for "Terraform Cloud". See the documentation on "strict" required status checks for more information: https://help.github.com/en/github/administering-a-repository/types-of-required-status-checks
- name: Terraform Apply
if: github.ref == 'refs/heads/"main"' && github.event_name == 'push'
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
run: terraform apply -auto-approve -input=false
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,4 @@
# Python
__pycache__/
*.pyc
target/
223 changes: 223 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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 = int(bar_length * progress)
bar = 'β–ˆ' * filled + '-' * (bar_length - filled)
print(f"\r{Colors.BLUE}Simulating: |{bar}| {progress:.1%}{Colors.ENDC}", end="", flush=True)

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

return portfolio

Expand Down
13 changes: 13 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

# A basic local backend and a dummy resource so `terraform plan` passes without cloud setup.
terraform {
backend "local" {
path = "terraform.tfstate"
}
}

resource "null_resource" "example" {
triggers = {
value = "A example resource that does nothing!"
}
}
1 change: 1 addition & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fn main() { println!("Hello from Rust Lab!"); }