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: 2 additions & 2 deletions .github/workflows/terraform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
# 3. Reference the GitHub secret in step using the `hashicorp/setup-terraform` GitHub Action.
# Example:
# - name: Setup Terraform
# uses: hashicorp/setup-terraform@v1
# uses: hashicorp/setup-terraform@v3
# with:
# cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}

Expand Down 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 Down
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.

22 changes: 19 additions & 3 deletions bitcoin_trading_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,11 @@ def simulate_trading(signals, initial_cash=10000, quiet=False):

if not quiet:
print(f"\n{Colors.HEADER}{Colors.BOLD}------ Daily Trading Ledger ------{Colors.ENDC}")
for i, row in signals.iterrows():

total_days = len(signals)
show_progress = quiet and sys.stdout.isatty()

for idx, (i, row) in enumerate(signals.iterrows()):
if i > 0:
portfolio.loc[i, 'cash'] = portfolio.loc[i-1, 'cash']
portfolio.loc[i, 'btc'] = portfolio.loc[i-1, 'btc']
Expand All @@ -94,21 +98,33 @@ 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 show_progress:
progress = (idx + 1) / total_days
bar_length = 30
filled_length = int(bar_length * progress)
bar = 'β–ˆ' * filled_length + '-' * (bar_length - filled_length)
sys.stdout.write(f"\r{Colors.CYAN}Simulating Trading: [{bar}] {progress:.1%}{Colors.ENDC}")
sys.stdout.flush()

if show_progress:
sys.stdout.write("\n")

return portfolio

Expand Down
5 changes: 5 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
terraform {
required_version = ">= 1.0.0"
}

