public static string CompareByHash(List <objMatch> Ibet, List <objMatch> Sbo, double profitmin)
        {
            string result = "";

            HashIbet.Clear();
            HashSbo.Clear();
            foreach (objMatch ObjIbet in Ibet)
            {
                string key = string.Format("{0},{1},{2},{3}", ObjIbet.HomeName, ObjIbet.AwayName, ObjIbet.hdp, ObjIbet.BetType);
                if (!HashIbet.Contains(key))
                {
                    HashIbet.Add(key, ObjIbet);
                }
            }
            foreach (objMatch ObjSbo in Sbo)
            {
                string key = string.Format("{0},{1},{2},{3}", ObjSbo.HomeName, ObjSbo.AwayName, ObjSbo.hdp, ObjSbo.BetType);
                if (!HashSbo.Contains(key))
                {
                    HashSbo.Add(key, ObjSbo);
                }
            }

            ICollection keySbos = HashSbo.Keys;

            foreach (string keySbo in keySbos)
            {
                if (HashIbet.ContainsKey(keySbo))
                {
                    string OddSbo1   = ((objMatch)HashSbo[keySbo]).Odd1;
                    string OddSbo2   = ((objMatch)HashSbo[keySbo]).Odd2;
                    string OddIbet1  = ((objMatch)HashIbet[keySbo]).Odd1;
                    string OddIbet2  = ((objMatch)HashIbet[keySbo]).Odd2;
                    double LeagueOdd = UtilSoccer.profit_odd(OddSbo1, OddSbo2);
                    string IdKeoSbo  = ((objMatch)HashSbo[keySbo]).IdKeo;
                    string IdKeoIbet = ((objMatch)HashIbet[keySbo]).IdKeo;
                    string HomeName  = ((objMatch)HashIbet[keySbo]).HomeName;
                    string AwayName  = ((objMatch)HashIbet[keySbo]).AwayName;
                    string Keo       = ((objMatch)HashIbet[keySbo]).hdp;
                    string BetType   = ((objMatch)HashSbo[keySbo]).BetType;
                    string Score     = ((objMatch)HashIbet[keySbo]).Score;
                    string Time      = ((objMatch)HashIbet[keySbo]).TimeNonLive;
                    //Time = Time.Split(' ')[Time.Split(' ').Length - 1];
                    if (profit_odd(OddSbo1, OddIbet2) >= profitmin)
                    {
                        result += HomeName + "," + AwayName + "," + BetType + "," + Keo + "," + OddSbo1 + "/" + OddIbet2 + ",h/a," + IdKeoSbo + "/" + IdKeoIbet + "," + UtilSoccer.profit_odd(OddSbo1, OddIbet2) + "," + LeagueOdd + "," + Score + "," + Time + "\n";
                    }
                    else if (profit_odd(OddSbo2, OddIbet1) >= profitmin)
                    {
                        result += HomeName + "," + AwayName + "," + BetType + "," + Keo + "," + OddSbo2 + "/" + OddIbet1 + ",a/h," + IdKeoSbo + "/" + IdKeoIbet + "," + UtilSoccer.profit_odd(OddSbo2, OddIbet1) + "," + LeagueOdd + "," + Score + "," + Time + "\n";
                    }
                }
            }
            return(result);
        }
        public static string CompareUnder(List <objMatch> lstIbet)
        {
            string result = "";

            foreach (objMatch match in lstIbet)
            {
                try
                {
                    string key = string.Format("{0},{1},{2},{3}", match.HomeName, match.AwayName, match.hdp, match.BetType);
                    if ((match.BetType == "3" || match.BetType == "9") && int.Parse(match.TimeLive.Split(' ')[1]) <= 5)
                    {
                        if (!hsIbetUnder.Contains(key))
                        {
                            hsIbetUnder.Add(key, match);
                        }
                    }
                    else if ((match.BetType == "3" || match.BetType == "9") && int.Parse(match.TimeLive.Split(' ')[1]) >= 30)
                    {
                        if (hsIbetUnder.Contains(key))
                        {
                            if (((objMatch)hsIbetUnder[key]).Score == match.Score)
                            {
                                string Odd1      = match.Odd1;
                                string Odd2      = match.Odd2;
                                double LeagueOdd = UtilSoccer.profit_odd(Odd1, Odd2);
                                string IdKeoIbet = match.IdKeo;
                                string HomeName  = match.HomeName;
                                string AwayName  = match.AwayName;
                                string Keo       = match.hdp;
                                string BetType   = match.BetType;
                                string Score     = match.Score;
                                string Time      = match.TimeLive;
                                result += HomeName + "," + AwayName + "," + BetType + "," + Keo + "," + Odd1 + "/" + Odd2 + ",h/a," + IdKeoIbet + "/" + IdKeoIbet + "," + UtilSoccer.profit_odd(Odd1, Odd2) + "," + LeagueOdd + "," + Score + "," + Time + "\n";
                            }
                            hsIbetUnder.Remove(key);
                        }
                    }
                }
                catch (Exception)
                {
                }
            }
            return(result);
        }
        public static void CompareMinus(List <objMatch> lstIbet)
        {
            string result = "";

            foreach (objMatch match in lstIbet)
            {
                try
                {
                    string key = string.Format("{0},{1},{2},{3}", match.HomeName, match.AwayName, match.hdp, match.BetType);
                    if ((float.Parse(match.Odd1) < 0 || float.Parse(match.Odd2) < 0) && match.hdp != "")
                    {
                        if (!hsIbetMinus.Contains(key))
                        {
                            hsIbetMinus.Add(key, match);
                            string Odd1      = match.Odd1;
                            string Odd2      = match.Odd2;
                            double LeagueOdd = UtilSoccer.profit_odd(Odd1, Odd2);
                            string IdKeoIbet = match.IdKeo;
                            string HomeName  = match.HomeName;
                            string AwayName  = match.AwayName;
                            string Keo       = match.hdp;
                            string BetType   = match.BetType;
                            string Score     = match.Score;
                            string Time      = match.TimeLive;
                            string home_away = "";
                            if (float.Parse(match.Odd1) < 0)
                            {
                                home_away = "a/h";
                            }
                            else
                            {
                                home_away = "h/a";
                            }
                            result = HomeName + "," + AwayName + "," + BetType + "," + Keo + "," + Odd1 + "/" + Odd2 + "," + home_away + "," + IdKeoIbet + "/" + IdKeoIbet + "," + UtilSoccer.profit_odd(Odd1, Odd2) + "," + LeagueOdd + "," + Score + "," + Time + "\n";
                        }
                    }
                }
                catch (Exception)
                {
                }
            }
        }
