Development of a Monte Carlo portfolio simulation system

Risk assessment breaks down where scenarios are taken from intuition rather than data. We develop Monte Carlo portfolio simulation turnkey: gather history, configure models, and hand over a ready-made tool to your team. Instead of a single number — a distribution of outcomes, and decisions on limits stop being an argument about preferences.

Blockchain Development Services

Frequently Asked Questions

Latest works

  • Development of a web application for FEEDME
    Development of a web application for FEEDME
    1365
  • Development of an online store for the company FURNORO
    Development of an online store for the company FURNORO
    1330
  • B2B Advance company logo design
    B2B Advance company logo design
    776
  • Development of a web application for Enviok
    Development of a web application for Enviok
    1077
  • AIDER company logo development
    AIDER company logo development
    1022
  • CRM development for Chasseurs
    CRM development for Chasseurs
    1113

Monte Carlo portfolio simulation: where risk assessment breaks down

A point estimate of risk relies on a single scenario: average return, specified deviation, chosen horizon. The answer looks neat while the market behaves as expected, and falls apart at the first dislocation.

Monte Carlo portfolio simulation replaces a single number with a distribution of outcomes, but rests on input assumptions: how asset volatility is described, whether correlations between instruments are accounted for, whether the relationship matrix changes in stress regimes.

If relationships are fixed as a constant, portfolio risk assessment underestimates the tails — and those are precisely where the losses lie that the strategy is not prepared for.

The second break is manual assumptions. Rates, horizons, and rebalancing rules are often set "from experience" and verified nowhere.

Hypothesis testing on historical data shows that some of them do not withstand even one crisis period: parameters are fitted to the past trend and are not reproduced on new data.

The third is non-convergence. Two runs on the same dataset produce different loss quantiles, and the decision depends on which result was opened first.

Strategy robustness is confirmed only when simulation is reproducible: fixed generator, same inputs, convergence of estimate as the number of runs grows.

Below is how this is addressed: from specification of input distributions to acceptance criteria by which the result is considered reliable.

What implementation delivers: measurable effects for risk assessment

The first measurable effect is the speed of scenario preparation. A set of market scenarios used to be assembled manually: return snapshots, correlation matrices, volatilities were consolidated into tables and coordinated between divisions.

A declarative description of the Monte Carlo generator removes this stage — a new scenario set is assembled many times faster, not over days.

Reproducibility of calculations rests on complete fixation of the input. A run saves the generator seed, model version, data snapshot, and distribution parameters, so a report calculated today is reproduced months later with the same result.

This closes the class of errors "the report shows some numbers, recalculation shows others": the discrepancy is visible immediately and explainable.

Elimination of manual assumptions is the most tangible shift. The share of operations where parameters were transferred by hand from emails, local files, and spreadsheets on the critical path drops to zero: both data and settings come from a versioned source.

The class of errors due to an outdated or someone else's snapshot disappears entirely — the model cannot silently calculate using a past period.

Load stability of the calculation manifests in how volume grows. Increasing the number of paths by an order of magnitude means adding compute nodes and parallel task distribution, not rewriting the model.

Calculation time remains predictable as long as the number of scenarios grows, not the complexity of logic.

Model version control closes the loop. The model, its parameters, and generator code live in a repository under tags: any report shows which version produced it, and rollback to a previous version does not erase history or break reproducibility of subsequent runs.

Approaches to portfolio modeling: comparison of modes

The calculation mode is chosen based on the planning horizon and how important tail scenarios are.

Historical modeling takes the shape of the distribution from actual return series and quickly answers what will happen if a familiar market repeats, but does not go beyond events that have already occurred.

Full scenario enumeration builds a deterministic grid for each asset and covers combinations that did not occur in history.

The limitation of the approach is combinatorial growth in the number of paths: the grid must be narrowed by the number of assets and steps, otherwise the calculation ceases to be manageable. Below is when each mode is appropriate.

Calculation mode When it is suitable Limitations
Historical modeling Testing portfolio structure under familiar market regimes Does not go beyond observed history, sensitive to the selected window
Full scenario enumeration Finding boundary conditions and stress checks Combinatorial growth in the number of paths, requires a narrow set of parameters
Mixed approach Long planning horizon with hypothetical branches More assumptions are set expert-wise, harder to explain

