Exemplo n.º 1
0
        public virtual void buildMissingConfig()
        {
            FxRateMarketDataFunction function = new FxRateMarketDataFunction();
            string regex = "No configuration found .*FxRateConfig";

            assertThrowsIllegalArg(() => function.build(RATE_ID, MarketDataConfig.empty(), ScenarioMarketData.empty(), REF_DATA), regex);
        }
Exemplo n.º 2
0
        public virtual void buildNoConfigForPair()
        {
            FxRateMarketDataFunction function = new FxRateMarketDataFunction();
            string       regex  = "No FX rate configuration available for GBP/USD";
            CurrencyPair gbpUsd = CurrencyPair.of(Currency.GBP, Currency.USD);

            assertThrowsIllegalArg(() => function.build(FxRateId.of(gbpUsd), config(), ScenarioMarketData.empty(), REF_DATA), regex);
        }
Exemplo n.º 3
0
        public virtual void buildInverse()
        {
            FxRateMarketDataFunction function   = new FxRateMarketDataFunction();
            MarketDataBox <double>   quoteBox   = MarketDataBox.ofSingleValue(1.1d);
            ScenarioMarketData       marketData = ImmutableScenarioMarketData.builder(LocalDate.of(2011, 3, 8)).addBox(QUOTE_ID, quoteBox).build();
            MarketDataBox <FxRate>   rateBox    = function.build(FxRateId.of(CURRENCY_PAIR.inverse()), config(), marketData, REF_DATA);

            assertThat(rateBox.SingleValue).True;
            assertThat(rateBox.SingleValue).isEqualTo(FxRate.of(CURRENCY_PAIR, 1.1d));
        }
Exemplo n.º 4
0
        public virtual void buildScenario()
        {
            FxRateMarketDataFunction function   = new FxRateMarketDataFunction();
            MarketDataBox <double>   quoteBox   = MarketDataBox.ofScenarioValues(1.1d, 1.2d, 1.3d);
            ScenarioMarketData       marketData = ImmutableScenarioMarketData.builder(LocalDate.of(2011, 3, 8)).addBox(QUOTE_ID, quoteBox).build();
            MarketDataBox <FxRate>   rateBox    = function.build(RATE_ID, config(), marketData, REF_DATA);

            assertThat(rateBox.SingleValue).False;
            assertThat(rateBox.ScenarioCount).isEqualTo(3);
            assertThat(rateBox.getValue(0)).isEqualTo(FxRate.of(CURRENCY_PAIR, 1.1d));
            assertThat(rateBox.getValue(1)).isEqualTo(FxRate.of(CURRENCY_PAIR, 1.2d));
            assertThat(rateBox.getValue(2)).isEqualTo(FxRate.of(CURRENCY_PAIR, 1.3d));
        }