Exemplo n.º 1
0
        public virtual void test_trade_noMarketData()
        {
            FixedOvernightSwapCurveNode node = FixedOvernightSwapCurveNode.of(TEMPLATE, QUOTE_ID, SPREAD);
            MarketData marketData            = MarketData.empty(VAL_DATE);

            assertThrows(() => node.trade(1d, marketData, REF_DATA), typeof(MarketDataNotFoundException));
        }
Exemplo n.º 2
0
        public virtual void test_of_withSpreadAndLabel()
        {
            FixedOvernightSwapCurveNode test = FixedOvernightSwapCurveNode.of(TEMPLATE, QUOTE_ID, SPREAD, LABEL);

            assertEquals(test.Label, LABEL);
            assertEquals(test.RateId, QUOTE_ID);
            assertEquals(test.AdditionalSpread, SPREAD);
            assertEquals(test.Template, TEMPLATE);
        }
Exemplo n.º 3
0
        public virtual void test_of_noSpread()
        {
            FixedOvernightSwapCurveNode test = FixedOvernightSwapCurveNode.of(TEMPLATE, QUOTE_ID);

            assertEquals(test.Label, LABEL_AUTO);
            assertEquals(test.RateId, QUOTE_ID);
            assertEquals(test.AdditionalSpread, 0.0d);
            assertEquals(test.Template, TEMPLATE);
        }
Exemplo n.º 4
0
        //-------------------------------------------------------------------------
        public virtual void coverage()
        {
            FixedOvernightSwapCurveNode test = FixedOvernightSwapCurveNode.of(TEMPLATE, QUOTE_ID, SPREAD);

            coverImmutableBean(test);
            FixedOvernightSwapCurveNode test2 = FixedOvernightSwapCurveNode.of(FixedOvernightSwapTemplate.of(TENOR_6M, FixedOvernightSwapConventions.USD_FIXED_TERM_FED_FUND_OIS), QuoteId.of(StandardId.of("OG-Ticker", "Deposit2")));

            coverBeanEquals(test, test2);
        }
Exemplo n.º 5
0
        public virtual void test_builder()
        {
            FixedOvernightSwapCurveNode test = FixedOvernightSwapCurveNode.builder().label(LABEL).template(TEMPLATE).rateId(QUOTE_ID).additionalSpread(SPREAD).build();

            assertEquals(test.Label, LABEL);
            assertEquals(test.RateId, QUOTE_ID);
            assertEquals(test.AdditionalSpread, SPREAD);
            assertEquals(test.Template, TEMPLATE);
            assertEquals(test.Date, CurveNodeDate.END);
        }
Exemplo n.º 6
0
        public virtual void test_metadata_fixed()
        {
            LocalDate nodeDate = VAL_DATE.plusMonths(1);
            FixedOvernightSwapCurveNode node = FixedOvernightSwapCurveNode.of(TEMPLATE, QUOTE_ID, SPREAD, LABEL).withDate(CurveNodeDate.of(nodeDate));
            LocalDate valuationDate          = LocalDate.of(2015, 1, 22);
            DatedParameterMetadata metadata  = node.metadata(valuationDate, REF_DATA);

            assertEquals(metadata.Date, nodeDate);
            assertEquals(metadata.Label, node.Label);
        }
Exemplo n.º 7
0
        public virtual void test_metadata_end()
        {
            FixedOvernightSwapCurveNode node = FixedOvernightSwapCurveNode.of(TEMPLATE, QUOTE_ID, SPREAD);
            LocalDate         valuationDate  = LocalDate.of(2015, 1, 22);
            ParameterMetadata metadata       = node.metadata(valuationDate, REF_DATA);

            // 2015-01-22 is Thursday, start is 2015-01-26, but 2025-01-26 is Sunday, so end is 2025-01-27
            assertEquals(((TenorDateParameterMetadata)metadata).Date, LocalDate.of(2025, 1, 27));
            assertEquals(((TenorDateParameterMetadata)metadata).Tenor, Tenor.TENOR_10Y);
        }
Exemplo n.º 8
0
        public virtual void test_initialGuess()
        {
            FixedOvernightSwapCurveNode node = FixedOvernightSwapCurveNode.of(TEMPLATE, QUOTE_ID, SPREAD);
            double     rate       = 0.035;
            MarketData marketData = ImmutableMarketData.builder(VAL_DATE).addValue(QUOTE_ID, rate).build();

            assertEquals(node.initialGuess(marketData, ValueType.ZERO_RATE), rate);
            assertEquals(node.initialGuess(marketData, ValueType.FORWARD_RATE), rate);
            assertEquals(node.initialGuess(marketData, ValueType.DISCOUNT_FACTOR), Math.Exp(-rate * TENOR_10Y.Period.toTotalMonths() / 12d), 1.0E-12);
        }
Exemplo n.º 9
0
        public virtual void test_trade()
        {
            FixedOvernightSwapCurveNode node = FixedOvernightSwapCurveNode.of(TEMPLATE, QUOTE_ID, SPREAD);
            double     rate       = 0.125;
            double     quantity   = -1234.56;
            MarketData marketData = ImmutableMarketData.builder(VAL_DATE).addValue(QUOTE_ID, rate).build();
            SwapTrade  trade      = node.trade(quantity, marketData, REF_DATA);
            SwapTrade  expected   = TEMPLATE.createTrade(VAL_DATE, BUY, -quantity, rate + SPREAD, REF_DATA);

            assertEquals(trade, expected);
        }
Exemplo n.º 10
0
        public virtual void test_requirements()
        {
            FixedOvernightSwapCurveNode test = FixedOvernightSwapCurveNode.of(TEMPLATE, QUOTE_ID, SPREAD);
            ISet <ObservableId>         set  = test.requirements();
            IEnumerator <ObservableId>  itr  = set.GetEnumerator();

//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
            assertEquals(itr.next(), QUOTE_ID);
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
            assertFalse(itr.hasNext());
        }
Exemplo n.º 11
0
 public override bool Equals(object obj)
 {
     if (obj == this)
     {
         return(true);
     }
     if (obj != null && obj.GetType() == this.GetType())
     {
         FixedOvernightSwapCurveNode other = (FixedOvernightSwapCurveNode)obj;
         return(JodaBeanUtils.equal(template, other.template) && JodaBeanUtils.equal(rateId, other.rateId) && JodaBeanUtils.equal(additionalSpread, other.additionalSpread) && JodaBeanUtils.equal(label, other.label) && JodaBeanUtils.equal(date_Renamed, other.date_Renamed) && JodaBeanUtils.equal(dateOrder, other.dateOrder));
     }
     return(false);
 }
Exemplo n.º 12
0
        public virtual void test_serialization()
        {
            FixedOvernightSwapCurveNode test = FixedOvernightSwapCurveNode.of(TEMPLATE, QUOTE_ID, SPREAD);

            assertSerialization(test);
        }
Exemplo n.º 13
0
        public virtual void test_metadata_last_fixing()
        {
            FixedOvernightSwapCurveNode node = FixedOvernightSwapCurveNode.of(TEMPLATE, QUOTE_ID, SPREAD, LABEL).withDate(CurveNodeDate.LAST_FIXING);

            assertThrowsWithCause(() => node.metadata(VAL_DATE, REF_DATA), typeof(System.NotSupportedException));
        }