Crate obol

Crate obol 

Source
Expand description

Obol - Portfolio networth calculator with real-time price fetching

This crate provides functionality to calculate the total networth of a portfolio by fetching current prices for various asset types including currencies, stocks, and cryptocurrencies.

§Quick Start

use obol::{PortfolioBuilder, CombinedPriceProvider, PortfolioConfig};
use rust_decimal::Decimal;

let mut config = PortfolioConfig::default();
config.currencies.insert("USD".to_string(), Decimal::from(1000));
config.stocks.insert("AAPL".to_string(), 10);

let provider = Box::new(CombinedPriceProvider::new());
let portfolio = PortfolioBuilder::new(config)
    .base_currency("USD")
    .with_price_provider(provider)
    .build()
    .await?;

println!("Total networth: {}", portfolio.total_networth());

Re-exports§

pub use crate::config::CryptoAsset;
pub use crate::config::PortfolioConfig;
pub use crate::error::Error;
pub use crate::error::ErrorContext;
pub use crate::error::Result;
pub use crate::portfolio::AssetHolding;
pub use crate::portfolio::Portfolio;
pub use crate::portfolio::PortfolioBreakdown;
pub use crate::portfolio::PortfolioBuilder;
pub use crate::price::AssetPrice;
pub use crate::price::CoinGeckoProvider;
pub use crate::price::CombinedPriceProvider;
pub use crate::price::PriceProvider;

Modules§

background_update
Background portfolio update system
config
Configuration handling for portfolio definitions
daemon
Daemon module for background portfolio data collection
database
Database module for time series storage
error
Error types for the obol crate
logging
Comprehensive logging configuration for obol
paths
Cross-platform path management for obol
portfolio
Portfolio models and builders
price
Price fetching providers for different asset types
tui
TUI (Terminal User Interface) module
utils
Utility functions for the obol crate
validation
Validation system for portfolio configurations

Constants§

VERSION
Current version of the obol crate