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 static ManageableMarketDataSnapshot FromFudgeMsg(IFudgeFieldContainer ffc,
                                                                IFudgeDeserializer deserializer)
        {
            var      uidString = ffc.GetString("uniqueId");
            UniqueId uid       = uidString == null ? null : UniqueId.Parse(uidString);

            var surfaceMessage = ffc.GetMessage("volatilitySurfaces");
            Dictionary <VolatilitySurfaceKey, ManageableVolatilitySurfaceSnapshot> surfaces;

            if (surfaceMessage == null)
            {
                //Handle old format
                surfaces = new Dictionary <VolatilitySurfaceKey, ManageableVolatilitySurfaceSnapshot>();
            }
            else
            {
                surfaces = MapBuilder.FromFudgeMsg <VolatilitySurfaceKey, ManageableVolatilitySurfaceSnapshot>(surfaceMessage, deserializer);
            }
            var manageableMarketDataSnapshot = new ManageableMarketDataSnapshot(
                ffc.GetString("basisViewName"),
                deserializer.FromField <ManageableUnstructuredMarketDataSnapshot>(ffc.GetByName("globalValues")),
                MapBuilder.FromFudgeMsg <YieldCurveKey, ManageableYieldCurveSnapshot>(ffc.GetMessage("yieldCurves"), deserializer),
                MapBuilder.FromFudgeMsg <VolatilityCubeKey, ManageableVolatilityCubeSnapshot>(ffc.GetMessage("volatilityCubes"), deserializer),
                surfaces,
                uid

                )
            {
                Name = ffc.GetString("name")
            };

            return(manageableMarketDataSnapshot);
        }
Exemple #3
0
        public override UnorderedCurrencyPair DeserializeImpl(IFudgeFieldContainer msg, IFudgeDeserializer deserializer)
        {
            Currency ccy1 = Currency.Create(msg.GetString("currency1"));
            Currency ccy2 = Currency.Create(msg.GetString("currency2"));

            return(new UnorderedCurrencyPair(ccy1, ccy2));
        }
 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;
 }
Exemple #5
0
 public static VolatilityPoint FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer)
 {
     return(new VolatilityPoint(
                new Tenor(ffc.GetString("swapTenor")),
                new Tenor(ffc.GetString("optionExpiry")),
                ffc.GetDouble("relativeStrike").Value
                ));
 }
            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 MarketDataValueSpecification FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer)
        {
            var marketDataValueType = EnumBuilder <MarketDataValueType> .Parse(ffc.GetString("type"));

            return(new MarketDataValueSpecification(
                       marketDataValueType,
                       UniqueId.Parse(ffc.GetString("uniqueId"))
                       ));
        }
 public static SABRFittedSurfaces FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer)
 {
     return(new SABRFittedSurfaces(
                deserializer.FromField <InterpolatedDoublesSurface>(ffc.GetByName("AlphaSurface")),
                deserializer.FromField <InterpolatedDoublesSurface>(ffc.GetByName("BetaSurface")),
                deserializer.FromField <InterpolatedDoublesSurface>(ffc.GetByName("NuSurface")),
                deserializer.FromField <InterpolatedDoublesSurface>(ffc.GetByName("RhoSurface")),
                Currency.Create(ffc.GetString("Currency")),
                ffc.GetString("DayCountName")
                ));
 }
Exemple #9
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));
        }
        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 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);
        }
Exemple #13
0
        public override PortfolioDocument DeserializeImpl(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer)
        {
            DateTimeOffset versionToInstant;
            DateTimeOffset correctionFromInstant;
            DateTimeOffset correctionToInstant;
            DateTimeOffset versionFromInstant = AbstractDocument.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 portfolio = deserializer.FromField <ManageablePortfolio>(ffc.GetByName("portfolio"));

            return(new PortfolioDocument(versionFromInstant, versionToInstant, correctionFromInstant, correctionToInstant, uid, portfolio));
        }
Exemple #14
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};
        }
Exemple #15
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));
        }
Exemple #16
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));
 }
Exemple #17
0
        public override ITrade DeserializeImpl(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer)
        {
            //TODO: the rest of this
            var uniqueIdentifier = UniqueId.Parse(ffc.GetString("uniqueId"));

            var tradeDate = ffc.GetValue <DateTimeOffset>("tradeDate");

            var securityKey = deserializer.FromField <ExternalIdBundle>(ffc.GetByName("securityKey"));

            var counterPartyIdentifier = ExternalId.Parse(ffc.GetString("counterpartyKey") ?? ffc.GetString("counterparty")); //NOTE: this is a hack because we don't use proto yet
            var quant = ffc.GetValue <string>("quantity");

            return(new SimpleTrade(uniqueIdentifier, tradeDate, securityKey, new CounterpartyImpl(counterPartyIdentifier), decimal.Parse(quant)));
        }
Exemple #18
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
         );
 }
Exemple #19
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
                                                    ));
        }
        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
            });
        }
