37 const string& currency)
38 : cubes_(cubes), currency_(currency), canComputeGamma_(false) {
43 for (
const auto& cube :
cubes_) {
44 const auto& upFactors = cube->upFactors();
45 const auto& downFactors = cube->downFactors();
46 if (upFactors.size() == downFactors.size() &&
47 equal(upFactors.begin(), upFactors.end(), downFactors.begin(),
48 [](
const auto& a,
const auto& b) { return a.first == b.first; }))
90 sr.
shift_1 = fd.targetShiftSize;
95 sr.
gamma = Null<Real>();
100 sr.
desc_1 = std::get<0>(fd).factorDesc;
101 sr.
shift_1 = std::get<0>(fd).targetShiftSize;
103 sr.
desc_2 = std::get<1>(fd).factorDesc;
104 sr.
shift_2 = std::get<1>(fd).targetShiftSize;
109 TLOG(
"Next record is: " << sr);
131 std::get<1>(
data).index, std::get<2>(
data), 1.0, 1.0),
SensitivityCube is a wrapper for an npvCube that gives easier access to the underlying cube elements.
std::pair< RiskFactorKey, RiskFactorKey > crossPair
SensitivityCubeStream(const QuantLib::ext::shared_ptr< SensitivityCube > &cube, const std::string ¤cy)
std::string currency_
Currency of the sensitivities in the SensitivityCubes.
std::set< std::pair< RiskFactorKey, RiskFactorKey > > currentCrossGammaKeys_
std::map< std::string, QuantLib::Size >::const_iterator tradeIdx_
Current trade iterator.
std::set< RiskFactorKey >::const_iterator currentDeltaKey_
std::vector< QuantLib::ext::shared_ptr< SensitivityCube > > cubes_
Handle on the SensitivityCubes.
bool canComputeGamma_
Can only compute gamma if the up and down risk factors align.
std::set< std::pair< RiskFactorKey, RiskFactorKey > >::const_iterator currentCrossGammaKey_
std::set< RiskFactorKey > currentDeltaKeys_
Current delta risk factor keys to process and iterators.
Size currentCubeIdx_
Current cube index in vector.
void reset() override
Resets the stream so that SensitivityRecord objects can be streamed again.
SensitivityRecord next() override
Filter close_enough(const RandomVariable &x, const RandomVariable &y)
Filter equal(Filter x, const Filter &y)
SensitivityCube::crossPair crossPair
Class for streaming SensitivityRecords from a SensitivityCube.
Shift scenario generation.