@Override public BloombergEquityFutureOptionVolatilitySurfaceInstrumentProvider buildObject( final FudgeDeserializer deserializer, final FudgeMsg message) { String futureOptionPrefix = message.getString(PREFIX_FIELD_NAME); // backward compatibility if (futureOptionPrefix == null) { futureOptionPrefix = message.getString("futureOptionPrefix"); } String postfix = message.getString(POSTFIX_FIELD_NAME); // backward compatibility if (postfix == null) { postfix = message.getString("postfix"); } String dataFieldName = message.getString(DATA_FIELD_NAME); // backward compatibility if (dataFieldName == null) { dataFieldName = message.getString("dataFieldName"); } final Double useCallAboveValue = message.getDouble(CALL_FIELD_NAME); if (message.hasField(EXCHANGE_ID_FIELD_NAME)) { final String exchangeId = message.getString(EXCHANGE_ID_FIELD_NAME); if (message.hasField(TICKER_SCHEME_NAME)) { final String tickerScheme = message.getString(TICKER_SCHEME_NAME); return new BloombergEquityFutureOptionVolatilitySurfaceInstrumentProvider( futureOptionPrefix, postfix, dataFieldName, useCallAboveValue, exchangeId, tickerScheme); } return new BloombergEquityFutureOptionVolatilitySurfaceInstrumentProvider( futureOptionPrefix, postfix, dataFieldName, useCallAboveValue, exchangeId); } if (message.hasField(TICKER_SCHEME_NAME)) { // this will never be hit, but better to be safe final String tickerScheme = message.getString(TICKER_SCHEME_NAME); return new BloombergEquityFutureOptionVolatilitySurfaceInstrumentProvider( futureOptionPrefix, postfix, dataFieldName, useCallAboveValue, DEFAULT_EXCHANGE_ID, tickerScheme); } return new BloombergEquityFutureOptionVolatilitySurfaceInstrumentProvider( futureOptionPrefix, postfix, dataFieldName, useCallAboveValue, DEFAULT_EXCHANGE_ID); }
protected static SimplePosition buildObjectImpl( final FudgeDeserializer deserializer, final FudgeMsg message) { SimpleSecurityLink secLink = new SimpleSecurityLink(); if (message.hasField(FIELD_SECURITYKEY)) { FudgeField secKeyField = message.getByName(FIELD_SECURITYKEY); if (secKeyField != null) { secLink.setExternalId(deserializer.fieldValueToObject(ExternalIdBundle.class, secKeyField)); } } if (message.hasField(FIELD_SECURITYID)) { FudgeField secIdField = message.getByName(FIELD_SECURITYID); if (secIdField != null) { secLink.setObjectId(deserializer.fieldValueToObject(ObjectId.class, secIdField)); } } SimplePosition position = new SimplePosition(); position.setSecurityLink(secLink); if (message.hasField(FIELD_UNIQUE_ID)) { FudgeField uniqueIdField = message.getByName(FIELD_UNIQUE_ID); if (uniqueIdField != null) { position.setUniqueId(deserializer.fieldValueToObject(UniqueId.class, uniqueIdField)); } } if (message.hasField(FIELD_QUANTITY)) { FudgeField quantityField = message.getByName(FIELD_QUANTITY); if (quantityField != null) { position.setQuantity(message.getFieldValue(BigDecimal.class, quantityField)); } } readTrades( deserializer, message.getFieldValue(FudgeMsg.class, message.getByName(FIELD_TRADES)), position); return position; }
@Override public SimpleHistoricalTimeSeries buildObject(FudgeDeserializer deserializer, FudgeMsg message) { UniqueId uniqueId = null; LocalDateDoubleTimeSeries timeseries = null; if (message.getByName(UNIQUE_ID_FIELD_NAME) != null) { uniqueId = deserializer.fieldValueToObject(UniqueId.class, message.getByName(UNIQUE_ID_FIELD_NAME)); } if (message.hasField(TIMESERIES_FIELD_NAME)) { Object fieldValue = deserializer.fieldValueToObject(message.getByName(TIMESERIES_FIELD_NAME)); if (fieldValue instanceof LocalDateDoubleTimeSeries) { timeseries = (LocalDateDoubleTimeSeries) fieldValue; } } if (uniqueId != null && timeseries != null) { return new SimpleHistoricalTimeSeries(uniqueId, timeseries); } else { throw new OpenGammaRuntimeException( "Cannot deserialize " + message + " to SimpleHistoricalTimeSeries"); } }