In practice, modes are combined: historical windows set the shape of distributions, enumeration sets boundaries, and the horizon determines how many steps to simulate.

In the report, we show the contribution of each mode separately — it is clear where the final risk assessment came from.

Development stages: from data audit to handover to operation

We fix the work order in advance so the result is reproducible: the same input data must produce the same report on any machine, both a month and a year later.

Therefore the calculation is built as a formalized pipeline with checkpoints, where at each step it is clear what exactly was accepted and why.

  1. Source data audit. We examine return series for each instrument: gaps, outliers, splits, quote currency changes, discrepancies between sources.

    We close defects with rules before calculation; otherwise the random number generator replicates the error across thousands of scenarios.

  2. Problem statement. We fix the horizon, portfolio composition, confidence levels, and metrics by which decisions are made: drawdown, probability of not achieving the goal, return distribution by quantiles. This determines both the number of runs and the method of scenario selection.

  3. Design of the calculation scheme. We agree assumptions about distributions, correlations, and the method of restoring them — a parametric approach or block sampling to preserve autocorrelation.

    We run the generator with a fixed seed: the result is reproducible, and an engineering change is visible separately from random variance.

  4. Model calibration. We estimate volatility and the correlation matrix using rolling windows, and check how sensitive the estimate is to window length. We add stress scenarios where correlations converge to one — this way the model does not underestimate risk during a crisis.

  5. Validation on historical periods. We run the model on segments with a known outcome and compare the forecast with the fact: whether the actual drawdown falls within the calculated interval, whether the result is stable when the seed changes. We analyze discrepancies and either refine assumptions or explicitly record them as a limitation.

  6. Handover to operation. We deliver the data update procedure, scheduled recalculation configured, discrepancy monitoring, and parameter documentation. The customer's team performs a run independently under our support — before we disengage.

What we hand over: models, configurations, procedures

A calculation that cannot be repeated is useless: if assumptions, quote source, and path generator parameters are not fixed, the next analyst will get a different distribution on the same data and will not understand the reason for the discrepancy.

That is why we hand over not only code but also the full reproducibility loop — from model description to recalculation procedure.

  • Model documentation: list of assumptions, types of return distributions, correlation matrix, forecast horizon, applicability boundaries, and known discrepancies with actual data.
  • Calculation configurations: parameter files — number of paths, rebalancing step, quote sources, corporate action processing; versioned together with code so the result can be rolled back to a previous state.
  • Data flow diagram: from loading market series and cleaning outliers to aggregating percentiles and building the distribution curve of final value, with quality control points at each transition.
  • Instructions for analysts: how to run a scenario, how to add an instrument to the portfolio, how to read the tail quantile report, and how to distinguish a model change from a shift in market data.
  • Run and update procedure: recalculation frequency, person responsible for the run, procedure for actions when there is a discrepancy with the control result and when updating the model.
  • Reproducibility tests: a fixed set of paths with a reference result — after edits, it is immediately visible that the calculation has not drifted and the distribution remains comparable.
  • Model change log: what changed, at whose initiative, and how it affected the shape of the distribution and risk estimates.

Case study: how risk assessment changed after implementation

Portfolio risk calculation lived on three disparate sources: exports from the accounting system, analyst spreadsheets, and files with historical quotes that were updated manually using Bloomberg data.

The asset set, horizon, number of paths, and correlation matrix were each time specified by editing scripts, so the run could not be repeated exactly.

Scenarios took 15 business days to prepare, and the outcome depended on who assembled the export: discrepancies in the 95th loss quantile between divisions reached 12 points, and another week was spent on reconciliation.

What was measured Before After
Scenario set preparation 15 business days 2 days
Share of manual operations in the run about 70% about 15%
Discrepancies in risk reporting 12 points 1 point
Spread of the 95th quantile between runs ±18% ±2%
Run time on the full portfolio 40 minutes 6 minutes

Sources were consolidated into a single versioned repository: quote loading receives a snapshot date and checksum, and the scenario references a specific version of the set, not "the latest file on disk." Run parameters — horizon, number of paths, generator seed, correlation matrix — are moved into configuration.

