Skip to content

Scenario Generation

Possibility of generating percent rate correlated scenarios with simulation. Example of such a model is e.g. A present time deposit is given as:

var p = new ScenarioCalculator(new DateTime(2017, 1, 1), new DateTime(2057, 1, 1))
    .WithInitalScenarioValue(ScenarioType.BondLong,0.01m)
    .WithTermsPrYear(TermsPrYear.Four)
    .WithScenarioCalculator(new ScenarioGenerator().AddNoise((repo, d, rnd) =>
        {
            var last3 = repo.GetLast(ScenarioType.BondLong, 3).ToArray();
            var m1 = last3[2].Rate * 1.06m;
            var m2 = last3[1].Rate * -0.035m;
            var m3 = last3[0].Rate * -0.01m;
            repo.AddScenario(ScenarioType.BondLong,d,m1+m2+m3);
        }))
    .WithRandomSeed(100)
    .Build();
Where we have Bond AR (Autoregressiv) model using the previous 3 terms. Notice how the generator function is given in the .WithScenarioCalculator.

TODO

  • Output to cumulativ distribution GetTimeWhere(x => x.BondInflation.Rate > 0.04, 0.5)
  • Output to cumulativ distribution GetProbability(x => x.BondInflation.Rate > 0.04, new DateTime(2018,05,03))