Esempio n. 1
0
        int IComparable.CompareTo(object obj)
        {
            YieldCurveSetting ycs = obj as YieldCurveSetting;

            if (ycs != null)
            {
                if (
                    (this.ZcBasisId == ycs.ZcBasisId) && (this.ZcCompounding == ycs.ZcCompounding) &&
                    (this.ZcFrequency == ycs.ZcFrequency) && (this.ifZc == ycs.ifZc) &&
                    (this.ZCColor == ycs.ZCColor) && (this.FrwBasisId == ycs.FrwBasisId) &&
                    (this.FrwCompounding == ycs.FrwCompounding) && (this.FrwFrequency == ycs.FrwFrequency) &&
                    (this.ifFrw == ycs.ifFrw) && (this.FrwColor == ycs.FrwColor) && (this.FrwTerm == ycs.FrwTerm) &&
                    (this.FrwTermBase == ycs.FrwTermBase) && (this.SpreadType == ycs.SpreadType) &&
                    (this.SpreadSize == ycs.SpreadSize) && (this.SpreadFamily == ycs.SpreadFamily) &&
                    (this.Calendar == ycs.Calendar)
                    )
                {
                    return(0);
                }
                else
                {
                    return(-1);
                }
            }
            else
            {
                throw new ArgumentException("Parameter is not a YieldCurveSetting!");
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Retrieves the list of yield curve data
        /// </summary>
        /// <param name="ctx">
        /// The connection context
        /// </param>
        /// <param name="idYc">
        /// The yield curve id
        /// </param>
        /// <param name="idYc">
        /// The date
        /// </param>
        /// <returns>
        /// List of yield curve data
        /// </returns>
        ///
        // ??? obsolete method

        internal static List <YieldCurveData> GetYieldCurveData(ConnectionContextSQLite ctx,
                                                                long?idYc)
        {
            List <YieldCurveData> ycDesc = new List <YieldCurveData>();

            var command = SqlHelperSQLite.SelectYieldCurveDataCommand(ctx, idYc);

            using (var reader = command.ExecuteReader())
            {
                while (reader.Read())
                {
                    var ycs = new YieldCurveSetting
                    {
                        ZcBasisId      = reader.GetInt32(reader.GetOrdinal("ZcBasisId")),
                        ZcCompounding  = reader.GetString(reader.GetOrdinal("ZcCompounding")),
                        ZcFrequency    = reader.GetString(reader.GetOrdinal("ZcFrequency")),
                        FrwCompounding = reader.GetString(reader.GetOrdinal("FrwCompounding")),
                        ifZc           = reader.GetBoolean(reader.GetOrdinal("ifZC")),

                        FrwBasisId   = reader.GetInt32(reader.GetOrdinal("FrwBasisId")),
                        ZCColor      = reader.IsDBNull(reader.GetOrdinal("ZCColor")) ? null : reader.GetString(reader.GetOrdinal("ZCColor")),
                        FrwFrequency = reader.GetString(reader.GetOrdinal("FrwFrequency")),
                        FrwTermBase  = reader.GetString(reader.GetOrdinal("FrwTermBase")),
                        FrwTerm      = reader.IsDBNull(reader.GetOrdinal("FrwTerm")) ? -1 : reader.GetInt32(reader.GetOrdinal("FrwTerm")),
                        FrwColor     = reader.IsDBNull(reader.GetOrdinal("FrwColor")) ? null : reader.GetString(reader.GetOrdinal("FrwColor")),
                        ifFrw        = reader.GetBoolean(reader.GetOrdinal("ifFrw")),

                        SpreadType   = reader.IsDBNull(reader.GetOrdinal("SpreadType")) ? -1 : reader.GetInt32(reader.GetOrdinal("SpreadType")),
                        SpreadSize   = reader.IsDBNull(reader.GetOrdinal("SpreadSize")) ? -1 : reader.GetInt32(reader.GetOrdinal("SpreadSize")),
                        SpreadFamily = reader.IsDBNull(reader.GetOrdinal("SpreadFamily")) ? -1 : reader.GetInt32(reader.GetOrdinal("SpreadFamily"))
                    };

                    Calendar cal = new Calendar
                    {
                        Id         = reader.IsDBNull(reader.GetOrdinal("calId")) ? -1 : reader.GetInt32(reader.GetOrdinal("calId")),
                        ClassName  = reader.IsDBNull(reader.GetOrdinal("calClassName")) ? null : reader.GetString(reader.GetOrdinal("calClassName")),
                        MarketName = reader.IsDBNull(reader.GetOrdinal("calMarketName")) ? null : reader.GetString(reader.GetOrdinal("calMarketName"))
                    };

                    ycs.Calendar = cal;

                    ycDesc.Add(new YieldCurveData
                    {
                        Id                = reader.GetInt32(reader.GetOrdinal("Id")),
                        Name              = reader.GetString(reader.GetOrdinal("Name")),
                        Family            = reader.GetString(reader.GetOrdinal("Family")),
                        CurrencyId        = reader.IsDBNull(reader.GetOrdinal("CurrencyId")) ? -1 : reader.GetInt32(reader.GetOrdinal("CurrencyId")),
                        settings          = ycs,
                        entryPointList    = null,
                        discountPointList = null
                    });
                }
            }

            return(ycDesc);
        }
Esempio n. 3
0
        public object Clone()
        {
            YieldCurveSetting ycs = new YieldCurveSetting();

            ycs.ZcBasisId      = this.ZcBasisId;
            ycs.ZcCompounding  = this.ZcCompounding;
            ycs.ZcFrequency    = this.ZcFrequency;
            ycs.ifZc           = this.ifZc;
            ycs.ZCColor        = this.ZCColor;
            ycs.FrwBasisId     = this.FrwBasisId;
            ycs.FrwCompounding = this.FrwCompounding;
            ycs.FrwFrequency   = this.FrwFrequency;
            ycs.ifFrw          = this.ifFrw;
            ycs.FrwColor       = this.FrwColor;
            ycs.FrwTerm        = this.FrwTerm;
            ycs.FrwTermBase    = this.FrwTermBase;
            ycs.SpreadType     = this.SpreadType;
            ycs.SpreadSize     = this.SpreadSize;
            ycs.SpreadFamily   = this.SpreadFamily;
            ycs.Calendar       = this.Calendar;
            return(ycs);
        }