UNPKG

@railpath/finance-toolkit

Version:

Production-ready finance library for portfolio construction, risk analytics, quantitative metrics, and ML-based regime detection

75 lines (74 loc) 1.93 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.PortfolioMetricsResultSchema = void 0; const zod_1 = require("zod"); exports.PortfolioMetricsResultSchema = zod_1.z.object({ /** * Total return over the entire period */ totalReturn: zod_1.z.number(), /** * Compound Annual Growth Rate (CAGR) */ cagr: zod_1.z.number(), /** * Maximum drawdown (largest peak-to-trough decline) */ maxDrawdown: zod_1.z.number(), /** * Maximum drawdown as a percentage */ maxDrawdownPercent: zod_1.z.number(), /** * Current drawdown (current decline from peak) */ currentDrawdown: zod_1.z.number(), /** * Current drawdown as a percentage */ currentDrawdownPercent: zod_1.z.number(), /** * Sharpe ratio (risk-adjusted return) */ sharpeRatio: zod_1.z.number(), /** * Sortino ratio (downside risk-adjusted return) */ sortinoRatio: zod_1.z.number(), /** * Value at Risk (VaR) at specified confidence level */ valueAtRisk: zod_1.z.number(), /** * Expected Shortfall (Conditional VaR) at specified confidence level */ expectedShortfall: zod_1.z.number(), /** * Volatility (annualized standard deviation of returns) */ volatility: zod_1.z.number(), /** * Mean return (annualized) */ meanReturn: zod_1.z.number(), /** * Number of periods */ periods: zod_1.z.number().int().positive(), /** * Number of years (calculated from periods and annualization factor) */ years: zod_1.z.number(), /** * Annualization factor used */ annualizationFactor: zod_1.z.number(), /** * Risk-free rate used */ riskFreeRate: zod_1.z.number(), /** * Confidence level used for VaR/ES calculations */ confidenceLevel: zod_1.z.number(), });