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 coverage() { ExtendedMarketData <string> test = ExtendedMarketData.of(ID1, VAL1, BASE_DATA); coverImmutableBean(test); ExtendedMarketData <string> test2 = ExtendedMarketData.of(ID2, VAL2, ImmutableMarketData.of(VAL_DATE, ImmutableMap.of())); coverBeanEquals(test, test2); }
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 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 virtual void coverage() { //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: java.util.Map<MarketDataId<?>, Object> dataMap = com.google.common.collect.ImmutableMap.of(ID1, VAL1); IDictionary <MarketDataId <object>, object> dataMap = ImmutableMap.of(ID1, VAL1); ImmutableMarketData test = ImmutableMarketData.of(VAL_DATE, dataMap); coverImmutableBean(test); //JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET: //ORIGINAL LINE: java.util.Map<MarketDataId<?>, Object> dataMap2 = com.google.common.collect.ImmutableMap.of(ID2, VAL2); IDictionary <MarketDataId <object>, object> dataMap2 = ImmutableMap.of(ID2, VAL2); ImmutableMarketData test2 = ImmutableMarketData.of(VAL_DATE.minusDays(1), dataMap2); coverBeanEquals(test, test2); }