Guest User

Untitled

a guest
Jul 19th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. //Calculate Floating Rate cashflow
  2. private double CalculateFRA(int index, double notional, double fixedRate,
  3. double currentResetRate, double currentPeriod,
  4. double frequencyInYear,
  5. IDictionary<double, double> floatingRates)
  6. {
  7. //Two Steps
  8. //Step 1: Find appropriate forward rate converted into target compounding
  9.  
  10. //except for first period
  11. //Step 2: Calculate Floating Rate cashflow from Notional and Calculated Rate
  12.  
  13. //for first period: //remember for first period, we always take the reset rate
  14.  
  15. //and calculate floating rate cashflow
  16. //therefore initialise with floating cashflow
  17. var currentRate = floatingRates[currentPeriod];
  18.  
  19. var targetRate = currentResetRate;
  20. if (index > 0)
  21. {
  22. targetRate = GetForwardRate(index, frequencyInYear, floatingRates);
  23. }
  24. //step 2: // Present value Of Fixed - Float Payment
  25. var fraPrice = notional * (fixedRate-targetRate) * frequencyInYear;
  26. var discountedFraPrice = CalculatePresentValueOfPayment(fraPrice, currentPeriod,
  27.  
  28. currentRate);
  29. return discountedFraPrice;
  30. }
Add Comment
Please, Sign In to add comment