public RelinkableCommodityCurveExtHandle(CommodityCurveExt arg0) : this(NQuantLibcPINVOKE.new_RelinkableCommodityCurveExtHandle__SWIG_0(CommodityCurveExt.getCPtr(arg0)), true) { if (NQuantLibcPINVOKE.SWIGPendingException.Pending) { throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve(); } }
public static string eqCurveCommodIndex( [ExcelArgument(Description = "index id ")] string ObjectId, [ExcelArgument(Description = "index name ")] string indexname, [ExcelArgument(Description = "curve id ")] string curveId, [ExcelArgument(Description = "calendar")] string calendar, [ExcelArgument(Description = "trigger ")] object trigger) { if (ExcelUtil.CallFromWizard()) { return(""); } string callerAddress = ExcelUtil.getActiveCellAddress(); try { calendar = "NULL"; CommodityCurveExt curve = OHRepository.Instance.getObject <CommodityCurveExt>(curveId); CommodityIndexExt idx = new CommodityIndexExt(indexname, curve, new NullCalendar()); // Store the index and return its id string id = "IDX@" + ObjectId; OHRepository.Instance.storeObject(id, idx, 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!"); } }
public CommodityIndexExt(string name, CommodityCurveExt forwardCurve, Calendar calendar) : this(NQuantLibcPINVOKE.new_CommodityIndexExt__SWIG_0(name, CommodityCurveExt.getCPtr(forwardCurve), Calendar.getCPtr(calendar)), true) { if (NQuantLibcPINVOKE.SWIGPendingException.Pending) { throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve(); } }
public void linkTo(CommodityCurveExt arg0) { NQuantLibcPINVOKE.RelinkableCommodityCurveExtHandle_linkTo(swigCPtr, CommodityCurveExt.getCPtr(arg0)); if (NQuantLibcPINVOKE.SWIGPendingException.Pending) { throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve(); } }
public void setForwardCurve(CommodityCurveExt forwardCurve) { NQuantLibcPINVOKE.CommodityIndexExt_setForwardCurve(swigCPtr, CommodityCurveExt.getCPtr(forwardCurve)); if (NQuantLibcPINVOKE.SWIGPendingException.Pending) { throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve(); } }
public static string eqCurveCommodForwardsCurve( [ExcelArgument(Description = "curve id ")] string ObjectId, [ExcelArgument(Description = "curve name (eg. commod ng exchange) ")] string curvename, [ExcelArgument(Description = "tenors ")] object[] dates, [ExcelArgument(Description = "quotes ")] double[] quotes, [ExcelArgument(Description = "calendar ")] string calendar, [ExcelArgument(Description = "day counter ")] string daycounter, [ExcelArgument(Description = "trigger ")] object trigger) { if (ExcelUtil.CallFromWizard()) { return(""); } string callerAddress = ExcelUtil.getActiveCellAddress(); try { calendar = "NULL"; daycounter = "Actual365Fixed"; if (dates.Length != quotes.Length) { return("size mismatch"); } DateVector datesvector = new DateVector(dates.Length); DoubleVector quotesvector = new DoubleVector(dates.Length); for (int i = 0; i < dates.Length; i++) { if ((ExcelUtil.isNull(dates[i])) || (quotes[i] == 0)) { continue; } //datesvector.Add(Conversion.ConvertObject<Date>((DateTime)dates[i], "NA")); datesvector.Add(new Date(Convert.ToInt32(dates[i]))); quotesvector.Add(quotes[i]); } CommodityCurveExt curve = new CommodityCurveExt(curvename, datesvector, quotesvector, new NullCalendar(), new Actual365Fixed()); // Store the curve and return its id string id = "CRV@" + ObjectId; OHRepository.Instance.storeObject(id, curve, 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!"); } }
public CommodityCurveExt __deref__() { CommodityCurveExt ret = new CommodityCurveExt(NQuantLibcPINVOKE.CommodityCurveExtHandle___deref__(swigCPtr), true); if (NQuantLibcPINVOKE.SWIGPendingException.Pending) { throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public static object eqCurveCommodDisplayForwardsCurve( [ExcelArgument(Description = "curve id ")] string ObjectId, [ExcelArgument(Description = "trigger ")] object trigger) { if (ExcelUtil.CallFromWizard()) { return(""); } string callerAddress = ExcelUtil.getActiveCellAddress(); try { if (!ObjectId.Contains('@')) { ObjectId = "CRV@" + ObjectId; } CommodityCurveExt curve = OHRepository.Instance.getObject <CommodityCurveExt>(ObjectId); DateVector dts = curve.dates(); DoubleVector pts = curve.prices(); double[,] ret = new double[dts.Count, 2]; for (int i = 0; i < dts.Count; i++) { ret[i, 0] = dts[i].serialNumber(); ret[i, 1] = pts[i]; } return(ret); } catch (Exception e) { ExcelUtil.logError(callerAddress, System.Reflection.MethodInfo.GetCurrentMethod().Name.ToString(), e.Message); return("#EQ_ERR!"); } }
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(CommodityCurveExt obj) { return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr); }