The same input gives the same output, and the report is assembled from a single calculation core, so discrepancies between divisions disappear at the data source level.

Manual labor shifted from data assembly to model validation: analysts confirm assumptions and look at the tail of the distribution instead of consolidating tables. Rollback to a previous calculation is switching the reference to the previous snapshot.

How does scenario analysis differ from stress testing?

These are not two variants of one procedure, but two layers of risk control.

Scenario analysis builds a distribution of outcomes: thousands of runs with different combinations of returns, volatilities, and correlations give not one number but a picture — median, quantiles, and tail shape.

Stress testing answers a different question: does the portfolio survive under one unfavorable condition specified manually.

Therefore the metrics also differ. The distribution gives the risk magnitude under a given confidence level, expected tail losses, probability of a drawdown deeper than the limit, and the share of runs with a margin call requirement.

Stress gives a point answer: at which step forced liquidations trigger and whether capital remains positive.

The difference is also in assumptions about relationships between assets. In scenario analysis, dependencies are reproduced by a statistical model — and in the tail they intensify, which is almost invisible in calm data.

In stress, relationships are set rigidly: risky assets fall together, liquidity disappears, spreads widen. Therefore stress is intentionally more pessimistic than the distribution and does not claim probability.

Hence the choice of method. The question "where does the portfolio break and what margin of safety is needed" is covered by stress testing; the question "how much capital to hold and how often the limit is breached" is covered by the distribution from runs.

Basel Committee requires both tools precisely because event probability and survival under pressure are different questions.

Technical concerns: data, accuracy, reproducibility

Before the calculation starts, the same set of doubts surfaces: where the source data comes from and how complete it is, whether the output spread can be trusted, whether the result will repeat in six months. All of these are verifiable things, and there is an answer to each.

Each run writes a log: a snapshot of market data with source and time, model version, number of scenarios, generator seed. Therefore the result is reproducible, and a discrepancy with the previous run is explained by parameters, not "randomness."

What do you do with gaps and outliers in history?

We fill gaps only for short breaks within the series; long breaks and outliers are flagged and excluded from parameter estimation. The report shows how many points were discarded and how this shifted the return distribution.

Is this a point forecast or a range?

The output is a distribution, not a single number: median, loss quantiles, probability of a drawdown deeper than a specified level. We check stability on historical periods and stress scenarios so that extreme quantiles do not drift when the estimation window changes.

Will the calculation repeat on the same dataset?

Yes — with a fixed seed and the same model version, the result matches; this is covered by an automatic check. If the scenario composition changes, the difference is visible in a comparison of two runs.

How do you embed the calculation into reporting and update the model?

We export results in formats that your reporting already reads; model assumptions are in a separate configuration file, so updating does not require rewriting code. We first run the new version in parallel with the old one and show the difference.

Let's discuss your task: what to send for assessment

For the assessment to be on point, not "plus or minus an order of magnitude," it is enough to send a description of the task and what data you have. Below is the minimum set. If something is missing, we will mark it as an open question and suggest how to close it.

  • Purpose of calculation. What decisions are made based on the results: strategy comparison, limit checks, stress scenarios, regular reporting to the committee.
  • Portfolio composition. Asset classes, weights, currencies, permissible deviation ranges, whether there are non-tradable or illiquid positions.
  • Data. Historical series or their source, depth and frequency, gaps, treatment of corporate events and commissions.
  • Model rules. Horizon, number of scenarios, rebalancing frequency, liquidity and trade size constraints.
  • Output metrics. Return distribution, drawdown probability, quantile loss estimates, required breakdowns, and report formats.
  • How the result reaches people. Export to files, dashboard, integration with the accounting system, access rights, run log.
  • Reproducibility and load. Whether the run must repeat to the digit with the same input dataset and within what time the full calculation must complete.

A full technical specification does not need to be prepared — from this set we reconstruct the calculation logic and scope of work. In response, we send an estimate of scope, a staged work plan, a list of assumptions, and questions that should be resolved before the start. Describe the task — we will return with an estimate and a plan.