How to use a bot with the TOL on a market without monitoring it?
Posted in Bfexplorer Products by Hamid
Every day I apply the same strategy with a bot but I don't want the market to be monitored.
I now i sound strange.
Thanks Stefan.
Posted in Bfexplorer Products by Hamid
Every day I apply the same strategy with a bot but I don't want the market to be monitored.
I now i sound strange.
Thanks Stefan.
Monday, March 22, 2010
It really sounds quite strange. If you use to run your bots using tools: Trade opportunity lookup (TOL) or Execute my strategy on selections (ESS), then after initial market loading, the market monitoring is postponed and started again at preset time from the official event start (the parameter: Start monitoring ...)
You may have noticed that TOL Start monitoring parameter has a check box, so you can switch this parameter on or off. When this parameter is switched off, TOL constantly monitors all markets added into its list, this can be used when you want to run dutching for instance. In this case all markets are monitored using the preset refresh rate (the parameter: Refresh rate)
Have a look at those two forum articles showing how to use TOL and ESS
Football automatic backing software
Laying Selected Horses at In-Running
Tuesday, March 23, 2010
In fact I want to do something simple:
Bot Executor: Place a bet
I want to place a lay at odds 1,1 for 30 euros on the runner 1 with in "play market type"
That means the bot will place 5,10 or 20 bets (football).
I don't need the bets to be monitored because as the market is "in-play" Betfair will stop all the unmatched bets.
I don't need the bets to be monitored because of the "Betfair API counter" (max 20)
Thanks Stefan
Thursday, March 25, 2010
Betfair API bot in C#.NET or Visual Basic
Yes Hamid it can be done with a custom bot script by adding this line of code:
betfairService.StopMonitorThisMarket(monitoredMarket);
Thursday, March 25, 2010
Sorry for this stupid question but How to do it ?
Could I do it using a text editor like Notepad++ ?
So I have to add this line : betfairService.StopMonitorThisMarket(monitoredMarket);
There is no specific place where to put it? I add this line in the file of the bespoke solution you made for me?
Or could I use this bot : Bfexplorer.scripting.stopMonitoringThismarketBot.cs
Thanks Stefan
Friday, March 26, 2010
Hamid
You want to stop a market monitoring after your bot have done its job.
I believe that you are not a software developer and most of you can see in the C# source code of your betfair bot script is not quite understandable for you, but you can find there in plain English some words: DoYourJob, BotJotDone, ClosePosition, DoSetBetPosition, GetIsTimeToStopOrClosePosition, GetOddsToClosePosition, IsPosibleToClosePosition, StopBot.
As I said, you do not have to understand each line of code but at least from the method names above, you can get an idea what is going on when the bot is executed, how this bot actually works.
The bot extends functionality of the BeTheFirstInQueueBot bot so a lot of code is hidden for you. From the method names you could identify two methods which could be called when the bot stops its work: BotJotDone and StopBot.
BotJotDone overrides functionality of the BeTheFirstInQueueBot implementation and is not the right place to add your code to, this method is called by BeTheFirstInQueueBot after opening bet is placed and fully matched, so it is not a method that is called when bot needs to stop.
The other method is: StopBot, and you read it right, this method is called to stop the bot, so this method is the right place to add your code:
Here is the C# source code of this method:
private void StopBot() { if (RunnerProperty.RepeatTradingCycle) { if (RunnerProperty.StopTradingCycleAtProfit != 0 && RunnerProperty.MinReturnOnInvestment >= RunnerProperty.StopTradingCycleAtProfit) { Stop(); } else { betType = RunnerProperty.BetType; DoSetBetPosition(); if (!stopLossActive) { RunnerProperty.MinReturnOnInvestment += RunnerProperty.IncreaseProfit; } betPlaced = false; tradingState = TradingState.WaitingForTrade; } } else { Stop(); } }Again quite a lot of lines of C# code you do not understand for what is there, and what it does, but in plain English you can identify two lines with Stop. Is it this method called: StopBot, so what the method called Stop could do? The Stop method stops the bot execution, so if you want to stop the market monitoring after the bot stops its execution, you have to place your code there. You can do so putting your code on the new line after Stop(); or you can do it like that:
private void StopBot() { bool stopTheBot = false; if (RunnerProperty.RepeatTradingCycle) { if (RunnerProperty.StopTradingCycleAtProfit != 0 && RunnerProperty.MinReturnOnInvestment >= RunnerProperty.StopTradingCycleAtProfit) { stopTheBot = true; } else { betType = RunnerProperty.BetType; DoSetBetPosition(); if (!stopLossActive) { RunnerProperty.MinReturnOnInvestment += RunnerProperty.IncreaseProfit; } betPlaced = false; tradingState = TradingState.WaitingForTrade; } } else { stopTheBot = true; } if (stopTheBot) { Stop(); betfairService.StopMonitorThisMarket(monitoredMarket); } }Hamid I hope you understand all implications your code would have if you would run this bot on more market selections. What will happen?
Friday, March 26, 2010
Hi Stefan,
Thanks for the explanation even I am not sure I understand all correctly.
"You want to stop a market monitoring after your bot have done its job." It is excatly waht I want the bot does.
I think the implication is that all the markets will not be monitored.
So how should we do? Can you create a bot like PlaceaBetAndStopMonitoring or should I do it myself?
Sunday, March 28, 2010
Hamid, if you would run the bot with such code only, the implication is that stopping market monitoring would stop running all bots on this market as well.
If you would run your custom built trading bot: HamidAutoTraderBot on home and away teams, the first bot stopping the market monitoring will stop other bot as well, even if that bot would not finish its full trading cycle on this market selection.
Everything can be programmed so adding additional 4 lines of code your bot can check if there are no other bots running on the market and stopping the market monitoring only when no bot is running on the market.
I will try to find some spare time tomorrow and will prepare for you the bot for placing a bet only with required feature for stopping the market monitoring.
Tuesday, March 30, 2010
C# source code for betfair bot
Just as I promised I created simple betfair bot script exteding features of PlaceBetBot.
public class PlaceBetAndStopMarketMonitoringBot : PlaceBetBot { public PlaceBetAndStopMarketMonitoringBot(IBetfairService betfairService, MonitoredMarket monitoredMarket, Runner runner) : base(betfairService, monitoredMarket, runner) { } public override void DoYourJob() { switch (tradingState) { case TradingState.BackingInProgress: case TradingState.LayingInProgress: case TradingState.BackingBetDone: case TradingState.LayingBetDone: Stop(); if (!GetIsRunningAnyBot()) { betfairService.StopMonitorThisMarket(monitoredMarket); } break; default: base.DoYourJob(); break; } } private bool GetIsRunningAnyBot() { foreach (Runner runner in monitoredMarket.MarketDetails.Runners) { if (runner.RunnerProperty.BotEnabled) { return true; } } return false; } }Download the C# bot script and extract it to the MyBots folder. Use it with the Bot Executor MyBot settings. The bot class name is:
Bfexplorer.Scripting.PlaceBetAndStopMarketMonitoringBot
Tuesday, March 30, 2010
Perfect. It works good.
Thanks Stefan.