private void appendCombo(final RequestBuilder builder) { if (SecurityType.COMBO.equals(contract.getSecurityType())) { builder.append(contract.getComboLegs().size()); for (final ComboLeg comboLeg : contract.getComboLegs()) { builder.append(comboLeg.getContractId()); builder.append(comboLeg.getRatio()); builder.append(comboLeg.getOrderAction().getAbbreviation()); builder.append(comboLeg.getExchange()); } } }
private void appendUnderlyingCombo(final RequestBuilder builder) { if (Feature.DELTA_NEUTRAL_COMBO_ORDER.isSupportedByVersion(getServerCurrentVersion())) { final UnderlyingCombo underComp = contract.getUnderlyingCombo(); if (underComp != null) { builder.append(true); builder.append(underComp.getContractId()); builder.append(underComp.getDelta()); builder.append(underComp.getPrice()); } else { builder.append(false); } } }
private RequestBuilder createRequestBuilder() { final RequestBuilder builder = new ByteArrayRequestBuilder(); checkDeltaNeutralOrderSupport(); checkContractIdSupport(); builder.append(OutgoingMessageId.MARKET_DATA_SUBSCRIPTION_REQUEST.getId()); builder.append(VERSION); builder.append(toInternalId(getId())); appendContract(builder); appendCombo(builder); appendUnderlyingCombo(builder); appendReturnedTickTypeFilters(builder); builder.append(snapshot); return builder; }
private void appendContract(final RequestBuilder builder) { if (Feature.MARKET_DATA_REQUEST_BY_CONTRACT_ID.isSupportedByVersion( getServerCurrentVersion())) { builder.append(contract.getId()); } builder.append(contract.getSymbol()); builder.append(contract.getSecurityType().getAbbreviation()); builder.append(contract.getExpiry()); builder.append(contract.getStrike()); builder.append(contract.getOptionRight().getName()); builder.append(contract.getMultiplier()); builder.append(contract.getExchange()); builder.append(contract.getPrimaryExchange()); builder.append(contract.getCurrencyCode()); builder.append(contract.getLocalSymbol()); }
private void appendReturnedTickTypeFilters(final RequestBuilder builder) { String returnedTickTypeFilterCommaSeparatedList = null; if ((returnedTickTypeFilters != null) && (returnedTickTypeFilters.length > 0)) { final List<String> returnedTickTypeFilterValues = Lists.transform( Lists.newArrayList(returnedTickTypeFilters), returnedTickTypeFilterToStringFunction); returnedTickTypeFilterCommaSeparatedList = StringUtils.join(returnedTickTypeFilterValues, ','); } builder.append(returnedTickTypeFilterCommaSeparatedList); }
@Override public byte[] getBytes() { final RequestBuilder builder = createRequestBuilder(); return builder.toBytes(); }