Betfair Market Search Using Trade Opportunity Lookup Service
Posted in From My Inbox by StefanBelo
Do any of your products include a customizable (Betfair) search function? I generally bet football and for example may want to search for all matches (regardless of country, league, competition etc) where the draw is available to lay at less than 3.0 or back at greater than 4.0.
As the Trade Opportunity Lookup service (TOLS) is able to load markets and evaluates market data against the LookUpBot logic we can use the TOLS also for this purpose, to search betfair markets. What we need is to create a lookup bot script which will evaluate our search logic.
using System;
using BeloSoft.Betfair.Data;
using BeloSoft.Betfair.Service;
using BeloSoft.Betfair.Trading;
namespace Bfexplorer.Scripting
{
class StartMonitoringLookUpBot : LookUpBot
{
// Const
private static string[] AllowedCountries = { "GBR", "DEU", "ESP" };
private const int NumberOfSelections = 3;
private const int CheckOddsRangeForSelection = 2;
private const double MinOdds = 3.0;
private const double MaxOdds = 4.5;
public StartMonitoringLookUpBot(IBetfairService betfairService)
: base(betfairService)
{
}
public override bool DoYourJob(MonitoredMarket monitoredMarket)
{
if (GetIsMyMarket(monitoredMarket))
{
MonitoredMarket myMonitoredMarket =
betfairService.GetMonitoredMarket(monitoredMarket.MarketId);
DoStartMonitoring(
myMonitoredMarket != null ? myMonitoredMarket : monitoredMarket
);
}
return false;
}
private bool GetIsMyMarket(MonitoredMarket monitoredMarket)
{
MarketDetails marketDetails = monitoredMarket.MarketDetails;
Runner[] runners = marketDetails.Runners;
// Number of selections
if (runners.Length != NumberOfSelections)
{
return false;
}
// Odds range
BetPrice betPrice = runners[CheckOddsRangeForSelection].BestPriceToBack;
if (betPrice != null)
{
double odds = betPrice.Price;
if (odds < MinOdds || odds > MaxOdds)
{
return false;
}
}
else
{
return false;
}
// Country filter
string myCountry = marketDetails.Country;
foreach (string country in AllowedCountries)
{
if (myCountry == country)
{
return true;
}
}
return false;
}
private void DoStartMonitoring(MonitoredMarket monitoredMarket)
{
betfairService.StartMonitorThisMarket(monitoredMarket);
}
}
}
The lookup bot will check if a market has 3 selections and the event is taking place in the allowed countries: Great Britain, Germany and Spain. If the third selection is offered in the preset odds range (MinOdds, MaxOdds) the market is opened for monitoring.
This custom LookUpBot script can be programmed the way it would place bets or run a trading bot as well.
To run such custom betfair market search task you need to add the LookUpBot script:
- Bfexplorer.Scripting.StartMonitoringLookUpBot
And then loads markets using the Browse selected market type. You can set the Start monitoring parameter so a market will be evaluated at preset time before or after the official event start time, or you can switch off this parameter so markets will be evaluated immediately.
If you run this betfair market search bot on today soccer fixtures the TOLS would open 3 markets from 8 offered markets.



Sunday, February 21, 2010
Look up script for over/under 2,5 goals
If I would like to start monitoring all the fotballgames having "over/under 2,5 gaols" in TOLS, I suppose this script could be modified ?
/Mattias
Sunday, February 21, 2010
I have probably miss understood the lookup bot functionality!
/Mattias
Monday, February 22, 2010
What the Bfexplorer PRO offers for betfair traders
The Bfexplorer PRO offers betting and trading facilities for betfair users. You can open more markets for monitoring and then place your bets or trade using Bfexplorer Trader user interface with ladders.
If you prefer to automate your trading you can use trading bots which can be executed using the Bot Wizards or the Bot Executor that offers possibility to create different bot configurations, in such case you decide when to start your bot.
If you prefer fully automate your betting or trading then you can use two tools:
The name of the tool suggests its usage, at least in the second one. You choose your selections manually and assign the strategies you want to execute. The trade opportunity lookup tool offers possibility to evaluate market/s and choose your selection/s automatically according to the strategy your LookUpBot implements.
You can use as a LookUpBot any bot settings you would create using the bot executor, in such case the market or selection criteria defines entry point, and in the bot setup you define by using the parameter: PlaceBetOnRunner on which selection you want to place your bet. Keep in mind that when using the Market criteria parameter: Sort selections by, the selection will depend on your sorting parameter.
As you can see on this example this custom LookUpBot does not place any bets, simply does what its implementation offers, and that is to evaluate market and if the market fulfills criteria it opens this market for monitoring.
Saturday, October 30, 2010
Hi Stefan,
I try to run Bfexplorer.Scripting.StartMonitoringLookUpBot and Bfexplorer.Scripting.StartMonitoringForCountryLookUpBot and every time i receive this message : Missing the bot code source!
Did I miss something?
Thanks
Tuesday, June 28, 2011
BFE2 Lookup Bot
Hi,
Similar to hamid above, I cannot seem to get my barebones lookup bot to run, I have set it up as per screenshot and the code resides in mybots etc in BFE install dir -
My code is this -
Tuesday, June 28, 2011
You can build your bots deriving from LookUpBot only if you implement your bot assembly for the Bot Executor. I did not publish yet a sample project showing how to do it but in Bfexplorer PRO 2 you can find such assemblies so you are able to find out how to do it.
If you want to use your bots from Bot executor then the simpler way is to derive your bot classes from MyMarketBot or MyRunnerBot.
Wednesday, June 29, 2011
Hi Stefan,
"You can build your bots deriving from LookUpBot only if you implement your bot assembly for the Bot Executor."
Not sure what you mean here? could you elaborate please.
I want to write a lookup bot so do I have to wait for you example or is it better to go back to BFE1?
Also, Is there anyway the error messages could be more useful to a novice bot coder, could it state what type of class it is expecting you to be derived from or something?
Finally, could you think about providing a couple of command line start options to BFE2.exe?
such as -
BeloSoft.BfexplorerPRO.exe /u username /p password /practice true, so we can start up the program each time for a debug session and automatically login in practice mode, save a few repetitive setup stages? some users may just use it as a shortcut (the risk is with them re:security)
Thanks
Wednesday, June 29, 2011
Bfexplorer BOT SDK - The way how to develop betfair bots
Ok, I have added option for auto login to betfair account when debugging your betfair bots. Please, read this article: Bfexplorer BOT SDK and what betfair bots you can program in C# or Visual Basic