示例#1
0
        public static string eqCurveIRIndex(
            [ExcelArgument(Description = "index id (USDOIS, USDLIB3M, USDLIB1M ")] string ObjectId,
            [ExcelArgument(Description = "currency (USD, GBP, CAD, EUR, JPY ) ")] string Curncy,
            [ExcelArgument(Description = "id or name of discount curve ")] string discountId,
            [ExcelArgument(Description = "trigger ")] object trigger)
        {
            if (ExcelUtil.CallFromWizard())
            {
                return("");
            }

            string callerAddress = ExcelUtil.getActiveCellAddress();

            try
            {
                if (!discountId.Contains('@'))
                {
                    discountId = "CRV@" + discountId;
                }
                EliteQuant.YieldTermStructure curve = OHRepository.Instance.getObject <EliteQuant.YieldTermStructure>(discountId);
                YieldTermStructureHandle      h     = new YieldTermStructureHandle(curve);

                // market defaults
                IborIndex idx_default;
                if (ObjectId == "USDOIS")       //
                {
                    // Eonia and ois shares defaults
                    //idx_default = new Eonia(h);
                    //idx_default = new OvernightIndex("USDOIS", 0, new USDCurrency(), new TARGET(), new Actual360(), h);
                    idx_default = new FedFunds(h);
                }
                else
                {
                    Period tenor = null;
                    switch (ObjectId)
                    {
                    case "USDLIB3M":
                        tenor = new Period(3, TimeUnit.Months);
                        break;

                    case "USDLIB1M":
                        tenor = new Period(1, TimeUnit.Months);
                        break;

                    case "USDLIB6M":
                        tenor = new Period(6, TimeUnit.Months);
                        break;

                    case "USDLIB12M":
                        tenor = new Period(12, TimeUnit.Months);
                        break;
                    }
                    idx_default = new USDLibor(tenor, h);
                }

                // Store the option and return its id
                string id = "IDX@" + ObjectId;
                OHRepository.Instance.storeObject(id, idx_default, callerAddress);
                id += "#" + (String)DateTime.Now.ToString(@"HH:mm:ss");
                return(id);
            }
            catch (Exception e)
            {
                ExcelUtil.logError(callerAddress, System.Reflection.MethodInfo.GetCurrentMethod().Name.ToString(), e.Message);
                return("#EQ_ERR!");
            }
        }
示例#2
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(FedFunds obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
示例#3
0
文件: FedFunds.cs 项目: minikie/test
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(FedFunds obj) {
   return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr;
 }