mirror of
https://github.com/manifoldbt/manifoldbt.git
synced 2026-11-02 07:56:11 +00:00
examples: 13 runs on the free tier
This commit is contained in:
@@ -4,7 +4,6 @@ Demonstrates:
|
|||||||
- Built-in presets (GBM, Heston, Merton, GARCH-JD)
|
- Built-in presets (GBM, Heston, Merton, GARCH-JD)
|
||||||
- Custom SDE model via string expressions
|
- Custom SDE model via string expressions
|
||||||
- Stochastic fan chart visualization
|
- Stochastic fan chart visualization
|
||||||
- CUDA GPU acceleration (device="cuda")
|
|
||||||
- All expressions compile to native Rust — full Rayon / CUDA parallelism
|
- All expressions compile to native Rust — full Rayon / CUDA parallelism
|
||||||
|
|
||||||
Data: none — this file simulates price paths, it does not backtest on any
|
Data: none — this file simulates price paths, it does not backtest on any
|
||||||
@@ -18,8 +17,12 @@ import manifoldbt as mbt
|
|||||||
|
|
||||||
from _bootstrap import plots_available
|
from _bootstrap import plots_available
|
||||||
|
|
||||||
N = 10_000_000 # 10M paths
|
# The mechanics are identical at any scale, so the defaults run on the free
|
||||||
DEVICE = "cuda" # "cpu" or "cuda"
|
# tier, which caps simulations at 1,000 paths. With a Pro licence the same
|
||||||
|
# file is a throughput demo: N = 10_000_000 and DEVICE = "cuda" run each
|
||||||
|
# preset below in about two seconds.
|
||||||
|
N = 1_000
|
||||||
|
DEVICE = "cpu" # Pro: "cuda"
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
# ── 1. Geometric Brownian Motion (preset) ───────────────────────────────
|
# ── 1. Geometric Brownian Motion (preset) ───────────────────────────────
|
||||||
@@ -117,7 +120,7 @@ if __name__ == "__main__":
|
|||||||
print(f" Elapsed: {elapsed:.3f}s\n")
|
print(f" Elapsed: {elapsed:.3f}s\n")
|
||||||
|
|
||||||
# ── 5. Custom mean-reverting model (CPU — store_paths needs RAM) ────────
|
# ── 5. Custom mean-reverting model (CPU — store_paths needs RAM) ────────
|
||||||
N_PLOT = 10_000
|
N_PLOT = min(N, 10_000)
|
||||||
print(f"5. Custom mean-reverting model ({N_PLOT:,} paths) [cpu, store_paths]")
|
print(f"5. Custom mean-reverting model ({N_PLOT:,} paths) [cpu, store_paths]")
|
||||||
mean_rev = mbt.StochasticModel(
|
mean_rev = mbt.StochasticModel(
|
||||||
name="mean_reverting",
|
name="mean_reverting",
|
||||||
|
|||||||
Reference in New Issue
Block a user