Article

Delayed API Status

Hello. Since yesterday I have a delayed API on my BF Explorer trading software. I had no bots running when this happened and now I am also unable to trade as all stakes in the markets keep flashing all over the ladders on random odds, being absolutely impossible to figure out what was the last price traded and all other API data. Why as this happened ? Anyone else facing this same problem ? What can be done for the software to have access to the Betfair API data in real time again ?

Comments ( 41 )


  • Betfair Bot
    23.5.2020 12:43:38

    For instance when running machine learning strategy on horse racing markets I set Strategy Bot Executor to load horse racing win markets each day at 10:00.  

    Start execution time is set to -15 seconds, because ML strategy requires loading some data for each race.

    Update interval is set to 1 second.

    Now count!

    Strategy Bot Executor before starting bot execution on the market updates market data, that is 1 call to betfair api.

    As the strategy requires those data for each race (it is not data from betfair api), the bot executes download of this data and processing, it takes by average 6 seconds. So during these 6 seconds, as “Strategy Bot Executor” monitors market data, the market data are 6 times updated (bfexplorer 6 times queries betfair api to listMarketBook method) .

    After data are loaded, bot processing them and decides if any bet is placed on this market. As the bot is executed in the update market cycle, in one cycle this data are evaluated and in the next cycle the bot places bet on dedicated selection.

    Update interval is set to 1 second, and we know that any update cycle requires bfexplorer to call betfair api for market data.

    If the bot will not continue with bet placing, the bot execution is finished and so the market monitoring is stopped as well.

    Now count!

    1 + 6 + 2 = 9 queries to betfair api.

    If the bot continues with bet placing, the action bot is created and executed on the dedicated market selection (1 cycle).

    If the bet placing is done by “Place Bet” bot, then from execution of the “Place Bet” and actually placing bet the bot requires additional 1 cycle (have a look at Place Bet parameters).

    Placing bets through betair api is done by other api method: placeOrders. And as the update interval is set to 1 second, but as there are two different api calls done by bfexplorer, and bot operates in the market update cycle, bet placing status must be confirmed in the market update status only, so successful bet placing operation even if takes 200-300ms takes for bot execution in 2 cycles.

    1 + 2 = 3, and totally 9 + 3 = 12 queries to betfair api for market updates.

    Ok, my bot places bet on current offer, and in UK horse racing there is good offer, so bet is immediately matched, If not “Place Bet” bot updates bet to be fully matched, so let say 6 cycles are additional needed.

    12 + 6 = 18 queries to betfair api.

    If there are 100 races per day my strategy requires maximum: 100 * 18 = 1800 queries to betfair api.

    So monthly: 1800 * 30 = 54000

    I simply can count, and try not to use too much betfair resources. Of course, I can execute trading strategies that require monitoring markets for 10-30 minutes, but then again I adjust update interval and try to monitor as less of markets as possible.