public static YieldCurveDefinitionDocument GenerateDocument()
        {
            string curveName = TestUtils.GetUniqueName();

            var yieldCurveDefinition = new YieldCurveDefinition(Currency.USD, curveName, "Linear") { Region = new ExternalId("SOMEWHERE", "Europe") };
            yieldCurveDefinition.AddStrip(new FixedIncomeStrip { ConventionName = "DEFAULT", CurveNodePointTime = Tenor.Day, InstrumentType = StripInstrumentType.Cash });
            yieldCurveDefinition.AddStrip(new FixedIncomeStrip { ConventionName = "DEFAULT", CurveNodePointTime = Tenor.TwoYears, InstrumentType = StripInstrumentType.Future, NthFutureFromTenor = 23 });
            return new YieldCurveDefinitionDocument
                       {
                           YieldCurveDefinition = yieldCurveDefinition
                       };
        }
        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 InterpolatedYieldCurveSpecification BuildCurve(DateTimeOffset curveDate, YieldCurveDefinition curveDefinition)
 {
     RestTarget target = _rest.Resolve("builder").Resolve(UriEncoding.ToString(curveDate));
     return target.Post<InterpolatedYieldCurveSpecification>(curveDefinition);
 }
Exemple #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;
        }