public virtual void test_ofNet_short() { EtdFuturePosition test = EtdFuturePosition.ofNet(SECURITY, -1000); assertEquals(test.LongQuantity, 0d, 0d); assertEquals(test.ShortQuantity, 1000d, 0d); assertEquals(test.Security, SECURITY); assertEquals(test.Quantity, -1000d, 0d); }
public virtual void test_ofNet_withInfo() { EtdFuturePosition test = EtdFuturePosition.ofNet(POSITION_INFO, SECURITY, 1000); assertEquals(test.LongQuantity, 1000d, 0d); assertEquals(test.ShortQuantity, 0d, 0d); assertEquals(test.Info, POSITION_INFO); assertEquals(test.Security, SECURITY); assertEquals(test.Quantity, 1000d, 0d); }
public EtdFuturePosition withQuantity(double quantity) { return(EtdFuturePosition.ofNet(info, security, quantity)); }
public EtdFuturePosition createPosition(PositionInfo positionInfo, double quantity, ReferenceData refData) { return(EtdFuturePosition.ofNet(positionInfo, this, quantity)); }
public virtual void test() { EtdFutureSecurity test = sut(); assertEquals(test.Variant, EtdVariant.MONTHLY); assertEquals(test.Type, EtdType.FUTURE); 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()), EtdFutureTrade.of(TradeInfo.empty(), test, 1, 2)); assertEquals(test.createPosition(PositionInfo.empty(), 1, ReferenceData.empty()), EtdFuturePosition.ofNet(PositionInfo.empty(), test, 1)); assertEquals(test.createPosition(PositionInfo.empty(), 1, 2, ReferenceData.empty()), EtdFuturePosition.ofLongShort(PositionInfo.empty(), test, 1, 2)); }