public static UniqueId GetUniqueIdentifier(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer, string fieldName) { UniqueId portfolioIdentifier; IFudgeField idField = ffc.GetByName(fieldName); if (idField != null) { var value = idField.Value; if (value is string) { portfolioIdentifier = UniqueId.Parse((string) value); } else if (value is IFudgeFieldContainer) { portfolioIdentifier = deserializer.FromField<UniqueId>(idField); } else { throw new ArgumentException(String.Format("Couldn't read UID {0}", value)); } } else { portfolioIdentifier = null; } return portfolioIdentifier; }
/// <inheritdoc/> public object Deserialize(IFudgeFieldContainer msg, IFudgeDeserializer deserializer) { IFudgeSerializable result = (IFudgeSerializable)constructor.Invoke(null); deserializer.Register(msg, result); result.Deserialize(msg, deserializer); return result; }
public static InterpolatedDoublesSurface FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer) { var xData = ffc.GetValue<double[]>("x data"); var yData = ffc.GetValue<double[]>("y data"); var zData = ffc.GetValue<double[]>("z data"); return new InterpolatedDoublesSurface(xData, yData, zData); }
public static YieldCurveDefinition FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer) { Currency currency = null; string name = null; string interpolatorName = null; var strips = new List<FixedIncomeStrip>(); ExternalId region = null; foreach (var fudgeField in ffc) { switch (fudgeField.Name) { case "currency": currency = Currency.Create((string)fudgeField.Value); break; case "name": name = (string)fudgeField.Value; break; case "interpolatorName": interpolatorName = (string)fudgeField.Value; break; case "region": region = ExternalId.Parse((string)fudgeField.Value); break; case "strip": strips.Add(deserializer.FromField<FixedIncomeStrip>(fudgeField)); break; } } var yieldCurveDefinition = new YieldCurveDefinition(currency, name, interpolatorName); yieldCurveDefinition.Region = region; yieldCurveDefinition.AddStrip(strips.ToArray()); return yieldCurveDefinition; }
public static NodalDoublesCurve FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer) { string name = GetName(ffc); var xData = ffc.GetValue<double[]>("x data"); var yData = ffc.GetValue<double[]>("y data"); return new NodalDoublesCurve(name, xData, yData); }
public static ViewCycleExecutionOptions FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer) { IFudgeField mdsField = ffc.GetByName("marketDataSpecification"); var marketDataSpecification = mdsField == null ? null : deserializer.FromField<MarketDataSpecification>(mdsField); var valuationValue = ffc.GetValue("valuation"); var valuation = (FudgeDateTime)(valuationValue == IndicatorType.Instance ? null : valuationValue); return new ViewCycleExecutionOptions(valuation.ToDateTimeOffsetWithDefault(), marketDataSpecification); }
public static VolatilityCubeDefinition FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer) { return new VolatilityCubeDefinition( deserializer.FromField<List<string>>(ffc.GetByName("swapTenors")).Select(s => new Tenor(s)).ToList(), deserializer.FromField<List<string>>(ffc.GetByName("optionExpiries")).Select(s => new Tenor(s)).ToList(), ffc.GetMessage("relativeStrikes").Select(f => f.Value).Cast<double>().ToList() ); }
public object Deserialize(IFudgeFieldContainer msg, IFudgeDeserializer deserializer) { var address = new Address(msg.GetString("line1"), msg.GetString("line2"), msg.GetString("zip")); deserializer.Register(msg, address); return address; }
public static ArrayLocalDateDoubleTimeSeries FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer) { var dateTimeConverterField = ffc.GetByOrdinal(1); var fastTimeSeriesField = ffc.GetByOrdinal(2); var dateTimeConverter = deserializer.FromField<LocalDateEpochDaysConverter>(dateTimeConverterField); var fastTimeSeries = deserializer.FromField<FastArrayIntDoubleTimeSeries>(fastTimeSeriesField); return new ArrayLocalDateDoubleTimeSeries(dateTimeConverter, fastTimeSeries); }
public static InterpolatedYieldCurveSpecificationWithSecurities FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer) { return new InterpolatedYieldCurveSpecificationWithSecurities( new DateTimeOffset( ((FudgeDate) ffc.GetValue("curveDate")).ToDateTime()), (string) ffc.GetValue("name"), ffc.GetValue<Currency>("currency"), ffc.GetAllByName("resolvedStrips").Select(deserializer.FromField<FixedIncomeStripWithSecurity>).ToList() ); }
public static ValueRequirement FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer) { ValueProperties constraints = deserializer.FromField<ValueProperties>(ffc.GetByName("constraints")) ?? ValueProperties.Create(); var computationTargetType = ffc.GetValue<string>("computationTargetType"); var computationTargetIdentifier = GetUniqueIdentifier(ffc, deserializer, "computationTargetIdentifier"); var targetSpec = new ComputationTargetSpecification(EnumBuilder<ComputationTargetType>.Parse(computationTargetType), computationTargetIdentifier); var valueName = ffc.GetValue<string>("valueName"); return new ValueRequirement(valueName, targetSpec, constraints); }
public static InterpolatedYieldCurveSpecification FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer) { var curveDate = ffc.GetValue<DateTimeOffset>("curveDate"); string name = ffc.GetString("name"); var currency = ffc.GetValue<Currency>("currency"); var region = ExternalId.Parse(ffc.GetString("region")); var resolvedStripFields = ffc.GetAllByName("resolvedStrips"); var resolvedStrips = resolvedStripFields.Select(deserializer.FromField<FixedIncomeStripWithIdentifier>) .ToList(); return new InterpolatedYieldCurveSpecification(curveDate, name, currency, resolvedStrips, region); }
public static SecurityDocument FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer) { DateTimeOffset versionToInstant; DateTimeOffset correctionFromInstant; DateTimeOffset correctionToInstant; DateTimeOffset versionFromInstant = GetDocumentValues(ffc, out versionToInstant, out correctionFromInstant, out correctionToInstant); var uid = (ffc.GetString("uniqueId") != null) ? UniqueId.Parse(ffc.GetString("uniqueId")) : deserializer.FromField<UniqueId>(ffc.GetByName("uniqueId")); var security = deserializer.FromField<ISecurity>(ffc.GetByName("security")); return new SecurityDocument(uid, security, versionFromInstant, versionToInstant, correctionFromInstant, correctionToInstant); }
public static MarketDataSnapshotDocument FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer) { DateTimeOffset versionToInstant; DateTimeOffset correctionFromInstant; DateTimeOffset correctionToInstant; DateTimeOffset versionFromInstant = GetDocumentValues(ffc, out versionToInstant, out correctionFromInstant, out correctionToInstant); var uid = (ffc.GetString("uniqueId") != null) ? UniqueId.Parse(ffc.GetString("uniqueId")) : deserializer.FromField<UniqueId>(ffc.GetByName("uniqueId")); var snapshot = deserializer.FromField<ManageableMarketDataSnapshot>(ffc.GetByName("snapshot")); return new MarketDataSnapshotDocument(uid, snapshot, versionFromInstant, versionToInstant, correctionFromInstant, correctionToInstant); }
public static YieldCurveDefinitionDocument FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer) { DateTimeOffset versionToInstant; DateTimeOffset correctionFromInstant; DateTimeOffset correctionToInstant; DateTimeOffset versionFromInstant = GetDocumentValues(ffc, out versionToInstant, out correctionFromInstant, out correctionToInstant); var uid = (ffc.GetString("uniqueId") != null) ? UniqueId.Parse(ffc.GetString("uniqueId")) : deserializer.FromField<UniqueId>(ffc.GetByName("uniqueId")); var definition = deserializer.FromField<YieldCurveDefinition>(ffc.GetByName("yieldCurveDefinition")); return new YieldCurveDefinitionDocument(versionFromInstant, versionToInstant, correctionFromInstant, correctionToInstant) { YieldCurveDefinition = definition, UniqueId = uid}; }
public static FixedIncomeStripWithSecurity FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer) { var originalstrip = deserializer.FromField<FixedIncomeStrip>(ffc.GetByName("strip")); var resolvedTenor = new Tenor(ffc.GetString("resolvedTenor")); DateTimeOffset maturity = GetDateTime(ffc.GetByName("maturity")); ExternalId securityIdentifier = ExternalId.Parse(ffc.GetString("identifier")); var security = deserializer.FromField<ISecurity>(ffc.GetByName("security")); return new FixedIncomeStripWithSecurity(originalstrip, resolvedTenor, maturity, securityIdentifier, security ); }
public static ChangeEvent FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer) { var changeType = EnumBuilder<ChangeType>.Parse(ffc.GetMessage("type").GetString(1)); var beforeField = ffc.GetString("beforeId"); var beforeId = beforeField == null ? null : UniqueId.Parse(beforeField); var afterField = ffc.GetString("afterId"); var afterId = afterField == null ? null : UniqueId.Parse(afterField); var versionField = ffc.GetByName("versionInstant"); var versionInstant = (FudgeDateTime) versionField.Value; return new ChangeEvent(changeType, beforeId, afterId, new Instant(versionInstant)); }
public static VolatilityCubeData FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer) { var dataPoints = MapBuilder.FromFudgeMsg(ffc.GetMessage("dataPoints"), deserializer.FromField<VolatilityPoint>, f => (double)f.Value); var otherValues = deserializer.FromField<SnapshotDataBundle>(ffc.GetByName("otherData")); Dictionary<Pair<Tenor, Tenor>, double> strikes = null; var strikesField = ffc.GetMessage("strikes"); if (strikesField != null) { strikes = strikesField.Select(deserializer.FromField<StrikeEntry>).ToDictionary(s => new Pair<Tenor, Tenor>(new Tenor(s.SwapTenor), new Tenor(s.OptionExpiry)), s => s.Strike); } return new VolatilityCubeData(dataPoints, otherValues, strikes); }
public object Deserialize(IFudgeFieldContainer msg, IFudgeDeserializer deserializer, Action<object, SerializationInfo, StreamingContext> deserializeMethod) { // Create without construction and register before we call the constructor in case there are any cycles object result = FormatterServices.GetUninitializedObject(type); deserializer.Register(msg, result); var converter = new DeserializingFormatterConverter(deserializer); var si = new SerializationInfo(this.type, converter); PopulateSerializationInfo(si, msg); beforeAfterMixin.CallBeforeDeserialize(result); deserializeMethod(result, si, streamingContext); beforeAfterMixin.CallAfterDeserialize(result); return result; }
public static PresentValueSensitivity FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer) { var data = new Dictionary<string, List<Tuple<double, double>>>(); var curveNames = ffc.GetAllByName("curve name"); var sensitivities = ffc.GetAllByName("sensitivities"); int id = 0; foreach (var tuple in curveNames.Zip(sensitivities, Tuple.Create)) { string curveName = new StringBuilder("TODO ").Append(id++).ToString(); //I believe the java is broken var listSensitivities = (IFudgeFieldContainer) tuple.Item2; var pairsFields = listSensitivities.GetAllByName(null); var tuples = pairsFields.Select(ReadPair).ToList(); data.Add(curveName, tuples); } return new PresentValueSensitivity(data); }
/// <inheritdoc/> public object Deserialize(IFudgeFieldContainer msg, IFudgeDeserializer deserializer) { // We create the new object without constructing it, so we can register it before trying // to deserialize the parameters. This allows us to support cycles. object result = FormatterServices.GetUninitializedObject(type); deserializer.Register(msg, result); var args = new object[constructorParams.Length]; foreach (var field in msg) { if (field.Name != null) { string name = field.Name.ToLower(); for (int i = 0; i < constructorParams.Length; i++) { var constructorParam = constructorParams[i]; if (constructorParam.LowerName == name) { switch (constructorParam.Kind) { case TypeData.TypeKind.FudgePrimitive: args[i] = context.TypeHandler.ConvertType(field.Value, constructorParam.TypeData.Type); ; break; default: args[i] = deserializer.FromField(field, constructorParam.TypeData.Type); break; } break; } } } } constructor.Invoke(result, args); return result; }
public static FixedIncomeStripWithSecurity FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer) { var originalstrip = deserializer.FromField <FixedIncomeStrip>(ffc.GetByName("strip")); var resolvedTenor = new Tenor(ffc.GetString("resolvedTenor")); DateTimeOffset maturity = GetDateTime(ffc.GetByName("maturity")); ExternalId securityIdentifier = ExternalId.Parse(ffc.GetString("identifier")); var security = deserializer.FromField <ISecurity>(ffc.GetByName("security")); return(new FixedIncomeStripWithSecurity(originalstrip, resolvedTenor, maturity, securityIdentifier, security )); }
public void Deserialize(IFudgeFieldContainer msg, IFudgeDeserializer deserializer) { Bid = msg.GetDouble("Bid") ?? 0.0; Ask = msg.GetDouble("Ask") ?? 0.0; BidVolume = msg.GetDouble("BidVolume") ?? 0.0; AskVolume = msg.GetDouble("AskVolume") ?? 0.0; Timestamp = msg.GetLong("Timestamp") ?? 0; }
private void ObjectAdd(MorePropertyData prop, object obj, IFudgeField field, IFudgeDeserializer deserializer) { // Handles both reference and inline object subObject = deserializer.FromField(field, prop.PropertyData.Type); prop.PropertyData.Setter(obj, subObject); }
public override SimplePortfolioNode DeserializeImpl(IFudgeFieldContainer msg, IFudgeDeserializer deserializer) { return(new SimplePortfolioNode( UniqueId.Parse(msg.GetString("identifier")), msg.GetString("name"), deserializer.FromField <IList <PortfolioNode> >(msg.GetByName("subNodes")) ?? new List <PortfolioNode>(), deserializer.FromField <IList <IPosition> >(msg.GetByName("positions")) ?? new List <IPosition>())); }
public override PagingRequest DeserializeImpl(IFudgeFieldContainer msg, IFudgeDeserializer deserializer) { return(PagingRequest.OfIndex(msg.GetInt("first").Value, msg.GetInt("size").Value)); }
public override ValueProperties DeserializeImpl(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer) { var withoutMessage = ffc.GetMessage("without"); if (withoutMessage != null) { if (withoutMessage.Any()) { var without = withoutMessage.Select(f => f.Value).Cast <string>(); var withoutSet = SmallSet <string> .Create(without); return(new NearlyInfiniteValueProperties(withoutSet)); } else { return(InfiniteValueProperties.Instance); } } var withMessage = ffc.GetMessage("with"); if (withMessage == null) { return(EmptyValueProperties.Instance); } var properties = new Dictionary <string, ISet <string> >(withMessage.GetNumFields()); HashSet <string> optional = null; foreach (var field in withMessage) { var name = string.Intern(field.Name); // Should be a small static set var fieldType = field.Type; if (Equals(fieldType, StringFieldType.Instance)) { var value = (string)field.Value; properties.Add(name, SmallSet <string> .Create(value)); } else if (Equals(fieldType, IndicatorFieldType.Instance)) { //withAny properties.Add(name, new HashSet <string>()); } else if (Equals(fieldType, FudgeMsgFieldType.Instance)) { var propMessage = (IFudgeFieldContainer)field.Value; var hashSet = new HashSet <string>(); foreach (var fudgeField in propMessage) { if (fudgeField.Value == IndicatorType.Instance) { if (fudgeField.Name != "optional") { throw new ArgumentException(); } optional = optional ?? new HashSet <string>(); optional.Add(name); } else { string value = (string)fudgeField.Value; hashSet.Add(value); } } if (hashSet.Any()) { properties.Add(name, hashSet); } } } return(new FiniteValueProperties(properties, optional == null ? null : SmallSet <string> .Create(optional))); }
public static SimpleResolutionRuleTransform FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer) { return(new SimpleResolutionRuleTransform(ffc)); }
public static InterpolatedDoublesSurface FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer) { var xData = ffc.GetValue <double[]>("x data"); var yData = ffc.GetValue <double[]>("y data"); var zData = ffc.GetValue <double[]>("z data"); return(new InterpolatedDoublesSurface(xData, yData, zData)); }
public static InterpolatedYieldCurveSpecification FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer) { var curveDate = ffc.GetValue <DateTimeOffset>("curveDate"); string name = ffc.GetString("name"); var currency = ffc.GetValue <Currency>("currency"); var region = ExternalId.Parse(ffc.GetString("region")); var resolvedStripFields = ffc.GetAllByName("resolvedStrips"); var resolvedStrips = resolvedStripFields.Select(deserializer.FromField <FixedIncomeStripWithIdentifier>) .ToList(); return(new InterpolatedYieldCurveSpecification(curveDate, name, currency, resolvedStrips, region)); }
public static SnapshotDataBundle FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer) { var map = MapBuilder.FromFudgeMsg(ffc.GetMessage("dataPoints"), f => UniqueId.Parse((string)f.Value), f => (double)f.Value); return(new SnapshotDataBundle(map)); }
/// <inheritdoc/> public object Deserialize(IFudgeFieldContainer msg, IFudgeDeserializer deserializer) { return(helper.CreateAndDeserialize(msg, deserializer)); }
public DeserializingFormatterConverter(IFudgeDeserializer deserializer) { this.deserializer = deserializer; }
public void Deserialize(IFudgeFieldContainer msg, IFudgeDeserializer deserializer) { // Skip message Other = deserializer.FromField <ClassWithMessageIn>(msg.GetByName("other")); }
public static NumberDeltaComparer FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer) { return(new NumberDeltaComparer(ffc.GetInt("decimalPlaces").Value)); }
public static FastArrayIntDoubleTimeSeries FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer) { var bits = FromFudgeMsgImpl(ffc, deserializer); return(new FastArrayIntDoubleTimeSeries(bits.Item1, bits.Item2, bits.Item3)); }
public static DateTimeNumericEncoding FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer) { string value = ffc.GetString(1); return(Build(value)); }
public static ManageableUnstructuredMarketDataSnapshot FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer) { var dictionary = new Dictionary <MarketDataValueSpecification, IDictionary <string, ValueSnapshot> >(); foreach (var entryField in ffc.GetAllByOrdinal(1)) { var entryMsg = (IFudgeFieldContainer)entryField.Value; MarketDataValueSpecification valueSpec = null; string valueName = null; ValueSnapshot value = null; foreach (var field in entryMsg) { switch (field.Name) { case "valueSpec": valueSpec = deserializer.FromField <MarketDataValueSpecification>(field); break; case "valueName": valueName = (string)field.Value; break; case "value": value = deserializer.FromField <ValueSnapshot>(field); break; default: throw new ArgumentOutOfRangeException(); } } IDictionary <string, ValueSnapshot> innerDict; if (!dictionary.TryGetValue(valueSpec, out innerDict)) { innerDict = new Dictionary <string, ValueSnapshot>(); dictionary.Add(valueSpec, innerDict); } innerDict.Add(valueName, value); } return(new ManageableUnstructuredMarketDataSnapshot(dictionary)); }
/// <inheritdoc/> public object Deserialize(IFudgeFieldContainer msg, IFudgeDeserializer deserializer) { return helper.Deserialize(msg, deserializer, (obj, si, sc) => { var args = new object[] { si, sc }; constructor.Invoke(obj, args); }); }
public static VolatilityCubeKey FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer) { return(new VolatilityCubeKey(ffc.GetValue <Currency>("currency"), ffc.GetString("name"))); }
/// <inheritdoc/> public object Deserialize(IFudgeFieldContainer msg, IFudgeDeserializer deserializer) { return memberSerializer.Deserialize(msg, deserializer); }
public static MissingMarketDataSentinel FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer) { return(Instance); }
/// <inheritdoc/> public object Deserialize(IFudgeFieldContainer msg, IFudgeDeserializer deserializer) { return helper.CreateAndDeserialize(msg, deserializer); }
private void PrimitiveAdd(MorePropertyData prop, object obj, IFudgeField field, IFudgeDeserializer deserializer) { object val = context.TypeHandler.ConvertType(field.Value, prop.PropertyData.Type); prop.PropertyData.Setter(obj, val); }
public static ViewDefinitionCompilationFailedCall FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer) { return new ViewDefinitionCompilationFailedCall(ffc.GetValue<DateTimeOffset>("valuationTime"), deserializer.FromField<JavaException>(ffc.GetByName("exception"))); }
private void ListAppend <T>(MorePropertyData prop, object obj, IFudgeField field, IFudgeDeserializer deserializer) where T : class { IList <T> newList = deserializer.FromField <IList <T> >(field); IList <T> currentList = (IList <T>)prop.PropertyData.Getter(obj); foreach (T item in newList) { currentList.Add(item); } }
public static ViewCycleExecutionOptions FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer) { IFudgeField mdsField = ffc.GetByName("marketDataSpecification"); var marketDataSpecification = mdsField == null ? null : deserializer.FromField <MarketDataSpecification>(mdsField); var valuationValue = ffc.GetValue("valuation"); var valuation = (FudgeDateTime)(valuationValue == IndicatorType.Instance ? null : valuationValue); return(new ViewCycleExecutionOptions(valuation.ToDateTimeOffsetWithDefault(), marketDataSpecification)); }
protected override InMemoryViewComputationResultModel BuildObject(IFudgeFieldContainer msg, IFudgeDeserializer deserializer, Dictionary <string, ViewCalculationResultModel> configurationMap, UniqueId viewProcessId, UniqueId viewCycleId, DateTimeOffset inputDataTimestamp, DateTimeOffset resultTimestamp, TimeSpan calculationDuration) { var liveDataMsg = msg.GetMessage("liveData"); List <ComputedValue> liveData = liveDataMsg == null ? null : liveDataMsg.GetAllByOrdinal(1).Select(deserializer.FromField <ComputedValue>).ToList(); return(new InMemoryViewComputationResultModel(viewProcessId, viewCycleId, inputDataTimestamp, resultTimestamp, configurationMap, liveData, calculationDuration)); }
public static SimpleResolutionRuleTransform FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer) { return new SimpleResolutionRuleTransform(ffc); }
public override UserMarketDataSpecification DeserializeImpl(IFudgeFieldContainer msg, IFudgeDeserializer deserializer) { return(new UserMarketDataSpecification(deserializer.FromField <UniqueId>(msg.GetByName("userSnapshotId")))); }
public static LocalDateEpochDaysConverter FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer) { return new LocalDateEpochDaysConverter(ffc.GetString(1)); }
public static MarketDataValueSpecification FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer) { var marketDataValueType = EnumBuilder <MarketDataValueType> .Parse(ffc.GetString("type")); return(new MarketDataValueSpecification( marketDataValueType, UniqueId.Parse(ffc.GetString("uniqueId")) )); }
public override ExecutionOptions DeserializeImpl(IFudgeFieldContainer msg, IFudgeDeserializer deserializer) { throw new NotImplementedException(); }
/// <inheritdoc/> public object Deserialize(IFudgeFieldContainer msg, IFudgeDeserializer deserializer) { return(deserializerDelegate(msg, deserializer)); }
public override TMatrix DeserializeImpl(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer) { string labelsTitle = ffc.GetString("labelsTitle"); string valuesTitle = ffc.GetString("valuesTitle"); var msg = ffc.GetMessage(MatrixField); var labelTypes = new Queue <string>(); var labelValues = new Queue <IFudgeField>(); IList <TKey> keys = new List <TKey>(); IList <object> labels = new List <object>(); IList <double> values = new List <double>(); foreach (IFudgeField field in msg) { switch (field.Ordinal) { case LabelTypeOrdinal: labelTypes.Enqueue((string)field.Value); break; case KeyOrdinal: TKey key = GetKey(field); keys.Add(key); break; case LabelOrdinal: labelValues.Enqueue(field); break; case ValueOrdinal: values.Add((double)field.Value); break; } if (labelTypes.Count != 0 && labelValues.Count != 0) { // Have a type and a value, which can be consumed string labelTypeName = labelTypes.Dequeue(); IFudgeField labelValue = labelValues.Dequeue(); switch (labelTypeName) { case "java.lang.String": var value = (string)labelValue.Value; labels.Add(value); break; case "com.opengamma.util.time.Tenor": //TODO DOTNET-14 this is serialized as a string here string period = (string)labelValue.Value; labels.Add(new Tenor(period)); break; case "com.opengamma.util.money.Currency": string iso = (string)labelValue.Value; labels.Add(Currency.Create(iso)); break; case "com.opengamma.id.ExternalId": string str = (string)labelValue.Value; labels.Add(ExternalId.Parse(str)); break; default: //TODO work out whether this is right (and fast enough) in the general case var typeMapper = (IFudgeTypeMappingStrategy) Context.GetProperty(ContextProperties.TypeMappingStrategyProperty); Type labelType = typeMapper.GetType(labelTypeName); object label = deserializer.FromField(labelValue, labelType); labels.Add(label); break; } } } var constructorInfo = typeof(TMatrix).GetConstructor(new[] { typeof(IList <TKey>), typeof(IList <object>), //TODO type up this (if the java side does) typeof(IList <double>), typeof(string), typeof(string), }); return((TMatrix)constructorInfo.Invoke(new object[] { keys, labels, values, labelsTitle, valuesTitle })); }
public override IPortfolio DeserializeImpl(IFudgeFieldContainer msg, IFudgeDeserializer deserializer) { return(new SimplePortfolio(deserializer.FromField <PortfolioNode>(msg.GetByName("root")), UniqueId.Parse(msg.GetString("identifier")), msg.GetString("name"))); }
public static LocalDateEpochDaysConverter FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer) { return(new LocalDateEpochDaysConverter(ffc.GetString(1))); }
public void Deserialize(IFudgeFieldContainer msg, IFudgeDeserializer deserializer) { // Skip message Other = deserializer.FromField<ClassWithMessageIn>(msg.GetByName("other")); }
public override object DeserializeImpl(IFudgeFieldContainer msg, IFudgeDeserializer deserializer) { return(Parse(msg.GetString(1))); }