public void test_optionId_monthly() { SecurityId test = EtdIdUtils.optionId(ExchangeIds.ECAG, FGBS, YearMonth.of(2017, 6), MONTHLY, 0, PutCall.PUT, 12.34); assertEquals(test.getStandardId(), StandardId.of("OG-ETD", "O-ECAG-FGBS-201706-P12.34")); }
public void test_optionIdUnderlying_monthly() { SecurityId test = EtdIdUtils.optionId( ExchangeIds.ECAG, FGBS, YearMonth.of(2017, 6), MONTHLY, 0, PutCall.PUT, 12.34, YearMonth.of(2017, 9)); assertEquals(test.getStandardId(), StandardId.of("OG-ETD", "O-ECAG-FGBS-201706-P12.34-U201709")); }
public void test_optionIdUnderlying_monthlySameMonth() { SecurityId test = EtdIdUtils.optionId( ExchangeIds.ECAG, FGBS, YearMonth.of(2017, 6), MONTHLY, 0, PutCall.PUT, 12.34, YearMonth.of(2017, 6)); assertEquals(test.getStandardId(), StandardId.of("OG-ETD", "O-ECAG-FGBS-201706-P12.34")); }
double strikePrice) { return optionId(exchangeId, contractCode, expiryMonth, variant, version, putCall, strikePrice, null);
public void test_optionId_weekly() { SecurityId test = EtdIdUtils.optionId( ExchangeIds.ECAG, FGBS, YearMonth.of(2017, 6), EtdVariant.ofWeekly(3), 0, PutCall.CALL, -1.45); assertEquals(test.getStandardId(), StandardId.of("OG-ETD", "O-ECAG-FGBS-201706W3-CM1.45")); }
public void test_optionId_daily9_version() { SecurityId test = EtdIdUtils.optionId(ExchangeIds.ECAG, FGBS, YearMonth.of(2017, 6), EtdVariant.ofDaily(9), 3, PutCall.PUT, 12.34); assertEquals(test.getStandardId(), StandardId.of("OG-ETD", "O-ECAG-FGBS-20170609-V3-P12.34")); }
public void test_optionId_daily21_version() { SecurityId test = EtdIdUtils.optionId(ExchangeIds.ECAG, FGBS, YearMonth.of(2017, 6), EtdVariant.ofDaily(21), 11, PutCall.PUT, 12.34); assertEquals(test.getStandardId(), StandardId.of("OG-ETD", "O-ECAG-FGBS-20170621-V11-P12.34")); }
public void test_optionIdUnderlying_daily9_version() { SecurityId test = EtdIdUtils.optionId( ExchangeIds.ECAG, FGBS, YearMonth.of(2017, 6), EtdVariant.ofDaily(9), 3, PutCall.PUT, 12.34, YearMonth.of(2017, 9)); assertEquals(test.getStandardId(), StandardId.of("OG-ETD", "O-ECAG-FGBS-20170609-V3-P12.34-U201709")); }
/** * Parses an ETD option position from the CSV row without using reference data. * <p> * This returns a {@link SecurityPosition} based on a standard ETD identifier from {@link EtdIdUtils}. * * @param row the CSV row to parse * @param info the position information * @return the loaded positions, position-level errors are captured in the result * @throws IllegalArgumentException if the row cannot be parsed */ public default SecurityPosition parseEtdOptionSecurityPosition(CsvRow row, PositionInfo info) { ExchangeId exchangeId = ExchangeId.of(row.getValue(EXCHANGE_FIELD)); EtdContractCode contractCode = EtdContractCode.of(row.getValue(CONTRACT_CODE_FIELD)); Pair<YearMonth, EtdVariant> variant = CsvLoaderUtils.parseEtdVariant(row, EtdType.OPTION); int version = row.findValue(VERSION_FIELD).map(Integer::parseInt).orElse(DEFAULT_OPTION_VERSION_NUMBER); PutCall putCall = LoaderUtils.parsePutCall(row.getValue(PUT_CALL_FIELD)); double strikePrice = Double.parseDouble(row.getValue(EXERCISE_PRICE_FIELD)); YearMonth underlyingExpiry = row.findValue(UNDERLYING_EXPIRY_FIELD) .map(str -> LoaderUtils.parseYearMonth(str)) .orElse(null); SecurityId securityId = EtdIdUtils.optionId( exchangeId, contractCode, variant.getFirst(), variant.getSecond(), version, putCall, strikePrice, underlyingExpiry); DoublesPair quantity = CsvLoaderUtils.parseQuantity(row); SecurityPosition position = SecurityPosition.ofLongShort(info, securityId, quantity.getFirst(), quantity.getSecond()); return completePosition(row, position); }
public void test_optionIdUnderlying_weekly() { SecurityId test = EtdIdUtils.optionId( ExchangeIds.ECAG, FGBS, YearMonth.of(2017, 6), EtdVariant.ofWeekly(3), 0, PutCall.CALL, -1.45, YearMonth.of(2017, 9)); assertEquals(test.getStandardId(), StandardId.of("OG-ETD", "O-ECAG-FGBS-201706W3-CM1.45-U201709")); }
public void test_optionIdUnderlying_daily21_version() { SecurityId test = EtdIdUtils.optionId( ExchangeIds.ECAG, FGBS, YearMonth.of(2017, 6), EtdVariant.ofDaily(21), 11, PutCall.PUT, 12.34, YearMonth.of(2017, 9)); assertEquals(test.getStandardId(), StandardId.of("OG-ETD", "O-ECAG-FGBS-20170621-V11-P12.34-U201709")); }
Messages.format("Cannot create an EtdOptionSecurity from a contract specification of type '{}'", spec.getType())); SecurityId securityId = EtdIdUtils.optionId( spec.getExchangeId(), spec.getContractCode(), expiry, variant, version, putCall, strikePrice, underlyingExpiryMonth); return EtdOptionSecurity.builder()
.id(StandardId.of("OG", "123431")) .build()) .securityId(EtdIdUtils.optionId( ExchangeIds.ECAG, OGBL, YearMonth.of(2017, 6), EtdVariant.ofMonthly(), 0, PutCall.PUT, 3d, YearMonth.of(2017, 9))) .longQuantity(15d) .id(StandardId.of("OG", "123432")) .build()) .securityId(EtdIdUtils.optionId( ExchangeIds.ECAG, OGBL, .id(StandardId.of("OG", "123433")) .build()) .securityId(EtdIdUtils.optionId( ExchangeIds.ECAG, OGBL, YearMonth.of(2017, 6), EtdVariant.ofWeekly(2), 0, PutCall.PUT, 5.1d)) .longQuantity(0d)