Exemple #1
0
        //-------------------------------------------------------------------------
        public virtual void test_builder()
        {
            IborFutureSecurity test = sut();

            assertEquals(test.Info, INFO);
            assertEquals(test.SecurityId, PRODUCT.SecurityId);
            assertEquals(test.Currency, PRODUCT.Currency);
            assertEquals(test.UnderlyingIds, ImmutableSet.of());
        }
        //-------------------------------------------------------------------------
        public IborFutureOption createProduct(ReferenceData refData)
        {
            Security security = refData.getValue(underlyingFutureId);

            if (!(security is IborFutureSecurity))
            {
                throw new System.InvalidCastException(Messages.format("{} underlying future '{}' resolved to '{}' when '{}' was expected", typeof(IborFutureOptionSecurity).Name, underlyingFutureId, security.GetType().Name, typeof(IborFutureSecurity).Name));
            }
            IborFutureSecurity futureSec  = (IborFutureSecurity)security;
            IborFuture         underlying = futureSec.createProduct(refData);

            return(new IborFutureOption(SecurityId, putCall, strikePrice, expiryDate, expiryTime, expiryZone, premiumStyle, rounding, underlying));
        }
 public override bool Equals(object obj)
 {
     if (obj == this)
     {
         return(true);
     }
     if (obj != null && obj.GetType() == this.GetType())
     {
         IborFutureSecurity other = (IborFutureSecurity)obj;
         return(JodaBeanUtils.equal(info, other.info) && JodaBeanUtils.equal(notional, other.notional) && JodaBeanUtils.equal(lastTradeDate, other.lastTradeDate) && JodaBeanUtils.equal(index, other.index) && JodaBeanUtils.equal(rounding, other.rounding));
     }
     return(false);
 }
Exemple #4
0
        //-------------------------------------------------------------------------
        public virtual void test_createProduct()
        {
            IborFutureSecurity test = sut();

            assertEquals(test.createProduct(ReferenceData.empty()), PRODUCT);
            TradeInfo       tradeInfo     = TradeInfo.of(date(2016, 6, 30));
            IborFutureTrade expectedTrade = IborFutureTrade.builder().info(tradeInfo).product(PRODUCT).quantity(100).price(0.995).build();

            assertEquals(test.createTrade(tradeInfo, 100, 0.995, ReferenceData.empty()), expectedTrade);

            PositionInfo       positionInfo      = PositionInfo.empty();
            IborFuturePosition expectedPosition1 = IborFuturePosition.builder().info(positionInfo).product(PRODUCT).longQuantity(100).build();

            TestHelper.assertEqualsBean(test.createPosition(positionInfo, 100, ReferenceData.empty()), expectedPosition1);
            IborFuturePosition expectedPosition2 = IborFuturePosition.builder().info(positionInfo).product(PRODUCT).longQuantity(100).shortQuantity(50).build();

            assertEquals(test.createPosition(positionInfo, 100, 50, ReferenceData.empty()), expectedPosition2);
        }
Exemple #5
0
 internal static IborFutureSecurity sut2()
 {
     return(IborFutureSecurity.builder().info(INFO2).notional(PRODUCT2.Notional).index(PRODUCT2.Index).lastTradeDate(PRODUCT2.LastTradeDate).rounding(PRODUCT2.Rounding).build());
 }