コード例 #1
0
        public void UpHand(List <FData> FootData, List <ParsedDataFromPage> PD, int id)
        {
            double MLimit = FootballHedge.Properties.Settings.Default.MailplLimit;

            foreach (ParsedDataFromPage obj in PD)
            {
                if (obj.League != "0.5")
                {
                    continue;
                }
                for (int j = FootData.Count - 1; j >= 0; j--)
                {
                    FData item = FootData[j];
                    if (!item.XKoef.ContainsKey(id))
                    {
                        item.AddNewItenToDictionary(id);
                    }
                    if (item.Match.Contains(obj.Team1) && item.Match.Contains(obj.Team2))
                    {
                        foreach (KeyValuePair <int, X> it in FootData[j].XKoef)
                        {
                            if (MainF.Bookmakers[it.Key].Type != BrokerType.BACK)
                            {
                                continue;
                            }

                            if (it.Value.Koef[1] < it.Value.Koef[2] && it.Value.Koef[1] >= MainF.Bookmakers[it.Key].Limit && it.Value.Koef[2] < obj.X[2])
                            {
                                double p1 = CalcHandicapPL(it.Value.Koef[1], obj.X[2]);
                                if (p1 >= 1 && MainF.Bookmakers[id].InUse)
                                {
                                    changecolor = true;
                                }
                                if (p1 >= MLimit && p1 >= MainF.Bookmakers[it.Key].PLlimit)
                                {
                                    PrepareMessage(item.Team1 + "-" + item.Team2, item.Team1, obj.X[2], it.Value.Koef[1], MainF.Bookmakers[it.Key].Name, obj.time, item.time);
                                }
                            }

                            if (it.Value.Koef[1] > it.Value.Koef[2] && it.Value.Koef[2] >= MainF.Bookmakers[it.Key].Limit && it.Value.Koef[1] < obj.X[1])
                            {
                                double p2 = CalcHandicapPL(it.Value.Koef[2], obj.X[1]);
                                if (p2 >= 1 && MainF.Bookmakers[id].InUse)
                                {
                                    changecolor = true;
                                }
                                if (p2 >= MLimit && p2 >= MainF.Bookmakers[it.Key].PLlimit)
                                {
                                    PrepareMessage(item.Team1 + "-" + item.Team2, item.Team1, obj.X[1], it.Value.Koef[2], MainF.Bookmakers[it.Key].Name + " handicap", obj.time, item.time);
                                }
                            }
                        }

                        //for (int q = 0; q < MainF.Bookmakers.Count; q++)
                        //{
                        //    if(MainF.Bookmakers[q].Type != BrokerType.BACK) continue;


                        //    if(item.Koef[q,1] == 0) continue;

                        //    if (item.Koef[q, 1] >= MainF.Bookmakers[q].Limit && item.Koef[id, 2] < obj.X[2])
                        //    {
                        //        double p1 = CalcHandicapPL(item.Koef[q,1], obj.X[2]);
                        //        if (p1 >= 1 && MainF.Bookmakers[id].InUse) changecolor = true;
                        //        if (p1 >= MLimit) PrepareMessage(item.Team1 + "-" + item.Team2, item.Team1, obj.X[2], item.Koef[q, 1], MainF.Bookmakers[q].Name, obj.time);
                        //    }

                        //    if (item.Koef[q, 2] >= MainF.Bookmakers[q].Limit && item.Koef[id, 1] < obj.X[1])
                        //    {
                        //        double p2 = CalcHandicapPL(item.Koef[q, 2], obj.X[1]);
                        //        if (p2 >= 1 && MainF.Bookmakers[id].InUse) changecolor = true;
                        //        if (p2 >= MLimit) PrepareMessage(item.Team1 + "-" + item.Team2, item.Team1, obj.X[1], item.Koef[q, 2], MainF.Bookmakers[q].Name+" handicap", obj.time);
                        //    }

                        //}
                        //item.Koef[id, 1] = obj.X[1];
                        //item.Koef[id, 2] = obj.X[2];
                        //item.LastUpdate[id] = DateTime.Now.ToString("HH:mm");
                        item.XKoef[id].Koef[1]    = obj.X[1];
                        item.XKoef[id].Koef[2]    = obj.X[2];
                        item.XKoef[id].LastUpdate = DateTime.Now.ToString("HH:mm");
                    }
                }
            }
        }
