Package org.fudgemsg

Examples of org.fudgemsg.FudgeMsg


    }
  }

  @Override
  public void messageReceived(FudgeContext fudgeContext, FudgeMsgEnvelope msgEnvelope) {
    final FudgeMsg msg = msgEnvelope.getMessage();
    s_logger.debug("Received change message {}", msg);
    final FudgeDeserializer deserializer = new FudgeDeserializer(fudgeContext);
    final ChangeEvent event = deserializer.fudgeMsgToObject(ChangeEvent.class, msg);
    fireEntityChanged(event);
  }
View Full Code Here


    ret.setDataPoints(dataPoints);
    ret.setDataIds(dataIds);
    ret.setRelativeStrikes(relativeStrikes);
    ret.setOtherData(otherData);

    final FudgeMsg strikesMsg = message.getMessage(STRIKES_FIELD_NAME);

    if (strikesMsg != null) {
      final Map<Pair<Tenor, Tenor>, Double> strikes = Maps.newHashMap();
      for (final FudgeField strikeField : strikesMsg) {
        final FudgeMsg strikeMsg = (FudgeMsg) strikeField.getValue();
        final Tenor swapTenor = deserializer.fieldValueToObject(Tenor.class, strikeMsg.getByName(SWAP_TENOR_FIELD_NAME));
        final Tenor optionExpiry = deserializer.fieldValueToObject(Tenor.class, strikeMsg.getByName(OPTION_EXPIRY_FIELD_NAME));
        final Double strike = deserializer.fieldValueToObject(Double.class, strikeMsg.getByName(STRIKE_FIELD_NAME));
        strikes.put(Pair.of(swapTenor, optionExpiry), strike);
      }
      ret.setATMStrikes(strikes);
    }

    final FudgeMsg atmVolatilitiesMsg = message.getMessage(ATM_VOLS_FIELD_NAME);
    if (atmVolatilitiesMsg != null) {
      final Map<Pair<Tenor, Tenor>, Double> atmVols = Maps.newHashMap();
      for (final FudgeField atmVolField : atmVolatilitiesMsg) {
        final FudgeMsg atmVolatilityMsg = (FudgeMsg) atmVolField.getValue();
        final Tenor swapTenor = deserializer.fieldValueToObject(Tenor.class, atmVolatilityMsg.getByName(SWAP_TENOR_FIELD_NAME));
        final Tenor optionExpiry = deserializer.fieldValueToObject(Tenor.class, atmVolatilityMsg.getByName(OPTION_EXPIRY_FIELD_NAME));
        final Double atmVol = deserializer.fieldValueToObject(Double.class, atmVolatilityMsg.getByName(ATM_VOLS_FIELD_NAME));
        atmVols.put(Pair.of(swapTenor, optionExpiry), atmVol);
      }
      ret.setATMVolatilities(atmVols);
    }
    return ret;