Exemple #21
0
        public static ViewDefinition FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer)
        {
            var name           = ffc.GetValue <string>("name");
            var uniqueIdString = ffc.GetString("uniqueId");
            var uniqueId       = uniqueIdString == null ? null : UniqueId.Parse(uniqueIdString);

            var resultModelDefinition = deserializer.FromField <ResultModelDefinition>(ffc.GetByName("resultModelDefinition"));

            UniqueId portfolioIdentifier = ValueRequirement.GetUniqueIdentifier(ffc, deserializer, "identifier");
            var      user = deserializer.FromField <UserPrincipal>(ffc.GetByName("user"));

            var currency = ffc.GetValue <Currency>("currency");

            var minDeltaCalcPeriod = ReadNullableTimeSpanField(ffc, "minDeltaCalcPeriod");
            var maxDeltaCalcPeriod = ReadNullableTimeSpanField(ffc, "maxDeltaCalcPeriod");

            var minFullCalcPeriod = ReadNullableTimeSpanField(ffc, "fullDeltaCalcPeriod");
            var maxFullCalcPeriod = ReadNullableTimeSpanField(ffc, "maxFullCalcPeriod");

            var calculationConfigurationsByName = ffc.GetAllByName("calculationConfiguration")
                                                  .Select(deserializer.FromField <ViewCalculationConfiguration>)
                                                  .ToDictionary(vcc => vcc.Name);

            return(new ViewDefinition(name, resultModelDefinition, portfolioIdentifier, user, currency, minDeltaCalcPeriod, maxDeltaCalcPeriod, minFullCalcPeriod, maxFullCalcPeriod, calculationConfigurationsByName, uniqueId));
        }
Exemple #22
0
        public static ConstantDoublesSurface FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer)
        {
            double z    = ffc.GetDouble("z value").Value;
            string name = ffc.GetString("surface name");

            return(new ConstantDoublesSurface(z, name));
        }
Exemple #23
0
        private static UniqueId GetUniqueId(IFudgeFieldContainer msg, string fieldName)
        {
            //TODO: remove this once PLAT-1683 is fixed
            var uidStr = msg.GetString(fieldName);

            return(uidStr == string.Empty ? null : UniqueId.Parse(uidStr));
        }
Exemple #24
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)));
        }
Exemple #25
0
            public object Deserialize(IFudgeFieldContainer msg, IFudgeDeserializer deserializer)
            {
                var deserialize = Enum.Parse(typeof(SurrogateEnumTest), msg.GetString(1));

                deserializer.Register(msg, deserialize);
                return(deserialize);
            }
        public override CompiledViewCalculationConfigurationImpl DeserializeImpl(IFudgeFieldContainer msg, IFudgeDeserializer deserializer)
        {
            string name = msg.GetString("name");
            Dictionary <ValueRequirement, ValueSpecification> marketDataRequirements = MapBuilder.FromFudgeMsg <ValueRequirement, ValueSpecification>(msg.GetMessage("marketDataRequirements"), deserializer);
            var computationTargets = new HashSet <ComputationTargetSpecification>(msg.GetMessage("computationTargets").GetAllByOrdinal(1).Select(deserializer.FromField <ComputationTargetSpecification>));

            IFudgeFieldContainer specMessage = msg.GetMessage("terminalOutputSpecifications");
            Dictionary <ValueSpecification, HashSet <ValueRequirement> > terminalOutputSpecifications = MapBuilder.FromFudgeMsg(specMessage, deserializer.FromField <ValueSpecification>, f => GetRequirementSet(f, deserializer));

            return(new CompiledViewCalculationConfigurationImpl(name, marketDataRequirements, computationTargets, terminalOutputSpecifications));
        }
        public override DependencyNode DeserializeImpl(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer)
        {
            var target = deserializer.FromField <ComputationTarget>(ffc.GetByName("target"));

            string parameterizedFunctionUniqueId = ffc.GetString("parameterizedFunctionUniqueId");
            var    functionParametersField       = ffc.GetByName("functionParameters");
            var    functionParameters            = functionParametersField != null?deserializer.FromField <IFunctionParameters>(functionParametersField) : null;

            string functionShortName = ffc.GetString("functionShortName");
            string functionUniqueId  = ffc.GetString("functionUniqueId");

            ICompiledFunctionDefinition function = new CompiledFunctionDefinitionStub(target.Type, functionShortName, functionUniqueId);
            var parameterizedFunction            = new ParameterizedFunction(function, functionParameters, parameterizedFunctionUniqueId);

            var inputValues          = DeserializeSet <ValueSpecification>(deserializer, ffc, "inputValues");
            var outputValues         = DeserializeSet <ValueSpecification>(deserializer, ffc, "outputValues");
            var terminalOutputValues = DeserializeSet <ValueSpecification>(deserializer, ffc, "terminalOutputValues");

            return(new DependencyNode(target, inputValues, outputValues, terminalOutputValues, parameterizedFunction));
        }
