Inconsistent settlement-date vs. evaluation-date anchoring for discrete dividends in `BinomialConvertibleEngine`
Issue A — dividendValues_ sizing/indexing bug
In the DiscretizedConvertible constructor, dividendValues_ is sized to dividends_.size(), the subset filtered on arguments_.settlementDate. But it's populated by looping over the original, unfiltered dividends vector with a different cutoff (process_->riskFreeRate()->referenceDate()), writing to dividendValues_[i] using the unfiltered index. If any dividend predates arguments_.settlementDate, later indices go out of bounds.
Repro: price via BinomialConvertibleEngine with settlementDays > 0 and a dividend schedule spanning the settlement date.
Fix: derive dividendValues_ from the already-filtered dividends_/dividendDates_, not a second pass over the raw list.
Issue B — evaluation-date vs. settlement-date gap in the dividend spot adjustment
In BinomialConvertibleEngine<T>::calculate(), we subtract future dividends from s0 using referenceDate = process_->riskFreeRate()->referenceDate() (~evaluation date) as cutoff. But the tree/lattice and all of DiscretizedConvertible's dividend/coupon/callability times are anchored at arguments_.settlementDate (evaluation date + settlementDays).
For a dividend falling strictly between the evaluation date and settlement date: it gets subtracted from s0 (evaluation-date cutoff) but is excluded from the tree's "add back" logic (adjustedGrid()), since relative to settlement it's already occurred. Net effect: that dividend's value silently vanishes from the price. Fixing this is a design decision (how to roll the spot forward across the settlement lag), not a one-line patch.
Source: lballabio/QuantLib