Crate aprender_monte_carlo

Crate aprender_monte_carlo 

Source
Expand description

§aprender-monte-carlo

CLI tool and utility library for Monte Carlo simulations.

This crate provides:

  • CLI Interface: Run simulations from the command line
  • CSV Data Loading: Load historical data from CSV files
  • S&P 500 Data: Embedded historical S&P 500 data (1928-present)
  • Business Revenue Modeling: Product revenue forecasting

§Core Monte Carlo functionality

The core simulation engine, risk metrics, and models are provided by the main aprender crate’s monte_carlo module. This crate re-exports those for convenience and adds CLI-specific functionality.

§Quick Start (Library)

use aprender_monte_carlo::prelude::*;

// Load S&P 500 data
let sp500 = Sp500Data::load();

// Run bootstrap simulation
let model = EmpiricalBootstrap::new(100.0, sp500.monthly_returns());
let engine = MonteCarloEngine::reproducible(42).with_n_simulations(10_000);
let result = engine.simulate(&model, &TimeHorizon::years(10));

// Generate risk report
let report = RiskReport::from_paths(&result.paths, 0.02)?;
println!("{}", report.summary());

§Quick Start (CLI)

# Run S&P 500 simulation
aprender-monte-carlo sp500 --years 30 --simulations 10000

# Load custom CSV data
aprender-monte-carlo csv --file returns.csv --initial 100000

# Business revenue forecast
aprender-monte-carlo revenue --file products.csv --quarters 4

Modules§

cli
Command-line interface for Monte Carlo simulations
core_models
Financial simulation models
data
Data loading and embedded historical data
engine
Core Monte Carlo simulation engine
error
Error types for Monte Carlo operations Error types for Monte Carlo simulations
models
Business and financial models for Monte Carlo simulation
prelude
Prelude for convenient imports
risk
Risk metrics for Monte Carlo simulations

Enums§

MonteCarloError
Errors that can occur during Monte Carlo simulation

Type Aliases§

Result
Result type for Monte Carlo operations