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()); }
public static void TestGetHQFrom163() { var list = WYStockBiz.GetTradeList(); if (list.Count > 0) { DailyDAL.Insert(list); } Console.WriteLine(list.Count); }
public static void Testsina() { var list = SinaBiz.GetTradeList(2); if (list.Count > 0) { DailyDAL.Insert(list); } Console.WriteLine(list.Count); }
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)); } } }
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); } }