请教一下, 有些软件中的几日和的算法
最近玩股票,看到有的软件中有5日,10日涨跌幅的数据
我自己试着写了 一个 , 但是 算的很慢, 但是股票软件中还是即时数据, 怎么那么快呢?
我的算法如下
我自己试着写了 一个 , 但是 算的很慢, 但是股票软件中还是即时数据, 怎么那么快呢?
我的算法如下
//历史价格集合
var list = dal.GetModelList(dal.SerialSafeSearchkey(mo)).OrderByDescending(x => x.PriceDateTime);
System.Diagnostics.Debug.WriteLine("GetModelList时间:"+ t.GetElapsedTime());
//股票集合
List<Model.stockcodelist> stlist = new List<Model.stockcodelist>();
foreach (var item in StockCodeList)
{
string code = item.Substring(2);
//当前股票价格集
var temp = list.Where(x => x.StockCode == code);
if (temp.Count() > 0)
{
Model.StockHistoryPrices_MD now = temp.ElementAt(0);
//三日数据集
var threeq = temp.Take(3);
//5日数据集
var fiveq = temp.Take(5);
//七日数据集
var sevenq = temp.Take(7);
//十日数据集
var tenq = temp.Take(10);
stlist.Add(new
Model.stockcodelist
{
stockcode = code,
data = now.PriceDateTime,
price = now.EndPrice,
ChangePrice = now.ChangePrice,
DailyVolume = now.DailyVolume,
TurnoverTotal = now.TurnoverTotal,
OfPrice = now.OfPrice
,
threeDailyVolume = threeq.Sum(x => x.DailyVolume),
threeTurnoverTotal =threeq.Sum(x => x.TurnoverTotal),
threeOfPrice = threeq.Last().EndPrice / now.EndPrice - 1,
threeprice = threeq.Last().EndPrice,
threeChangePrice = now.EndPrice - threeq.Last().EndPrice
,
fiveDailyVolume = fiveq.Sum(x => x.DailyVolume),
fiveTurnoverTotal = fiveq.Sum(x => x.TurnoverTotal),
fiveOfPrice = fiveq.Last().EndPrice / now.EndPrice - 1,
fiveprice = fiveq.Last().EndPrice,
fiveChangePrice = now.EndPrice - fiveq.Last().EndPrice
,
sevenDailyVolume = sevenq.Sum(x => x.DailyVolume),
sevenTurnoverTotal = sevenq.Sum(x => x.TurnoverTotal),
sevenOfPrice = sevenq.Last().EndPrice / now.EndPrice - 1,
sevenprice = sevenq.Last().EndPrice,
sevenChangePrice = now.EndPrice - sevenq.Last().EndPrice
,
tenDailyVolume = tenq.Sum(x => x.DailyVolume),
tenTurnoverTotal = tenq.Sum(x => x.TurnoverTotal),
tenOfPrice = tenq.Last().EndPrice / now.EndPrice - 1,
tenprice = tenq.Last().EndPrice,
tenChangePrice = now.EndPrice - tenq.Last().EndPrice
,
tenminprice = temp.Take(10).Min(x => x.MinimumPrice),
tenmaxprice = temp.Take(10).Max(x => x.MaximumPrice)
});
}
}
...全文
相关推荐
通达信指标公式源码 智能暴力短线主图.doc
在源代码中,我们可以看到多个变量的定义,这些变量是根据过去几日的收盘价(CLOSE)、最低价(LOW)、最高价(HIGH)和开盘价(OPEN)计算得出的。例如:1.
【C语言入门到进阶算法试题】118、几月几日? | 算法真题+思路参考+代码解析
题目描述 >今天是M月D日,L天后是几月几日? 今年不是闰年,而且L天后还是今年。
一款基于MVVM架构的学习小项目,已经实现的功能有: 1.新闻和视频列表的查看 2.基于高德地图实现定位和城市搜索 3.
所有这些功能的实现,都离不开计算机科学领域的深厚积累,包括但不限于软件工程、数据结构、算法设计、人工智能、云计算、移动开发等。
【股票指标公式下载】-【大智慧】看资金(主力流入净量、主力账户、统计分类)[收集].pdf
这个指标公式主要关注的是软件开发中的金融数据处理,它利用大智慧提供的API和算法来解析和展示交易数据,对软件开发者来说,可以深入理解如何使用编程语言来处理金融数据,实现自定义的分析功能。
php实现获取近几日、月时间示例
本文主要介绍了如何在PHP中实现获取近几日、月以及特定时间点的时间。PHP提供了一系列强大的日期和时间处理函数,这对于开发中处理日期操作非常实用。以下是详细的知识点概述:1. **设置时区**:


