private static MarketDataFxRateProvider provider2() { IDictionary <FxRateId, FxRate> marketDataMap = ImmutableMap.of(FxRateId.of(EUR, USD), FxRate.of(EUR, USD, EUR_USD), FxRateId.of(EUR, BEF), FxRate.of(EUR, BEF, EUR_BEF), FxRateId.of(GBP, USD), FxRate.of(GBP, USD, GBP_USD)); MarketData marketData = ImmutableMarketData.of(VAL_DATE, marketDataMap); return(MarketDataFxRateProvider.of(marketData, ObservableSource.NONE, GBP)); }
//------------------------------------------------------------------------- private static MarketDataFxRateProvider provider() { IDictionary <FxRateId, FxRate> marketDataMap = ImmutableMap.of(FxRateId.of(EUR, USD, OBS_SOURCE), FxRate.of(EUR, USD, EUR_USD)); MarketData marketData = ImmutableMarketData.of(VAL_DATE, marketDataMap); return(MarketDataFxRateProvider.of(marketData, OBS_SOURCE, GBP)); }
public virtual void cross_counter() { IDictionary <FxRateId, FxRate> marketDataMap = ImmutableMap.of(FxRateId.of(EUR, USD), FxRate.of(EUR, USD, EUR_USD), FxRateId.of(EUR, BEF), FxRate.of(EUR, BEF, EUR_BEF)); MarketData marketData = ImmutableMarketData.of(VAL_DATE, marketDataMap); FxRateProvider fx = MarketDataFxRateProvider.of(marketData); assertEquals(fx.fxRate(USD, BEF), EUR_BEF / EUR_USD, 1.0E-10); assertEquals(fx.fxRate(BEF, USD), EUR_USD / EUR_BEF, 1.0E-10); }
public virtual void cross_base() { IDictionary <FxRateId, FxRate> marketDataMap = ImmutableMap.of(FxRateId.of(EUR, USD), FxRate.of(EUR, USD, EUR_USD), FxRateId.of(GBP, USD), FxRate.of(GBP, USD, GBP_USD)); MarketData marketData = ImmutableMarketData.of(VAL_DATE, marketDataMap); FxRateProvider fx = MarketDataFxRateProvider.of(marketData); assertEquals(fx.fxRate(GBP, EUR), GBP_USD / EUR_USD, 1.0E-10); assertEquals(fx.fxRate(EUR, GBP), EUR_USD / GBP_USD, 1.0E-10); }
//------------------------------------------------------------------------- public virtual void coverage() { MarketDataFxRateProvider test = provider(); coverImmutableBean(test); MarketDataFxRateProvider test2 = provider2(); coverBeanEquals(test, test2); }
public virtual void cross_specified() { IDictionary <FxRateId, FxRate> marketDataMap = ImmutableMap.of(FxRateId.of(EUR, CHF), FxRate.of(EUR, CHF, EUR_CHF), FxRateId.of(GBP, CHF), FxRate.of(GBP, CHF, GBP_CHF)); MarketData marketData = ImmutableMarketData.of(VAL_DATE, marketDataMap); FxRateProvider fx = MarketDataFxRateProvider.of(marketData, ObservableSource.NONE, CHF); assertEquals(fx.fxRate(GBP, EUR), GBP_CHF / EUR_CHF, 1.0E-10); assertEquals(fx.fxRate(EUR, GBP), EUR_CHF / GBP_CHF, 1.0E-10); assertThrows(() => fx.fxRate(EUR, USD), typeof(MarketDataNotFoundException)); }
//----------------------------------------------------------------------- public override bool Equals(object obj) { if (obj == this) { return(true); } if (obj != null && obj.GetType() == this.GetType()) { MarketDataFxRateProvider other = (MarketDataFxRateProvider)obj; return(JodaBeanUtils.equal(marketData, other.marketData) && JodaBeanUtils.equal(fxRatesSource, other.fxRatesSource) && JodaBeanUtils.equal(triangulationCurrency, other.triangulationCurrency)); } return(false); }