Пример #1
0
        public double Last10LayMovements()
        {
            double r1;
            double r2;
            double r3;
            double r4;
            double r5;
            double r6;
            double r7;
            double r8;

            try
            {
                BetfairE.Price[] price1 = m_layPrices[m_layPrices.Count];
                BetfairE.Price[] price2 = m_layPrices[m_layPrices.Count - 1];
                BetfairE.Price[] price3 = m_layPrices[m_layPrices.Count - 2];

                r1 = price1[0].price - price1[1].price;
                r2 = price1[1].price - price1[2].price;
                r3 = price1[2].price - price2[0].price;
                r4 = price2[0].price - price2[1].price;
                r5 = price2[1].price - price2[2].price;
                r6 = price2[2].price - price3[0].price;
                r7 = price3[0].price - price3[1].price;
                r8 = price3[1].price - price3[2].price;

                return(r1 + r2 + r3 + r4 + r5 + r6 + r7 + r8);
            }
            catch (Exception ex)
            {
                BfBot.DumpToFile("**** Error in MarketItemMovement->Last10LayMovements ****");
                BfBot.DumpToFile(ex.Message + "InnerException=[" + ex.InnerException.Message + "]");
                return(0.0);
            }
        }
Пример #2
0
 public bool Back()
 {
     try
     {
         double tempBet = BfBot.Balance / 8;
         //m_backBet = new BackBet(m_itemID, BFBot.GetAccount.AllowedStake, m_backPrice[0].price, m_exchangeID, m_marketID);
         //m_backBet = new BackBet(m_itemID, tempBet, m_marketItemMovement.BackPrice, m_exchangeID, m_marketID);
         m_backBet    = new BackBet(m_itemID, tempBet, 1.01, m_exchangeID, m_marketID);
         m_backedOdds = m_marketItemMovement.BackPrice;
         if (m_backBet.PlaceBet())
         {
             m_marketItemState = MarketItemState.Backed;
             //BFBotDB.BFBotDBWorker.Instance().AddBackBet(System.Guid.NewGuid().ToString(), m_itemID.ToString(), (decimal)m_backBet.Stake, (decimal)m_backBet.Odds, (decimal)m_backBet.Profit);
             BfBot.Balance += m_backBet.Profit;
             BfBot.DumpToFile("******************** Backed -> " + m_name + " - " + tempBet + " - Back Price : " + m_marketItemMovement.BackPrice + " Available = " + m_backAmount + " Balance = £ " + BfBot.Balance);
             //BFBotDB.BFBotDBWorker.Instance().AddBackBet(System.Guid.NewGuid().ToString(), m_itemID.ToString(), (decimal)tempBet, (decimal)m_backBet.Odds);
             //BFBot.SendMailMessage("******************** Backed -> ", m_name + " - " + tempBet + " - " + m_marketItemMovement.BackPrice + " Available = " + m_backAmount + " Balance = £ " + BFBot.Balance);
             if (OnMarketItemBacked != null)
             {
                 OnMarketItemBacked(this);
             }
             m_marketItemState = MarketItemState.Backed;
         }
     }
     catch (Exception ex)
     {
         BfBot.DumpToFile("Error in MarketItem->Back  : " + ex.Message);
     }
     return(true);
 }
Пример #3
0
        private void CalculateRaceLength(string value)
        {
            try
            {
                //int furlongs;
                string[] cfurlongs;

                string[] temp   = value.Split(' ');
                string[] cmiles = temp[0].Split('m');
                if (cmiles.Length > 1)
                {
                    int miles = Convert.ToInt16(cmiles[0]);
                    cfurlongs = cmiles[1].Split('f');
                    if (cfurlongs.Length > 1)
                    {
                        m_totalFurlongs = (miles * 8) + Convert.ToInt16(cfurlongs[0]);
                    }
                    else
                    {
                        m_totalFurlongs = (miles * 8);
                    }
                }
                else
                {
                    cfurlongs       = temp[0].Split('f');
                    m_totalFurlongs = Convert.ToInt16(cfurlongs[0]);
                }
                m_estimatedRaceTime = m_totalFurlongs * 12;
            }
            catch (Exception ex)
            {
                BfBot.DumpToFile("Error in Market->CalculateRaceLength : " + ex.Message);
            }
        }
