public override int GetOneResult(LotTickData data)
 {
     List<int> res = new List<int>();
     for (int i = 0; i < data.NormalData.Length - 1; i++)
     {
         res.Add(data.NormalData[i + 1] - data.NormalData[i]);
     }
     return res.Min();
 }
 //根据需要计算的行数来循环计算,输入数据已经考虑了所需行
 public override int[] GetAllValue(LotTickData[] data)
 {
     int[] res = new int[data.Length - this.RuleInfoParams.NeedRows];
     for (int i = 0; i < res.Length; i++)
     {
         res[i] = data[i + 1].NormalData.Index_S邻号出现个数(data[i].NormalData);
     }
     return res;
 }
 public override int GetOneResult(LotTickData data)
 {
     bool[] res = data.NormalData.Select(n => n % 2 == 1).ToArray();//是否是奇数
     int count = 0;
     for (int i = 0; i < res.Length - 1; i++)
     {
         if (res[i + 1] && res[i]) count++;
     }
     return count;
 }
 public override LotTickData[] GetFilterResult(LotTickData[] data, LotTickData[] NeedData = null)
 {
     List<int> temp = new List<int>();
     for (int i = 0; i < this.RuleInfoParams.NeedRows ; i++)
     {
         temp.AddRange(NeedData[i].NormalData );
     }
     return data.Where(n => (n.NormalData.Index_S序列重复个数(temp )).
         GetCompareResult(this.RuleInfoParams)).ToArray();
 }
示例#5
0
 public override LotTickData[] GetFilterResult(LotTickData[] data, LotTickData[] NeedData = null)
 {
     //过滤的时候,要针对All,把所有的数据都传入进来,向构造序列
     List<int> cur = new List<int>();
     foreach (var item in NeedData)
     {
         cur.Add(GetValue(item));
     }
     return data.Where(n => cur.FindAll(k => k == GetValue(n))
         .Count().GetCompareResult(this.RuleInfoParams)).ToArray();
 }
 public override LotTickData[] GetFilterResult(LotTickData[] data, LotTickData[] NeedData = null)
 {
     //过滤的时候,要针对All,把所有的数据都传入进来,向构造序列
     Dictionary<string, string> cur = new Dictionary<string, string>();
     foreach (var item in NeedData)
     {
         string s = item.NormalData.ListToString<int>();
         if (!cur.ContainsKey(s)) cur.Add(s, string.Empty);
     }
     return data.Where(n => !cur.ContainsKey(n.NormalData.ListToString<int>())).ToArray();
 }
示例#7
0
  /// <summary>
  /// 获取计算所需数据,从已有的数据中直接获取,用于过滤
  /// </summary>        
 public static LotTickData[] GetNeedDataByCache(int needRows)
 {
      if (needRows <= 0) return null;
      else
      {
          LotTickData[] data = GetBallData();
          LotTickData[] curData = new LotTickData[needRows];
          Array.Copy(data, data.Length - needRows, curData, 0, needRows);
          return curData;
      }
  }       
 public override int[] GetAllValue(LotTickData[] data)
 {               
     int[] res = new int[data.Length  - this.RuleInfoParams.NeedRows];             
     for (int i = 0; i < res.Length ; i++)
     {
         List<int> temp = new List<int>();
         for (int j = i ; j < i + this.RuleInfoParams.NeedRows ; j++)
         {
             temp.AddRange(data[j ].NormalData);//多期的号码添加到一起后再计算比较
         }
         res[i] = data[i + this.RuleInfoParams.NeedRows ].NormalData.Index_S序列重复个数(temp);
     }
     return res;
 }
示例#9
0
 public override int[] GetAllValue(LotTickData[] data)
 {
     int[] res = new int[data.Length - this.RuleInfoParams.NeedRows];
     int[] str = data.Select(n => GetValue(n)).ToArray();
     for (int i = 0; i < res.Length; i++)
     {
         List<int> temp = new List<int>();
         for (int j = i; j < i + this.RuleInfoParams.NeedRows; j++)
         {
             temp.Add(str[j]);//添加到一起后再计算比较
         }
         res[i] = temp.FindAll(n => n == str[i + this.RuleInfoParams.NeedRows]).Count();
     }
     return res;
 }
