Skip to content

Commit 8e1bf69

Browse files
author
jenkins
committed
git subrepo pull (merge) ore
subrepo: subdir: "ore" merged: "e1cc79a4cf" upstream: origin: "git@gitlab.acadiasoft.net:qs/ore.git" branch: "master" commit: "a541f326b9" git-subrepo: version: "0.4.6" origin: "https://github.com/ingydotnet/git-subrepo" commit: "73a0129"
2 parents 4d7685b + a541f32 commit 8e1bf69

4 files changed

Lines changed: 18 additions & 11 deletions

File tree

OREAnalytics/orea/cube/sensitivitycube.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ Real SensitivityCube::delta(const Size tradeIdx, const RiskFactorKey& riskFactor
225225
return (cube_->get(tradeIdx, fd.index) - cube_->getT0(tradeIdx, 0)) * scaling(fd);
226226
} else if (s->second == ShiftScheme::Backward) {
227227
auto fd = index(riskFactorKey, downFactors_);
228-
return cube_->getT0(tradeIdx, 0) - cube_->get(tradeIdx, fd.index) * scaling(fd);
228+
return (cube_->getT0(tradeIdx, 0) - cube_->get(tradeIdx, fd.index)) * scaling(fd);
229229
} else if (s->second == ShiftScheme::Central) {
230230
auto fdup = index(riskFactorKey, upFactors_);
231231
auto fddown = index(riskFactorKey, downFactors_);

OREData/ored/configuration/yieldcurveconfig.hpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,10 +122,6 @@ class YieldCurveSegment : public XMLSerializable {
122122
//! Utility to build a quote, optional flag defaults to false
123123
pair<string, bool> quote(const string& name, bool opt = false) { return make_pair(name, opt); }
124124

125-
//! Utility method to read quotes from XML
126-
void loadQuotesFromXML(XMLNode* node);
127-
//! Utility method to write quotes to XML
128-
129125
private:
130126
// TODO: why type and typeID?
131127
Type type_;

QuantExt/qle/math/openclenvironment.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -906,14 +906,14 @@ void OpenClContext::finalizeCalculation(std::vector<double*>& output, const Sett
906906
QL_REQUIRE(err == CL_SUCCESS,
907907
"OpenClContext::finalizeCalculation(): writing to output buffer fails: " << errorText(err));
908908
}
909-
// copy from float to double
910-
for (std::size_t i = 0; i < output.size(); ++i) {
911-
std::copy(outputFloat[i].begin(), outputFloat[i].end(), output[i]);
912-
}
913909
err = clWaitForEvents(outputBufferEvents.size(), outputBufferEvents.empty() ? nullptr : &outputBufferEvents[0]);
914910
QL_REQUIRE(
915911
err == CL_SUCCESS,
916912
"OpenClContext::finalizeCalculation(): wait for output buffer events to finish fails: " << errorText(err));
913+
// copy from float to double
914+
for (std::size_t i = 0; i < output.size(); ++i) {
915+
std::copy(outputFloat[i].begin(), outputFloat[i].end(), output[i]);
916+
}
917917
}
918918

919919
if (debug_) {

QuantExt/qle/pricingengines/fddefaultableequityjumpdiffusionconvertiblebondengine.cpp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,12 @@ void FdDefaultableEquityJumpDiffusionConvertibleBondEngine::calculate() const {
516516
cr = events.getCallData(i).mwCr(S[j], cr0);
517517
// compuate forced conversion value and update npv node
518518
Real forcedConversionValue = S[j] * cr * notional(grid[i]) / N0 + accrual(grid[i]);
519+
if (forcedConversionValue > c && forcedConversionValue < value[plane][j]) {
520+
// conversion is forced -> update flags
521+
if (!conversionIndicator.empty())
522+
conversionIndicator[plane][j] = 0.0;
523+
conversionExercised[plane][j] = false;
524+
}
519525
value[plane][j] = std::min(std::max(forcedConversionValue, c), value[plane][j]);
520526
if (!valueNoConversion.empty()) {
521527
valueNoConversion[plane][j] =
@@ -529,8 +535,13 @@ void FdDefaultableEquityJumpDiffusionConvertibleBondEngine::calculate() const {
529535
if (events.hasPut(i)) {
530536
Real c = getCallPriceAmount(events.getPutData(i), notional(t_from), accrual(t_from));
531537
for (Size j = 0; j < n; ++j) {
532-
if (!conversionExercised[plane][j])
533-
value[plane][j] = std::max(c, value[plane][j]);
538+
if (c > value[plane][j]) {
539+
// put is more favorable than conversion (if that happened above)
540+
value[plane][j] = c;
541+
if (!conversionIndicator.empty())
542+
conversionIndicator[plane][j] = 0.0;
543+
conversionExercised[plane][j] = false;
544+
}
534545
}
535546
if (!valueNoConversion.empty()) {
536547
for (Size j = 0; j < n; ++j) {

0 commit comments

Comments
 (0)