/** * Restricted copy constructor. * @param beanToCopy the bean to copy from, not null */ private Builder(EtdOptionSecurity beanToCopy) { this.info = beanToCopy.getInfo(); this.contractSpecId = beanToCopy.getContractSpecId(); this.expiry = beanToCopy.getExpiry(); this.variant = beanToCopy.getVariant(); this.version = beanToCopy.getVersion(); this.putCall = beanToCopy.getPutCall(); this.strikePrice = beanToCopy.getStrikePrice(); this.underlyingExpiryMonth = beanToCopy.underlyingExpiryMonth; }
@Override protected Object propertyGet(Bean bean, String propertyName, boolean quiet) { switch (propertyName.hashCode()) { case 3237038: // info return ((EtdOptionSecurity) bean).getInfo(); case 948987368: // contractSpecId return ((EtdOptionSecurity) bean).getContractSpecId(); case -1289159373: // expiry return ((EtdOptionSecurity) bean).getExpiry(); case 236785797: // variant return ((EtdOptionSecurity) bean).getVariant(); case 351608024: // version return ((EtdOptionSecurity) bean).getVersion(); case -219971059: // putCall return ((EtdOptionSecurity) bean).getPutCall(); case 50946231: // strikePrice return ((EtdOptionSecurity) bean).getStrikePrice(); case 1929351536: // underlyingExpiryMonth return ((EtdOptionSecurity) bean).underlyingExpiryMonth; } return super.propertyGet(bean, propertyName, quiet); }
public void createOptionAutoId() { EtdOptionSecurity security = OPTION_CONTRACT.createOption(YearMonth.of(2015, 6), EtdVariant.MONTHLY, 0, PutCall.CALL, 123.45); assertThat(security.getSecurityId()).isEqualTo(SecurityId.of(EtdIdUtils.ETD_SCHEME, "O-IFEN-BAR-201506-C123.45")); assertThat(security.getExpiry()).isEqualTo(YearMonth.of(2015, 6)); assertThat(security.getContractSpecId()).isEqualTo(OPTION_CONTRACT.getId()); assertThat(security.getVariant()).isEqualTo(EtdVariant.MONTHLY); assertThat(security.getPutCall()).isEqualTo(PutCall.CALL); assertThat(security.getStrikePrice()).isEqualTo(123.45); assertThat(security.getUnderlyingExpiryMonth()).isEmpty(); assertThat(security.getInfo().getPriceInfo()).isEqualTo(OPTION_CONTRACT.getPriceInfo()); }
public void createOptionWithUnderlyingAutoId() { EtdOptionSecurity security = OPTION_CONTRACT.createOption( YearMonth.of(2015, 6), EtdVariant.MONTHLY, 0, PutCall.CALL, 123.45, YearMonth.of(2015, 9)); assertThat(security.getSecurityId()).isEqualTo(SecurityId.of(EtdIdUtils.ETD_SCHEME, "O-IFEN-BAR-201506-C123.45-U201509")); assertThat(security.getExpiry()).isEqualTo(YearMonth.of(2015, 6)); assertThat(security.getContractSpecId()).isEqualTo(OPTION_CONTRACT.getId()); assertThat(security.getVariant()).isEqualTo(EtdVariant.MONTHLY); assertThat(security.getPutCall()).isEqualTo(PutCall.CALL); assertThat(security.getStrikePrice()).isEqualTo(123.45); assertThat(security.getUnderlyingExpiryMonth()).hasValue(YearMonth.of(2015, 9)); assertThat(security.getInfo().getPriceInfo()).isEqualTo(OPTION_CONTRACT.getPriceInfo()); }