resource "null_resource" "example" {}
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!"); }
1 change: 1 addition & 0 deletions target/.rustc_info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"rustc_fingerprint":11990908473491073401,"outputs":{"7971740275564407648":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.so\nlib___.so\nlib___.a\nlib___.so\n/home/jules/.rustup/toolchains/stable-x86_64-unknown-linux-gnu\noff\npacked\nunpacked\n___\ndebug_assertions\npanic=\"unwind\"\nproc_macro\ntarget_abi=\"\"\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"gnu\"\ntarget_family=\"unix\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_has_atomic=\"16\"\ntarget_has_atomic=\"32\"\ntarget_has_atomic=\"64\"\ntarget_has_atomic=\"8\"\ntarget_has_atomic=\"ptr\"\ntarget_os=\"linux\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"unknown\"\nunix\n","stderr":""},"17747080675513052775":{"success":true,"status":"","code":0,"stdout":"rustc 1.92.0 (ded5c06cf 2025-12-08)\nbinary: rustc\ncommit-hash: ded5c06cf21d2b93bffd5d884aa6e96934ee4234\ncommit-date: 2025-12-08\nhost: x86_64-unknown-linux-gnu\nrelease: 1.92.0\nLLVM version: 21.1.3\n","stderr":""}},"successes":{}}
3 changes: 3 additions & 0 deletions target/CACHEDIR.TAG
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Signature: 8a477f597d28d172789f06886806bc55
# This file is a cache directory tag created by cargo.
# For information about cache directory tags see https://bford.info/cachedir/
Empty file added target/debug/.cargo-lock
Empty file.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This file has an mtime of when this was started.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
42f79c9e6f1bfe9d
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"rustc":4758242423518056681,"features":"[]","declared_features":"[\"core\", \"rustc-dep-of-std\"]","target":13840298032947503755,"profile":2241668132362809309,"path":828088505969299709,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/cfg-if-e720413b8edafa0a/dep-lib-cfg_if","checksum":false}}],"rustflags":[],"config":2069994364910194474,"compile_kind":0}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This file has an mtime of when this was started.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
6240645ec1b7b3d3
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"rustc":4758242423518056681,"features":"[]","declared_features":"[\"no-color\"]","target":10635017557502881088,"profile":2241668132362809309,"path":4587278367410923654,"deps":[[17917672826516349275,"lazy_static",false,3304188705693632751]],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/colored-144b09567e8d8f5a/dep-lib-colored","checksum":false}}],"rustflags":[],"config":2069994364910194474,"compile_kind":0}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
80e25a70abf32003
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"rustc":4758242423518056681,"features":"[]","declared_features":"[]","target":16337832459791398879,"profile":17672942494452627365,"path":4942398508502643691,"deps":[[13208667028893622512,"rand",false,12930400809424697332],[13731153033113646547,"colored",false,15254738403974201442]],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/eijack-lab-rust-3436cb5b8ccdf778/dep-bin-eijack-lab-rust","checksum":false}}],"rustflags":[],"config":2069994364910194474,"compile_kind":0}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This file has an mtime of when this was started.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This file has an mtime of when this was started.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
f997d1d28ca0004f
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"rustc":4758242423518056681,"features":"[\"std\"]","declared_features":"[\"compiler_builtins\", \"core\", \"custom\", \"js\", \"js-sys\", \"linux_disable_fallback\", \"rdrand\", \"rustc-dep-of-std\", \"std\", \"test-in-browser\", \"wasm-bindgen\"]","target":16244099637825074703,"profile":2241668132362809309,"path":59692596234819462,"deps":[[7667230146095136825,"cfg_if",false,11384567074255599426],[18365559012052052344,"libc",false,1534625899069055608]],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/getrandom-ac53c26d78321fd1/dep-lib-getrandom","checksum":false}}],"rustflags":[],"config":2069994364910194474,"compile_kind":0}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This file has an mtime of when this was started.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ef08ba191fd6da2d
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"rustc":4758242423518056681,"features":"[]","declared_features":"[\"spin\", \"spin_no_std\"]","target":8659156474882058145,"profile":2241668132362809309,"path":14186808162164221862,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/lazy_static-9bf3f646e7e24520/dep-lib-lazy_static","checksum":false}}],"rustflags":[],"config":2069994364910194474,"compile_kind":0}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This file has an mtime of when this was started.
1 change: 1 addition & 0 deletions target/debug/.fingerprint/libc-5f17920b755ef494/lib-libc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
782220d91f164c15
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"rustc":4758242423518056681,"features":"[]","declared_features":"[\"align\", \"const-extern-fn\", \"default\", \"extra_traits\", \"rustc-dep-of-std\", \"rustc-std-workspace-core\", \"std\", \"use_std\"]","target":17682796336736096309,"profile":15222631470922254920,"path":15371363379775449269,"deps":[[18365559012052052344,"build_script_build",false,5662575024077545023]],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/libc-5f17920b755ef494/dep-lib-libc","checksum":false}}],"rustflags":[],"config":2069994364910194474,"compile_kind":0}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
901ab8cd676b0076
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"rustc":4758242423518056681,"features":"[]","declared_features":"[\"align\", \"const-extern-fn\", \"default\", \"extra_traits\", \"rustc-dep-of-std\", \"rustc-std-workspace-core\", \"std\", \"use_std\"]","target":5408242616063297496,"profile":1565149285177326037,"path":6665272496194606373,"deps":[],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/libc-9c599bdfe2e6e8b5/dep-build-script-build-script-build","checksum":false}}],"rustflags":[],"config":2069994364910194474,"compile_kind":0}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This file has an mtime of when this was started.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3f1e2498fb81954e
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"rustc":4758242423518056681,"features":"","declared_features":"","target":0,"profile":0,"path":0,"deps":[[18365559012052052344,"build_script_build",false,8502914190052694672]],"local":[{"RerunIfChanged":{"output":"debug/build/libc-db946e1a6607099d/output","paths":["build.rs"]}},{"RerunIfEnvChanged":{"var":"RUST_LIBC_UNSTABLE_FREEBSD_VERSION","val":null}},{"RerunIfEnvChanged":{"var":"RUST_LIBC_UNSTABLE_MUSL_V1_2_3","val":null}},{"RerunIfEnvChanged":{"var":"RUST_LIBC_UNSTABLE_LINUX_TIME_BITS64","val":null}},{"RerunIfEnvChanged":{"var":"RUST_LIBC_UNSTABLE_GNU_FILE_OFFSET_BITS","val":null}},{"RerunIfEnvChanged":{"var":"RUST_LIBC_UNSTABLE_GNU_TIME_BITS","val":null}}],"rustflags":[],"config":0,"compile_kind":0}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This file has an mtime of when this was started.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9900cd4eb1057524
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"rustc":4758242423518056681,"features":"[\"simd\", \"std\"]","declared_features":"[\"default\", \"no_simd\", \"simd\", \"std\"]","target":2607852365283500179,"profile":2241668132362809309,"path":13675546687387606575,"deps":[[17375358419629610217,"zerocopy",false,10260184207524635767]],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/ppv-lite86-7238b2ad47c96939/dep-lib-ppv_lite86","checksum":false}}],"rustflags":[],"config":2069994364910194474,"compile_kind":0}
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This file has an mtime of when this was started.
1 change: 1 addition & 0 deletions target/debug/.fingerprint/rand-78826d44af18bdef/lib-rand
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
f4b72e29070372b3
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"rustc":4758242423518056681,"features":"[\"alloc\", \"default\", \"getrandom\", \"libc\", \"rand_chacha\", \"std\", \"std_rng\"]","declared_features":"[\"alloc\", \"default\", \"getrandom\", \"libc\", \"log\", \"min_const_gen\", \"nightly\", \"packed_simd\", \"rand_chacha\", \"serde\", \"serde1\", \"simd_support\", \"small_rng\", \"std\", \"std_rng\"]","target":8827111241893198906,"profile":2241668132362809309,"path":10385015244823701454,"deps":[[1573238666360410412,"rand_chacha",false,7614937021212895392],[18130209639506977569,"rand_core",false,5817633276881980994],[18365559012052052344,"libc",false,1534625899069055608]],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/rand-78826d44af18bdef/dep-lib-rand","checksum":false}}],"rustflags":[],"config":2069994364910194474,"compile_kind":0}
Binary file not shown.
Loading