@ImmutableDefaults private static void applyDefaults(Builder builder) { builder.info = PositionInfo.empty(); }
/** * Obtains an instance from the security, long quantity and short quantity. * <p> * The long quantity and short quantity must be zero or positive, not negative. * In many cases, only a long quantity or short quantity will be present with the other set to zero. * However it is also possible for both to be non-zero, allowing long and short positions to be treated separately. * * @param security the underlying security * @param longQuantity the long quantity of the underlying security * @param shortQuantity the short quantity of the underlying security * @return the position */ public static EtdFuturePosition ofLongShort(EtdFutureSecurity security, double longQuantity, double shortQuantity) { return ofLongShort(PositionInfo.empty(), security, longQuantity, shortQuantity); }
@ImmutableDefaults private static void applyDefaults(Builder builder) { builder.info = PositionInfo.empty(); }
@ImmutableDefaults private static void applyDefaults(Builder builder) { builder.info = PositionInfo.empty(); }
@ImmutableDefaults private static void applyDefaults(Builder builder) { builder.info = PositionInfo.empty(); }
@ImmutableDefaults private static void applyDefaults(Builder builder) { builder.info = PositionInfo.empty(); }
@ImmutableDefaults private static void applyDefaults(Builder builder) { builder.info = PositionInfo.empty(); }
@ImmutableDefaults private static void applyDefaults(Builder builder) { builder.info = PositionInfo.empty(); }
@ImmutableDefaults private static void applyDefaults(Builder builder) { builder.info = PositionInfo.empty(); }
@ImmutableDefaults private static void applyDefaults(Builder builder) { builder.info = PositionInfo.empty(); }
@ImmutableDefaults private static void applyDefaults(Builder builder) { builder.info = PositionInfo.empty(); }
@ImmutableDefaults private static void applyDefaults(Builder builder) { builder.info = PositionInfo.empty(); }
@ImmutableDefaults private static void applyDefaults(Builder builder) { builder.info = PositionInfo.empty(); }
@ImmutableDefaults private static void applyDefaults(Builder builder) { builder.info = PositionInfo.empty(); }
public void test_methods() { Position test = sut(); assertEquals(test.getId(), Optional.empty()); assertEquals(test.getInfo(), PositionInfo.empty()); assertEquals(test.getQuantity(), 123d); assertEquals(test.getSecurityId(), SecurityId.of(STANDARD_ID)); }
public void test_ofLongShort_noInfo() { SecurityPosition test = SecurityPosition.ofLongShort(SECURITY_ID, LONG_QUANTITY, SHORT_QUANTITY); assertEquals(test.getInfo(), PositionInfo.empty()); assertEquals(test.getSecurityId(), SECURITY_ID); assertEquals(test.getLongQuantity(), LONG_QUANTITY); assertEquals(test.getShortQuantity(), SHORT_QUANTITY); assertEquals(test.getQuantity(), QUANTITY); }
public void test_ofLongShort_noInfo() { GenericSecurityPosition test = GenericSecurityPosition.ofLongShort(SECURITY, LONG_QUANTITY, SHORT_QUANTITY); assertEquals(test.getInfo(), PositionInfo.empty()); assertEquals(test.getSecurity(), SECURITY); assertEquals(test.getLongQuantity(), LONG_QUANTITY); assertEquals(test.getShortQuantity(), SHORT_QUANTITY); assertEquals(test.getQuantity(), QUANTITY); }
public void test_ofNet_noInfo() { SecurityPosition test = SecurityPosition.ofNet(SECURITY_ID, QUANTITY); assertEquals(test.getInfo(), PositionInfo.empty()); assertEquals(test.getSecurityId(), SECURITY_ID); assertEquals(test.getLongQuantity(), QUANTITY); assertEquals(test.getShortQuantity(), 0d); assertEquals(test.getQuantity(), QUANTITY); assertEquals(test.withInfo(POSITION_INFO).getInfo(), POSITION_INFO); assertEquals(test.withQuantity(129).getQuantity(), 129d, 0d); assertEquals(test.withQuantity(-129).getQuantity(), -129d, 0d); }
static GenericSecurityPosition sut2() { return GenericSecurityPosition.builder() .info(PositionInfo.empty()) .security(SECURITY2) .longQuantity(LONG_QUANTITY2) .shortQuantity(SHORT_QUANTITY2) .build(); }
static SecurityPosition sut2() { return SecurityPosition.builder() .info(PositionInfo.empty()) .securityId(SECURITY_ID2) .longQuantity(LONG_QUANTITY2) .shortQuantity(SHORT_QUANTITY2) .build(); }