Пример #4
0
        private bool ValidMarket(string s)
        {
            try
            {
                string[] parts = s.Split('~');

                if (m_activeMarkets.ContainsKey(parts[8] + " - " + parts[0]))
                {
                    return(false);
                }
                if (parts[14] != "Y")
                {
                    return(false);
                }
                if (parts[3] == "SUSPENDED")
                {
                    return(false);
                }
                if (parts[5].Split('\\').Length > 4)
                {
                    return(false);
                }
                if (parts[1] == "To Be Placed")
                {
                    return(false);
                }
                return(true);
            }
            catch (Exception ex)
            {
                BfBot.DumpToFile("Error in MarketTracker->ValidMarket : " + ex.Message);
                return(false);
            }
        }
Пример #5
0
 private void CalculateLeastFavourite()
 {
     try
     {
         if (m_marketItems.Count == 0)
         {
             PopulateMarketDetails();
         }
         foreach (MarketItem marketItem in m_marketItems.Values)
         {
             if (m_leastFavourite == null)
             {
                 m_leastFavourite = marketItem;
             }
             else if (m_leastFavourite.Name == marketItem.Name)
             {
                 m_leastFavourite = marketItem;
             }
             if (marketItem.BackPrice > m_leastFavourite.BackPrice)
             {
                 m_leastFavourite = marketItem;
             }
         }
     }
     catch (Exception ex)
     {
         BfBot.DumpToFile("Error in Market->CalculateLeastFavourite : " + ex.Message);
     }
 }
Пример #6
0
        public double Last5BackMovements()
        {
            double r1;
            double r2;
            double r3;
            double r4;
            double r5;

            try
            {
                BetfairE.Price[] price1 = m_backPrices[m_backPrices.Count];
                BetfairE.Price[] price2 = m_backPrices[m_backPrices.Count - 1];

                r1 = price1[0].price - price1[1].price;
                r2 = price1[1].price - price1[2].price;
                r3 = price1[2].price - price2[0].price;
                r4 = price2[0].price - price2[1].price;
                r5 = price2[1].price - price2[2].price;

                return(r1 + r2 + r3 + r4 + r5);
            }
            catch (Exception ex)
            {
                BfBot.DumpToFile("**** Error in MarketItemMovement->Last5BackMovements ****");
                BfBot.DumpToFile(ex.Message + "InnerException=[" + ex.InnerException.Message + "]");
                return(0.0);
            }
        }
Пример #7
0
 public bool LayBet()
 {
     try
     {
         if (m_marketItemMovement.LayPrices().Length > 0)
         {
             double amount;
             if (m_marketItemMovement.LayPrices()[0].amountAvailable > 2)
             {
                 amount = m_marketItemMovement.LayPrices()[0].amountAvailable;
             }
             else
             {
                 amount = 2.0;
             }
             //public LayBet(int selectionID, double stake, double odds, int exchangeId, int marketId, BetfairE.PlaceBetsResult placeResult)
             LayBet free = new LayBet(m_itemID, amount, m_marketItemMovement.LayPrice, m_exchangeID, m_marketID);
             //free.PlaceBet();
             BfBot.DumpToFile("******************** Layed -> " + m_name + " - " + free.Stake + " - " + free.Odds);
             return(true);
         }
         return(false);
     }
     catch (Exception ex)
     {
         BfBot.DumpToFile("Error in MarketItem.LayBet : " + ex.Message);
         return(false);
     }
 }
Пример #8
0
 public Market(string marketDetails)
 {
     try
     {
         GetValue(marketDetails);
     }
     catch (Exception ex)
     {
         BfBot.DumpToFile("Error in Market->Market : " + ex.Message);
     }
 }
