Hello :
Im trying to calculate a volatility using Interop.AdfinXAnalytics with one of the exercise in the developer's book in c#
When i try to Attach the Volatility to the Asset object
i get the following error:
System.Runtime.InteropServices.COMException: 'Undefined error : missing or invalid resource'
i can't figure out my mistake, the code was written originally in vba so i re write the code to c#
can anyone help me out
EikonDesktopDataAPI.EikonDesktopDataAPI sdk; IAdxOption Option ; Option = sdk.CreateAdxOption();// new AdxOption(); IAdxAsset Asset; //AdxAsset Asset; Asset = sdk.CreateAdxAsset();//new AdxAsset(); IAdxRateModel RateModel; RateModel = sdk.CreateAdxRateModel();//new AdxRateModel(); IAdxVolatilityModel VolatilityModel; VolatilityModel = sdk.CreateAdxVolatilityModel();//= new AdxVolatilityModel(); IAdxCalcMethod CalcMethod;// AdxCalcMethod CalcMethod = sdk.CreateAdxCalcMethod();//new AdxCalcMethod(); string OptionStructure; string UnderlyingStructure; string RateStructure; string CalcStructure; string CalcDate; double SpotPrice; double Volatility; double RiskFreeRate; string ExpiryDate; double StrikePrice; double Premium; //Set Asset attributes and parameters SpotPrice = 134; UnderlyingStructure = "UI:SEC"; Asset.Init(UnderlyingStructure); Asset.SetAttribute (AdxAttrAsset.ADX_ATTR1F_ASSET_PRICE, SpotPrice); //Set VolatilityModel attributes VolatilityModel.ErrorMode = AdfinXAnalyticsObjects.AdxErrorMode.DIALOGBOX; Volatility = 0.18; VolatilityModel.Init("IM:CUBS"); VolatilityModel.SetAttribute(AdxAttrVolatilityModel.ADX_ATTR1R_VOLATILITY, Volatility); //ERROR (1) //Attach the Volatility to the Asset object Asset.AttachModel(40965,VolatilityModel); //AdxAttrAsset.ADX_PTR_MODEL_DIVIDEND