private static void ShortGbpEurExample(DateTime todaysDate) { var deliveryDate = new DateTime(2020, 3, 11); var baseNotionalAmount = new Money(40300000m, Currency.GBP); var contractAllInRate = new ExchangeRate(Currency.GBP, Currency.EUR, 1.16992588519517); var fxFwd = new ForeignExchangeForward(deliveryDate, baseNotionalAmount, contractAllInRate); Console.WriteLine("Valuation of FxFwd " + fxFwd); ExchangeRate spotBaseTermRate = ExchangeRateManager.Lookup(Currency.GBP, Currency.EUR, todaysDate); var termBaseFwdCurve = EurGbpFwdPointStructure(todaysDate); var baseTermFwdCurve = GbpEurFwdPointStructure(todaysDate); var termDiscountCurve = DiscountingEurCurve(todaysDate); var baseDiscountCurve = DiscountingGbpCurve(todaysDate); fxFwd.PricingEngine = new ForwardPointsEngine(spotBaseTermRate, baseTermFwdCurve, baseDiscountCurve, termDiscountCurve); PrintResults(fxFwd); // Base Leg: 47,148,013.17 EUR // Term Leg: -46,843,587.57 EUR // ---------------------------- // NPV: 304,425.60 EUR // ============================ }
private static void ShortUsdEurExample(DateTime todaysDate) { var deliveryDate = new DateTime(2020, 3, 4); var baseNotionalAmount = new Money(12925000m, Currency.USD); var contractAllInRate = new ExchangeRate(Currency.USD, Currency.EUR, 0.897487215294618); var fxFwd = new ForeignExchangeForward(deliveryDate, baseNotionalAmount, contractAllInRate); Console.WriteLine("Valuation of FxFwd " + fxFwd); ExchangeRate spotUsdEurRate = ExchangeRateManager.Lookup(Currency.USD, Currency.EUR, todaysDate); var usdEurFwdCurve = UsdEurFwdPointStructure(todaysDate); var eurDiscountCurve = DiscountingEurCurve(todaysDate); var usdDiscountCurve = DiscountingUsdCurve(todaysDate); fxFwd.PricingEngine = new ForwardPointsEngine(spotUsdEurRate, usdEurFwdCurve, usdDiscountCurve, eurDiscountCurve); PrintResults(fxFwd); // Base Leg: 11,600,022.36 EUR // Term Leg: -11,762,835.05 EUR // ---------------------------- // NPV: -162,812.69 EUR // ============================ }
private static void LongGbpEurExample(DateTime todaysDate) { var deliveryDate = new DateTime(2020, 5, 28); var baseNotionalAmount = new Money(16925000m, Currency.GBP); var contractAllInRate = new ExchangeRate(Currency.GBP, Currency.EUR, 1.19394431443717); var fxFwd = new ForeignExchangeForward(deliveryDate, baseNotionalAmount, contractAllInRate); Console.WriteLine("Valuation of FxFwd " + fxFwd); ExchangeRate spotBaseTermRate = ExchangeRateManager.Lookup(Currency.GBP, Currency.EUR, todaysDate); var termBaseFwdCurve = EurGbpFwdPointStructure(todaysDate); var baseTermFwdCurve = GbpEurFwdPointStructure(todaysDate); var termDiscountCurve = DiscountingEurCurve(todaysDate); var baseDiscountCurve = DiscountingGbpCurve(todaysDate); fxFwd.PricingEngine = new ForwardPointsEngine(spotBaseTermRate, baseTermFwdCurve, baseDiscountCurve, termDiscountCurve); PrintResults(fxFwd); // Base Leg: 20,207,507.52 EUR // Term Leg: -19,621,824.42 EUR // ---------------------------- // NPV: 585,683.10 EUR // ============================ }
private static void LongUsdEurExample(DateTime todaysDate) { var deliveryDate = new DateTime(2020, 5, 28); var baseNotionalAmount = new Money(24750000m, Currency.USD); var contractAllInRate = new ExchangeRate(Currency.USD, Currency.EUR, 0.919214806712107); var fxFwd = new ForeignExchangeForward(deliveryDate, baseNotionalAmount, contractAllInRate); Console.WriteLine("Valuation of FxFwd " + fxFwd); ExchangeRate spotUsdEurRate = ExchangeRateManager.Lookup(Currency.USD, Currency.EUR, todaysDate); var eurUsdFwdCurve = EurUsdFwdPointStructure(todaysDate); var usdEurFwdCurve = UsdEurFwdPointStructure(todaysDate); var eurDiscountCurve = DiscountingEurCurve(todaysDate); var usdDiscountCurve = DiscountingUsdCurve(todaysDate); fxFwd.PricingEngine = new ForwardPointsEngine(spotUsdEurRate, usdEurFwdCurve, usdDiscountCurve, eurDiscountCurve); PrintResults(fxFwd); // Base Leg: 22,750,566.47 EUR // Term Leg: -22,412,996.84 EUR // ---------------------------- // NPV: 337,569.62 EUR // ============================ }
private static FxForwardPointTermStructure UsdEurFwdPointStructure(DateTime todaysDate) { ExchangeRate spotExchRate = ExchangeRateManager.Lookup(Currency.USD, Currency.EUR, todaysDate); if (spotExchRate.BaseCurrency != Currency.USD) { spotExchRate = spotExchRate.Inverse(); } var builder = new FxForwardPointTermStructure.Builder(todaysDate, spotExchRate) { BaseCalendar = CalendarName.UnitedStatesFederalReserve, QuoteCalendar = CalendarName.TARGET, DayCounter = DayCounter.Actual360, ForwardPoints = new[]