Пример #9
0
 public bool InitialiseMarket()
 {
     try
     {
         return(MarketInitialise());
     }
     catch (Exception ex)
     {
         BfBot.DumpToFile("Error in  Market->InitialiseMarket: " + ex.Message);
         m_marketInitialised = false;
         return(false);
     }
 }
Пример #10
0
 private void Login()
 {
     try
     {
         if (File.Exists(@"C:/Safe/BFB.txt"))
         {
             string[] lines = File.ReadAllLines(@"C:/Safe/BFB.txt");
             s_exchange.Login(lines[0], lines[1]);
         }
     }
     catch (Exception ex)
     {
         BfBot.DumpToFile("Error in MarketTracker->Login : " + ex.Message);
     }
 }
Пример #11
0
 void market_OnMarketClosed(Market market)
 {
     try
     {
         if (!m_closedMarkets.ContainsKey(market.ExchangeID + " - " + market.MarketID))
         {
             m_closedMarkets.Add(market.ExchangeID + " - " + market.MarketID, market);
             m_activeMarkets.Remove(market.ExchangeID + " - " + market.MarketID);
         }
     }
     catch (Exception ex)
     {
         BfBot.DumpToFile("Error in MarketTracker->OnMarketClosed : " + ex.Message);
     }
 }
Пример #12
0
 public bool ActivateMarket()
 {
     try
     {
         m_timer.Elapsed += new ElapsedEventHandler(m_timer_Elapsed);
         m_timer.Interval = 3000;
         m_timer.Start();
         m_marketActive = true;
         return(true);
     }
     catch (Exception ex)
     {
         BfBot.DumpToFile("Error in Market->ActivateMarket : " + ex.Message);
         return(false);
     }
 }
Пример #13
0
        //private void CalculateInterests()
        //    {

        //    }


        private void CalculateFavourite()
        {
            try
            {
                if (m_marketState == BfBot.MarketState.Backed)
                {
                    return;
                }
                if (m_marketItems.Count == 0)
                {
                    PopulateMarketDetails();
                }
                foreach (MarketItem marketItem in m_marketItems.Values)
                {
                    if (m_favourite == null)
                    {
                        m_favourite = marketItem;
                    }
                    else if (m_favourite.Name == marketItem.Name)
                    {
                        m_favourite = marketItem;
                    }
                    if (marketItem.BackPrice < m_favourite.BackPrice)// & marketItem.BackLayDif <= Math.Abs(m_favourite.BackLayDif))
                    {
                        m_favourite = marketItem;
                    }
                }
                BfBot.DumpToFile("*****Favourite : " + m_favourite.Name + "  : Back Price " + m_favourite.BackPrice);
                CalculateSecondFavourite();
                if (m_favourite.BackPrice <= 1.25 & m_betDelay == "1")
                {
                    if ((m_secondFavourite.BackPrice - m_favourite.BackPrice) >= 3.0)
                    {
                        BfBot.DumpToFile("1st - 2nd dif >= 3.0");
                    }
                    m_favourite.Back();
                    m_marketState = BfBot.MarketState.Backed;
                }
                //CalculateSecondFavourite();
            }
            catch (Exception ex)
            {
                BfBot.DumpToFile("Error in Market->CalculateFavourite : " + ex.Message);
            }
        }
Пример #14
0
 protected MarketTracker()
 {
     try
     {
         m_activeMarkets = new System.Collections.Hashtable();
         m_closedMarkets = new System.Collections.Hashtable();
         s_exchange      = new Exchange();
         Login();
         m_timer          = new System.Windows.Forms.Timer();
         m_timer.Tick    += new EventHandler(m_timer_Tick);
         m_timer.Interval = 900000;
         //GetClosedMarkets();
         Process();
     }
     catch (Exception ex)
     {
         BfBot.DumpToFile("Error in MarketTracker->MarketTracker : " + ex.Message);
     }
 }
