コード例 #1
0
        //-------------------------------------------------------------------------
        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);
        }
コード例 #2
0
        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]");
        }
コード例 #3
0
 //-------------------------------------------------------------------------
 /// <summary>
 /// Compares this observation to another based on the index and fixing date.
 /// <para>
 /// The maturity date is ignored.
 ///
 /// </para>
 /// </summary>
 /// <param name="obj">  the other observation </param>
 /// <returns> true if equal </returns>
 public override bool Equals(object obj)
 {
     if (obj == this)
     {
         return(true);
     }
     if (obj != null && obj.GetType() == this.GetType())
     {
         FxIndexObservation other = (FxIndexObservation)obj;
         return(index.Equals(other.index) && fixingDate.Equals(other.fixingDate));
     }
     return(false);
 }
コード例 #4
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));
        }
コード例 #5
0
        public virtual void test_serialization()
        {
            FxIndexObservation test = FxIndexObservation.of(GBP_USD_WM, FIXING_DATE, REF_DATA);

            assertSerialization(test);
        }