Ejemplo n.º 1
0
 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);
 }
Ejemplo n.º 4
0
        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;
        }
Ejemplo n.º 5
0
        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);
        }
Ejemplo n.º 6
0
 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);
 }
Ejemplo n.º 7
0
 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);
        }
Ejemplo n.º 10
0
 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()
         );
 }
Ejemplo n.º 11
0
        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);
        }
Ejemplo n.º 12
0
        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);
        }
Ejemplo n.º 13
0
        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);
        }
Ejemplo n.º 15
0
        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};
        }
Ejemplo n.º 16
0
 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
         );
 }
Ejemplo n.º 17
0
 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));
 }
Ejemplo n.º 18
0
        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);
        }
Ejemplo n.º 19
0
        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;
        }
Ejemplo n.º 20
0
 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);
 }
Ejemplo n.º 21
0
        /// <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;
        }
Ejemplo n.º 22
0
        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
                                                    ));
        }
Ejemplo n.º 23
0
 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;
 }
Ejemplo n.º 24
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>()));
 }
Ejemplo n.º 26
0
 public override PagingRequest DeserializeImpl(IFudgeFieldContainer msg, IFudgeDeserializer deserializer)
 {
     return(PagingRequest.OfIndex(msg.GetInt("first").Value, msg.GetInt("size").Value));
 }
Ejemplo n.º 27
0
        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));
 }
Ejemplo n.º 29
0
        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));
        }
Ejemplo n.º 30
0
        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));
        }
Ejemplo n.º 31
0
        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));
        }
Ejemplo n.º 32
0
 /// <inheritdoc/>
 public object Deserialize(IFudgeFieldContainer msg, IFudgeDeserializer deserializer)
 {
     return(helper.CreateAndDeserialize(msg, deserializer));
 }
 public DeserializingFormatterConverter(IFudgeDeserializer deserializer)
 {
     this.deserializer = deserializer;
 }
Ejemplo n.º 34
0
 public void Deserialize(IFudgeFieldContainer msg, IFudgeDeserializer deserializer)
 {
     // Skip message
     Other = deserializer.FromField <ClassWithMessageIn>(msg.GetByName("other"));
 }
Ejemplo n.º 35
0
 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));
        }
Ejemplo n.º 37
0
        public static DateTimeNumericEncoding FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer)
        {
            string value = ffc.GetString(1);

            return(Build(value));
        }
Ejemplo n.º 38
0
        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);
         });
 }
Ejemplo n.º 40
0
 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);
 }
Ejemplo n.º 42
0
 public static MissingMarketDataSentinel FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer)
 {
     return(Instance);
 }
Ejemplo n.º 43
0
 /// <inheritdoc/>
 public object Deserialize(IFudgeFieldContainer msg, IFudgeDeserializer deserializer)
 {
     return helper.CreateAndDeserialize(msg, deserializer);
 }
Ejemplo n.º 44
0
 public DeserializingFormatterConverter(IFudgeDeserializer deserializer)
 {
     this.deserializer = deserializer;
 }
Ejemplo n.º 45
0
            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);
            }
Ejemplo n.º 46
0
 public static ViewDefinitionCompilationFailedCall FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer)
 {
     return new ViewDefinitionCompilationFailedCall(ffc.GetValue<DateTimeOffset>("valuationTime"), deserializer.FromField<JavaException>(ffc.GetByName("exception")));
 }
Ejemplo n.º 47
0
            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);
                }
            }
Ejemplo n.º 48
0
        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));
        }
Ejemplo n.º 50
0
 public static SimpleResolutionRuleTransform FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer)
 {
     return new SimpleResolutionRuleTransform(ffc);
 }
Ejemplo n.º 51
0
 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"))
                       ));
        }
Ejemplo n.º 54
0
 public override ExecutionOptions DeserializeImpl(IFudgeFieldContainer msg, IFudgeDeserializer deserializer)
 {
     throw new NotImplementedException();
 }
 /// <inheritdoc/>
 public object Deserialize(IFudgeFieldContainer msg, IFudgeDeserializer deserializer)
 {
     return(deserializerDelegate(msg, deserializer));
 }
Ejemplo n.º 56
0
        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 }));
        }
Ejemplo n.º 57
0
 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")));
 }
Ejemplo n.º 58
0
 public static LocalDateEpochDaysConverter FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer)
 {
     return(new LocalDateEpochDaysConverter(ffc.GetString(1)));
 }
Ejemplo n.º 59
0
 public void Deserialize(IFudgeFieldContainer msg, IFudgeDeserializer deserializer)
 {
     // Skip message
     Other = deserializer.FromField<ClassWithMessageIn>(msg.GetByName("other"));
 }
Ejemplo n.º 60
0
 public override object DeserializeImpl(IFudgeFieldContainer msg, IFudgeDeserializer deserializer)
 {
     return(Parse(msg.GetString(1)));
 }