public void GenerateCashFlows(DateTime creationDate)
        {
            BusinessDay date = Calendar.GetClosestBusinessDay(StartDate, TimeSeries.DateSearchType.Previous);
            BusinessDay end  = Calendar.GetClosestBusinessDay(EndDate, TimeSeries.DateSearchType.Next);

            BusinessDay expiryDate = date;

            for (int i = 1; expiryDate.DateTime <= end.DateTime; i++)
            {
                switch (Frequency)
                {
                case InterestRateTenorType.Daily:
                    expiryDate = date.AddActualDays(i, TimeSeries.DateSearchType.Next);
                    break;

                case InterestRateTenorType.Weekly:
                    expiryDate = date.AddActualDays(7 * i, TimeSeries.DateSearchType.Next);
                    break;

                case InterestRateTenorType.Monthly:
                    expiryDate = date.AddMonths(i, TimeSeries.DateSearchType.Next);
                    break;

                case InterestRateTenorType.Yearly:
                    expiryDate = date.AddYears(i, TimeSeries.DateSearchType.Next);
                    break;

                default:
                    break;
                }

                CashFlow cf = CashFlow.CreateCashFlow(Name + "-" + expiryDate, Currency, Calendar.GetBusinessDay(creationDate), Amount, expiryDate, this, SimulationObject);
                this.AddCashFlow(cf, creationDate);

                //date = expiryDate;
            }
        }
 public void AddCashFlow(CashFlow cashFlow, DateTime date)
 {
     this.AddInstrument(cashFlow, date);
     this.Portfolio.CreatePosition(cashFlow, date, 1.0, cashFlow.NPV(Calendar.GetBusinessDay(date)));
 }