Exemple #1
0
        public virtual MarketDataBox <FxRate> build(FxRateId id, MarketDataConfig marketDataConfig, ScenarioMarketData marketData, ReferenceData refData)
        {
            FxRateConfig       fxRateConfig = marketDataConfig.get(typeof(FxRateConfig), id.ObservableSource);
            Optional <QuoteId> optional     = fxRateConfig.getObservableRateKey(id.Pair);

            return(optional.map(key => buildFxRate(id, key, marketData)).orElseThrow(() => new System.ArgumentException("No FX rate configuration available for " + id.Pair)));
        }
Exemple #2
0
        public virtual MarketDataRequirements requirements(FxRateId id, MarketDataConfig marketDataConfig)
        {
            FxRateConfig       fxRateConfig = marketDataConfig.get(typeof(FxRateConfig), id.ObservableSource);
            Optional <QuoteId> optional     = fxRateConfig.getObservableRateKey(id.Pair);

            return(optional.map(key => MarketDataRequirements.of(key)).orElse(MarketDataRequirements.empty()));
        }
Exemple #3
0
        private static MarketDataConfig config()
        {
            IDictionary <CurrencyPair, QuoteId> ratesMap = ImmutableMap.of(CURRENCY_PAIR, QUOTE_ID);
            FxRateConfig fxRateConfig = FxRateConfig.builder().observableRates(ratesMap).build();

            return(MarketDataConfig.builder().add(ObservableSource.NONE, fxRateConfig).build());
        }
        public virtual void nonConventionPair()
        {
            IDictionary <CurrencyPair, QuoteId> ratesMap = ImmutableMap.of(CurrencyPair.of(Currency.USD, Currency.EUR), QUOTE_KEY);
            string regex = "Currency pairs must be quoted using market conventions but USD/EUR is not";

            assertThrowsIllegalArg(() => FxRateConfig.builder().observableRates(ratesMap).build(), regex);
            assertThrowsIllegalArg(() => FxRateConfig.of(ratesMap), regex);
        }
 public override bool Equals(object obj)
 {
     if (obj == this)
     {
         return(true);
     }
     if (obj != null && obj.GetType() == this.GetType())
     {
         FxRateConfig other = (FxRateConfig)obj;
         return(JodaBeanUtils.equal(observableRates, other.observableRates));
     }
     return(false);
 }
        private static FxRateConfig config()
        {
            IDictionary <CurrencyPair, QuoteId> ratesMap = ImmutableMap.of(CURRENCY_PAIR, QUOTE_KEY);

            return(FxRateConfig.of(ratesMap));
        }