示例#1
0
        /// <summary>
        /// 从csv文件中读取交易日信息。
        /// </summary>
        /// <param name="CSVName"></param>
        private void GetDataFromCSV(string CSVName)
        {
            DataTable tradeDaysData = CsvApplication.OpenCSV(CSVName);

            foreach (DataRow r in tradeDaysData.Rows)
            {
                tradeDaysOfDataBase.Add(Convert.ToInt32(r["tradedays"]));
            }
        }
示例#2
0
        /// <summary>
        /// 将交易日信息存入CSV文件。
        /// </summary>
        private void SaveTradeDaysDataByCSV(string CSVName)
        {
            DataTable tradeDaysData = new DataTable();

            tradeDaysData.Columns.Add("tradedays", typeof(int));
            foreach (int date in tradeDaysOfDataBase)
            {
                DataRow r = tradeDaysData.NewRow();
                r["tradedays"] = date;
                tradeDaysData.Rows.Add(r);
            }
            CsvApplication.SaveCSV(tradeDaysData, CSVName);
        }
示例#3
0
        private void PrintBonus()
        {
            DataTable dt = new DataTable();

            dt.Columns.Add("代码", System.Type.GetType("System.String"));
            dt.Columns.Add("股票", System.Type.GetType("System.String"));
            dt.Columns.Add("股权登记日", System.Type.GetType("System.String"));
            dt.Columns.Add("分红时间", System.Type.GetType("System.String"));
            dt.Columns.Add("分红利息", System.Type.GetType("System.String"));
            dt.Columns.Add("分红点数", System.Type.GetType("System.String"));
            dt.Columns.Add("备注", System.Type.GetType("System.String"));


            foreach (var item in evaluatePointList)
            {
                stockBonus bonus = item.Value;
                if ((bonus.firstDate > yesterday || bonus.firstDate == 0) && bonus.firstBonus > 0 && GetStocks.stockList[item.Key].existsDate[GetStocks.stockList[item.Key].existsDate.Count() - 1] > yesterday)
                {
                    DataRow row = dt.NewRow();
                    row[0] = bonus.code;
                    row[1] = bonus.name;
                    row[2] = bonus.firstRegisterDate.ToString();
                    row[3] = bonus.firstDate.ToString();
                    row[4] = bonus.firstBonus.ToString("f4");
                    row[5] = bonus.firstPoint.ToString("f4");
                    row[6] = bonus.firstStatus;
                    dt.Rows.Add(row);
                }
                if ((bonus.secondDate > yesterday || bonus.secondDate == 0) && bonus.secondBonus > 0 && GetStocks.stockList[item.Key].existsDate[GetStocks.stockList[item.Key].existsDate.Count() - 1] > yesterday)
                {
                    DataRow row = dt.NewRow();
                    row[0] = bonus.code;
                    row[1] = bonus.name;
                    row[2] = bonus.SecondRegisterDate.ToString();
                    row[3] = bonus.secondDate.ToString();
                    row[4] = bonus.secondBonus.ToString("f4");
                    row[5] = bonus.secondPoint.ToString("f4");
                    row[6] = bonus.secondStatus;
                    dt.Rows.Add(row);
                }
            }
            CsvApplication.SaveCSV(dt, "bonus" + yesterday.ToString() + ".csv");
        }