/// <summary> /// The object factory for a particular data collection instance. /// </summary> public virtual void CreateObjectsFromData(InterestRateIndexs interestrateindexs, System.Data.DataSet data) { // Do nothing if we have nothing if (data == null || data.Tables.Count == 0 || data.Tables[0].Rows.Count == 0) { return; } // Create a local variable for the new instance. InterestRateIndex newobj = null; // Create a local variable for the data row instance. System.Data.DataRow dr = null; // Iterate through the table rows for (int i = 0; i < data.Tables[0].Rows.Count; i++) { // Get a reference to the data row dr = data.Tables[0].Rows[i]; // Create a new object instance newobj = System.Activator.CreateInstance(interestrateindexs.ContainsType[0]) as InterestRateIndex; // Let the instance set its own members newobj.SetMembers(ref dr); // Add the new object to the collection instance interestrateindexs.Add(newobj); } }
public AssetSwap(bool payFixedRate, Bond bond, double bondCleanPrice, InterestRateIndex index, double spread, Schedule floatSchedule, DayCounter floatingDayCount) : this(NQuantLibcPINVOKE.new_AssetSwap__SWIG_1(payFixedRate, Bond.getCPtr(bond), bondCleanPrice, InterestRateIndex.getCPtr(index), spread, Schedule.getCPtr(floatSchedule), DayCounter.getCPtr(floatingDayCount)), true) { if (NQuantLibcPINVOKE.SWIGPendingException.Pending) { throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve(); } }
/// <summary> /// Fill method for populating an entire collection of InterestRateIndexs /// </summary> public virtual void Fill(InterestRateIndexs interestRateIndexs) { // create the connection to use SqlConnection cnn = new SqlConnection(InterestRateIndex.GetConnectionString()); try { using (cnn) { // open the connection cnn.Open(); // create an instance of the reader to fill. SqlDataReader datareader = SqlHelper.ExecuteReader(cnn, "gsp_SelectInterestRateIndexs"); // Send the collection and data to the object factory CreateObjectsFromData(interestRateIndexs, datareader); // close the connection cnn.Close(); } // nullify the connection cnn = null; } catch (SqlException sqlex) { throw sqlex; } }
public AssetSwap(bool payFixedRate, Bond bond, double bondCleanPrice, InterestRateIndex index, double spread) : this(NQuantLibcPINVOKE.new_AssetSwap__SWIG_3(payFixedRate, Bond.getCPtr(bond), bondCleanPrice, InterestRateIndex.getCPtr(index), spread), true) { if (NQuantLibcPINVOKE.SWIGPendingException.Pending) { throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve(); } }
public static IborIndex as_iborindex(InterestRateIndex index) { IborIndex ret = new IborIndex(NQuantLibcPINVOKE.as_iborindex(InterestRateIndex.getCPtr(index)), true); if (NQuantLibcPINVOKE.SWIGPendingException.Pending) { throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public InterestRateIndex index() { InterestRateIndex ret = new InterestRateIndex(NQuantLibcPINVOKE.FloatingRateCoupon_index(swigCPtr), true); if (NQuantLibcPINVOKE.SWIGPendingException.Pending) { throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public InterestRateIndex index() { global::System.IntPtr cPtr = NQuantLibcPINVOKE.FloatingRateCoupon_index(swigCPtr); InterestRateIndex ret = (cPtr == global::System.IntPtr.Zero) ? null : new InterestRateIndex(cPtr, true); if (NQuantLibcPINVOKE.SWIGPendingException.Pending) { throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
/// <summary> /// Deletes the object. /// </summary> public virtual void Delete(InterestRateIndex deleteObject) { // create a new instance of the connection SqlConnection cnn = new SqlConnection(InterestRateIndex.GetConnectionString()); // create local variable array for the sql parameters SqlParameterHash sqlparams = null; try { // discover the parameters sqlparams = SqlHelperParameterCache.GetSpParameterSet(InterestRateIndex.GetConnectionString(), "gsp_DeleteInterestRateIndex"); // Store the parameter for the Id attribute. sqlparams["@id"].Value = deleteObject.Id; using (cnn) { // open the connection cnn.Open(); // Execute the stored proc to perform the delete on the instance. SqlHelper.ExecuteNonQuery(cnn, CommandType.StoredProcedure, "gsp_DeleteInterestRateIndex", sqlparams); // close the connection after usage cnn.Close(); } // nullify the connection var cnn = null; } catch (SqlException sqlex) { throw sqlex; } // nullify the reference deleteObject = null; }
public SubPeriodsCoupon(Date paymentDate, double nominal, Date startDate, Date endDate, InterestRateIndex index, Type type, BusinessDayConvention convention, double spread = 0.0, DayCounter dayCounter = null, bool includeSpread = false, double gearing = 1.0) : base(paymentDate, nominal, startDate, endDate, index.fixingDays(), index, gearing, spread, new Date(), new Date(), dayCounter, false) { _type = type; _includeSpread = includeSpread; // Populate the value dates. Schedule sch = new MakeSchedule() .from(startDate) .to(endDate) .withTenor(index.tenor()) .withCalendar(index.fixingCalendar()) .withConvention(convention) .withTerminationDateConvention(convention) .backwards().value(); _valueDates = sch.dates(); Utils.QL_REQUIRE(_valueDates.Count >= 2, () => "Degenerate schedule."); // Populate the fixing dates. _numPeriods = _valueDates.Count - 1; if (index.fixingDays() == 0) { _fixingDates = new List <Date> { _valueDates.First(), _valueDates.Last() - 1 }; } else { _fixingDates.Resize(_numPeriods); for (int i = 0; i < _numPeriods; ++i) { _fixingDates[i] = index.fixingDate(_valueDates[i]); } } // Populate the accrual periods. _accrualFractions.Resize(_numPeriods); for (int i = 0; i < _numPeriods; ++i) { _accrualFractions[i] = dayCounter.yearFraction(_valueDates[i], _valueDates[i + 1]); } }
/// <summary> /// Fills a single instance with data based on its primary key values. /// </summary> public virtual void Fill(InterestRateIndex iri, System.Int16 id) { // create the connection to use SqlConnection cnn = new SqlConnection(InterestRateIndex.GetConnectionString()); try { // discover the sql parameters SqlParameterHash sqlparams = SqlHelperParameterCache.GetSpParameterSet(InterestRateIndex.GetConnectionString(), "gsp_SelectInterestRateIndex"); using (cnn) { // open the connection cnn.Open(); // set the parameters sqlparams["@id"].Value = id; // create an instance of the reader to fill. SqlDataReader datareader = SqlHelper.ExecuteReader(cnn, "gsp_SelectInterestRateIndex", sqlparams); if (datareader.Read()) { iri.SetMembers(ref datareader); } cnn.Close(); // close the connection } // nullify the connection var cnn = null; } catch (SqlException sqlex) { throw sqlex; } }
/// <summary> /// The object factory for a particular data collection instance. /// </summary> public virtual void CreateObjectsFromData(InterestRateIndexs interestrateindexs, System.Data.SqlClient.SqlDataReader data) { // Do nothing if we have nothing if (data == null) { return; } // Create a local variable for the new instance. InterestRateIndex newobj = null; // Iterate through the data reader while (data.Read()) { // Create a new object instance newobj = System.Activator.CreateInstance(interestrateindexs.ContainsType[0]) as InterestRateIndex; // Let the instance set its own members newobj.SetMembers(ref data); // Add the new object to the collection instance interestrateindexs.Add(newobj); } }
// Factory - for Leg generators public virtual CashFlow factory(double nominal, Date paymentDate, Date startDate, Date endDate, int fixingDays, InterestRateIndex index, double gearing, double spread, double?cap, double?floor, Date refPeriodStart, Date refPeriodEnd, DayCounter dayCounter, bool isInArrears) { return(new CappedFlooredCoupon(new IborCoupon(paymentDate, nominal, startDate, endDate, fixingDays, (IborIndex)index, gearing, spread, refPeriodStart, refPeriodEnd, dayCounter, isInArrears), cap, floor)); }
public FloatFloatSwap(_VanillaSwap.Type type, DoubleVector nominal1, DoubleVector nominal2, Schedule schedule1, InterestRateIndex indexPtr1, DayCounter dayCount1, Schedule schedule2, InterestRateIndex indexPtr2, DayCounter dayCount2, bool intermediateCapitalExchange, bool finalCapitalExchange, DoubleVector gearing1, DoubleVector spread1, DoubleVector cappedRate1, DoubleVector flooredRate1) : this(NQuantLibcPINVOKE.new_FloatFloatSwap__SWIG_6((int)type, DoubleVector.getCPtr(nominal1), DoubleVector.getCPtr(nominal2), Schedule.getCPtr(schedule1), InterestRateIndex.getCPtr(indexPtr1), DayCounter.getCPtr(dayCount1), Schedule.getCPtr(schedule2), InterestRateIndex.getCPtr(indexPtr2), DayCounter.getCPtr(dayCount2), intermediateCapitalExchange, finalCapitalExchange, DoubleVector.getCPtr(gearing1), DoubleVector.getCPtr(spread1), DoubleVector.getCPtr(cappedRate1), DoubleVector.getCPtr(flooredRate1)), true) { if (NQuantLibcPINVOKE.SWIGPendingException.Pending) { throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve(); } }
public FloatFloatSwap(_VanillaSwap.Type type, DoubleVector nominal1, DoubleVector nominal2, Schedule schedule1, InterestRateIndex indexPtr1, DayCounter dayCount1, Schedule schedule2, InterestRateIndex indexPtr2, DayCounter dayCount2) : this(NQuantLibcPINVOKE.new_FloatFloatSwap__SWIG_12((int)type, DoubleVector.getCPtr(nominal1), DoubleVector.getCPtr(nominal2), Schedule.getCPtr(schedule1), InterestRateIndex.getCPtr(indexPtr1), DayCounter.getCPtr(dayCount1), Schedule.getCPtr(schedule2), InterestRateIndex.getCPtr(indexPtr2), DayCounter.getCPtr(dayCount2)), true) { if (NQuantLibcPINVOKE.SWIGPendingException.Pending) { throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve(); } }
public AssetSwap(bool payFixedRate, Bond bond, double bondCleanPrice, InterestRateIndex index, double spread) : this(NQuantLibcPINVOKE.new_AssetSwap__SWIG_3(payFixedRate, Bond.getCPtr(bond), bondCleanPrice, InterestRateIndex.getCPtr(index), spread), true) { if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve(); }
public AssetSwap(bool payFixedRate, Bond bond, double bondCleanPrice, InterestRateIndex index, double spread, Schedule floatSchedule, DayCounter floatingDayCount) : this(NQuantLibcPINVOKE.new_AssetSwap__SWIG_1(payFixedRate, Bond.getCPtr(bond), bondCleanPrice, InterestRateIndex.getCPtr(index), spread, Schedule.getCPtr(floatSchedule), DayCounter.getCPtr(floatingDayCount)), true) { if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve(); }
public IborCoupon(Date paymentDate, double nominal, Date startDate, Date endDate, int fixingDays, InterestRateIndex index) : this(NQuantLibcPINVOKE.new_IborCoupon__SWIG_5(Date.getCPtr(paymentDate), nominal, Date.getCPtr(startDate), Date.getCPtr(endDate), fixingDays, InterestRateIndex.getCPtr(index)), true) { if (NQuantLibcPINVOKE.SWIGPendingException.Pending) { throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve(); } }
public FloatFloatSwap(VanillaSwap.Type type, DoubleVector nominal1, DoubleVector nominal2, Schedule schedule1, InterestRateIndex index1, DayCounter dayCount1, Schedule schedule2, InterestRateIndex index2, DayCounter dayCount2, bool intermediateCapitalExchange) : this(NQuantLibcPINVOKE.new_FloatFloatSwap__SWIG_11((int)type, DoubleVector.getCPtr(nominal1), DoubleVector.getCPtr(nominal2), Schedule.getCPtr(schedule1), InterestRateIndex.getCPtr(index1), DayCounter.getCPtr(dayCount1), Schedule.getCPtr(schedule2), InterestRateIndex.getCPtr(index2), DayCounter.getCPtr(dayCount2), intermediateCapitalExchange), true) { if (NQuantLibcPINVOKE.SWIGPendingException.Pending) { throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve(); } }
public IborCoupon(Date paymentDate, double nominal, Date startDate, Date endDate, int fixingDays, InterestRateIndex index) : this(NQuantLibcPINVOKE.new_IborCoupon__SWIG_5(Date.getCPtr(paymentDate), nominal, Date.getCPtr(startDate), Date.getCPtr(endDate), fixingDays, InterestRateIndex.getCPtr(index)), true) { if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve(); }
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(InterestRateIndex obj) { return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr); }
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(InterestRateIndex obj) { return (obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr; }
/// <summary> /// Persists the object. /// </summary> public virtual void Persist(InterestRateIndex persistObject) { // Make a call to the overloaded method with a null transaction Persist(persistObject, null); }
public InterestRateIndex index() { InterestRateIndex ret = new InterestRateIndex(NQuantLibcPINVOKE.FloatingRateCoupon_index(swigCPtr), true); if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve(); return ret; }
// Factory - for Leg generators public override CashFlow factory(double nominal, Date paymentDate, Date startDate, Date endDate, int fixingDays, InterestRateIndex index, double gearing, double spread, double?cap, double?floor, Date refPeriodStart, Date refPeriodEnd, DayCounter dayCounter, bool isInArrears) { return(new CappedFlooredCmsCoupon(nominal, paymentDate, startDate, endDate, fixingDays, (SwapIndex)index, gearing, spread, cap, floor, refPeriodStart, refPeriodEnd, dayCounter, isInArrears)); }
public IborCoupon(Date paymentDate, double nominal, Date startDate, Date endDate, int fixingDays, InterestRateIndex index, double gearing, double spread, Date refPeriodStart, Date refPeriodEnd) : this(NQuantLibcPINVOKE.new_IborCoupon__SWIG_1(Date.getCPtr(paymentDate), nominal, Date.getCPtr(startDate), Date.getCPtr(endDate), fixingDays, InterestRateIndex.getCPtr(index), gearing, spread, Date.getCPtr(refPeriodStart), Date.getCPtr(refPeriodEnd)), true) { if (NQuantLibcPINVOKE.SWIGPendingException.Pending) { throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve(); } }
public IborCoupon(Date paymentDate, double nominal, Date startDate, Date endDate, int fixingDays, InterestRateIndex index, double gearing, double spread, Date refPeriodStart, Date refPeriodEnd) : this(NQuantLibcPINVOKE.new_IborCoupon__SWIG_1(Date.getCPtr(paymentDate), nominal, Date.getCPtr(startDate), Date.getCPtr(endDate), fixingDays, InterestRateIndex.getCPtr(index), gearing, spread, Date.getCPtr(refPeriodStart), Date.getCPtr(refPeriodEnd)), true) { if (NQuantLibcPINVOKE.SWIGPendingException.Pending) throw NQuantLibcPINVOKE.SWIGPendingException.Retrieve(); }
/// <summary> /// Persists the object. /// </summary> public virtual void Persist(InterestRateIndex persistObject, SqlTransaction sqlTrans) { // create local variable array for the sql parameters SqlParameterHash sqlparams = null; // Create a local variable for the connection SqlConnection cnn = null; // Use the parameter overload or create a new instance if (sqlTrans == null) { cnn = new SqlConnection(InterestRateIndex.GetConnectionString()); } try { // discover the parameters if (persistObject.Persisted) { sqlparams = SqlHelperParameterCache.GetSpParameterSet(InterestRateIndex.GetConnectionString(), "gsp_UpdateInterestRateIndex"); } else { sqlparams = SqlHelperParameterCache.GetSpParameterSet(InterestRateIndex.GetConnectionString(), "gsp_CreateInterestRateIndex"); } // Store the parameter for the Name attribute. sqlparams["@name"].Value = persistObject.Name; // Store the parameter for the EnumeratedName attribute. sqlparams["@enumeratedName"].Value = persistObject.EnumeratedName; // Store the parameter for the Description attribute. if (!persistObject.DescriptionIsNull) { sqlparams["@description"].Value = persistObject.Description; } // Store the parameter for the Id attribute. sqlparams["@id"].Value = persistObject.Id; if (!persistObject.Persisted) { // store the create only (historical fixed) values } else { // store the update only (historical changeable) values } if (sqlTrans == null) { // Process using the isolated connection using (cnn) { // open the connection cnn.Open(); if (!persistObject.Persisted) { SqlHelper.ExecuteNonQuery(cnn, CommandType.StoredProcedure, "gsp_CreateInterestRateIndex", sqlparams); } else { SqlHelper.ExecuteNonQuery(cnn, CommandType.StoredProcedure, "gsp_UpdateInterestRateIndex", sqlparams); } // close the connection after usage cnn.Close(); } // nullify the connection var cnn = null; } else { // Process using the shared transaction if (!persistObject.Persisted) { SqlHelper.ExecuteNonQuery(sqlTrans, CommandType.StoredProcedure, "gsp_CreateInterestRateIndex", sqlparams); } else { SqlHelper.ExecuteNonQuery(sqlTrans, CommandType.StoredProcedure, "gsp_UpdateInterestRateIndex", sqlparams); } } } catch (SqlException sqlex) { throw sqlex; } }