public override VersionCorrection DeserializeImpl(IFudgeFieldContainer msg, IFudgeDeserializer deserializer) { var versionOf = ((FudgeDateTime)msg.GetValue("versionAsOf")).ToDateTimeOffsetWithDefault(); var correctedTo = ((FudgeDateTime)msg.GetValue("correctedTo")).ToDateTimeOffsetWithDefault(); return(new VersionCorrection(versionOf, correctedTo)); }
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 override ExternalId DeserializeImpl(IFudgeFieldContainer msg, IFudgeDeserializer deserializer) { string scheme = msg.GetValue <string>("Scheme"); string value = msg.GetValue <string>("Value"); return(new ExternalId(scheme, value)); }
public override VolatilitySurfaceData DeserializeImpl(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer) { Currency currency = ffc.GetValue <Currency>("currency"); string definitionName = ffc.GetValue <string>("definitionName"); string specificationName = ffc.GetValue <string>("specificationName"); string interpolatorName = ffc.GetValue <string>("interpolatorName"); bool xWrapped; IList <object> xs = ReadAllAsObjectList(ffc, "xs", deserializer, out xWrapped); bool yWrapped; IList <object> ys = ReadAllAsObjectList(ffc, "ys", deserializer, out yWrapped); Type xType = GetType(xs); Type yType = GetType(ys); var values = new Dictionary <Tuple <object, object>, double>(); var valuesFields = ffc.GetAllByName("values"); foreach (var valueField in valuesFields) { var subMessage = (IFudgeFieldContainer)valueField.Value; var xField = subMessage.GetByName("x"); var yField = subMessage.GetByName("y"); object x = xWrapped ? GetWrappedPrimitive(xField) : deserializer.FromField(xField, xType); object y = yWrapped ? GetWrappedPrimitive(yField) : deserializer.FromField(yField, yType); double value = subMessage.GetValue <double>("value"); values.Add(new Tuple <object, object>(x, y), value); } return(Build(xType, yType, definitionName, specificationName, currency, interpolatorName, xs, ys, values)); }
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)); }
protected static Tuple <DateTimeNumericEncoding, T[], double[]> FromFudgeMsgImpl(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer) { var encoding = deserializer.FromField <DateTimeNumericEncoding>(ffc.GetByOrdinal(1)); var times = ffc.GetValue <T[]>(2); var values = ffc.GetValue <double[]>(3); return(System.Tuple.Create(encoding, times, values)); }
public static InterpolatedDoublesCurve 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 InterpolatedDoublesCurve(name, xData, yData)); }
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 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 DateTimeOffset GetDocumentValues(IFudgeFieldContainer ffc, out DateTimeOffset versionToInstant, out DateTimeOffset correctionFromInstant, out DateTimeOffset correctionToInstant) { var versionFromInstant = ffc.GetValue<FudgeDateTime>("versionFromInstant").ToDateTimeOffsetWithDefault(); correctionFromInstant = ffc.GetValue<FudgeDateTime>("correctionFromInstant").ToDateTimeOffsetWithDefault(); versionToInstant = ffc.GetValue<FudgeDateTime>("versionToInstant").ToDateTimeOffsetWithDefault(); correctionToInstant = ffc.GetValue<FudgeDateTime>("correctionToInstant").ToDateTimeOffsetWithDefault(); return versionFromInstant; }
public static DateTimeOffset GetDocumentValues(IFudgeFieldContainer ffc, out DateTimeOffset versionToInstant, out DateTimeOffset correctionFromInstant, out DateTimeOffset correctionToInstant) { var versionFromInstant = ffc.GetValue <FudgeDateTime>("versionFromInstant").ToDateTimeOffsetWithDefault(); correctionFromInstant = ffc.GetValue <FudgeDateTime>("correctionFromInstant").ToDateTimeOffsetWithDefault(); versionToInstant = ffc.GetValue <FudgeDateTime>("versionToInstant").ToDateTimeOffsetWithDefault(); correctionToInstant = ffc.GetValue <FudgeDateTime>("correctionToInstant").ToDateTimeOffsetWithDefault(); return(versionFromInstant); }
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 ResultModelDefinition FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer) { return(new ResultModelDefinition( EnumBuilder <ResultOutputMode> .Parse(ffc.GetValue <string>("aggregatePositionOutputMode")), EnumBuilder <ResultOutputMode> .Parse(ffc.GetValue <string>("positionOutputMode")), EnumBuilder <ResultOutputMode> .Parse(ffc.GetValue <string>("tradeOutputMode")), EnumBuilder <ResultOutputMode> .Parse(ffc.GetValue <string>("securityOutputMode")), EnumBuilder <ResultOutputMode> .Parse(ffc.GetValue <string>("primitiveOutputMode")) )); }
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 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 CompiledViewDefinitionImpl FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer) { ViewDefinition defn = deserializer.FromField <ViewDefinition>(ffc.GetByName("viewDefinition")); IPortfolio portfolio = deserializer.FromField <IPortfolio>(ffc.GetByName("portfolio")); DateTimeOffset latestValidity = ffc.GetValue <FudgeDateTime>("latestValidity").ToDateTimeOffsetWithDefault(); DateTimeOffset earliestValidity = ffc.GetValue <FudgeDateTime>("earliestValidity").ToDateTimeOffsetWithDefault(); var configs = ffc.GetAllByName("compiledCalculationConfigurations").Select(deserializer.FromField <CompiledViewCalculationConfigurationImpl>).ToDictionary(c => c.Name, c => (ICompiledViewCalculationConfiguration)c); return(new CompiledViewDefinitionImpl(defn, portfolio, latestValidity, earliestValidity, configs)); }
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 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))); }
public static FixedIncomeStrip FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer) { FixedIncomeStrip ret = new FixedIncomeStrip(); ret.InstrumentType = EnumBuilder <StripInstrumentType> .Parse(ffc.GetValue <string>("type")); ret.CurveNodePointTime = new Tenor(ffc.GetValue <string>("tenor")); ret.ConventionName = ffc.GetValue <string>("conventionName"); if (ret.InstrumentType == StripInstrumentType.Future) { ret.NthFutureFromTenor = ffc.GetValue <int>("numFutures"); } return(ret); }
public static ViewCalculationConfiguration FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer) { var name = ffc.GetValue <string>("name"); List <ValueRequirement> specificRequirements = GetList <ValueRequirement>(ffc, "specificRequirement", deserializer); //TODO MAP deserializer by magic var portfolioRequirementsBySecurityType = new Dictionary <string, HashSet <Tuple <string, ValueProperties> > >(); foreach (var portfolioReqField in ffc.GetAllByName("portfolioRequirementsBySecurityType")) { const string securitytypeKey = "securityType"; var securityType = ((IFudgeFieldContainer)portfolioReqField.Value).GetValue <string>(securitytypeKey); var enumerable = ((IFudgeFieldContainer)portfolioReqField.Value).GetAllByName("portfolioRequirement").Select(f => GetReqPair(f, deserializer)); portfolioRequirementsBySecurityType.Add(securityType, new HashSet <Tuple <string, ValueProperties> >(enumerable)); } var defaultProperties = deserializer.FromField <ValueProperties>(ffc.GetByName("defaultProperties")); var deltaDefinition = deserializer.FromField <DeltaDefinition>(ffc.GetByName("deltaDefinition")); IResolutionRuleTransform transform = null; IFudgeField transformField = ffc.GetByName("resolutionRuleTransform"); if (transformField != null) { transform = deserializer.FromField <IResolutionRuleTransform>(transformField); } return(new ViewCalculationConfiguration(name, specificRequirements, portfolioRequirementsBySecurityType, deltaDefinition, defaultProperties, transform)); }
public static FunctionalDoublesCurve FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer) { string name = GetName(ffc); double[] parameters = ffc.GetValue <double[]>("NSS parameters"); return(Create(new NelsonSiegelSvennsonBondCurveModel(parameters).Eval, name)); }
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); }
private static DateTimeOffset GetToDateTimeOffsetWithDefault(IFudgeFieldContainer msg, string fieldName) { //TODO strict once [PLAT-1683] is fixed if (msg.GetByName(fieldName).Type == IndicatorFieldType.Instance) { return(new DateTimeOffset()); } return(msg.GetValue <DateTimeOffset>(fieldName)); }
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 override IPosition DeserializeImpl(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer) { var id = ffc.GetValue <string>("uniqueId"); var secKey = deserializer.FromField <ExternalIdBundle>(ffc.GetByName("securityKey")); var quant = ffc.GetValue <string>("quantity"); var trades = deserializer.FromField <IList <ITrade> >(ffc.GetByName("trades")) ?? new List <ITrade>(); decimal quantity; if (!decimal.TryParse(quant, out quantity)) { if (quant == "0E-8") { quantity = 0; } else { throw new OpenGammaException("Failed to parse quantity " + quant); } } return(new SimplePosition(id == null ? null : UniqueId.Parse(id), quantity, secKey, trades)); }
public static VolatilityCubeKey FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer) { return(new VolatilityCubeKey(ffc.GetValue <Currency>("currency"), ffc.GetString("name"))); }
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); }
public static ViewDefinitionCompilationFailedCall FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer) { return new ViewDefinitionCompilationFailedCall(ffc.GetValue<DateTimeOffset>("valuationTime"), deserializer.FromField<JavaException>(ffc.GetByName("exception"))); }
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 FunctionalDoublesCurve FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer) { string name = GetName(ffc); double[] parameters = ffc.GetValue<double[]>("NSS parameters"); return Create(new NelsonSiegelSvennsonBondCurveModel(parameters).Eval, name); }
public static ResultModelDefinition FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer) { return new ResultModelDefinition( EnumBuilder<ResultOutputMode>.Parse(ffc.GetValue<string>("aggregatePositionOutputMode")), EnumBuilder<ResultOutputMode>.Parse(ffc.GetValue<string>("positionOutputMode")), EnumBuilder<ResultOutputMode>.Parse(ffc.GetValue<string>("tradeOutputMode")), EnumBuilder<ResultOutputMode>.Parse(ffc.GetValue<string>("securityOutputMode")), EnumBuilder<ResultOutputMode>.Parse(ffc.GetValue<string>("primitiveOutputMode")) ); }
public static ManageableYieldCurveSnapshot FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer) { var valuationTime = ffc.GetValue <FudgeDateTime>("valuationTime").ToDateTimeOffsetWithDefault(); return(new ManageableYieldCurveSnapshot(deserializer.FromField <ManageableUnstructuredMarketDataSnapshot>(ffc.GetByName("values")), valuationTime)); }
public static ViewDefinitionCompilationFailedCall FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer) { return(new ViewDefinitionCompilationFailedCall(ffc.GetValue <DateTimeOffset>("valuationTime"), deserializer.FromField <JavaException>(ffc.GetByName("exception")))); }
public static CompiledViewDefinitionImpl FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer) { ViewDefinition defn = deserializer.FromField<ViewDefinition>(ffc.GetByName("viewDefinition")); IPortfolio portfolio = deserializer.FromField<IPortfolio>(ffc.GetByName("portfolio")); DateTimeOffset latestValidity = ffc.GetValue<FudgeDateTime>("latestValidity").ToDateTimeOffsetWithDefault(); DateTimeOffset earliestValidity = ffc.GetValue<FudgeDateTime>("earliestValidity").ToDateTimeOffsetWithDefault(); var configs = ffc.GetAllByName("compiledCalculationConfigurations").Select(deserializer.FromField<CompiledViewCalculationConfigurationImpl>).ToDictionary(c => c.Name, c => (ICompiledViewCalculationConfiguration)c); return new CompiledViewDefinitionImpl(defn, portfolio, latestValidity, earliestValidity, configs); }
public static Tenor FromFudgeMsg(IFudgeFieldContainer ffc, IFudgeDeserializer deserializer) { return(new Tenor(ffc.GetValue <string>("tenor"))); // TODO Period type }