Example #4
0
        public bool CheckLai(string Filter)
        {
            double oddsspreada = UtilSoccer.profit_odd(Odd1, Odd2);

            switch (Filter)
            {
            case "First_a":
                switch (BetType)
                {
                case "1":
                    if (oddsspreada < -0.05)
                    {
                        return(false);
                    }
                    break;

                case "3":
                    if (oddsspreada < -0.08)
                    {
                        return(false);
                    }
                    break;

                case "7":
                    if (oddsspreada < -0.1)
                    {
                        return(false);
                    }
                    break;

                case "9":
                    if (oddsspreada < -0.1)
                    {
                        return(false);
                    }
                    break;
                }
                break;

            case "First_b":
                switch (BetType)
                {
                case "1":
                    if (oddsspreada < -0.06)
                    {
                        return(false);
                    }
                    break;

                case "3":
                    if (oddsspreada < -0.09)
                    {
                        return(false);
                    }
                    break;

                case "7":
                    if (oddsspreada < -0.11)
                    {
                        return(false);
                    }
                    break;

                case "9":
                    if (oddsspreada < -0.11)
                    {
                        return(false);
                    }
                    break;
                }
                break;

            case "First_c":
                switch (BetType)
                {
                case "1":
                    if (oddsspreada < -0.07)
                    {
                        return(false);
                    }
                    break;

                case "3":
                    if (oddsspreada < -0.1)
                    {
                        return(false);
                    }
                    break;

                case "7":
                    if (oddsspreada < -0.12)
                    {
                        return(false);
                    }
                    break;

                case "9":
                    if (oddsspreada < -0.12)
                    {
                        return(false);
                    }
                    break;
                }
                break;

            case "First_d":
                switch (BetType)
                {
                case "1":
                    if (oddsspreada < -0.07)
                    {
                        return(false);
                    }
                    break;

                case "3":
                    if (oddsspreada < -0.1)
                    {
                        return(false);
                    }
                    break;

                case "7":
                    if (oddsspreada < -0.12)
                    {
                        return(false);
                    }
                    break;

                case "9":
                    if (oddsspreada < -0.12)
                    {
                        return(false);
                    }
                    break;
                }
                break;

            case "Second_a":
                switch (BetType)
                {
                case "1":
                    if (oddsspreada < -0.08)
                    {
                        return(false);
                    }
                    break;

                case "3":
                    if (oddsspreada < -0.1)
                    {
                        return(false);
                    }
                    break;

                case "7":
                    if (oddsspreada < -0.12)
                    {
                        return(false);
                    }
                    break;

                case "9":
                    if (oddsspreada < -0.12)
                    {
                        return(false);
                    }
                    break;
                }
                break;

            case "Second_b":
                switch (BetType)
                {
                case "1":
                    if (oddsspreada < -0.09)
                    {
                        return(false);
                    }
                    break;

                case "3":
                    if (oddsspreada < -0.11)
                    {
                        return(false);
                    }
                    break;

                case "7":
                    if (oddsspreada < -0.13)
                    {
                        return(false);
                    }
                    break;

                case "9":
                    if (oddsspreada < -0.13)
                    {
                        return(false);
                    }
                    break;
                }
                break;

            case "Second_c":
                switch (BetType)
                {
                case "1":
                    if (oddsspreada < -0.1)
                    {
                        return(false);
                    }
                    break;

                case "3":
                    if (oddsspreada < -0.12)
                    {
                        return(false);
                    }
                    break;

                case "7":
                    if (oddsspreada < -0.14)
                    {
                        return(false);
                    }
                    break;

                case "9":
                    if (oddsspreada < -0.14)
                    {
                        return(false);
                    }
                    break;
                }
                break;

            case "Second_d":
                switch (BetType)
                {
                case "1":
                    if (oddsspreada < -0.11)
                    {
                        return(false);
                    }
                    break;

                case "3":
                    if (oddsspreada < -0.13)
                    {
                        return(false);
                    }
                    break;

                case "7":
                    if (oddsspreada < -0.15)
                    {
                        return(false);
                    }
                    break;

                case "9":
                    if (oddsspreada < -0.15)
                    {
                        return(false);
                    }
                    break;
                }
                break;
            }
            return(true);
        }
        public static string CompareByHashLive(List <objMatch> Ibet, List <objMatch> Sbo, double profitmin)
        {
            string result = "";

            under_compare = "";
            HashIbetLive.Clear();
            HashSboLive.Clear();
            //HashKeoDuoi.Clear();
            foreach (objMatch ObjIbet in Ibet)
            {
                string key = string.Format("{0},{1},{2},{3}", ObjIbet.HomeName, ObjIbet.AwayName, ObjIbet.hdp, ObjIbet.BetType);
                if (!HashIbetLive.Contains(key))
                {
                    HashIbetLive.Add(key, ObjIbet);
                }

                //if (ObjIbet.hdp.Trim() != "")
                //{
                //    try
                //    {
                //        if (float.Parse(ObjIbet.hdp) < 0 && !HashKeoDuoi.Contains(ObjIbet.HomeName))
                //            HashKeoDuoi.Add(ObjIbet.HomeName, ObjIbet.HomeName);
                //        else if (float.Parse(ObjIbet.hdp) >= 0 && !HashKeoDuoi.Contains(ObjIbet.AwayName))
                //            HashKeoDuoi.Add(ObjIbet.AwayName, ObjIbet.AwayName);
                //    }
                //    catch (Exception)
                //    {

                //    }
                //}
            }
            foreach (objMatch ObjSbo in Sbo)
            {
                string key = string.Format("{0},{1},{2},{3}", ObjSbo.HomeName, ObjSbo.AwayName, ObjSbo.hdp, ObjSbo.BetType);
                if (!HashSboLive.Contains(key))
                {
                    HashSboLive.Add(key, ObjSbo);
                }
            }

            ICollection keySbos = HashSboLive.Keys;

            foreach (string keySbo in keySbos)
            {
                try
                {
                    if (HashIbetLive.ContainsKey(keySbo))
                    {
                        string OddSbo1   = ((objMatch)HashSboLive[keySbo]).Odd1;
                        string OddSbo2   = ((objMatch)HashSboLive[keySbo]).Odd2;
                        string OddIbet1  = ((objMatch)HashIbetLive[keySbo]).Odd1;
                        string OddIbet2  = ((objMatch)HashIbetLive[keySbo]).Odd2;
                        double LeagueOdd = UtilSoccer.profit_odd(OddSbo1, OddSbo2);
                        string IdKeoSbo  = ((objMatch)HashSboLive[keySbo]).IdKeo;
                        string IdKeoIbet = ((objMatch)HashIbetLive[keySbo]).IdKeo;
                        string HomeName  = ((objMatch)HashIbetLive[keySbo]).HomeName;
                        string AwayName  = ((objMatch)HashIbetLive[keySbo]).AwayName;
                        string Keo       = ((objMatch)HashIbetLive[keySbo]).hdp;
                        string BetType   = ((objMatch)HashSboLive[keySbo]).BetType;
                        string Score     = ((objMatch)HashIbetLive[keySbo]).Score;
                        string Time      = ((objMatch)HashIbetLive[keySbo]).TimeLive;
                        //Time = Time.Split(' ')[Time.Split(' ').Length - 1];
                        if (profit_odd_new(OddSbo1, OddIbet2) >= profitmin)
                        {
                            result += HomeName + "," + AwayName + "," + BetType + "," + Keo + "," + OddSbo1 + "/" + OddIbet2 + ",h/a," + IdKeoSbo + "/" + IdKeoIbet + "," + UtilSoccer.profit_odd_new(OddSbo1, OddIbet2) + "," + LeagueOdd + "," + Score + "," + Time + "\n";
                            try
                            {
                                if (int.Parse(Time.Split(' ')[1]) >= 25 && int.Parse(Time.Split(' ')[1]) <= 43)
                                {
                                    if (Time.Split(' ')[0].ToUpper().Contains("1H"))
                                    {
                                        if (BetType == "7" && float.Parse(Keo) >= 0)
                                        {
                                            under_compare += HomeName + "," + AwayName + "," + BetType + "," + Keo + "," + OddSbo1 + "/" + OddIbet2 + ",h/a," + IdKeoSbo + "/" + IdKeoIbet + "," + UtilSoccer.profit_odd_new(OddSbo1, OddIbet2) + "," + LeagueOdd + "," + Score + "," + Time + "\n";
                                        }
                                        else if (BetType == "9")
                                        {
                                            under_compare += HomeName + "," + AwayName + "," + BetType + "," + Keo + "," + OddSbo1 + "/" + OddIbet2 + ",h/a," + IdKeoSbo + "/" + IdKeoIbet + "," + UtilSoccer.profit_odd_new(OddSbo1, OddIbet2) + "," + LeagueOdd + "," + Score + "," + Time + "\n";
                                        }
                                    }
                                    else if (Time.Split(' ')[0].ToUpper().Contains("2H"))
                                    {
                                        if (BetType == "1" && float.Parse(Keo) >= 0)
                                        {
                                            under_compare += HomeName + "," + AwayName + "," + BetType + "," + Keo + "," + OddSbo1 + "/" + OddIbet2 + ",h/a," + IdKeoSbo + "/" + IdKeoIbet + "," + UtilSoccer.profit_odd_new(OddSbo1, OddIbet2) + "," + LeagueOdd + "," + Score + "," + Time + "\n";
                                        }
                                        else if (BetType == "3")
                                        {
                                            under_compare += HomeName + "," + AwayName + "," + BetType + "," + Keo + "," + OddSbo1 + "/" + OddIbet2 + ",h/a," + IdKeoSbo + "/" + IdKeoIbet + "," + UtilSoccer.profit_odd_new(OddSbo1, OddIbet2) + "," + LeagueOdd + "," + Score + "," + Time + "\n";
                                        }
                                    }
                                }
                            }
                            catch (Exception)
                            {
                                ;
                            }
                        }
                        else if (profit_odd_new(OddSbo2, OddIbet1) >= profitmin)
                        {
                            result += HomeName + "," + AwayName + "," + BetType + "," + Keo + "," + OddSbo2 + "/" + OddIbet1 + ",a/h," + IdKeoSbo + "/" + IdKeoIbet + "," + UtilSoccer.profit_odd_new(OddSbo2, OddIbet1) + "," + LeagueOdd + "," + Score + "," + Time + "\n";
                            try
                            {
                                if (int.Parse(Time.Split(' ')[1]) >= 25 && int.Parse(Time.Split(' ')[1]) <= 43)
                                {
                                    if (Time.Split(' ')[0].ToUpper().Contains("1H"))
                                    {
                                        if (BetType == "7" && float.Parse(Keo) >= 0)
                                        {
                                            under_compare += HomeName + "," + AwayName + "," + BetType + "," + Keo + "," + OddSbo2 + "/" + OddIbet1 + ",a/h," + IdKeoSbo + "/" + IdKeoIbet + "," + UtilSoccer.profit_odd_new(OddSbo2, OddIbet1) + "," + LeagueOdd + "," + Score + "," + Time + "\n";
                                        }
                                        else if (BetType == "9")
                                        {
                                            under_compare += HomeName + "," + AwayName + "," + BetType + "," + Keo + "," + OddSbo2 + "/" + OddIbet1 + ",a/h," + IdKeoSbo + "/" + IdKeoIbet + "," + UtilSoccer.profit_odd_new(OddSbo2, OddIbet1) + "," + LeagueOdd + "," + Score + "," + Time + "\n";
                                        }
                                    }
                                    else if (Time.Split(' ')[0].ToUpper().Contains("2H"))
                                    {
                                        if (BetType == "1" && float.Parse(Keo) >= 0)
                                        {
                                            under_compare += HomeName + "," + AwayName + "," + BetType + "," + Keo + "," + OddSbo2 + "/" + OddIbet1 + ",a/h," + IdKeoSbo + "/" + IdKeoIbet + "," + UtilSoccer.profit_odd_new(OddSbo2, OddIbet1) + "," + LeagueOdd + "," + Score + "," + Time + "\n";
                                        }
                                        else if (BetType == "3")
                                        {
                                            under_compare += HomeName + "," + AwayName + "," + BetType + "," + Keo + "," + OddSbo2 + "/" + OddIbet1 + ",a/h," + IdKeoSbo + "/" + IdKeoIbet + "," + UtilSoccer.profit_odd_new(OddSbo2, OddIbet1) + "," + LeagueOdd + "," + Score + "," + Time + "\n";
                                        }
                                    }
                                }
                            }
                            catch (Exception)
                            {
                            }
                        }
                    }
                }
                catch (Exception)
                {
                }
            }
            return(result);
        }