// instruments used for callibration and valid start date and valid end date internal static List <InflationCurveEntryData> GetInflationCurveEntryData(ConnectionContextSQLite ctx, long?idIc, DateTime?settlementDate) { List <InflationCurveEntryData> EntryDataList = new List <InflationCurveEntryData>(); var command = SqlHelperSQLite.SelectInflationCurveEntryDataCommand(ctx, idIc, settlementDate); using (var reader = command.ExecuteReader()) { // Dictionary<long, ValuePair> entryPointDic = new Dictionary<long, ValuePair>(); while (reader.Read()) { var d = new InflationCurveEntryData { InflationCurveId = reader.GetInt32(reader.GetOrdinal("InflationCurveId")), Id = reader.GetInt32(reader.GetOrdinal("Id")), Type = reader.GetString(reader.GetOrdinal("Type")), Enabled = true, // default ValidDateBegin = reader.GetDateTime(reader.GetOrdinal("ValidDateStart")), ValidDateEnd = reader.GetDateTime(reader.GetOrdinal("ValidDateEnd")), }; if (d.Type.ToLower() == "inflationbond") { d.Instrument = (InflationBond)GetInflationBond(reader.GetInt32(reader.GetOrdinal("RateId"))); } else if (d.Type.ToLower() == "swap") { d.Instrument = (InflationRate)GetInflationRate(reader.GetInt32(reader.GetOrdinal("RateId"))); } /* else if (d.Type.ToLower() == "bond") * { * d.Instrument = (Instrument)GetBond(reader.GetInt32(reader.GetOrdinal("RateId"))); * } * else * { * d.Instrument = (Instrument)GetRate(reader.GetInt32(reader.GetOrdinal("RateId"))); * } */ // if (((d.Type == "inflationbond") || (d.Type == "bond")) && (d.Instrument as Bond).MaturityDate <= settlementDate) // continue; // skip if bond and maturity date is not in future if ((d.Type == "inflationbond") && (d.Instrument as InflationBond).MaturityDate <= settlementDate) { // if ((d.Type == "inflationbond") && (d.Instrument as Bond).MaturityDate <= settlementDate) continue; // skip if bond and maturity date is not in future } EntryDataList.Add(d); } } EntryDataList.Sort(new InflationCurveEntryDataCompare()); return(EntryDataList); }
public object Clone() { InflationCurveEntryData iced = new InflationCurveEntryData(); iced.Id = this.Id; iced.InflationCurveId = this.InflationCurveId; iced.Enabled = this.Enabled; iced.Type = this.Type; iced.Instrument = this.Instrument; iced.ValidDateBegin = this.ValidDateBegin; iced.ValidDateEnd = this.ValidDateEnd; return(iced); }