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()); }
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)); } } }