Ejemplo n.º 1
0
        public override List <PK10CorePress.ChanceClass> getChances(PK10CorePress.CommCollection sc, PK10CorePress.ExpectData ed)
        {
            List <ChanceClass> ret = new List <ChanceClass>();
            ExpectList         el  = sc.orgData;
            List <ChanceClass> scs = new List <ChanceClass>();
            strag_CommOldClass coc = new strag_CommOldClass();

            coc.CommSetting = this.CommSetting;
            coc.ChipCount   = this.ChipCount;
            coc.FixChipCnt  = true;
            //coc.AllowMaxHoldTimeCnt = this.AllowMaxHoldTimeCnt;
            coc.BySer = this.BySer;
            //coc.ReviewExpectCnt = ;
            coc.InputMinTimes = this.InputMinTimes;
            coc.StagSetting   = new StagConfigSetting();
            if (!this.IsTracing)//未持仓时才计算过往概率
            {
                double sucrate = double.NaN;
                if (this.CommSetting.UseLocalWaveData)//如果使用本地数据,获取该期本地数据
                {
                    sucrate = this.LocalWaveData[el.LastData.Expect];
                }
                if (double.IsNaN(sucrate))               //如果数据异常,继续去寻找
                {
                    sucrate = getSucRate(el, coc, true); //该类策略全部是一次性机会,可反复下注
                }
                if (this.RateDic == null)
                {
                    this.RateDic = new Dictionary <string, double>();
                }
                if (!this.RateDic.ContainsKey(this.LastUseData().LastData.Expect))//加入胜率队列
                {
                    RateDic.Add(this.LastUseData().LastData.Expect, sucrate);
                }
                if (!this.CheckEnableIn())
                {
                    return(ret);
                }

                this.IsTracing = true;//满足条件,开始持仓
                //this.debug_maxRate = 0;
            }
            CommCollection scc = new ExpectListProcess(el).getSerialData(InputMinTimes, BySer);

            ret = coc.getChances(scc, el.LastData);
            for (int i = 0; i < ret.Count; i++)
            {
                ret[i].NeedConditionEnd  = true;
                ret[i].OnCheckTheChance += CheckNeedEndTheChance;
            }
            return(ret);
        }
Ejemplo n.º 2
0
        public CommCollection getSerialData(int reviewCnt, bool ByNo)
        {
            CommCollection ret = null;

            if (ByNo)
            {
                ret      = new SerialCollection();
                ret.Data = getNoDispCars(reviewCnt);
            }
            else
            {
                ret      = new CarCollection();
                ret.Data = getNoDispNums(reviewCnt);
            }
            //LogableClass.ToLog("获取视图集合时赋值原始数据", string.Format("到底做什么用的真忘记了{0}", reviewCnt));
            ret.orgData = this.data.LastDatas(Math.Min(reviewCnt, data.Count));//?为什么要指定长度?因为回测时输入的原始数据太长?
            return(ret);
        }
Ejemplo n.º 3
0
 public override List <PK10CorePress.ChanceClass> getChances(PK10CorePress.CommCollection sc, PK10CorePress.ExpectData ed)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 4
0
        public override List <PK10CorePress.ChanceClass> getChances(PK10CorePress.CommCollection sc, PK10CorePress.ExpectData ed)
        {
            List <ChanceClass> ret = new List <ChanceClass>();
            DataTableEx        dt  = null;

            if (this.BySer)
            {
                dt = sc.SerialDistributionTable;
            }
            else
            {
                dt = sc.CarDistributionTable;
            }
            if (dt == null)
            {
                throw new Exception("无法获得概率分布表!");
            }
            int    MatchCnt    = 0;
            string strAllCodes = "";
            double MinSucRate  = 0;

            if (this.FixChipCnt)
            {
                MinSucRate = this.CommSetting.Odds / this.ChipCount; //指定注数需要的最小胜率
            }
            for (int i = 0; i < 10; i++)
            {
                //获得各项的最小的
                List <double> coldata = null;
                string        strCol  = string.Format("{0}", (i + 1) % 10);

                string strVal   = ed.ValueList[i];
                int    ExistCnt = sc.FindLastDataExistCount(this.InputMinTimes, strCol, strVal);
                if (ExistCnt > 1)//前n次不是最后一次才出现
                {
                    continue;
                }
                dt.getColumnData(strCol, ref coldata);
                double    avgval  = coldata.Average();
                double    stdval  = ProbMath.CalculateStdDev(coldata);
                string    strSql  = string.Format("[{0}]={1}", "Id", strVal);
                string    strSort = string.Format("[{0}] asc", "Id");
                DataRow[] drs     = dt.Select(strSql, "");
                if (drs.Length != 1)
                {
                    throw new Exception("概率数据表错乱!");
                }
                int InAllViewExistCnt = int.Parse(drs[0][strCol].ToString()); //前100(指定的viewcnt)期出现的次数
                if (InAllViewExistCnt > avgval - stdval * this.StdvCnt)       //如果前100期内出现的概率大于指定的标准差数,跳过
                {
                    continue;
                }
                if (InAllViewExistCnt > this.ReviewExpectCnt * (1 - MinSucRate))//如果成功数小于对应注数的失败数
                {
                    continue;
                }
                string strCode = string.Format("{0}/{1}", BySer ? strCol : strVal, BySer ? strVal : strCol);

                MatchCnt++;
                strAllCodes = string.Format("{0}{1}{2}", strAllCodes, MatchCnt > 1 ? "+" : "", strCode);
            }
            if (MatchCnt < this.ChipCount)
            {
                return(ret);
            }
            ChanceClass cc = new ChanceClass();

            cc.SignExpectNo        = ed.Expect;
            cc.ChanceType          = 3;
            cc.InputTimes          = 1;
            cc.strInputTimes       = "1";
            cc.AllowMaxHoldTimeCnt = 1;
            cc.InputExpect         = ed;
            cc.ChipCount           = MatchCnt;
            cc.ChanceCode          = strAllCodes;
            cc.CreateTime          = ed.OpenTime;
            cc.NeedConditionEnd    = true;
            cc.OnCheckTheChance   += CheckNeedEndTheChance;
            cc.Closed = false;
            ret.Add(cc);
            return(ret);
        }