コード例 #1
0
        //-------------------------------------------------------------------------
        public virtual void coverage()
        {
            FxOptionVolatilitiesDefinition test1 = FxOptionVolatilitiesDefinition.of(SPEC);

            coverImmutableBean(test1);
            BlackFxOptionSmileVolatilitiesSpecification spec2 = BlackFxOptionSmileVolatilitiesSpecification.builder().name(VOL_NAME).currencyPair(EUR_GBP).dayCount(ACT_360).nodes(NODES).timeInterpolator(LINEAR).strikeInterpolator(LINEAR).build();
            FxOptionVolatilitiesDefinition test2 = FxOptionVolatilitiesDefinition.of(spec2);

            coverBeanEquals(test1, test2);
        }
コード例 #2
0
        public virtual void test_of()
        {
            FxOptionVolatilitiesDefinition test = FxOptionVolatilitiesDefinition.of(SPEC);

            assertEquals(test.Specification, SPEC);
            assertEquals(test.ParameterCount, SPEC.ParameterCount);
            assertEquals(test.volatilitiesInputs(), SPEC.volatilitiesInputs());
            ZonedDateTime dateTime   = LocalDate.of(2017, 9, 25).atStartOfDay().atZone(ZoneId.of("Europe/London"));
            DoubleArray   parameters = DoubleArray.of(0.05, -0.05, 0.15, 0.25, 0.1, -0.1);

            assertEquals(test.volatilities(dateTime, parameters, REF_DATA), SPEC.volatilities(dateTime, parameters, REF_DATA));
        }
 //-----------------------------------------------------------------------
 public override bool Equals(object obj)
 {
     if (obj == this)
     {
         return(true);
     }
     if (obj != null && obj.GetType() == this.GetType())
     {
         FxOptionVolatilitiesDefinition other = (FxOptionVolatilitiesDefinition)obj;
         return(JodaBeanUtils.equal(specification, other.specification));
     }
     return(false);
 }
コード例 #4
0
        public virtual MarketDataBox <FxOptionVolatilities> build(FxOptionVolatilitiesId id, MarketDataConfig marketDataConfig, ScenarioMarketData marketData, ReferenceData refData)
        {
            FxOptionVolatilitiesDefinition volatilitiesDefinition = marketDataConfig.get(typeof(FxOptionVolatilitiesDefinition), id.Name.Name);
            ValuationZoneTimeDefinition    zoneTimeDefinition     = marketDataConfig.get(typeof(ValuationZoneTimeDefinition));
            int nScenarios = marketData.ScenarioCount;
            MarketDataBox <LocalDate>     valuationDates     = marketData.ValuationDate;
            MarketDataBox <ZonedDateTime> valuationDateTimes = zoneTimeDefinition.toZonedDateTime(valuationDates);

            int nParameters = volatilitiesDefinition.ParameterCount;
//JAVA TO C# CONVERTER TODO TASK: Most Java stream collectors are not converted by Java to C# Converter:
            ImmutableList <MarketDataBox <double> > inputs = volatilitiesDefinition.volatilitiesInputs().Select(q => marketData.getValue(q)).collect(toImmutableList());
            ImmutableList <FxOptionVolatilities>    vols   = IntStream.range(0, nScenarios).mapToObj(scenarioIndex => volatilitiesDefinition.volatilities(valuationDateTimes.getValue(scenarioIndex), DoubleArray.of(nParameters, paramIndex => inputs.get(paramIndex).getValue(scenarioIndex)), refData)).collect(toImmutableList());

            return(nScenarios > 1 ? MarketDataBox.ofScenarioValues(vols) : MarketDataBox.ofSingleValue(vols.get(0)));
        }
コード例 #5
0
        public virtual MarketDataRequirements requirements(FxOptionVolatilitiesId id, MarketDataConfig marketDataConfig)
        {
            FxOptionVolatilitiesDefinition volatilitiesDefinition = marketDataConfig.get(typeof(FxOptionVolatilitiesDefinition), id.Name.Name);

            return(MarketDataRequirements.builder().addValues(volatilitiesDefinition.volatilitiesInputs()).build());
        }
コード例 #6
0
        public virtual void serialization()
        {
            FxOptionVolatilitiesDefinition test = FxOptionVolatilitiesDefinition.of(SPEC);

            assertSerialization(test);
        }