Thread: Betfair
View Single Post
  #16  
Old 2nd October 2011, 12:41 PM
UselessBettor UselessBettor is offline
Member
 
Join Date: Sep 2011
Posts: 1,474
Default

The Elk,

The updating of the times for delayed races has only recently been added to betfair. I think in the last couple of months.

I call getAllMarkets. I do this every 5 mins. This gives me a listing of all the markets and it includes the times. I use this to update an array of races and race times. At 20mins before the race I call getMarket(marketId) and then I call market.getMarketTime(). This time matches the time I have 99% of the time. When it doesn't match I recall getAllMarkets and this always updates my array to the correct time.

I suggest using the getAllMarkets call to determine the times and to update it often.

My code is below. It should be fairly obvious but ask if you have questions. bmMarket is just a wrapper class I have written to hold market information with a few extra attributes.

Code:
a = getAllMarketsUK(HORSERACING); st1 = new StringTokenizer(a, ":"); bm = new betfairMarket(); while(st1.hasMoreTokens())**** String token1 = st1.nextToken(); StringTokenizer st2 = new StringTokenizer(token1, "~"); int count = 0; while(st2.hasMoreTokens())**** count++; String token2 = st2.nextToken(); if (count == 1)**** bm.setMarketIdWin(token2); **** if (count == 5)**** bm.setTimeOfMarket(token2); **** if (count == 7)**** String timeOfMe = bm.getTimeOfMarket(); bm.setTimeOfMarket(token2.substring(0,token2.lastI ndexOf("/")+1)+timeOfMe); **** if (count == 9)**** bm.setEventId(token2); **** **** betfairMarket aTemp = (betfairMarket)winMarkets.get(bm.getTimeOfMarket() ); if (aTemp == null)**** winMarkets.put(bm.getTimeOfMarket(), bm); bm = new betfairMarket(); **** ****


For some reason this forum has changed the brackets to stars but I think you can work out which are opening and closing brackets.
Reply With Quote