Exemple #1
0
        private DividendSourceData GetDividends_ManualOverride(int SecurityID, DateTime ValuationDate)
        {
            DividendSourceData dsd    = new DividendSourceData();
            SqlCommand         sqlCom = new SqlCommand("spOTCOptionPrice_GetSecurityDividends_Default");

            sqlCom.CommandType = CommandType.StoredProcedure;
            sqlCom.Parameters.Add(new SqlParameter("@SecurityID", SecurityID));
            DataSet ds = db.FetchData(sqlCom);

            if (ds.Tables[0].Rows.Count != 0)
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    //dividend data is stored in the form exdate(amount) ie. 01/12/09(213.345)
                    string   divdata  = dr["DefaultDividends"].ToString();
                    string   ccy      = dr["Currency"].ToString();
                    DateTime Maturity = DateTime.Parse(dr["MatDate"].ToString());
                    if (divdata.Length != 0)
                    {
                        DateTime exdate = DateTime.ParseExact(divdata.Substring(0, 8), "dd/MM/yy", null);
                        double   amount = Double.Parse(divdata.Substring(9).TrimEnd(")".ToCharArray()));

                        //only add if before maturity
                        if (exdate <= Maturity)
                        {
                            dsd.Source      = InputSourceData.InputSource.Override;
                            dsd.CaptureTime = DateTime.ParseExact(dr["CaptureTime"].ToString(), "dd/MM/yyyy HH:mm:ss", null);
                            dsd.Dividends.Add(new DividendWithCurrency(exdate, amount, ccy, 1));
                        }
                    }
                }
            }
            return(dsd);
        }
Exemple #2
0
        private DividendSourceData GetDividends_Bloomberg(int SecurityID, DateTime ValuationDate)
        {
            DividendSourceData dsd    = new DividendSourceData();
            SqlCommand         sqlCom = new SqlCommand("spOTCOptionPrice_GetSecurityDividends_Bloomberg");

            sqlCom.CommandType = CommandType.StoredProcedure;
            sqlCom.Parameters.Add(new SqlParameter("@SecurityID", SecurityID));
            sqlCom.Parameters.Add(new SqlParameter("@PriceDate", ValuationDate));
            DataSet ds = db.FetchData(sqlCom);

            if (ds.Tables[0].Rows.Count != 0)
            {
                dsd.Source = InputSourceData.InputSource.Bloomberg;
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    dsd.CaptureTime = DateTime.ParseExact(dr["CaptureTime"].ToString(), "dd/MM/yyyy HH:mm:ss", null);
                    dsd.Dividends.Add(new DividendWithCurrency(DateTime.Parse(dr["ExDate"].ToString()), Double.Parse(dr["Amount"].ToString()), dr["Currency"].ToString(), Double.Parse(dr["FX"].ToString())));
                }
            }

            return(dsd);
        }