示例#10
0
 /// <summary>
 /// 从数据库获取指定期数数据
 /// </summary>
 /// <param name="length">最近的期数</param>
 public static LotTickData[] GetBallData(int selectLength = -1)
 {
     //获取数据 order by  desc 降序排列, asc 升序		
     EntityList<tb_Ssq> list = tb_Ssq.FindAll("", tb_Ssq._.期号 + " asc", "", 0, selectLength);
  // EntityList<tb_Ssq> list = tb_Ssq.FindAll("select * from tb_ssq order by 期号 asc");//升序
     LotTickData[] data = new LotTickData[list.Count];
     for (int i = 0; i < list.Count ; i++)
     {
         data[i] = new LotTickData();
         data[i].NormalData = new int[] { list[i].号码1, list[i].号码2, list[i].号码3, list[i].号码4,
         list[i].号码5 ,list[i].号码6};
         data[i].SpecialData = list[i].蓝球;
     }
     return data ;
 }
 //验证,直接单独进行
 public override bool[] GetValidateResult(LotTickData[] data)
 {
     //一边计算,一边插入,一边统计
     List<string> list = new List<string>();
     bool[] res = new bool[data.Length];
     for (int i = 0; i < data.Length; i++)
     {
         string s = data[i].NormalData.ParitySequence() + data[i].NormalData.PrimesSequence();
         bool have = list.Exists(n => n == s);
         if (have) res[i] = false;
         else
         {
             list.Add(s);
             res[i] = true;
         }
     }
     return res;
 }
 //测试通过
 public override int GetOneResult(LotTickData data)
 {
     int[] spanList = new int[data.NormalData.Length -1 ];
     for (int i = 0; i < spanList.Length ; i++)
     {
         spanList[i] = data.NormalData[i + 1] - data.NormalData[i];
     }
     bool[] res = spanList.Select(n => n == 1).ToArray();
     //寻找连续的True的个数           
     int max = 0;
     int count = 0;
     foreach (var item in res )
     {   //为True,说明2个相连,个数相加
         if (item)  count++;
         else //说明不连,重置个数
         {
             max = count > max ? count : max;                   
             count = 0;
         }
     }
     return (count >max ? count :max) +1 ;//可能最后一次最大,但没有计算进去
 }
示例#13
0
 public override int GetOneResult(LotTickData data)
 {
     return data.NormalData.Select(n => n % 10).Distinct().Count();
 }
示例#14
0
 /// <summary>
 /// 最高优先级,杀号处理,根据计算,返回需要去除的数字列表
 /// </summary>        
 /// <param name="data">辅助的历史数据</param>
 public virtual List<Int32> DeleteNumbers(LotTickData[] data)
 {
     throw new System.NotImplementedException();
 }
示例#15
0
 /// <summary>
 /// 根据该指标的规则,验证对历史数据的准确性
 /// </summary>`
 /// <remarks>验证历史数据库中,最近的N期数据,数据按照时间升序排列</remarks>
 /// <param name="data">计算的原始数据</param>
 /// <returns>返回每一期的正确性</returns>
 public virtual bool[] GetValidateResult(LotTickData[] data)
 {
     return GetAllValue(data).GetCompareResult(this.RuleInfoParams);
 }
示例#16
0
 /// <summary>
 /// 根据该规则,对数据集进行过滤,只保留满足规则的书籍
 /// </summary>
 /// <param name="data">所有需要过滤的数据</param>
 /// <param name="NeedData">需要的历史数据,数目为所需要的行数</param>
 /// <param name="compCoditon">比较参数</param>
 /// <returns>满足规则的数据集</returns>
 public virtual LotTick.LotTickData[] GetFilterResult(LotTickData[] data, LotTick.LotTickData[] NeedData = null)
 {
     return data.Where(n => (GetOneResult(n)).GetCompareResult(this.RuleInfoParams)).ToArray();
 }
示例#17
0
 /// <summary>
 /// 计算一组数据的指标结果
 /// </summary>
 /// <param name="data">一组数据</param>
 public virtual int GetOneResult(LotTickData data)
 {
     throw new System.NotImplementedException();
 }
示例#18
0
 public override int GetOneResult(LotTickData data)
 {
     return data.NormalData.Select(n => n % 10).Sum();
 }
 public override int GetValue(LotTickData data)
 {
     return data.NormalData.Where(k => k >= 17).Count();
 }
 public override LotTickData[] GetFilterResult(LotTickData[] data, LotTickData[] NeedData = null)
 {  //LotTickData lastData = NeedData[0 ];去需要的第一个个数据来进行对比计算
     return data.Where(n => (n.NormalData.Index_S邻号出现个数(NeedData[0].NormalData)).
         GetCompareResult(this.RuleInfoParams)).ToArray();
 }
示例#21
0
 /// <summary>
 /// 获取指标的值,需要在子类重写
 /// </summary>        
 public virtual int GetValue(LotTickData data)
 {
     return -1;
 }
示例#22
0
 public override bool[] GetValidateResult(LotTickData[] data)
 {
     //验证杀号是否准确
     return GetAllValue(data).GetCompareResult(this.RuleInfoParams);
 }
示例#23
0
 //获取序列的方法,需要在子类中重载才行
 public virtual string GetSequence(LotTickData data)
 {
     return data.NormalData.ToString();
 }
示例#24
0
 public override int GetOneResult(LotTickData data)
 {
     return data.NormalData.Last() - data.NormalData.First();
 }        
示例#25
0
 public override bool[] GetValidateResult(LotTickData[] data)
 {
     return GetAllValue(data).Select(n => n.GetCompareResult(this.RuleInfoParams)).ToArray();
 }
示例#26
0
 public override int GetOneResult(LotTickData data)
 {            
     return data.NormalData.Index_S序列重复个数(PrimeNumbers);
 }
示例#27
0
 public override LotTickData[] GetFilterResult(LotTickData[] data, LotTickData[] NeedData = null)
 {
     return base.GetFilterResult(data, NeedData);
 }
 public override int GetValue(LotTickData data)
 {
     return data.NormalData.Where(n => ((int)n) % 2 == 0).Count();
 }
 public override string GetSequence(LotTickData data)
 {
     return data.NormalData.ParitySequence() + data.NormalData.PrimesSequence();
 }
示例#30
0
 public override int[] GetAllValue(LotTickData[] data)
 {
     return base.GetAllValue(data);
 }