Docs - Results
The Results section provides a detailed breakdown of the simulation outcome, offering comprehensive performance metrics and a log of significant events during the simulation.
Metrics (AlgoResult interface):
- summary: AlgoResultSummary - A concise overview of the simulation results, including:
- initCash: number (Initial cash balance)
- finalCash: number (Final cash balance)
- totalVar: number (Total return as a decimal)
- annualVar: number (Annualized return as a decimal)
- high: number (Highest portfolio value reached)
- low: number (Lowest portfolio value reached)
- nTrades: number (Total number of trades executed)
- performance: AlgoResultPerformance[] - An array of objects, each representing a data point in the simulation, including:
- date: Date (The date of the data point)
- value: number (Portfolio value at this date)
- prevVariation: number (Percentage change from the previous data point)
- initVariation: number (Percentage change from the initial value)
- drawdown: number (Current drawdown as a percentage of the peak value)
- portfolio: AssetPortfolio - Represents the final state of the portfolio, including cash balance and all asset positions.
- portfolioHist: AssetPortfolio[] - An array of AssetPortfolio objects, representing the historical states of the portfolio throughout the simulation.
- assetHist: Record<string, AssetDataFlat[]> - A record of historical data for each asset, keyed by asset ticker. Each value is an array of AssetDataFlat objects containing price and other relevant data for each simulation data point.
- tradeHist: Record<string, AssetTrade[]> - A record of all trades executed during the simulation, keyed by date. Each value is an array of AssetTrade objects detailing the trades made on that date.
Messages Output:
An array of string messages logged during the simulation. These messages provide a narrative of the simulation's progress and include:
- Trading actions: Details of buy and sell orders executed by the algorithm.
- Cash injections or withdrawals: Records of any cash added to or removed from the portfolio.
- Rebalancing events: Notifications of portfolio rebalancing in the Portfolio simulation.
- Errors or warnings: Any issues encountered during the simulation execution.
The combination of quantitative metrics and qualitative message logs provides users with a comprehensive understanding of their algorithm's performance and behavior throughout the simulated period. This data can be used for strategy refinement, performance analysis, and identifying areas for improvement in the trading algorithm or portfolio allocation.
Charts:
Several charts are generated at the end of the run to visually represent the performance and behavior of the algorithm. These charts include:
- Performance Chart: Displays the portfolio value over time, providing a visual representation of the performance of the algorithm throughout the simulation.
- Drawdown Chart: Shows the drawdown over time, indicating the percentage drop from the peak portfolio value, which helps in understanding the risk and volatility of the strategy.
- Positions Chart: Illustrates the value of different asset positions over time, giving insights into how the portfolio's composition changed during the simulation.
- Quantities Chart: Represents the quantities of each asset held in the portfolio over time, helping to analyze the trading behavior and asset allocation.
- Prices Chart: Displays the prices of assets in the portfolio over time, providing a view of the market conditions and price movements that influenced the portfolio's performance.