public static string eqOpRootPath( [ExcelArgument(Description = "Method 1 or 2 ")] double method) { if (ExcelUtil.CallFromWizard()) { return(""); } string callerAddress = ""; callerAddress = ExcelUtil.getActiveCellAddress(); OHRepository.Instance.removeErrorMessage(callerAddress); try { if (method == 1.0) { return(getXllPath()); } else { return(EliteQuant.ConfigManager.Instance.RootDir); } } catch (Exception e) { ExcelUtil.logError(callerAddress, System.Reflection.MethodInfo.GetCurrentMethod().Name.ToString(), e.Message); return(""); } }
public static object eqInstCommodityFuture( [ExcelArgument(Description = "id of instrument ")] string ObjectId, [ExcelArgument(Description = "name of instrument ")] string name, // given by user, could be the same as objectid [ExcelArgument(Description = "buy/sell (1/-1) ")] int buysell, [ExcelArgument(Description = "trade price ")] double tradePrice, [ExcelArgument(Description = "trade quantity ")] double quantity, [ExcelArgument(Description = "start date ")] DateTime startdate, [ExcelArgument(Description = "end date ")] DateTime enddate, [ExcelArgument(Description = "id of commodity index ")] string indexid, [ExcelArgument(Description = "id of discount curve ")] string discountId, [ExcelArgument(Description = "trigger ")] object trigger) { if (ExcelUtil.CallFromWizard()) { return(""); } string callerAddress = ""; callerAddress = ExcelUtil.getActiveCellAddress(); try { Xl.Range rng = ExcelUtil.getActiveCellRange(); CommodityIndexExt idx = OHRepository.Instance.getObject <CommodityIndexExt>(indexid); YieldTermStructureHandle discountcurve = OHRepository.Instance.getObject <YieldTermStructureHandle>(discountId); Date refDate = discountcurve.referenceDate(); EliteQuant.Date sd = EliteQuant.EQConverter.ConvertObject <EliteQuant.Date>(startdate); EliteQuant.Date ed = EliteQuant.EQConverter.ConvertObject <EliteQuant.Date>(enddate); PricingPeriodExt pp = new PricingPeriodExt(sd, ed, sd, quantity); // pay at start date EnergyFutureExt ef = new EnergyFutureExt(buysell, pp, tradePrice, idx, name, discountcurve); // Store the futures and return its id string id = "Fut@" + ObjectId; OHRepository.Instance.storeObject(id, ef, 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 static object eqInstSaveIRSwapToDisk( [ExcelArgument(Description = "id of IR Swap ")] string tradeid, [ExcelArgument(Description = "trigger ")] object trigger) { if (ExcelUtil.CallFromWizard()) { return(""); } string callerAddress = ""; callerAddress = ExcelUtil.getActiveCellAddress(); try { Xl.Range rng = ExcelUtil.getActiveCellRange(); string genswaptplid_ = tradeid; if (!genswaptplid_.Contains('@')) { genswaptplid_ = "SWP@" + genswaptplid_; } if (!genswaptplid_.Contains("_TPL")) { genswaptplid_ = genswaptplid_ + "_TPL"; } EliteQuant.Instruments.InterestRateGenericSwap genswaptpl = OHRepository.Instance.getObject <EliteQuant.Instruments.InterestRateGenericSwap>(genswaptplid_); string path = EliteQuant.ConfigManager.Instance.IRRootDir + @"Trades\"; EliteQuant.Instruments.InterestRateGenericSwap.Serialize(genswaptpl, path + tradeid + ".xml"); return(tradeid); } catch (Exception e) { ExcelUtil.logError(callerAddress, System.Reflection.MethodInfo.GetCurrentMethod().Name.ToString(), e.Message); return("#EQ_ERR!"); } }
public static string eqOpVersion() { if (ExcelUtil.CallFromWizard()) { return(""); } string callerAddress = ""; callerAddress = ExcelUtil.getActiveCellAddress(); OHRepository.Instance.removeErrorMessage(callerAddress); try { return(getVerStr()); } catch (Exception exception_) { ExcelUtil.logError(callerAddress, System.Reflection.MethodInfo.GetCurrentMethod().Name.ToString(), exception_.Message); return(""); } }