//-------------------------------------------------------------------------
        public virtual void coverage()
        {
            FxIndexObservation test = FxIndexObservation.of(GBP_USD_WM, FIXING_DATE, REF_DATA);

            coverImmutableBean(test);
            FxIndexObservation test2 = FxIndexObservation.of(EUR_GBP_ECB, FIXING_DATE.plusDays(1), REF_DATA);

            coverBeanEquals(test, test2);
        }
        public virtual void test_of()
        {
            FxIndexObservation test = FxIndexObservation.of(GBP_USD_WM, FIXING_DATE, REF_DATA);

            assertEquals(test.Index, GBP_USD_WM);
            assertEquals(test.FixingDate, FIXING_DATE);
            assertEquals(test.MaturityDate, MATURITY_DATE);
            assertEquals(test.CurrencyPair, GBP_USD_WM.CurrencyPair);
            assertEquals(test.ToString(), "FxIndexObservation[GBP/USD-WM on 2016-02-22]");
        }
Exemplo n.º 3
0
        //-------------------------------------------------------------------------
        public virtual void test_ecb_eur_gbp_dates()
        {
            FxIndex test = FxIndices.EUR_GBP_ECB;

            assertEquals(test.FixingDateOffset, DaysAdjustment.ofBusinessDays(-2, EUTA.combinedWith(GBLO)));
            assertEquals(test.MaturityDateOffset, DaysAdjustment.ofBusinessDays(2, EUTA.combinedWith(GBLO)));
            assertEquals(test.calculateMaturityFromFixing(date(2014, 10, 13), REF_DATA), date(2014, 10, 15));
            assertEquals(test.calculateFixingFromMaturity(date(2014, 10, 15), REF_DATA), date(2014, 10, 13));
            // weekend
            assertEquals(test.calculateMaturityFromFixing(date(2014, 10, 16), REF_DATA), date(2014, 10, 20));
            assertEquals(test.calculateFixingFromMaturity(date(2014, 10, 20), REF_DATA), date(2014, 10, 16));
            assertEquals(test.calculateMaturityFromFixing(date(2014, 10, 17), REF_DATA), date(2014, 10, 21));
            assertEquals(test.calculateFixingFromMaturity(date(2014, 10, 21), REF_DATA), date(2014, 10, 17));
            // input date is Sunday
            assertEquals(test.calculateMaturityFromFixing(date(2014, 10, 19), REF_DATA), date(2014, 10, 22));
            assertEquals(test.calculateFixingFromMaturity(date(2014, 10, 19), REF_DATA), date(2014, 10, 16));
            // skip maturity over EUR (1st May) and GBP (5th May) holiday
            assertEquals(test.calculateMaturityFromFixing(date(2014, 4, 30), REF_DATA), date(2014, 5, 6));
            assertEquals(test.calculateFixingFromMaturity(date(2014, 5, 6), REF_DATA), date(2014, 4, 30));
            // resolve
            assertEquals(test.resolve(REF_DATA).apply(date(2014, 5, 6)), FxIndexObservation.of(test, date(2014, 5, 6), REF_DATA));
        }
        public virtual void test_serialization()
        {
            FxIndexObservation test = FxIndexObservation.of(GBP_USD_WM, FIXING_DATE, REF_DATA);

            assertSerialization(test);
        }