Example #1
0
        public ArbitrageBetService()
        {/*
          * try
          * {
          *     CefSharp.CefSettings settings = new CefSharp.CefSettings();
          *     settings.LogSeverity = CefSharp.LogSeverity.Error;
          *    // settings.BrowserSubprocessPath = System.IO.Path.Combine(cefPath, "CefSharp.BrowserSubprocess.exe");
          *     CefSharp.Cef.Initialize(settings, performDependencyCheck: true, browserProcessHandler: null);
          * }catch(Exception ex) { Console.WriteLine(ex.Message); }
          */
            finder = new ArbitrageFinder();

            Marathonbet    marathonbet = new Marathonbet();
            LeonBets       leon        = new LeonBets();
            OlimpBookmaker olimp       = new OlimpBookmaker();

            //    TitanBet titan = new TitanBet();

            finder.AddBookmaker(marathonbet);
            finder.AddBookmaker(leon);
            finder.AddBookmaker(olimp);
            //  finder.AddBookmaker(titan);
            //   var newForks = finder.GetForks();

            try
            {
                //Thread thread = new Thread();
                task = Task.Factory.StartNew(() =>
                {
                    try
                    {
                        while (true)
                        {
                            // Console.WriteLine("here");
                            var newForks = finder.GetForks();

                            lock (lockobj)
                            {
                                forkList = newForks;
                            }
                            // Thread.Sleep(1000);
                        }
                    } catch (Exception ex) { Console.WriteLine(ex); }
                }, CancellationToken.None, TaskCreationOptions.LongRunning, TaskScheduler.Default);

                //  task.Start();
            } catch (Exception ex) { Console.WriteLine(ex.Message); }

            task.ContinueWith((e) => Console.WriteLine("closed"));
        }
Example #2
0
        public static void Main(string[] args)
        {/*
          * ArbitrageFinder finder = new ArbitrageFinder();
          *
          * OlimpBookmaker olimp = new OlimpBookmaker();
          * Marathonbet marathon = new Marathonbet();
          * LeonBets leon = new LeonBets();
          * TitanBet titan = new TitanBet();
          *
          * finder.AddBookmaker(marathon);
          * finder.AddBookmaker(leon);
          * finder.AddBookmaker(olimp);
          * //   finder.AddBookmaker(titan);
          *
          * var result = finder.GetForks();
          *
          * //   Console.WriteLine("here");
          *
          * for (int i = 0; i < 10; i++)
          * {
          *    result = finder.GetForks();
          *
          *    var m_matches = marathon.GetMatchList();
          *    var l_matches = leon.GetMatchList();
          *     var o_matches = olimp.GetMatchList();
          *     var t_matches = titan.GetMatchList();
          *     var forks = result.Where(e => e.Profit > 0);
          *     Thread.Sleep(10000);
          * }
          *
          *     List<Bet> list = new List<Bet>();
          * /*
          * foreach(var bet in leon.GetBetList())
          * {
          *     if (!list.Contains(bet)) list.Add(bet);
          *     else
          *     {
          *         Console.WriteLine("error");
          *         Console.WriteLine();
          *         Console.Write("{0} vs {1}   ", bet.MatchName.FirstTeam, bet.MatchName.SecondTeam);
          *         Console.Write("Sport : {0}  ", bet.Sport);
          *         try
          *         {
          *             var T = bet as ResultBet;
          *             if (T != null)
          *             {
          *                 Console.Write("{0}", ((ResultBet)bet).ToString());
          *                 Console.Write("coef: {0}", T.Odds);
          *             }
          *         }
          *         catch (Exception ex) { Console.WriteLine(ex.Message); }
          *         try
          *         {
          *             var T = bet as TotalBet;
          *             if (T != null)
          *             {
          *                 Console.Write("{0}", ((TotalBet)bet).ToString());
          *                 Console.Write("coef: {0}", T.Odds);
          *             }
          *         }
          *         catch { }
          *         try
          *         {
          *             var h = bet as HandicapBet;
          *             if (h != null)
          *             {
          *                 Console.Write("{0}", ((HandicapBet)bet).ToString());
          *                 Console.Write("coef: {0}", h.Odds);
          *             }
          *         }
          *         catch { }
          *     }
          * }
          */
         //   result = finder.GetArbitrageBets();

            //     Console.WriteLine(finder);

            //  MatchName name1 = new MatchName("Ukraine Dinamo (U-21)", "Russia");
            //  MatchName name2 = new MatchName("D/Ukr U21", "Russia A");

            //  Console.WriteLine(name1.Equals(name2));

            /*var web = new HtmlWeb();
             * web.UserAgent = "Mozilla/5.0 (Linux; U; Android 4.0.3; ko-kr; LG-L160L Build/IML74K) AppleWebkit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30";
             * // var doc = web.Load("http://sports.titanbet.com/web_nr?key=do_switch_platform&amp;platform=mobile");
             * var doc = web.Load("https://m.10bet.com/?#home");
             *
             * Console.WriteLine(doc.DocumentNode.OuterHtml);*/

            Marathonbet    marathon = new Marathonbet();
            OlimpBookmaker olimp    = new OlimpBookmaker();
            LeonBets       leon     = new LeonBets();


            for (int i = 0; i < 10000; i++)
            {
                leon.Parse();
                //   Console.WriteLine(leon().Count);
                Thread.Sleep(2000);
            }

            Console.ReadLine();
        }