Пример #15
0
 private void PopulateMarketDetails()
 {
     try
     {
         if (m_bfMarket != null)
         {
             foreach (BetfairE.Runner thisRunner in m_bfMarket.runners)
             {
                 MarketItem marketItem = new MarketItem(thisRunner, m_exchangeId, this);
                 marketItem.OnMarketItemBacked    += new MarketItem.MarketItemBacked(marketItem_OnMarketItemBacked);
                 marketItem.OnMarketItemEqualised += new MarketItem.MarketItemEqualised(marketItem_OnMarketItemEqualised);
                 m_marketItems.Add(marketItem.ItemID, marketItem);
             }
         }
     }
     catch (Exception ex)
     {
         BfBot.DumpToFile("Error in Market->PopulateMarketDetails : " + ex.Message);
     }
 }
Пример #16
0
        public MarketItem(BetfairE.Runner runner, int exchangeID, Market market)
        {
            try
            {
                m_name               = runner.name;
                m_itemID             = runner.selectionId;
                m_exchangeID         = exchangeID;
                m_marketID           = market.MarketID;
                m_market             = market;
                m_marketItemMovement = new MarketItemMovement();
                m_marketItemState    = MarketItemState.Unknown;

                BFBotDB.BfBotDbWorker.Instance().AddMarketItem(m_marketID, m_name, m_marketItemState.ToString());
                //BFBotDB.BFBotDBWorker.Instance().AddMarketItem(m_itemID.ToString(), m_marketID.ToString(), m_name, m_marketItemState.ToString());
            }
            catch (Exception ex)
            {
                BfBot.DumpToFile("MarketItem->MarketItem : " + ex.Message);
            }
        }
