portfolio_rs/docs/library.md
Markus Zoppelt 9a40461008 docs: slim down README, move reference material to docs/, drop outdated images
The README had grown to ~600 lines, mostly MCP and HTTP API reference.
It now keeps the pitch, installation, quick start, a short TUI section,
the command table and an index of docs/. The reference material moved to
docs/ (tui, agents, mcp, http-api, library, quotes, configuration), and
the MCP docs test now checks docs/mcp.md.

The TUI screenshots and the CLI demo gif were outdated and are removed;
img/ is excluded from the published crate. Em-dashes are gone from the
README, the new docs and the crate description.
2026-10-28 08:51:53 +01:00

607 B

Library usage

The crate is also a library: state::AppState is an embedding-friendly facade used by the HTTP API and external GUIs (e.g. a Tauri desktop app). It loads portfolios/workspaces/policies, does position CRUD, and runs every analysis (context, review, simulate, doctor, validate, reports) with camelCase-serializable DTOs.

use portfolio_rs::AppState;

async fn total_value() -> eyre::Result<f64> {
    let state = AppState::new("EUR".to_string());
    state.load_file("positions.json").await?;
    let summary = state.get_portfolio_summary().await;
    Ok(summary.total_value)
}