Logo
Fully annotated reference manual - version 1.8.12
Loading...
Searching...
No Matches
Classes | Public Member Functions | Private Attributes | List of all members
ZeroSensitivityLoader Class Reference

#include <orea/app/zerosensitivityloader.hpp>

+ Collaboration diagram for ZeroSensitivityLoader:

Classes

struct  ZeroSensitivity
 

Public Member Functions

 ZeroSensitivityLoader (const std::string &filename, const std::string &idColum="TradeId", const std::string &riskFactorColumn="Factor_1", const std::string &deltaColumn="Delta", const std::string &currencyColumn="Currency", const std::string &baseNpvColumn="Base NPV", const std::string &shiftSizeColumn="ShiftSize_1")
 
std::map< std::string, std::vector< ZeroSensitivity > > sensitivities ()
 

Private Attributes

std::map< std::string, std::vector< ZeroSensitivity > > sensitivities_
 

Detailed Description

Definition at line 32 of file zerosensitivityloader.hpp.

Constructor & Destructor Documentation

◆ ZeroSensitivityLoader()

ZeroSensitivityLoader ( const std::string &  filename,
const std::string &  idColum = "TradeId",
const std::string &  riskFactorColumn = "Factor_1",
const std::string &  deltaColumn = "Delta",
const std::string &  currencyColumn = "Currency",
const std::string &  baseNpvColumn = "Base NPV",
const std::string &  shiftSizeColumn = "ShiftSize_1" 
)

Definition at line 26 of file zerosensitivityloader.cpp.

29 {
30 ore::data::CSVFileReader reader(filename, true);
31 // TODO: Check if all columns in file
32 while (reader.next()) {
33 QuantLib::Real shiftSize = QuantLib::Null<QuantLib::Real>();
34 QuantLib::Real baseNpv = QuantLib::Null<QuantLib::Real>();
35 QuantLib::Real delta = QuantLib::Null<QuantLib::Real>();
36 std::string id = reader.get(idColumn);
37 std::string key = reader.get(riskFactorColumn);
38 std::string currency = reader.get(currencyColumn);
39 bool validNpv = ore::data::tryParseReal(reader.get(baseNpvColumn), baseNpv);
40 bool validDelta = ore::data::tryParseReal(reader.get(deltaColumn), delta);
41 bool validShiftSize = ore::data::tryParseReal(reader.get(shiftSizeColumn), shiftSize);
42 if (validDelta && validNpv && validShiftSize && !QuantLib::close_enough(delta, 0.0)) {
43 sensitivities_[id].push_back({key, delta, currency, baseNpv, shiftSize});
44 }
45 }
46}
std::map< std::string, std::vector< ZeroSensitivity > > sensitivities_
bool tryParseReal(const string &s, QuantLib::Real &result)
+ Here is the call graph for this function:

Member Function Documentation

◆ sensitivities()

std::map< std::string, std::vector< ZeroSensitivity > > sensitivities ( )

Definition at line 48 of file zerosensitivityloader.hpp.

48{ return sensitivities_; }

Member Data Documentation

◆ sensitivities_

std::map<std::string, std::vector<ZeroSensitivity> > sensitivities_
private

Definition at line 51 of file zerosensitivityloader.hpp.