You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, after trying to start historic VAR analyses and getting the output in a different file (histvar.csv), I found that the historic var analysis somehow mixes up configuration (and maybe even code?):
My config for this is:
<Analytic type="parametricVar">
<Parameter name="active">N</Parameter>
<Parameter name="sensitivityInputFile">../Output/sensitivity.csv</Parameter>
<Parameter name="covarianceInputFile">covariance.csv</Parameter>
<Parameter name="salvageCovarianceMatrix">N</Parameter>
<Parameter name="quantiles">0.01,0.05,0.95,0.99</Parameter>
<!-- Breakdown of risk classes and types -->
<Parameter name="breakdown">Y</Parameter>
<!-- Portfolio filter (regex), may be empty or not given -->
<Parameter name="portfolioFilter"></Parameter>
<!-- VaR method (Delta, DeltaGammaNormal, MonteCarlo) -->
<Parameter name="method">DeltaGammaNormal</Parameter>
<!-- Only required for method = MonteCarlo -->
<!-- <Parameter name="mcSamples">100000</Parameter> -->
<!-- <Parameter name="mcSeed">42</Parameter> -->
<Parameter name="outputFile">var.csv</Parameter>
</Analytic>
<Analytic type="historicalSimulationVar">
<Parameter name="active">Y</Parameter>
<Parameter name="historicalScenarioFile">scenarios.csv</Parameter>
<Parameter name="simulationConfigFile">simulationNew.xml</Parameter>
<Parameter name="historicalPeriod">2023-03-28,2024-02-28</Parameter>
<Parameter name="mporDays">10</Parameter>
<Parameter name="mporCalendar">EUR</Parameter>
<Parameter name="mporOverlappingPeriods">true</Parameter>
<Parameter name="quantiles">0.01,0.05,0.95,0.99</Parameter>
<!--<Parameter name="breakdown">Y</Parameter>-->
<!--<Parameter name="portfolioFilter">PF1</Parameter>-->
<Parameter name="outputFile">histvar.csv</Parameter>
</Analytic>
Later, when running the histsim analytic, something strange happens:
NOTICE [2024-Aug-09 18:54:25.603457] (...ytics\orea\app\analyticsmanager.cpp:159) : run analytic with label 'HISTSIM_VAR'
WARNING [2024-Aug-09 18:54:25.603457] (OREAnalytics\orea\app\analytic.cpp:85) : 27205632|25341952
NOTICE [2024-Aug-09 18:54:25.619097] (...s\orea\app\analytics\varanalytic.cpp:46) : Running parametric VaR
NOTICE [2024-Aug-09 18:54:25.619097] (...s\orea\app\analytics\varanalytic.cpp:51) : VAR: Build Market
NOTICE [2024-Aug-09 18:54:25.619097] (OREAnalytics\orea\app\analytic.cpp:180) : Analytic::buildMarket called
NOTICE [2024-Aug-09 18:54:25.634711] (...\ored\marketdata\bondspreadimply.cpp:48) : identify securities that require a spread imply for configuration default
Still later, the histsim var seems to be used again for portfolio building:
NOTICE [2024-Aug-09 18:54:27.666036] (...ta\ored\portfolio\enginefactory.cpp:184) : Building EngineFactory
NOTICE [2024-Aug-09 18:54:27.681614] (OREData\ored\portfolio\portfolio.cpp:124) : Building Portfolio of size 310 for context = 'analytic/HISTSIM_VAR'
...
NOTICE [2024-Aug-09 18:54:29.415983] (OREData\ored\portfolio\portfolio.cpp:142) : Built Portfolio. Initial size = 310, size now 310, built 0 failed trades, context is analytic/HISTSIM_VAR
NOTICE [2024-Aug-09 18:54:29.431610] (OREAnalytics\orea\app\analytic.cpp:246) : Filter trades that expire before August 9th, 2024
Then, the VaR calculator seems to use the historic simulation approach:
NOTICE [2024-Aug-09 18:54:30.040990] (...\orea\app\analytics\varanalytic.cpp:148) : Build VaR calculator
NOTICE [2024-Aug-09 18:54:30.056616] (...cenario\historicalscenarioloader.cpp:47) : Loading historical scenarios from March 14th, 2023 to February 28th, 2024
NOTICE [2024-Aug-09 18:54:30.415996] (...cenario\historicalscenarioloader.cpp:94) : Loaded 243 from March 14th, 2023 to February 28th, 2024
NOTICE [2024-Aug-09 18:54:30.415996] (...orea\scenario\scenariosimmarket.cpp:330) : building ScenarioSimMarket...
...
NOTICE [2024-Aug-09 18:54:30.931685] (...s\orea\app\analytics\varanalytic.cpp:63) : Call VaR calculation
NOTICE [2024-Aug-09 18:54:30.931685] (...cs\orea\engine\marketriskreport.cpp:142) : Build the portfolio for full reval bt.
NOTICE [2024-Aug-09 18:54:30.947271] (...ta\ored\portfolio\enginefactory.cpp:184) : Building EngineFactory
NOTICE [2024-Aug-09 18:54:30.947271] (OREData\ored\portfolio\portfolio.cpp:124) : Building Portfolio of size 189 for context = 'historical pnl generation'
...
NOTICE [2024-Aug-09 18:54:49.353716] (...s\orea\app\analytics\varanalytic.cpp:74) : VaR completed
WARNING [2024-Aug-09 18:54:49.353716] (OREAnalytics\orea\app\analytic.cpp:88) : 56516608|54218752
NOTICE [2024-Aug-09 18:54:49.353716] (...ytics\orea\app\analyticsmanager.cpp:161) : run analytic with label 'HISTSIM_VAR' finished.
The output however goes to var.csv:
NOTICE [2024-Aug-09 19:20:18.512691] (...ytics\orea\app\analyticsmanager.cpp:234) : report name var occurs 1 times
...
NOTICE [2024-Aug-09 19:20:18.684566] (OREData\ored\report\csvreport.cpp:110) : Opening CSV file report 'Output/var.csv'
NOTICE [2024-Aug-09 19:20:18.700189] (OREData\ored\report\csvreport.cpp:199) : CSV file report 'Output/var.csv' closed.
NOTICE [2024-Aug-09 19:20:18.700189] (...ytics\orea\app\analyticsmanager.cpp:277) : report var written to Output/var.csv
Somehow the parameters of the parametric var seem to be mixed into the historical var, after commenting out the first (parametricVar) definition, ORE ran as expected.
Besides fixing the fundamental parameter setup mixing, I'd suggest to also bring the logging in line with the two different methods:
void VarAnalyticImpl::runAnalytic(const QuantLib::ext::shared_ptr<ore::data::InMemoryLoader>& loader,
const std::set<std::string>& runTypes) {
MEM_LOG;
LOG("Running parametric VaR"); // remove parametric
...
void ParametricVarAnalyticImpl::setVarReport(const QuantLib::ext::shared_ptr<ore::data::InMemoryLoader>& loader) {
LOG("Build trade to portfolio id mapping");
ParametricVarCalculator::ParametricVarParams varParams(inputs_->varMethod(), inputs_->mcVarSamples(),
inputs_->mcVarSeed());
QuantLib::ext::shared_ptr<SensitivityStream> ss = sensiStream(loader);
LOG("Build PARAMETRIC VaR calculator");
...
void HistoricalSimulationVarAnalyticImpl::setVarReport(
const QuantLib::ext::shared_ptr<ore::data::InMemoryLoader>& loader) {
LOG("Build HISTSIM VaR calculator");
-regards,
Roland
The text was updated successfully, but these errors were encountered:
It really seems to be constrained to the <Parameter name="outputFile">var.csv</Parameter> in the parametricVar analytic definition, when only this is commented, then the hist sim filename is taken.
Hi, after trying to start historic VAR analyses and getting the output in a different file (histvar.csv), I found that the historic var analysis somehow mixes up configuration (and maybe even code?):
My config for this is:
At the beginning, the log says everything is only HISTSIM_VAR (besides tje other 4 analyses):
NOTICE [2024-Aug-09 18:54:10.056549] (OREAnalytics\orea\app\oreapp.cpp:2048) : analytics: 5
NOTICE [2024-Aug-09 18:54:10.072113] (OREAnalytics\orea\app\oreapp.cpp:2050) : analytic: CASHFLOW
NOTICE [2024-Aug-09 18:54:10.072113] (OREAnalytics\orea\app\oreapp.cpp:2050) : analytic: EXPOSURE
NOTICE [2024-Aug-09 18:54:10.072113] (OREAnalytics\orea\app\oreapp.cpp:2050) : analytic: HISTSIM_VAR
NOTICE [2024-Aug-09 18:54:10.087735] (OREAnalytics\orea\app\oreapp.cpp:2050) : analytic: NPV
NOTICE [2024-Aug-09 18:54:10.087735] (OREAnalytics\orea\app\oreapp.cpp:2050) : analytic: XVA
NOTICE [2024-Aug-09 18:54:10.087735] (OREAnalytics\orea\app\oreapp.cpp:2052) : buildInputParameters done
NOTICE [2024-Aug-09 18:54:10.103369] (...lytics\orea\app\inputparameters.cpp:597) : OutputFileNameMap called
NOTICE [2024-Aug-09 18:54:10.103369] (...lytics\orea\app\inputparameters.cpp:676) : OutputFileNameMap complete
NOTICE [2024-Aug-09 18:54:10.103369] (OREAnalytics\orea\app\oreapp.cpp:376) : initFromParameters done, requested analytics:CASHFLOW,EXPOSURE,HISTSIM_VAR,NPV,XVA
NOTICE [2024-Aug-09 18:54:10.118996] (OREAnalytics\orea\app\oreapp.cpp:221) : ORE analytics starting
Later, when running the histsim analytic, something strange happens:
NOTICE [2024-Aug-09 18:54:25.603457] (...ytics\orea\app\analyticsmanager.cpp:159) : run analytic with label 'HISTSIM_VAR'
WARNING [2024-Aug-09 18:54:25.603457] (OREAnalytics\orea\app\analytic.cpp:85) : 27205632|25341952
NOTICE [2024-Aug-09 18:54:25.619097] (...s\orea\app\analytics\varanalytic.cpp:46) : Running parametric VaR
NOTICE [2024-Aug-09 18:54:25.619097] (...s\orea\app\analytics\varanalytic.cpp:51) : VAR: Build Market
NOTICE [2024-Aug-09 18:54:25.619097] (OREAnalytics\orea\app\analytic.cpp:180) : Analytic::buildMarket called
NOTICE [2024-Aug-09 18:54:25.634711] (...\ored\marketdata\bondspreadimply.cpp:48) : identify securities that require a spread imply for configuration default
Still later, the histsim var seems to be used again for portfolio building:
NOTICE [2024-Aug-09 18:54:27.666036] (...ta\ored\portfolio\enginefactory.cpp:184) : Building EngineFactory
NOTICE [2024-Aug-09 18:54:27.681614] (OREData\ored\portfolio\portfolio.cpp:124) : Building Portfolio of size 310 for context = 'analytic/HISTSIM_VAR'
...
NOTICE [2024-Aug-09 18:54:29.415983] (OREData\ored\portfolio\portfolio.cpp:142) : Built Portfolio. Initial size = 310, size now 310, built 0 failed trades, context is analytic/HISTSIM_VAR
NOTICE [2024-Aug-09 18:54:29.431610] (OREAnalytics\orea\app\analytic.cpp:246) : Filter trades that expire before August 9th, 2024
Then, the VaR calculator seems to use the historic simulation approach:
NOTICE [2024-Aug-09 18:54:30.040990] (...\orea\app\analytics\varanalytic.cpp:148) : Build VaR calculator
NOTICE [2024-Aug-09 18:54:30.056616] (...cenario\historicalscenarioloader.cpp:47) : Loading historical scenarios from March 14th, 2023 to February 28th, 2024
NOTICE [2024-Aug-09 18:54:30.415996] (...cenario\historicalscenarioloader.cpp:94) : Loaded 243 from March 14th, 2023 to February 28th, 2024
NOTICE [2024-Aug-09 18:54:30.415996] (...orea\scenario\scenariosimmarket.cpp:330) : building ScenarioSimMarket...
...
NOTICE [2024-Aug-09 18:54:30.931685] (...s\orea\app\analytics\varanalytic.cpp:63) : Call VaR calculation
NOTICE [2024-Aug-09 18:54:30.931685] (...cs\orea\engine\marketriskreport.cpp:142) : Build the portfolio for full reval bt.
NOTICE [2024-Aug-09 18:54:30.947271] (...ta\ored\portfolio\enginefactory.cpp:184) : Building EngineFactory
NOTICE [2024-Aug-09 18:54:30.947271] (OREData\ored\portfolio\portfolio.cpp:124) : Building Portfolio of size 189 for context = 'historical pnl generation'
...
NOTICE [2024-Aug-09 18:54:49.353716] (...s\orea\app\analytics\varanalytic.cpp:74) : VaR completed
WARNING [2024-Aug-09 18:54:49.353716] (OREAnalytics\orea\app\analytic.cpp:88) : 56516608|54218752
NOTICE [2024-Aug-09 18:54:49.353716] (...ytics\orea\app\analyticsmanager.cpp:161) : run analytic with label 'HISTSIM_VAR' finished.
The output however goes to var.csv:
NOTICE [2024-Aug-09 19:20:18.512691] (...ytics\orea\app\analyticsmanager.cpp:234) : report name var occurs 1 times
...
NOTICE [2024-Aug-09 19:20:18.684566] (OREData\ored\report\csvreport.cpp:110) : Opening CSV file report 'Output/var.csv'
NOTICE [2024-Aug-09 19:20:18.700189] (OREData\ored\report\csvreport.cpp:199) : CSV file report 'Output/var.csv' closed.
NOTICE [2024-Aug-09 19:20:18.700189] (...ytics\orea\app\analyticsmanager.cpp:277) : report var written to Output/var.csv
Somehow the parameters of the parametric var seem to be mixed into the historical var, after commenting out the first (parametricVar) definition, ORE ran as expected.
Besides fixing the fundamental parameter setup mixing, I'd suggest to also bring the logging in line with the two different methods:
-regards,
Roland
The text was updated successfully, but these errors were encountered: