private static PricingStructureAlgorithmsHolder GenerateHolder(ILogger logger, ICoreCache cache, String nameSpace, NamedValueSet properties) { var pricingStructureId = new CommodityCurveIdentifier(properties); var holder = new PricingStructureAlgorithmsHolder(logger, cache, nameSpace, pricingStructureId.PricingStructureType, pricingStructureId.Algorithm); return(holder); }
/// <summary> /// Creates the pricing structure. /// </summary> protected void CreatePricingStructure(CommodityCurveIdentifier curveId, TermCurve termCurve, IEnumerable <IPriceableCommodityAssetController> priceableCommodityAssets, IEnumerable <IPriceableCommoditySpreadAssetController> priceableCommoditySpreadAssets) { FxRateSet quotedAssetSet = priceableCommodityAssets != null?PriceableAssetFactory.Parse(priceableCommodityAssets, priceableCommoditySpreadAssets) : null; CreatePricingStructure(curveId, termCurve, quotedAssetSet); }
/// <summary> /// Creates the pricing structure. /// </summary> protected void CreatePricingStructure(CommodityCurveIdentifier curveId, TermCurve termCurve, FxRateSet quotedAssetSet) { FpML.V5r10.Reporting.FxCurve yieldCurve = CreateCommodityCurve(curveId); FxCurveValuation yieldCurveValuation = CreateCommodiyCurveValuation(curveId, quotedAssetSet, yieldCurve.id, termCurve); var fpmlData = new Pair <PricingStructure, PricingStructureValuation>(yieldCurve, yieldCurveValuation); SetFpMLData(fpmlData, false); }
/// <summary> /// Creates the yield curve. /// </summary> /// <param name="curveId">The curve id.</param> /// <returns></returns> protected static FpML.V5r10.Reporting.FxCurve CreateCommodityCurve(CommodityCurveIdentifier curveId) { var yieldCurve = new FpML.V5r10.Reporting.FxCurve { id = curveId.Id, name = curveId.CurveName, currency = curveId.Currency, }; return(yieldCurve); }
/// <summary> /// Initializes a new instance of the <see cref="CommodityCurve"/> class. /// </summary> /// <param name="logger">The logger.</param> /// <param name="cache">The cache.</param> /// <param name="nameSpace">The nameSpace</param> /// <param name="properties">The properties.</param> /// <param name="assetSet">The assetSet.</param> /// <param name="fixingCalendar">The fixingCalendar.</param> /// <param name="rollCalendar">The rollCalendar.</param> /// <param name="tolerance">The tolerance for the solver.</param> public CommodityCurve(ILogger logger, ICoreCache cache, string nameSpace, NamedValueSet properties, FxRateSet assetSet, IBusinessCalendar fixingCalendar, IBusinessCalendar rollCalendar, double tolerance) { PricingStructureData = new PricingStructureData(CurveType.Parent, AssetClass.Commodity, properties); var curveId = new CommodityCurveIdentifier(properties); PricingStructureIdentifier = curveId; Holder = new PricingStructureAlgorithmsHolder(logger, cache, nameSpace, curveId.PricingStructureType, curveId.Algorithm); // Get algo name from the properties // Algorithm = properties.GetValue <string>("Algorithm", true); InitialiseInstance(logger, cache, nameSpace, curveId, curveId.BaseDate, assetSet, fixingCalendar, rollCalendar, tolerance); }
public void PricingStructureIdTestWithProperties13() { var props = new NamedValueSet(); props.Set(CurveProp.PricingStructureType, "CommodityCurve"); props.Set(CurveProp.CurveName, "AUD-USD"); props.Set("BuildDateTime", _baseDate); props.Set(CurveProp.BaseDate, _baseDate); props.Set("Algorithm", "Default"); props.Set("Identifier", "Alex"); props.Set("CommodityAsset", "Wheat"); var curveId = new CommodityCurveIdentifier(props); Debug.Print("RateCurveIdentifier : {0} BuildDateTime : {1} CurveName : {2} PricingStructureType : {3} Algorithm : {4}Currency : {5} BaseDate : {6} CommodityAsset : {7} Domain : {8} SourceSystem : {9} UniqueId : {10} Market : {11}", curveId.Id, curveId.BuildDateTime, curveId.CurveName, curveId.PricingStructureType, curveId.Algorithm, curveId.Currency.Value, curveId.BaseDate, curveId.CommodityAsset, curveId.Domain, curveId.SourceSystem, curveId.UniqueIdentifier, curveId.Market); }
//Clones a curve, maps the quoted assets specified and then returns an FpML structure back. // /// <summary> /// /// </summary> /// <param name="logger"></param> /// <param name="cache"></param> /// <param name="nameSpace"></param> /// <param name="referenceCurve"></param> /// <param name="spreadValues"></param> /// <param name="properties"></param> /// <param name="calendar"></param> /// <returns></returns> public static Pair <PricingStructure, PricingStructureValuation> ProcessQuotedAssetSet(ILogger logger, ICoreCache cache, string nameSpace, ICommodityCurve referenceCurve, FxRateSet spreadValues, NamedValueSet properties, IBusinessCalendar calendar) { var identifier = new CommodityCurveIdentifier(properties); //Clone the ref curves. // Pair <PricingStructure, PricingStructureValuation> fpml = CloneCurve(referenceCurve.GetFpMLData(), identifier.UniqueIdentifier); if (identifier.PricingStructureType != PricingStructureTypeEnum.CommoditySpreadCurve) { var ycvCurveCloned = (FxCurveValuation)fpml.Second; // assign id to the cloned YieldCurve // ycvCurveCloned.fxForwardCurve.point = null; ycvCurveCloned.fxForwardCurve = null; //Manipulate the quated asset set. ycvCurveCloned.spotRate = MappedQuotedAssetSet(logger, cache, nameSpace, referenceCurve, spreadValues, properties, calendar); } return(fpml); }
/// <summary> /// /// </summary> /// <param name="properties">The properties.</param> /// <param name="algorithmHolder">The algorithmHolder.</param> public CommodityCurve(NamedValueSet properties, PricingStructureAlgorithmsHolder algorithmHolder) { PricingStructureData = new PricingStructureData(CurveType.Parent, AssetClass.Commodity, properties); PricingStructureIdentifier = new CommodityCurveIdentifier(properties); Initialize(properties, algorithmHolder); }