コード例 #1
0
ファイル: MainForm.cs プロジェクト: qingshenyijiu/BetTool
 public void ShowBetPanel(bool bShow, BetWinPair pair = null)
 {
     lbGameName.Visible = bShow;
     panelBet1.Visible  = bShow;
     panelBet2.Visible  = bShow;
     lbBetWin.Visible   = bShow;
     if (bShow && pair != null && pair.b1 != null && pair.b2 != null)
     {
         lbGameName.Text = pair.b1.gameName;
         if (!string.IsNullOrEmpty(pair.b1.leagueName1))
         {
             lbGameName.Text = lbGameName.Text + "(" + pair.b1.leagueName1 + ")";
         }
         else if (!string.IsNullOrEmpty(pair.b2.leagueName1))
         {
             lbGameName.Text = lbGameName.Text + "(" + pair.b2.leagueName1 + ")";
         }
         lbWebName1.Text = StaticData.webNames[(int)pair.b1.webID] + "-[BO" + pair.b1.bo + "]";
         lbWebName2.Text = StaticData.webNames[(int)pair.b2.webID] + "-[BO" + pair.b2.bo + "]";
         lbOdds1.Text    = pair.odds1.ToString("F3");
         lbOdds2.Text    = pair.odds2.ToString("F3");
         lbPName1.Text   = pair.pAbbr1;
         lbPName2.Text   = pair.pAbbr2;
         lbTime1.Text    = pair.b1.time.ToString();
         lbTime2.Text    = pair.b2.time.ToString();
         lbLimit1.Text   = pair.betLimit1 == 0?  "N/A" : pair.betLimit1.ToString();
         lbLimit2.Text   = pair.betLimit2 == 0 ? "N/A" : pair.betLimit2.ToString();
         ShowBetWin(pair.odds1, pair.odds2);
     }
 }
コード例 #2
0
        private static List <BetWinPair> ParseBetWin(List <BetItem> bs1, List <BetItem> bs2)
        {
            List <BetWinPair> listPair = new List <BetWinPair>();

            foreach (var b1 in bs1)
            {
                foreach (var b2 in bs2)
                {
                    if (b1.itemID == b2.itemID && b1.pID1 == b2.pID2)
                    {
                        if ((b1.compare == BetCompare.Larger && b2.compare == BetCompare.Smaller && b1.handicap <= b2.handicap) ||
                            (b1.compare == BetCompare.Smaller && b2.compare == BetCompare.Larger && b1.handicap >= b2.handicap))
                        {
                            if (CanMustWin(b1.odds1, b2.odds1))
                            {
                                BetWinPair pair = new BetWinPair();
                                pair.b1 = b1;
                                pair.b2 = b2;
                                listPair.Add(pair);
                            }
                        }
                    }
                }
            }
            return(listPair);
        }
