Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FxCurve"/> class.
        /// </summary>
        /// <param name="logger">The logger.</param>
        /// <param name="cache">The cache.</param>
        /// <param name="nameSpace">THe client namespace</param>
        /// <param name="fpmlData">The FPML data.</param>
        /// <param name="properties">The properties.</param>
        /// <param name="fixingCalendar">The fixingCalendar.</param>
        /// <param name="rollCalendar">The rollCalendar.</param>
        public EquityCurve(ILogger logger, ICoreCache cache, string nameSpace,
                           Pair <PricingStructure, PricingStructureValuation> fpmlData, NamedValueSet properties,
                           IBusinessCalendar fixingCalendar, IBusinessCalendar rollCalendar)
            : base(logger, cache, nameSpace, fpmlData, new EquityCurveIdentifier(properties))
        {
            PricingStructureData = new PricingStructureData(CurveType.Parent, AssetClass.Equity, properties);
            if (properties == null)
            {
                properties = PricingStructurePropertyHelper.FxCurve(fpmlData);//TODO
            }
            //Set the spot date;
            SettlementDate = GetSettlementDate(logger, cache, nameSpace, GetEquityCurveId(), fixingCalendar, rollCalendar, PricingStructureValuation.baseDate.Value);
            var fxCurveValuation = (FxCurveValuation)fpmlData.Second;

            // hack - set the base date - todo - is this the right place alex?
            PricingStructureValuation.baseDate = new IdentifiedDate {
                Value = PricingStructureIdentifier.BaseDate
            };
            SetFpmlData(fpmlData);
            TermCurve termCurve = SetConfigurationData();
            var       bootstrap = PropertyHelper.ExtractBootStrapOverrideFlag(properties);
            var       buildFlag = (fxCurveValuation.spotRate != null) && (fxCurveValuation.fxForwardCurve == null || fxCurveValuation.fxForwardCurve.point == null);

            // If there's no forward points - do build the curve.
            // - TODO what happened the central bank dates
            if ((bootstrap || buildFlag) && cache != null)
            {
                // if (BootstrapperName == "FastBootstrapper") //TODO
                PriceableEquityAssets = PriceableAssetFactory.CreatePriceableEquityAssets(logger, cache, nameSpace,
                                                                                          fxCurveValuation.baseDate.Value, fxCurveValuation.spotRate, fixingCalendar, rollCalendar);
                fxCurveValuation.fxForwardCurve       = termCurve;
                fxCurveValuation.fxForwardCurve.point = EquityBootstrapper.Bootstrap(
                    PriceableEquityAssets,
                    fxCurveValuation.baseDate.Value,
                    fxCurveValuation.fxForwardCurve.extrapolationPermitted,
                    fxCurveValuation.fxForwardCurve.interpolationMethod);
            }
            ((FxCurveValuation)PricingStructureValuation).fxForwardCurve = fxCurveValuation.fxForwardCurve;
            SetInterpolator(PricingStructureValuation.baseDate.Value);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Create a surface from an FpML
 /// </summary>
 /// <param name="logger">The logger.</param>
 /// <param name="cache">The cache.</param>
 /// <param name="nameSpace">The nameSpace</param>
 /// <param name="fpmlData"></param>
 public FxVolatilitySurface(ILogger logger, ICoreCache cache, String nameSpace, Pair <PricingStructure, PricingStructureValuation> fpmlData)
     : this(logger, cache, nameSpace, fpmlData, PricingStructurePropertyHelper.FxVolatilityMatrix(fpmlData))
 {
 }