Пример #1
0
        private void btnTest_Click(object sender, EventArgs e)
        {
            var     stockList = StockDAL.GetStockList();
            var     accList   = new List <Account>(stockList.Count);
            decimal totalGain = 0m;

            foreach (var stock in stockList)
            {
                var dailyList = DailyDAL.GetDailyList(stock.StockCode);
                dailyList.Sort((a, b) => a.InDate.Value.CompareTo(b.InDate.Value));
                var account = new Account(10000);
                foreach (var daily in dailyList)
                {
                    account.AddDaily(daily);
                }
                var gain = account.Gain();
                totalGain += gain;
                accList.Add(account);
                LogFactory.Instance.Write(string.Format("{0} gain:{1}", stock.StockName, gain));
            }

            //accList.Sort((b,a) => a.Gain().CompareTo(b.Gain()));
            //foreach(var account in accList)
            //{
            //    LogFactory.Instance.Write(string.Format("{0} gain:{1}", ));
            //}

            LogFactory.Instance.Write("盈亏:" + totalGain.ToString());
        }
Пример #2
0
        public static void TestGetHQFrom163()
        {
            var list = WYStockBiz.GetTradeList();

            if (list.Count > 0)
            {
                DailyDAL.Insert(list);
            }
            Console.WriteLine(list.Count);
        }
Пример #3
0
        public static void Testsina()
        {
            var list = SinaBiz.GetTradeList(2);

            if (list.Count > 0)
            {
                DailyDAL.Insert(list);
            }

            Console.WriteLine(list.Count);
        }
Пример #4
0
 private void txtStockCode_KeyDown(object sender, KeyEventArgs e)
 {
     if (!string.IsNullOrWhiteSpace(txtStockCode.Text) &&
         e.KeyCode == Keys.Enter)
     {
         var list = DailyDAL.GetDailyList(txtStockCode.Text);
         foreach (var item in list)
         {
             kSeries.Points.Add(new DataPoint(item.InDate.Value.ToOADate(),
                                              (double)item.Close.Value));
         }
     }
 }
Пример #5
0
        public static void TestHistoryDate()
        {
            var stocklist = WYStockBiz.GetTradeList();

            foreach (var stockEntity in stocklist)
            {
                var list = WYStockBiz.HistoryTradeList(stockEntity.StockCode, DateTime.Now.AddYears(-1), DateTime.Now);
                if (list.Count > 0)
                {
                    DailyDAL.Insert(list);
                }
                Console.WriteLine(list.Count);
            }
        }