Exemple #28
0
 public static SABRFittedSurfaces FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer)
 {
     return new SABRFittedSurfaces(
         deserializer.FromField<InterpolatedDoublesSurface>(ffc.GetByName("AlphaSurface")),
         deserializer.FromField<InterpolatedDoublesSurface>(ffc.GetByName("BetaSurface")),
         deserializer.FromField<InterpolatedDoublesSurface>(ffc.GetByName("NuSurface")),
         deserializer.FromField<InterpolatedDoublesSurface>(ffc.GetByName("RhoSurface")),
         Currency.Create(ffc.GetString("Currency")),
         ffc.GetString("DayCountName")
         );
 }
 public void Deserialize(IFudgeFieldContainer msg, IFudgeDeserializer deserializer)
 {
     Ticker = msg.GetString("ticker");
     Bid    = msg.GetDouble("bid") ?? 0.0;
     Offer  = msg.GetDouble("offer") ?? 0.0;
 }
Exemple #30
0
 public static FixedIncomeStripWithIdentifier FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer)
 {
     return new FixedIncomeStripWithIdentifier(ExternalId.Parse(ffc.GetString("identifier")), deserializer.FromField<FixedIncomeStrip>(ffc.GetByName("strip")));
 }
Exemple #31
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);
        }
        public static DateTimeNumericEncoding FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer)
        {
            string value = ffc.GetString(1);

            return(Build(value));
        }
        public static DateTimeNumericEncoding FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer)
        {
            string value = ffc.GetString(1);

            return Build(value);
        }
        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 ManageablePortfolio DeserializeImpl(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer)
 {
     return(new ManageablePortfolio(ffc.GetString("name"), UniqueId.Parse(ffc.GetString("uniqueId"))));
 }
 public object Deserialize(IFudgeFieldContainer msg, IFudgeDeserializer deserializer)
 {
     var deserialize = Enum.Parse(typeof (SurrogateEnumTest), msg.GetString(1));
     deserializer.Register(msg, deserialize);
     return deserialize;
 }
 public static ConstantDoublesSurface FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer)
 {
     double z = ffc.GetDouble("z value").Value;
     string name = ffc.GetString("surface name");
     return new ConstantDoublesSurface(z, name);
 }
Exemple #38
0
        public static ViewDefinition FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer)
        {
            var name = ffc.GetValue<string>("name");
            var uniqueIdString = ffc.GetString("uniqueId");
            var uniqueId = uniqueIdString == null ? null : UniqueId.Parse(uniqueIdString);

            var resultModelDefinition = deserializer.FromField<ResultModelDefinition>(ffc.GetByName("resultModelDefinition"));

            UniqueId portfolioIdentifier = ValueRequirement.GetUniqueIdentifier(ffc, deserializer, "identifier");
            var user = deserializer.FromField<UserPrincipal>(ffc.GetByName("user"));

            var currency = ffc.GetValue<Currency>("currency");

            var minDeltaCalcPeriod = ReadNullableTimeSpanField(ffc, "minDeltaCalcPeriod");
            var maxDeltaCalcPeriod = ReadNullableTimeSpanField(ffc, "maxDeltaCalcPeriod");

            var minFullCalcPeriod = ReadNullableTimeSpanField(ffc, "fullDeltaCalcPeriod");
            var maxFullCalcPeriod = ReadNullableTimeSpanField(ffc, "maxFullCalcPeriod");

            var calculationConfigurationsByName = ffc.GetAllByName("calculationConfiguration")
                .Select(deserializer.FromField<ViewCalculationConfiguration>)
                .ToDictionary(vcc => vcc.Name);

            return new ViewDefinition(name, resultModelDefinition, portfolioIdentifier, user, currency, minDeltaCalcPeriod, maxDeltaCalcPeriod, minFullCalcPeriod, maxFullCalcPeriod, calculationConfigurationsByName, uniqueId);
        }
Exemple #39
0
 public override object DeserializeImpl(IFudgeFieldContainer msg, IFudgeDeserializer deserializer)
 {
     return(Parse(msg.GetString(1)));
 }
Exemple #40
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")));
 }
Exemple #41
0
 public static LocalDate FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer)
 {
     return(new LocalDate(DateTime.Parse(ffc.GetString("date"))));
 }
 public static LocalDateEpochDaysConverter FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer)
 {
     return new LocalDateEpochDaysConverter(ffc.GetString(1));
 }
Exemple #43
0
 public static VolatilitySurfaceKey FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer)
 {
     return(new VolatilitySurfaceKey(UniqueId.Parse(ffc.GetString("target")), ffc.GetString("name"), ffc.GetString("instrumentType"), ffc.GetString("quoteType"), ffc.GetString("quoteUnits")));
 }
Exemple #44
0
 protected static string GetName(IFudgeFieldContainer ffc)
 {
     return ffc.GetString("name") ?? ffc.GetString("curve name");
 }
 public void Deserialize(IFudgeFieldContainer msg, IFudgeDeserializer deserializer)
 {
     Ticker = msg.GetString("ticker");
     Bid = msg.GetDouble("bid") ?? 0.0;
     Offer = msg.GetDouble("offer") ?? 0.0;
 }
 public static VolatilityCubeKey FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer)
 {
     return(new VolatilityCubeKey(ffc.GetValue <Currency>("currency"), ffc.GetString("name")));
 }