@@ -17,18 +17,22 @@ struct TarfPathInfo {
1717 double npv;
1818};
1919
20+ enum class FxTradeDirection { kLong , kShort };
21+
2022class TargetRedemptionForward {
2123 public:
22- TargetRedemptionForward (float notional,
23- float target,
24- float strike,
24+ TargetRedemptionForward (double notional,
25+ double target,
26+ double strike,
2527 double end_date_years,
26- double settlement_date_frequency)
28+ double settlement_date_frequency,
29+ FxTradeDirection direction)
2730 : notional_(notional),
2831 target_ (target),
2932 strike_(strike),
3033 end_date_years_(end_date_years),
31- settlement_date_frequency_(settlement_date_frequency) {}
34+ settlement_date_frequency_(settlement_date_frequency),
35+ direction_(direction) {}
3236
3337 // Initial implementation: given a flat volatility and a specified forward,
3438 // price the scenarios using the provided discount curve. (It is up to the
@@ -43,6 +47,9 @@ class TargetRedemptionForward {
4347 // - the distribution of payments (right?)
4448 // - whether it got knocked out, and when
4549
50+ const double direction_multiplier =
51+ (direction_ == FxTradeDirection::kLong ) ? 1.0 : -1.0 ;
52+
4653 double cumulative_profit = 0 .;
4754 double npv = 0 .;
4855
@@ -80,7 +87,8 @@ class TargetRedemptionForward {
8087 fx *= std::exp (drift_term + stoch_term);
8188
8289 if (timesteps_taken == num_timesteps_in_period) {
83- float payment_amount = notional_ * (fx - strike_);
90+ double payment_amount =
91+ direction_multiplier * notional_ * (fx - strike_);
8492
8593 // If we reach the target on this payment date, then the current
8694 // payment is truncated to deliver the exact amount remaining
@@ -130,11 +138,12 @@ class TargetRedemptionForward {
130138 }
131139
132140 private:
133- float notional_;
134- float target_;
135- float strike_;
141+ double notional_;
142+ double target_;
143+ double strike_;
136144 double end_date_years_;
137145 double settlement_date_frequency_;
146+ FxTradeDirection direction_;
138147
139148 // This is set to "mutable" to enable the pricing methods to retain their
140149 // const annotation, while still being able to access the random number
0 commit comments