Пример #17
0
        private void Process()
        {
            try
            {
                if (m_activeMarkets.Count != 0)
                {
                    return;
                }

                string   currentMarkets = s_exchange.GetAllMarketsUKHorseRacing();
                string[] marketsSplit   = currentMarkets.Split(':');
                foreach (string str in marketsSplit)
                {
                    if (str != "")
                    {
                        if (ValidMarket(str))
                        {
                            Market market = new Market(str);
                            if (!m_closedMarkets.ContainsKey(market.ExchangeID + " - " + market.MarketID))
                            {
                                market.InitialiseMarket();
                                if (market.IsMarketActive() == true && market.ValidMarket)
                                {
                                    market.ActivateMarket();
                                    market.OnMarketBacked    += new Market.MarketBackedDelegate(market_OnMarketBacked);
                                    market.OnMarketEqualised += new Market.MarketEqualisedDelegate(market_OnMarketEqualised);
                                    market.OnMarketClosed    += new Market.MarketClosed(market_OnMarketClosed);
                                    m_activeMarkets.Add(market.ExchangeID + " - " + market.MarketID, market);
                                    //return;
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                BfBot.DumpToFile("Error in MarketTracker->Process : " + ex.Message);
            }
        }
Пример #18
0
 private void CalculateSecondFavourite()
 {
     try
     {
         if (m_marketState == BfBot.MarketState.Backed)
         {
             return;
         }
         if (m_marketItems.Count == 0)
         {
             PopulateMarketDetails();
         }
         foreach (MarketItem marketItem in m_marketItems.Values)
         {
             if (marketItem.Name != m_favourite.Name)
             {
                 if (m_secondFavourite == null)
                 {
                     m_secondFavourite = marketItem;
                 }
                 if (marketItem.BackPrice < m_secondFavourite.BackPrice)
                 {
                     m_secondFavourite = marketItem;
                 }
                 else if (marketItem.BackPrice == m_secondFavourite.BackPrice)
                 {
                     if (marketItem.LayPrice < m_secondFavourite.LayPrice)
                     {
                         m_secondFavourite = marketItem;
                     }
                 }
             }
         }
         BfBot.DumpToFile("*****Second Favourite : " + m_secondFavourite.Name + "  : Back Price " + m_secondFavourite.BackPrice);
     }
     catch (Exception ex)
     {
         BfBot.DumpToFile("Error in Market->CalculateSecondFavourite : " + ex.Message);
     }
 }
Пример #19
0
        private void DoWeight(BetfairE.Price[] backPrices, BetfairE.Price[] layPrices)
        {
            double r1;
            double r2;

            try
            {
                if (backPrices.Length == 2)
                {
                    r1            = backPrices[0].price - backPrices[1].price;
                    m_backWeight += r1;
                }
                else if (backPrices.Length == 3)
                {
                    r1            = backPrices[0].price - backPrices[1].price;
                    r2            = backPrices[1].price - backPrices[2].price;
                    m_backWeight += r1;
                    m_backWeight += r2;
                }

                if (layPrices.Length == 2)
                {
                    r1           = layPrices[0].price - layPrices[1].price;
                    m_layWeight += r1;
                }
                else if (layPrices.Length == 3)
                {
                    r1           = layPrices[0].price - layPrices[1].price;
                    r2           = layPrices[1].price - layPrices[2].price;
                    m_layWeight += r1;
                    m_layWeight += r2;
                }
            }
            catch (Exception ex)
            {
                BfBot.DumpToFile("**** Error in MarketItemMovement->DoWeight ****");
                BfBot.DumpToFile(ex.Message);
            }
        }
Пример #20
0
        public bool Equalise()
        {
            try
            {
                if (m_marketItemMovement.LayPrice < m_backBet.Odds)
                {
                    m_layOdds = m_marketItemMovement.LayPrice;
                    LayBet free = new LayBet(m_itemID, m_backBet.Stake, m_marketItemMovement.LayPrice, m_exchangeID, m_marketID);
                    //free.PlaceBet();
                    m_layBet = free;

                    ////Used to equalise the bet.
                    //double ls = (m_backBet.Profit - free.Profit) / m_layPrice[0].price;
                    //// cast to int(not sure on BF policy on pence?
                    //LayBet equaliser = new LayBet(m_itemID, m_backBet.Stake, m_layPrice[0].price, m_exchangeID, m_marketID);
                    //m_layBet = equaliser;
                    //m_layBet.PlaceBet();
                    //m_state = BFBot.MarketItemState.Equalised;
                    BfBot.DumpToFile("******************** Layed -> " + m_name + " - " + m_layBet.Stake + " - " + m_layBet.Odds);
                    //BFBot.AddMessage("******************** Layed -> " + m_name + " - " + m_layBet.Stake + " - " + m_layBet.Odds);
                    //BFBot.SendMailMessage("******************** Layed -> ", m_name + " - " + m_layBet.Stake + " - " + m_layBet.Odds);
                    if (OnMarketItemEqualised != null)
                    {
                        OnMarketItemEqualised(this);
                    }
                    m_marketItemState = MarketItemState.Equalised;
                    return(true);
                }
                return(false);
            }
            catch (Exception ex)
            {
                BfBot.DumpToFile("Error in MarketItem->Equalise : " + ex.Message);
                return(false);
            }
        }
Пример #21
0
        public void UpdateItem(BetfairE.RunnerPrices runnerprices, int inPlay)
        {
            double backPrice;
            double backAmount;
            double layPrice;
            double layAmount;

            double[] values;

            try
            {
                m_marketItemMovement.AddPrices(runnerprices.bestPricesToBack, runnerprices.bestPricesToLay);
                if (runnerprices.bestPricesToLay.Length > 0)
                {
                    layAmount = runnerprices.bestPricesToLay[0].amountAvailable;
                }
                else
                {
                    layAmount = 0.0;
                }
                if (runnerprices.bestPricesToLay.Length > 0)
                {
                    layPrice = runnerprices.bestPricesToLay[0].price;
                }
                else
                {
                    layPrice = 0.0;
                }
                if (runnerprices.bestPricesToBack.Length > 0)
                {
                    backAmount = runnerprices.bestPricesToBack[0].amountAvailable;
                }
                else
                {
                    backAmount = 0.0;
                }
                if (runnerprices.bestPricesToBack.Length > 0)
                {
                    backPrice = runnerprices.bestPricesToBack[0].price;
                }
                else
                {
                    backPrice = 0.0;
                }
                m_layAmount  = layAmount;
                m_backAmount = backAmount;
                //BFBot.DumpToFile("[" + m_marketID + "],[" + m_itemID.ToString() + "] " + m_name.PadRight(20) + " : B[" + runnerprices.bestPricesToBack[0].price + " £" + runnerprices.bestPricesToBack[0].amountAvailable + "] - L[" + runnerprices.bestPricesToLay[0].price + " £" + runnerprices.bestPricesToLay[0].amountAvailable + "]");
                BfBot.DumpToFile("[" + m_marketID + "],[" + m_itemID.ToString() + "], " + m_name.PadRight(20) + " : B[" + backPrice + ", £" + backAmount + "] : L[" + layPrice + ", £" + layAmount + "]");
                //BFBot.DumpDetails(m_marketID + "," + m_itemID.ToString() + "," + m_name + "," + backPrice + "," + backAmount + "," + layPrice + "," + layAmount + "," + m_marketItemMovement.Report());
                values = m_marketItemMovement.Report();
                //BFBotDB.BfBotDbWorker.Instance().AddMarketItemMovement(m_marketID, m_itemID, m_name, backPrice, backAmount, layPrice, layAmount, inPlay, values);
                //BFBotDB.BFBotDBWorker.Instance().AddMarketItemMovement(m_marketID.ToString(), m_itemID.ToString(), m_name, backPrice, backAmount, layPrice, layAmount, inPlay, values);
                if (OnMarketItemUpdate != null)
                {
                    OnMarketItemUpdate();
                }
                BFBotDB.BfBotDbWorker.Instance().AddMarketMovement(m_marketID, m_itemID, backPrice, backAmount, layPrice, layAmount, inPlay);
                //BFBotDB.BFBotDBWorker.Instance().AddMarketMovement(m_marketID, m_itemID, backPrice, backAmount, layPrice, layAmount, inPlay);
                //BFBot.DumpDetails(m_name + " - " + m_itemID + m_marketItemMovement.Report());
            }
            catch (Exception ex)
            {
                BfBot.DumpToFile("Error in MarketItem->UpdateItem : " + ex.Message);
                BfBot.DumpToFile(" : " + ex.Message);
            }
        }
Пример #22
0
 private void UpdateMarket()
 {
     try
     {
         m_timer.Stop();
         BetfairE.MarketPrices marketPrices = MarketTracker.Instance.Exchange.GetMarketPrices(m_exchangeId, m_marketId);
         m_betDelay = marketPrices.delay.ToString();
         BfBot.DumpToFile("=================================================================================");
         if (marketPrices.marketStatus == global::BFBot.com.betfair.api6.exchange.MarketStatusEnum.SUSPENDED)
         {
             m_raceOffTime = DateTime.Now;
             BfBot.DumpToFile("SUSPENDED," + m_marketName + "," + m_menuPath + "," + TimeToOff() + "," + m_suspendTime);
             if (m_leastFavourite.LayAmount > 2)
             {
                 BfBot.DumpToFile("Least Favourite Layed," + m_leastFavourite.Name + " - Lay Price = " + m_leastFavourite.LayPrice + " , Lay Amount = " + m_leastFavourite.LayAmount);
             }
             if (m_favourite != null)
             {
                 BfBot.DumpToFile("Favourite : " + m_favourite.Name + " , Back = " + m_favourite.BackPrice + " , Layed = " + m_favourite.LayPrice);
             }
             m_raceCountdown = DateTime.Now.AddSeconds(m_estimatedRaceTime);
             if (OnUpdateMarket != null)
             {
                 OnUpdateMarket(this);
             }
             m_timer.Start();
         }
         else if (marketPrices.marketStatus == global::BFBot.com.betfair.api6.exchange.MarketStatusEnum.CLOSED)
         {
             BfBot.DumpToFile("CLOSED," + m_marketName + "," + m_menuPath + "," + TimeToOff() + "," + m_suspendTime);
             if (m_leastFavourite != null)
             {
                 BfBot.DumpToFile(" Least Favourite End Price," + m_leastFavourite.Name + " , Layed = " + m_leastFavourite.LayPrice + " , Back = " + m_leastFavourite.BackPrice);
             }
             if (m_favourite != null)
             {
                 BfBot.DumpToFile("Favourite End Price," + m_favourite.Name + " , Layed = " + m_favourite.LayPrice + " , Back = " + m_favourite.BackPrice);
             }
             m_marketState = BfBot.MarketState.Closed;
             if (OnMarketClosed != null)
             {
                 OnMarketClosed(this);
             }
             return;
         }
         else if (m_betDelay == "1")
         {
             foreach (BetfairE.RunnerPrices runnerprices in marketPrices.runnerPrices)
             {
                 MarketItem thisMarketItem = m_marketItems[runnerprices.selectionId] as MarketItem;
                 if (thisMarketItem != null)
                 {
                     thisMarketItem.UpdateItem(runnerprices, marketPrices.delay);
                 }
             }
             CalculateFavourite();
             CalculateLeastFavourite();
             BfBot.DumpToFile("** in play **," + m_marketId + "," + m_marketName + "," + m_menuPath + "," + TimeToOff() + "," + m_suspendTime + "," + m_timer.Interval.ToString());
             if (m_leastFavourite != null)
             {
                 BfBot.DumpToFile(m_marketId + " Least favourite : " + m_leastFavourite.Name + " - Lay Price = " + m_leastFavourite.LayPrice + " , Lay Amount = " + m_leastFavourite.LayAmount + " ' " + m_leastFavourite.BackPrice);
             }
             if (m_favourite != null)
             {
                 BfBot.DumpToFile("Favourite : " + m_favourite.Name + " , Back = " + m_favourite.BackPrice + " , Layed = " + m_favourite.LayPrice);
             }
             BfBot.DumpToFile("Estimated time to race finish : " + m_raceCountdown.Subtract(DateTime.Now));
             if (OnUpdateMarket != null)
             {
                 OnUpdateMarket(this);
             }
             if (OnMarketInPlay != null)
             {
                 OnMarketInPlay(this);
             }
             m_timer.Start();
         }
         else
         {
             foreach (BetfairE.RunnerPrices runnerprices in marketPrices.runnerPrices)
             {
                 MarketItem thisMarketItem = m_marketItems[runnerprices.selectionId] as MarketItem;
                 if (thisMarketItem != null)
                 {
                     thisMarketItem.UpdateItem(runnerprices, marketPrices.delay);
                 }
             }
             CalculateFavourite();
             CalculateLeastFavourite();
             BfBot.DumpToFile(m_marketId + "," + m_marketName + "," + m_menuPath + "," + TimeToOff() + "," + m_suspendTime + "," + m_timer.Interval.ToString());
             if (m_leastFavourite != null)
             {
                 BfBot.DumpToFile(m_marketId + " Least favourite : " + m_leastFavourite.Name + " - Lay Price = " + m_leastFavourite.LayPrice + " , Lay Amount = " + m_leastFavourite.LayAmount + " ' " + m_leastFavourite.BackPrice);
             }
             if (m_favourite != null)
             {
                 BfBot.DumpToFile(m_marketId + " Favourite : " + m_favourite.Name + " , Back = " + m_favourite.BackPrice + " , Layed = " + m_favourite.LayPrice);
             }
             if (OnUpdateMarket != null)
             {
                 OnUpdateMarket(this);
             }
             m_timer.Start();
         }
         BfBot.DumpToFile("=================================================================================");
     }
     catch (Exception ex)
     {
         BfBot.DumpToFile("Error in Market->UpdateMarket : " + ex.Message);
         m_timer.Start();
     }
 }