Exemple #1
0
 public RateCurve(FinCADTable value)
 {
     var array = value.ObjectTable;
     mValues = new Dictionary<decimal, double>();
     for (int i = 0; i < array.GetLength(0); i++)
     {
         mValues.Add((decimal)((double)array[i, 0]), (double)array[i, 1]);
     }
 }
        public GenericTable Calculate(DateTime valueDate, DateTime settleDate, DateTime maturity, decimal coupon, string[] futures) // assume 1m size
        {
            try
            {
                mSettlement = settleDate;
                mValueDate = valueDate;
                
                CreateFuturesStrip(futures);
                
                if (mSettlement < mTEDFutures.First().Maturity)
                {
                    mSettlement = mTEDFutures.First().Maturity;
                }

                CreateCashflows(mSettlement, maturity, coupon);

                mFirstTED = FindFirstTED(mSettlement);
                foreach(var cashflow in mCashflows)
                {
                    DiscountCashflow(cashflow);
                    CalculateWeights(cashflow);
                }

                var strip = new double[mTEDFutures.Length, 1];
                foreach(var future in mTEDFutures)
                {
                    strip[future.No, 0] = mTEDFutures[future.No].Weight;
                }
                var fcTable = new FinCADTable();
                fcTable.FromDoubleArray(strip);
                return new GenericTable { Table = fcTable };
            }
            catch (Exception ex)
            {
                SLog.log.Error("Error calculating ED hedge ratios", ex);
            }
            return null;
        }
 public GenericTable()
 {
     Table = null;
 }
 public DiscountCurve(FinCADTable table)
 {
     Table = table;
 }