super(inputStream, serverCurrentVersion);
}
@Override
protected PortfolioUpdateEvent consumeVersionLess(final InputStream inputStream) {
final Contract contract = consumeContract(inputStream);
final int position = readInt(inputStream);
final double marketPrice = readDouble(inputStream);
final double marketValue = readDouble(inputStream);
double averageCost = 0;
double unrealizedProfitAndLoss = 0;
double realizedProfitAndLoss = 0;
if (getVersion() >= 3) {
averageCost = readDouble(inputStream);
unrealizedProfitAndLoss = readDouble(inputStream);
realizedProfitAndLoss = readDouble(inputStream);
}
String accountName = null;
if (getVersion() >= 4) {
accountName = readString(inputStream);
}
if ((getVersion() == 6) && (getServerCurrentVersion() == 39)) {
contract.setPrimaryExchange(readString(inputStream));
}
return createEvent(contract, position, marketPrice, marketValue, averageCost, unrealizedProfitAndLoss,
realizedProfitAndLoss, accountName);
}