コード例 #2
0
        public void Load(List <FData> FootData, List <BasicBrokerData> Bookmakers)
        {
            if (File.Exists(pathAllMatches))
            {
                XmlDocument xd = new XmlDocument();
                xd.Load(pathAllMatches);
                FootData.Clear();
                foreach (XmlNode item in xd.SelectNodes("Data/Match"))
                {
                    FData f = new FData();



                    if (item.SelectSingleNode(".//Team1") == null)
                    {
                        continue;
                    }
                    f.Team1 = item.SelectSingleNode(".//Team1").InnerText;

                    if (item.SelectSingleNode(".//Team2") == null)
                    {
                        continue;
                    }
                    f.Team2 = item.SelectSingleNode(".//Team2").InnerText;


                    if (item.SelectSingleNode(".//Match") == null)
                    {
                        continue;
                    }
                    f.Match = item.SelectSingleNode(".//Match").InnerText;

                    if (item.SelectSingleNode(".//League") == null)
                    {
                        continue;
                    }
                    f.League = item.SelectSingleNode(".//League").InnerText;


                    if (item.SelectSingleNode(".//Time") != null)
                    {
                        string time = time = item.SelectSingleNode(".//Time").InnerText;
                        try
                        {
                            DateTime buftime;
                            if (TryToParse.ParseDateTime(time, out buftime))
                            {
                                f.time = buftime;
                            }
                        }
                        catch (FormatException)
                        {
                            f.time = DateTime.Today;
                        }
                    }

                    for (int i = 0; i < Bookmakers.Count; i++)
                    {
                        BasicBrokerData data = Bookmakers[i];
                        if (item.SelectSingleNode(".//BookieOdds/B_" + data.Name + "/X0") == null)
                        {
                            continue;
                        }
                        f.AddNewItenToDictionary(i);
                        if (item.SelectSingleNode(".//BookieOdds/B_" + data.Name + "/LastUpdate") != null)
                        {
                            f.XKoef[i].LastUpdate = item.SelectSingleNode(".//BookieOdds/B_" + data.Name + "/LastUpdate").InnerText;
                        }

                        double value = 1;
                        var    x     = item.SelectSingleNode(".//BookieOdds/B_" + data.Name + "/X0");

                        if (x != null && TryToParse.ParseDouble(x.InnerText, out value))
                        {
                        }
                        f.XKoef[i].Koef[0] = value;

                        value = 1;
                        x     = item.SelectSingleNode(".//BookieOdds/B_" + data.Name + "/X1");
                        if (x != null && TryToParse.ParseDouble(x.InnerText, out value))
                        {
                        }
                        f.XKoef[i].Koef[1] = value;

                        value = 1;
                        x     = item.SelectSingleNode(".//BookieOdds/B_" + data.Name + "/X2");
                        if (x != null && TryToParse.ParseDouble(x.InnerText, out value))
                        {
                        }
                        f.XKoef[i].Koef[2] = value;

                        if (Bookmakers[i].Type == BrokerType.LAY)
                        {
                            value = 1;
                            x     = item.SelectSingleNode(".//BookieOdds/B_" + data.Name + "/LX0");

                            if (x != null && TryToParse.ParseDouble(x.InnerText, out value))
                            {
                            }
                            f.Lay[0] = value;

                            value = 1;
                            x     = item.SelectSingleNode(".//BookieOdds/B_" + data.Name + "/LX1");
                            if (x != null && TryToParse.ParseDouble(x.InnerText, out value))
                            {
                            }
                            f.Lay[1] = value;

                            value = 1;
                            x     = item.SelectSingleNode(".//BookieOdds/B_" + data.Name + "/LX2");
                            if (x != null && TryToParse.ParseDouble(x.InnerText, out value))
                            {
                            }
                            f.Lay[2] = value;
                        }
                    }

                    FootData.Add(f);
                }
            }
        }
コード例 #3
0
        public void UpBack(List <FData> FootData, List <ParsedDataFromPage> PD, int id)
        {
            double MLimit = FootballHedge.Properties.Settings.Default.MailplLimit;

            foreach (ParsedDataFromPage obj in PD)
            {
                for (int j = FootData.Count - 1; j >= 0; j--)
                {
                    FData item = FootData[j];

                    int del = item.Match.IndexOf("|");
                    if (del == -1)
                    {
                        continue;
                    }

                    if (item.Match.IndexOf(obj.Team1, 0, del) == -1)
                    {
                        continue;
                    }

                    if (item.Match.IndexOf(obj.Team2, del) == -1)
                    {
                        continue;
                    }

                    if (!item.XKoef.ContainsKey(id))
                    {
                        item.AddNewItenToDictionary(id);
                    }

                    for (int q = 0; q < 3; q++)
                    {
                        if (item.XKoef[id].Koef[q] >= MainF.Bookmakers[id].Limit && item.XKoef[id].Koef[q] < obj.X[q])
                        {
                            double p0 = CalcLayPL(obj.X[q], item.Lay[q]);
                            if (p0 >= 1 && MainF.Bookmakers[id].InUse)
                            {
                                WriteBreakToFile.LogSave("Back " + MainF.Bookmakers[id].Name + " | " + item.Team1 + "-" + item.Team2 + "  [" + q.ToString() + "] " + item.XKoef[id].Koef[q].ToString() + " -> " + obj.X[q].ToString());
                                changecolor = true;
                            }
                            if (p0 >= MLimit && p0 >= MainF.Bookmakers[id].PLlimit && MainF.Bookmakers[id].EMailing)
                            {
                                StringBuilder selection = new StringBuilder();
                                switch (q)
                                {
                                case 0: selection.Append("Draw"); break;

                                case 1: selection.Append(item.Team1); break;

                                case 2: selection.Append(item.Team2); break;

                                default: selection.Append("uknown");  break;
                                }
                                PrepareMessage(item.Team1 + "-" + item.Team2, selection.ToString(), obj.X[q], item.Lay[q], MainF.Bookmakers[id].Name, obj.time, item.time);
                                WriteBreakToFile.LogSave("EMAIL Back " + MainF.Bookmakers[id].Name + " | " + item.Team1 + "-" + item.Team2 + "  [" + q.ToString() + "] " + item.XKoef[id].Koef[q].ToString() + " -> " + obj.X[q].ToString());
                            }
                        }
                    }

                    item.XKoef[id].Koef[0]    = obj.X[0];
                    item.XKoef[id].Koef[1]    = obj.X[1];
                    item.XKoef[id].Koef[2]    = obj.X[2];
                    item.XKoef[id].LastUpdate = DateTime.Now.ToString("HH:mm");
                }
            }
        }