示例#1
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);
        }
示例#2
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));
        }