Exemplo n.º 1
0
        //-------------------------------------------------------------------------
        public virtual void test_summarize()
        {
            EtdOptionTrade       trade    = sut();
            PortfolioItemSummary expected = PortfolioItemSummary.builder().portfolioItemType(PortfolioItemType.TRADE).productType(ProductType.ETD_OPTION).currencies(SECURITY.Currency).description(SECURITY.SecurityId.StandardId.Value + " x 3000, Jun17 P2").build();

            assertEquals(trade.summarize(), expected);
        }
Exemplo n.º 2
0
 public override bool Equals(object obj)
 {
     if (obj == this)
     {
         return(true);
     }
     if (obj != null && obj.GetType() == this.GetType())
     {
         EtdOptionTrade other = (EtdOptionTrade)obj;
         return(JodaBeanUtils.equal(info, other.info) && JodaBeanUtils.equal(security, other.security) && JodaBeanUtils.equal(quantity, other.quantity) && JodaBeanUtils.equal(price, other.price));
     }
     return(false);
 }
Exemplo n.º 3
0
        public virtual void test_of()
        {
            EtdOptionTrade test = EtdOptionTrade.of(TRADE_INFO, SECURITY, 1000, 20);

            assertEquals(test.Security, SECURITY);
            assertEquals(test.Quantity, 1000d, 0d);
            assertEquals(test.Price, 20d, 0d);
            assertEquals(test.SecurityId, SECURITY.SecurityId);
            assertEquals(test.Currency, SECURITY.Currency);
            assertEquals(test.withInfo(TRADE_INFO).Info, TRADE_INFO);
            assertEquals(test.withQuantity(129).Quantity, 129d, 0d);
            assertEquals(test.withPrice(129).Price, 129d, 0d);
        }
Exemplo n.º 4
0
        public virtual void test()
        {
            EtdOptionSecurity test = sut();

            assertEquals(test.Variant, EtdVariant.MONTHLY);
            assertEquals(test.Type, EtdType.OPTION);
            assertEquals(test.Currency, Currency.GBP);
            assertEquals(test.UnderlyingIds, ImmutableSet.of());
            assertEquals(test.createProduct(REF_DATA), test);
            assertEquals(test.createTrade(TradeInfo.empty(), 1, 2, ReferenceData.empty()), EtdOptionTrade.of(TradeInfo.empty(), test, 1, 2));
            assertEquals(test.createPosition(PositionInfo.empty(), 1, ReferenceData.empty()), EtdOptionPosition.ofNet(PositionInfo.empty(), test, 1));
            assertEquals(test.createPosition(PositionInfo.empty(), 1, 2, ReferenceData.empty()), EtdOptionPosition.ofLongShort(PositionInfo.empty(), test, 1, 2));
        }
Exemplo n.º 5
0
 internal static EtdOptionTrade sut2()
 {
     return(EtdOptionTrade.builder().security(EtdOptionSecurityTest.sut2()).quantity(4000).price(30).build());
 }
Exemplo n.º 6
0
 //-------------------------------------------------------------------------
 internal static EtdOptionTrade sut()
 {
     return(EtdOptionTrade.builder().info(TRADE_INFO).security(SECURITY).quantity(3000).price(20).build());
 }
Exemplo n.º 7
0
 public EtdOptionTrade createTrade(TradeInfo tradeInfo, double quantity, double tradePrice, ReferenceData refData)
 {
     return(EtdOptionTrade.builder().info(tradeInfo).quantity(quantity).price(tradePrice).security(this).build());
 }