public object GetChartData(string fundCode, DateTime?startDate, DateTime?endDate) { DateTime startTime = DateTime.Now.Date.AddDays(-30); DateTime endTime = DateTime.Now; if (startDate != null) { startTime = startDate.Value; } if (endDate != null) { endTime = endDate.Value.AddDays(1).AddMilliseconds(-1); } var list = dapperHelper.GetList <FundDataDay>(@"SELECT * FROM fund_data_day WHERE jzrq >= @startTime AND jzrq <= @endTime AND code=@code ORDER BY jzrq ASC", new { code = fundCode, startTime, endTime }); var x = list.Select(w => w.Jzrq); var y = list.Select(w => w.JZZZL); decimal startJz = 0.0M; if (list.FirstOrDefault() != null) { startJz = list.First().Jz; } var y2 = new List <decimal>(); foreach (var item in list) { y2.Add(Math.Round((item.Jz - startJz) / startJz * 100, 2)); } return(new { title = fundCode, x, y, y2 }); }
public object GetChartData(string fundCode) { DateTime startTime = DateTime.Now.Date; DateTime endTime = DateTime.Now; var list = dapperHelper.GetList <FundDataMin>(@"SELECT * FROM fund_data_min WHERE jzsj >= @startTime AND jzsj <= @endTime AND code=@code ORDER BY jzsj ASC", new { code = fundCode, startTime, endTime }); var x = list.Select(w => w.Jzsj); var y1 = list.Select(w => w.Gsz); var y2 = list.Select(w => w.Gssy); return(new { title = fundCode, x, y1, y2 }); }
public List <FundGatherList> GetGatherList() { return(dapperHelper.GetList <FundGatherList>(@"SELECT * FROM fund_gather_list")); }