///<summary> ///</summary> ///<param name="description"></param> ///<param name="priceableAsset"></param> public MarketInstrument(string description, IPriceableAssetController priceableAsset) { Identifier = priceableAsset.Id; Description = description; PriceableAsset = priceableAsset; Calculated = false; }
public NewtonRaphsonSolverFunctions(IPriceableAssetController asset, IPriceableAssetController previousAsset, PricingStructureAlgorithmsHolder algorithmHolder, IRateCurve baseCurve, DateTime baseDate, SortedDictionary <DateTime, Pair <string, decimal> > items, double compoundingPeriod, IDictionary <DateTime, double> zeroRateSpreads, IDayCounter dayCounter, List <DateTime> assetDates) { _asset = asset; _baseCurve = baseCurve; _zeroRateSpreads = zeroRateSpreads; string currency = PropertyHelper.ExtractCurrency(baseCurve.GetPricingStructureId().Properties); _algorithm = algorithmHolder; _properties = new NamedValueSet(new Dictionary <string, object> { { CurveProp.PricingStructureType, "RateCurve" }, { CurveProp.Market, "DiscountCurveConstruction" }, { CurveProp.IndexTenor, "0M" }, { CurveProp.Currency1, currency }, { "Index", "XXX-XXX" }, { "Algorithm", "FastLinearZero" }, { "BaseDate", baseDate }, }); _items = items; _compoundingPeriod = compoundingPeriod; _dayCounter = dayCounter; _assetDates = assetDates; if (previousAsset != null) { DateTime previousAssetMaturity = previousAsset.GetRiskMaturityDate(); DateTime assetMaturity = asset.GetRiskMaturityDate(); IEnumerable <KeyValuePair <DateTime, string> > points = from b in baseCurve.GetTermCurve().point where (DateTime)b.term.Items[0] > previousAssetMaturity && (DateTime)b.term.Items[0] < assetMaturity select new KeyValuePair <DateTime, string>((DateTime)b.term.Items[0], b.id); foreach (KeyValuePair <DateTime, string> point in points) { _extraPoints.Add(point.Key, point.Value); Pair <string, decimal> pair = new Pair <string, decimal>(point.Value, 0); items.Add(point.Key, pair); } } }
static public void ProcessAssetControllerResults(IPriceableAssetController assetController, string[] metrics, DateTime baseDate) { Assert.IsNotNull(assetController); Double[] times = { 0, 1, 5 }; Double[] dfs = { 1, 0.9, 0.3 }; ISimpleRateMarketEnvironment market = CreateSimpleRateMarketEnvironment(baseDate, times, dfs); IAssetControllerData controllerData = CreateModelData(metrics, baseDate, market); Assert.IsNotNull(controllerData); Assert.AreEqual(controllerData.BasicAssetValuation.quote.Length, metrics.Length); Assert.AreEqual(controllerData.BasicAssetValuation.quote[0].measureType.Value, metrics[0]); BasicAssetValuation results = assetController.Calculate(controllerData); Debug.Print("Id : {0}", assetController.Id); foreach (var metric in results.quote) { Debug.Print("Id : {0} Metric Name : {1} Metric Value : {2}", assetController.Id, metric.measureType.Value, metric.value); } }
private static bool IsSpreadAsset(IPriceableAssetController priceableAsset) { return(priceableAsset is PriceableSimpleCommoditySpreadAsset); }
private static bool IsSpreadAsset(IPriceableAssetController priceableAsset) { return(priceableAsset is PriceableBasisSwap || priceableAsset is PriceableSimpleRateSpreadAsset); }