コード例 #3
0
ファイル: BaseParser.cs プロジェクト: okinawa1/BetTool
        public static List <BetWinPair> ParseBetWin(List <BetItem> bs)
        {
            List <BetWinPair> listPair = new List <BetWinPair>();

            if (bs.Count < 2)
            {
                return(listPair);
            }
            for (int i = 0; i < bs.Count; i++)
            {
                BetItem b1 = bs[i];
                for (int j = i + 1; j < bs.Count; j++)
                {
                    BetItem b2 = bs[j];

                    //过滤同一个网站
                    if (b1.webID == b2.webID)
                    {
                        continue;
                    }
                    //过滤不同的体育项目
                    if (b1.sportID != b2.sportID)
                    {
                        continue;
                    }
                    //过滤不同的类型
                    if (b1.type != b2.type)
                    {
                        continue;
                    }
                    //过滤没有注册的teamID
                    if (b1.pID1 == INVALID_INDEX || b1.pID2 == INVALID_INDEX || b2.pID1 == INVALID_INDEX || b2.pID2 == INVALID_INDEX)
                    {
                        continue;
                    }
                    //过滤bo不同的
                    //if(b1.bo != b2.bo)
                    //{
                    //    continue;
                    //}
                    //时间不能相差太多
                    TimeSpan timeSpan = b1.time - b2.time;
                    if (timeSpan.TotalHours > 4 || timeSpan.TotalHours < -4)
                    {
                        continue;
                    }
                    if (b1.type == BetType.BT_TEAM)
                    {
                        double odd1 = 0.0f;
                        double odd2 = 0.0f;
                        double odd3 = 0.0f;
                        double odd4 = 0.0f;
                        if (b1.gameID == b2.gameID)
                        {
                            if ((b1.pID1 == b2.pID1) && (b1.pID2 == b2.pID2))
                            {
                                odd1 = b1.odds1;
                                odd2 = b2.odds2;
                                odd3 = b1.odds2;
                                odd4 = b2.odds1;
                                //B1让B2分
                                if (b1.handicap >= b2.handicap)
                                {
                                    if (CanMustWin(odd1, odd2))
                                    {
                                        BetWinPair pair = new BetWinPair();
                                        pair.b1           = b1;
                                        pair.b2           = b2;
                                        pair.orderForward = true;
                                        pair.odds1        = odd1;
                                        pair.odds2        = odd2;
                                        pair.pName1       = b1.pName1;
                                        pair.pName2       = b2.pName2;
                                        pair.pAbbr1       = b1.pAbbr1;
                                        pair.pAbbr2       = b2.pAbbr2;
                                        pair.betLimit1    = b1.betLimit1;
                                        pair.betLimit2    = b2.betLimit2;
                                        pair.handicap1    = b1.handicap;
                                        pair.handicap2    = -b2.handicap;
                                        pair.profit       = GetProfit(pair.odds1, pair.odds2);
                                        listPair.Add(pair);
                                    }
                                }
                                if (b1.handicap <= b2.handicap)
                                {
                                    if (CanMustWin(odd3, odd4))
                                    {
                                        BetWinPair pair = new BetWinPair();
                                        pair.b1           = b1;
                                        pair.b2           = b2;
                                        pair.orderForward = false;
                                        pair.odds1        = odd3;
                                        pair.odds2        = odd4;
                                        pair.pName1       = b1.pName2;
                                        pair.pName2       = b2.pName1;
                                        pair.pAbbr1       = b1.pAbbr2;
                                        pair.pAbbr2       = b2.pAbbr1;
                                        pair.betLimit1    = b1.betLimit2;
                                        pair.betLimit2    = b2.betLimit1;
                                        pair.handicap1    = -b1.handicap;
                                        pair.handicap2    = b2.handicap;
                                        pair.profit       = GetProfit(pair.odds1, pair.odds2);
                                        listPair.Add(pair);
                                    }
                                }
                            }
                            else if ((b1.pID1 == b2.pID2) && (b1.pID2 == b2.pID1))
                            {
                                odd1 = b1.odds1;
                                odd2 = b2.odds1;
                                odd3 = b1.odds2;
                                odd4 = b2.odds2;
                                double tmpHandicap = -b2.handicap;
                                if (b1.handicap >= tmpHandicap)
                                {
                                    if (CanMustWin(odd1, odd2))
                                    {
                                        BetWinPair pair = new BetWinPair();
                                        pair.b1           = b1;
                                        pair.b2           = b2;
                                        pair.orderForward = true;
                                        pair.odds1        = odd1;
                                        pair.odds2        = odd2;
                                        pair.pName1       = b1.pName1;
                                        pair.pName2       = b2.pName1;
                                        pair.pAbbr1       = b1.pAbbr1;
                                        pair.pAbbr2       = b2.pAbbr1;
                                        pair.betLimit1    = b1.betLimit1;
                                        pair.betLimit2    = b2.betLimit1;
                                        pair.handicap1    = b1.handicap;
                                        pair.handicap2    = b2.handicap;
                                        pair.profit       = GetProfit(pair.odds1, pair.odds2);
                                        listPair.Add(pair);
                                    }
                                }
                                if (b1.handicap <= tmpHandicap)
                                {
                                    if (CanMustWin(odd3, odd4))
                                    {
                                        BetWinPair pair = new BetWinPair();
                                        pair.b1           = b1;
                                        pair.b2           = b2;
                                        pair.orderForward = false;
                                        pair.odds1        = odd3;
                                        pair.odds2        = odd4;
                                        pair.pName1       = b1.pName2;
                                        pair.pName2       = b2.pName2;
                                        pair.pAbbr1       = b1.pAbbr2;
                                        pair.pAbbr2       = b2.pAbbr2;
                                        pair.betLimit1    = b1.betLimit2;
                                        pair.betLimit2    = b2.betLimit2;
                                        pair.handicap1    = -b1.handicap;
                                        pair.handicap2    = -b2.handicap;
                                        pair.profit       = GetProfit(pair.odds1, pair.odds2);
                                        listPair.Add(pair);
                                    }
                                }
                            }
                        }
                    }
                    else if (b1.type == BetType.BT_SOLO)
                    {
                        if (b1.itemID == b2.itemID && b1.pID1 == b2.pID1)
                        {
                            if ((b1.compare == BetCompare.Larger && b2.compare == BetCompare.Smaller && b1.handicap <= b2.handicap) ||
                                (b1.compare == BetCompare.Smaller && b2.compare == BetCompare.Larger && b1.handicap >= b2.handicap))
                            {
                                if (CanMustWin(b1.odds1, b2.odds1))
                                {
                                    BetWinPair pair = new BetWinPair();
                                    pair.b1 = b1;
                                    pair.b2 = b2;
                                    listPair.Add(pair);
                                }
                            }
                        }
                    }
                }
            }
            return(listPair);
        }