View Full Code Here

    if (id != null) {
      portfolio.setUniqueId(id);
    }
    portfolio.setRootNode((SimplePortfolioNode) node);
    if (message.hasField(ATTRIBUTES_FIELD_NAME)) {
      FudgeMsg attributesMsg = message.getMessage(ATTRIBUTES_FIELD_NAME);
      for (FudgeField fudgeField : attributesMsg) {
        String key = fudgeField.getName();
        Object value = fudgeField.getValue();
        if (key != null && value != null) {
          portfolio.addAttribute(key, (String) value);
View Full Code Here

  @Override
  public ManageableUnstructuredMarketDataSnapshot buildObject(final FudgeDeserializer deserializer, final FudgeMsg message) {
    final ManageableUnstructuredMarketDataSnapshot object = new ManageableUnstructuredMarketDataSnapshot();
    for (final FudgeField fudgeField : message.getAllByOrdinal(1)) {
      final FudgeMsg innerValue = (FudgeMsg) fudgeField.getValue();
      final ExternalIdBundle identifiers = deserializer.fieldValueToObject(ExternalIdBundle.class, innerValue.getByName(IDENTIFIERS_FIELD_NAME));
      final String valueName = innerValue.getFieldValue(String.class, innerValue.getByName(VALUE_NAME_FIELD_NAME));
      final FudgeField valueField = innerValue.getByName(VALUE_FIELD_NAME);
      final ValueSnapshot value = valueField == null ? null : deserializer.fieldValueToObject(ValueSnapshot.class, valueField);
      object.putValue(identifiers, valueName, value);
    }
    return object;
  }
View Full Code Here

    return ret;
  }

  private static HashMap<Pair<Tenor, Tenor>, ValueSnapshot> readStrikes(FudgeDeserializer deserializer, FudgeMsg msg) {
    HashMap<Pair<Tenor, Tenor>, ValueSnapshot> values = Maps.newHashMap();
    FudgeMsg valuesMessage = msg.getMessage("strikes");
    if (valuesMessage == null) {
      return values;
    }
    Pair<Tenor, Tenor> key = null;
    for (FudgeField fudgeField : valuesMessage) {
View Full Code Here

    return values;
  }

  private static HashMap<VolatilityPoint, ValueSnapshot> readValues(FudgeDeserializer deserializer, FudgeMsg msg) {
    HashMap<VolatilityPoint, ValueSnapshot> values = Maps.newHashMap();
    FudgeMsg valuesMessage = msg.getMessage("values");
    if (valuesMessage == null) {
      return values;
    }
    VolatilityPoint key = null;
    for (FudgeField fudgeField : valuesMessage) {
View Full Code Here

      if (premiumTime != null) {
        trade.setPremiumTime(message.getFieldValue(OffsetTime.class, premiumTime));
      }
    }
    if (message.hasField(ATTRIBUTES_FIELD_NAME)) {
      FudgeMsg attributesMsg = message.getMessage(ATTRIBUTES_FIELD_NAME);
      for (FudgeField fudgeField : attributesMsg) {
        String key = fudgeField.getName();
        Object value = fudgeField.getValue();
        if (key != null && value != null) {
          trade.addAttribute(key, (String) value);
View Full Code Here

      if (quantityField != null) {
        position.setQuantity(message.getFieldValue(BigDecimal.class, quantityField));
      }
    }
    if (message.hasField(ATTRIBUTES_FIELD_NAME)) {
      FudgeMsg attributesMsg = message.getMessage(ATTRIBUTES_FIELD_NAME);
      for (FudgeField fudgeField : attributesMsg) {
        String key = fudgeField.getName();
        Object value = fudgeField.getValue();
        if (key != null && value != null) {
          position.addAttribute(key, (String) value);
View Full Code Here

  public Map<ExternalIdBundle, HistoricalTimeSeries> getHistoricalTimeSeries(Set<ExternalIdBundle> identifierSet, String dataSource, String dataProvider, String dataField,
      LocalDate start, boolean includeStart, LocalDate end, boolean includeEnd) {
    ArgumentChecker.notNull(identifierSet, "identifierSet");
    try {
      URI uri = DataHistoricalTimeSeriesSourceResource.uriSearchBulk(getBaseUri());
      FudgeMsg msg = DataHistoricalTimeSeriesSourceResource.uriSearchBulkData(identifierSet, dataSource, dataProvider, dataField, start, includeStart, end, includeEnd);
      return accessRemote(uri).post(FudgeMapWrapper.class, msg).getMap();
    } catch (UniformInterfaceException404NotFound ex) {
      return null;
    }
  }
View Full Code Here

      }
    }

    @Override
    public StringLabelledMatrix1D buildObject(final FudgeDeserializer deserializer, final FudgeMsg message) {
      final FudgeMsg msg = message.getMessage(MATRIX_FIELD_NAME);
      final List<String> keys = new LinkedList<>();
      final List<Double> values = new LinkedList<>();
      for (final FudgeField field : msg) {
        switch (field.getOrdinal()) {
          case KEY_ORDINAL:
View Full Code Here

TOP

Related Classes of org.fudgemsg.FudgeMsg

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.