Expand description
Margin weight, balance, and price calculations for Drift spot positions.
Provides shared math used by api-v2, settlement-service, and notification-service for computing token balances, USDC values, asset/liability weights with IMF size adjustments, and conservative oracle prices.
Re-exports§
pub use balance::calculate_value_usdc_base_units;pub use balance::get_token_balance;pub use error::MathError;pub use error::MathResult;pub use math::CheckedDivCeil;pub use weights::calculate_asset_weight;pub use weights::calculate_liability_weight;pub use weights::calculate_scaled_initial_asset_weight;pub use weights::calculate_size_discount_asset_weight;pub use weights::get_strict_price;pub use weights::to_amm_precision;pub use weights::AMM_RESERVE_PRECISION;pub use weights::SPOT_IMF_PRECISION;pub use weights::SPOT_WEIGHT_PRECISION;