Using VB2008 to acccess the Betfair API: A tutorial

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts

  • I am the one and only223
    replied
    OK I posted before about trying to use placeBetsAsync in the VBA Excel code, and I've come to the conclusion that the reason it doesn't work is that VBA is not able to handle the multithreading aspect. So going back to the drawing board I decided to create a VB2010 application that processes bets asynchronously that I can call from VBA. But I still can't get the dratted thing to work. To call the async version I construct the oPlaceBetsReq object and use this code:

    BetFairUK.placeBetsAsync(oPlaceBetsReq)

    But nothing happens. If I replace this with the normal:

    oPlaceBetsResp = BetFairUK.placeBets(oPlaceBetsReq)

    Then it works fine. The BetFairUK_placeBetsCompleted method doesn't return anything when I debug it. Is there some extra coding I need to do for placeBetsAsync that doesn't apply to other asynchronous methods?

    Leave a comment:


  • NatHunter
    replied
    FYI - I updated VS 2010 to SP1 and my PC stopped crashing.

    Thanks for the guide, Mumbles, btw. I do program now and again in VB.NET and this is easy to follow and introducing me to new concepts along the way

    Cheers

    Natty

    Leave a comment:


  • NatHunter
    replied
    Loading the BF Global Service Crashes VB.net 2010

    Hi folks.

    Hopefully you can help.

    I am attempting to add the Betfair service to a VB.net 2010 application and have followed the 'mumbles way', but VB.net crashes once it has searched for the service. Any ideas why?

    I did manage to add the BF service on the same PC previously to another project (which has been deleted), but have been unable to add it since.

    Any help would be much appreciated!

    Regards

    Natty

    Leave a comment:


  • Strappa71
    replied
    Originally posted by ahn View Post
    hi to all,

    i have a strange problem! using the market id, asian lite id and selection id i get the live prices for the total goals event. In case that the score in a match is 0-0 then my algorithm can succesfully place back/lay bets. The problem arises after at least a goal has been scored. Then every time i try to place a bet i receive a selection removed error from the server. Does enyone know why do i get this error and how can i overcome it!!! thanks
    I think your problem lies in the understanding of asian hcp works in-play.

    All bets on Asian hcp are calculated from the as if the score is 0-0 when the bet is made. Therefore a new market ID is assigned after every scored goal to what may seem be the "same market".

    If you read the rules for asian lines carefully you will understand what I try to explain.

    Leave a comment:


  • john_baptiste_of_cheshire
    replied
    thanks to mumbles

    thank you very much for posting this brilliant guide. i found it easy to follow and i am a complete novice to programming. it's been a great help.

    Leave a comment:


  • Dingo Bongo
    replied
    How can I get the Football games occuring today?
    I already know that the Football ID is, but I can't figure out how to get football games. I know how to get all the markets, but not each single game.

    Help would be appreciated!
    Dime bar? Dime........bar.

    When making your market call set the date item to return only markets happening that day. Read this thread if you're not sure how.

    If you catch the response and examine it in a text editor you'll begin to see a pattern in the event hierarchy, eg leagues have a number associated with them so you can start to filter out wheat from chaff.

    Hope that helps.

    Leave a comment:


  • RuiGomes
    replied
    How can I get the Football games occuring today?
    I already know that the Football ID is, but I can't figure out how to get football games. I know how to get all the markets, but not each single game.

    Help would be appreciated!

    Leave a comment:


  • Dingo Bongo
    replied
    As regards time you might want to synch the PCs clock inline with Betfair. I think there might be something in the API guide about it somewhere. There are are number of different internet time services that you can log in to and they update your PC's clock for you. It also helps you ensure that you dont exceed throttle limits too.

    Leave a comment:


  • monkeymagix
    replied
    Hi Dingo,

    Yes it seems that I have to log the time myself and I have come up with a threaded system that locks a race about to turn inplay using the race start date (with a few minutes either side to handle time differences on the PC running the app, the database server and the actual race off time) and then I repeatedly poll the market for that race checking the InPlay flag.

    It seems that the market will first turn into SUSPENDED mode before going InPlay at which point I use the time that my app has recorded as the actual race start time and use the difference from the current date (within my app) as the no of seconds the race has been in action for.

    As I only place bets up until 2/3rds of the minimum recorded duration I have logged for that course/distance/going I am giving myself a good third before the end of the race to place the bets.

    Thanks for replying.

    Leave a comment:


  • Dingo Bongo
    replied
    I might be wrong but Im pretty sure youre initial assumptions are correct. Youd need to check for the in-play indicator and then time it yourself. Id give yourself a bit of a buffer too. You may also want to consider how promptly Betfair switch the markets over from pre-market to in-play. It may only be a matter of seconds which wouldnt impact on a 3 mile chase but might be important on a 5f sprint.

    Leave a comment:


  • monkeymagix
    replied
    Best way of calculating how long a market has been inplay for

    Hello

    I have a Windows Service/BOT that uses the API to place bets (purely automated) which is working fine however I came up with a strategy for horse race betting that involves betting "inplay" but only up to a certain time within the event - as I don't want to place a LAY bet on a horse who is half a furlong from the line and 10 lengths ahead of the crowd.

    As I don't get to watch the races and the BOT is purely automated I have accumulated for every racecourse the min, max and average running time for each distance and going (ground type). Using this data I can set a max time for me to place inplay bets up to.

    For some reason I thought that the delay property of UnpackCompleteMarketPricesCompressed would return the actual no of seconds the event had been "inplay" for but it's value is only ever 1 or 0 and is only good for telling you whether the market has turned in-play or not.

    Therefore it seems I am going to have to constantly poll up coming races looking for markets turning inplay and then once that value has switched from 0 to 1 use my own timer to work out the event running time.

    OR is there another way of finding out how long the horse race has been running for?

    Obviously there are a few things to think about such as
    -False starts - I was going to wait 5-15 seconds before starting to bet to handle these but it looks like I will have to check for market suspension with my own timer
    -Accurate timings, I don't want my timer to be out of sync with the actual event start time

    Maybe I am missing something or there is another property in an object somewhere I could use to detect the time the event has been "inplay"?

    I am using the free API.

    Any help would be much appreciated. Thanks

    Leave a comment:


  • JayBee
    replied
    Matching win and RFC market prices...

    Hello,

    Is there a process or algorithm for matching runners in win/place horse racing markets with the 1-2/2-1 etc. in the RFC market?

    The runnerIds in the RFC market do not match the win/place market runnerIds.

    I assume I need to use runner numbers.

    Can someone clarify which data in win/place markets matches against data in the RFC market so that I may link horse pairs in the win/place markets with bets in the RFC market.

    Thank you.

    Leave a comment:


  • ahn
    replied
    selection removed problem

    hi to all,

    i have a strange problem! using the market id, asian lite id and selection id i get the live prices for the total goals event. In case that the score in a match is 0-0 then my algorithm can succesfully place back/lay bets. The problem arises after at least a goal has been scored. Then every time i try to place a bet i receive a selection removed error from the server. Does enyone know why do i get this error and how can i overcome it!!! thanks

    Leave a comment:


  • Dingo Bongo
    replied
    I hope so.

    Anyways, your question regarding markets looks quite straightforward unless Ive misunderstood what you are after. You seem to be asking for the labels in the over/unders markets, eg over/under 2.5 goals. As they are in the same place that runners in horseracing occupy, I would imagine that a call to GetMarket would return you the info that you are after.

    Live long and prosper

    Leave a comment:


  • cpcGiorgi
    replied
    Fine, Long Live Dingo Bongo !

    Leave a comment:

Working...
X