-
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 ...
9.5.2020 16:19:41
-
Free Trial Review
I tried BFexplorer, having used 3-4 different software applications beforehand.
The 2 days utilising the software, I managed to get a feel for the product and like the modern display on the black background.
Bets placed were very responsive with no lagging experienced from other products.
A few ...
25.3.2015 17:55:00
-
Bfexplorer Latest Release
Version 3.23.1126
Cumulative updates to the Bfexplorer Preview version (.net 9.0)
Version 3.22.0821
Cumulative updates to the Bfexplorer Preview version
Version 3.10.0721
Cumulative updates to the Bfexplorer Preview version (.net 8.0)
Version 3.9.0425
Cumulative ...
26.11.2024 10:54:45
peteresgate@outlook.com
Maybe GetPriceSize is not the code I'm looking for? When a bet is matched or partially matched, it has the Stake that is matched and the odds it is matched at. So the code I am looking for that you have questioned is to find the stake amount that is matched. Thanks
Betfair Bot
Peter may I ask you to explain me by your own words, how do you understand this line of code?
let Stake = _selection.GetPriceSize(BetType.Lay)
As you may know, and now I speak not about programming languages, but about languages, my mother’s language is Slovak, and in many Slavic languages there is no such strict rule for word order like in English sentence.
That is the funny part in your question, because well my understanding of any language construct is a little bit different from the way only English people could read the code, the sentence.
Well, yes I understand what you want to try to do in your code, but the “words” you chose to do so are quite unclear for me.
peteresgate@outlook.com
Thanks for the info Stefan. I am trying to use the info for a selection like this:
let UnmatchedLayBets () =
if _selection.Bets |> Seq.exists (fun bet -> bet.OrderStatus <> BetOrderStatus.Matched && bet.BetType = BetType.Lay)
then
let price = _selection.GetPrice(BetType.Lay)
let Stake = _selection.GetPriceSize(BetType.Lay)
if price > 10.0
then
outputMessage (sprintf "Unmatched Price > 10: %.2f " price )
But the error exists because the result is a float option. I have tried to find how to cast the float option to float so that I can use the result in calculations but have not found how to do it yet. How would I return the stake and price as a float so that I can use it? I'm sure this is an easy question for you but I have been pulling my hair out over this.
Betfair Bot
this. is used to access object properties or methods.
You type your code as you would access static method or type. You must type object, so in this case maybe: market.MarketInfo.StartTime
Betfair Bot
You can access market’s bets or selection’s bets directly (line 76 and 31), and for matched bets you can access BetPosition property, the line 79 and 34.
BetPosition type/class allows you to calculate hedge stake and so on, have a look at on the type methods.
To cancel bets you can use TriggerResult.CancelBets, the line 150.
I already mentioned that the better way is to orchestrate existing bots to execute parts of your strategy, for instance you set trading bot and all bet placing/updating or cancelling your bets is then managed by this trading bot.
In my bot trigger I showed what you asked and created such simple bots’ orchestration:
BetStatusBetCancellingBotOrchestrationBotTrigger.fsx
Please watch my video. To show how to cancel bets, I set my action bot: “Back 1 tick better”, so bot offers 2 Euro back bet 1 tick over best offered price. When odds changes and are in allowed odds range Minimum/MaximumOdds, the bot updates its unmatched bet to always offer its back bet 1 tick over the best offered, set by the parameter: PriceImprovemnt.
Now, in my bot trigger I cancelled unmatched bet on my selection, the line 150. But what happened?
As the bet was placed by my action bot, and the bot is managing its bets itself, the bet was again placed.
What does it mean?
If you place your bets by action bots, you do not need to manage bets placed by the action bot, but of course if you do not want your unmatched bets be offered on the market anymore, you need to stop the action bot, and as the action bot managing its bets, the unmatched bets will cancel its bets when you end its execution, the line 160.
It is really better way to orchestrate action bots in your bot trigger than managing bet status in your bot trigger.
Well yes, if you want to place your bets directly then you can do so, you have got:
TriggerResult.PlaceBets
TriggerResult.CancelBets
Let’s say you have got strange trading strategy, where you setup the trading bot:
"Place Bet and Close Selection Bet Position"
To offer bet 3 ticks from best offered price, and close its bet position with profit of 3 ticks, or 5 ticks to lose.
You would setup two versions of this trading bot one offering back and the other one lay bet. In your bot trigger you would execute such pair of trading bots on 3 favourites when some conditions occurred.
Now imagine what you would have to program to manage such complex trading strategy in your bot trigger by directly placing your bets.
Betfair Bot
Here is my bot trigger code:
ShowPriceTradedVolume.fsx
Please watch video, showing how to use IntelliSense to browse available code.
peteresgate@outlook.com
Edit,
When I say at +/- 2 levels, I mean the matched volume at a price (which I will use the price at +/- 2 levels because I know those prices
peteresgate@outlook.com
This is the code I am using to try and find Matched Volume at levels:
https://github.com/PeterEsgate/BfexplorerTestBots/blob/master/MarketDepthMatched
and I use it by:
let test = getMarketDepthMatched(BetType.Lay) (MYSELECTION) 1
outputMessage (sprintf "matched data %.2f" test)
But this causes Bfexplorer to "hang" and I have to cancel the bot
For my bot, the last 2 things I need is to find the matched volumes at +/- 2 levels and the Time from scheduled start, but I am having difficulty with these 2 things.
Betfair Bot
Full market data are available in the active market, so in the only market open in Bet Event View or in Bet Event Trader View.
Why is it so?
Bfexplorer can monitor hundreds of markets so this way it is reasonably lower amount of data loaded from betfair servers.
Yes you can get matched volume only through PriceGridData, of course you must iterate through prices with traded volume, not all of 399 prices are traded.
If you run your bot in Bot Executor, then you can simply use the bot: “Execute at Time” and set the parameter: UseSetMarketInactive to True. So when executed in bot executes your action bot and set MonitoringStatus to Inactive, Bot Executor then removes such market from monitoring and opens it in Bet Event view, so your bot have them full market data available.
Of course there are other betfair api methods you can use to get traded data betfair uses in charts. You can see that in my post:
Lay the Field Strategy – Analyzing Data
Betfair Bot
Here is my bot trigger showing on ladders near BSP and after the race is turned at in-play the actual BSP:
HorseRacingShowStartPrices.fsx
peteresgate@outlook.com
I have tried both the MyF#bot and MyC#Bot for showSelectionSP, and I tried the HorseRacingSPBotTrigger and moved showHorseData to show before inPlay the Near and Far SP, but I have never achieved to show the Near/Far Projected SP or the actual SP when inPlay (the horse metadata works). I was wondering if there has been a change in the method to receive the SP prices?
Betfair Bot
Actually, there are such bot triggers:
HorseRacingSpFavouriteBotTrigger.fsx
HorseRacingSpBotTrigger.fsx
As an example you could create a bot trigger showing for active selections near BSP and actual BSP after race is turned at in-play. You can show prices on ladder, like in this example:
Horse Racing - Oddschecker Favourite Trigger
Betfair Bot
Yes, placing betfair sp bet returns matched bet with matched amount zero, as SP bet is fully matched only after race is turned at in-play and all betfair start price bets are processed. This be cannot be cancelled I believe, well have never try that.
You can place normal bet with Take SP, such bet can be cancelled and unmatched part of bet is turned to SP at the moment race is turned at in-play.
Have a look at UpdateSpPricesMarketBot.fs if you want to update sp prices, but that is bot assembly, not bot trigger code. You have got access to betfair api in bot trigger code, so you need to study betfair documentation and then you can replicated code working with sp prices in bot trigger as well.
Betfair Bot
That is great Peter.
I would really suggest you to set breakpoint in your code and then debug it and browse available data offered by bfexplorer.
You must know what data you have got, visualize them in your head, and then you know what you can do with data.
Your approach for now is browsing existing code, so when you did not find similar one you cannot make progress, but data you have got, so working with data is the way to go.
peteresgate@outlook.com
I got it to work using another of your codes that I found from weight of money :)
peteresgate@outlook.com
Hi Stefan,
Yes thanks it will get the odds at specified levels now thanks.
But with the volume it is different.
https://github.com/PeterEsgate/BfexplorerTestBots/blob/master/Market%20Depth%20Volume
On Line 35 and 27, why I can't I just substitute the "priceData.Price" with "priceData.ToBack" ?
With the PriceGridData.GetOfferedPriceData(), there is no method (that I could find) to go to different levels like with priceGridData.GetPriceData(index)
Betfair Bot
On the line 3 of your code, there are set three values: startIndex, nextIndex, findFun
The findFun is function used to evaluate the place with empty offer. So when you want to place back bet, it must be checked lay offer and wise versa.
You change that code, therefore your findFun function returns true on offer with available offer. Actually in your code I cannot see logical problem because you start iterating through data on the best offer, so price must be set.
If you code does not go to the line 23, as you say price returned is always 0.0
Peter, how/where you execute your bot trigger?
The full market depth is updated only for active market, so for the market that is currently open in Bet Event/Trader.
It means that if you run your bot by Bot Executor tool you will get updates only for 3 best offered prices.
I would suggest you to debug code, only this way you can find your problem in the code.
Hint: There is function selection.PriceGridData.GetOfferedPriceData()
You can use to get all offered prices. I do not know what you want to make in your code, so this function: GetOfferedPriceData returns all offered prices, and you can filter whatever criteria you use.
Here is bot trigger code:
ShowOfferedPrices.fsx
Peter, please use VS debugger when testing your code.
peteresgate@outlook.com
Please see the code here:
https://github.com/PeterEsgate/BfexplorerTestBots/blob/master/Market%20Depth%20Levels
I run it like this:
let mutable odds = defaultArg (botTriggerParameters.GetParameter<float>("Odds")) 1.0
odds <- getMarketDepthPrice(BetType.Back) (myLaySelection) 1
outputMessage (sprintf "Lay Odds at Level 0 %.2f" odds)
odds <- getMarketDepthPrice(BetType.Back) (myLaySelection) 2
outputMessage (sprintf "Lay Odds at Level 1 %.2f" odds)
but the result of odds is always 0.0
I am trying to find the available odds at different market depth levels
Could you please tell me what is wrong with the code?
Betfair Bot
I have just updated Bfexplorer BOT SDK source code adding MyFootballStrategy projects showing how to use Bfexplorer Plugin integration.
The MyFootballStrategy.App is working example. If you trade football matches on betfair you can use it to monitor all matches live score and match statistics.
https://github.com/StefanBelo/Bfexplorer-BOT-SDK/tree/master/MyFootballStrategy
If anyone wants to collaborate on this project adding new features, and is able to program, then of course you can clone entire Bfexplorer BOT SDK solution.
Those of you who just want to use this app, and are not able to build plugin from the source code, just contact me through support page and I will send you app/plugin files.
Betfair Bot
One of TriggerResult discriminated unions entry is:
TriggerResult.OpenAssociatedMarkets of string[] * (DataResult<Market list> -> unit)
Allowing requesting associated markets to the market you are running your bot on.
Every market is open as bet event on betfair, and you have got access to this information:
market.MarketInfo.BetEvent
So bfexplorer when you request TriggerResult.OpenAssociatedMarkets knows for which bet event id the associated markets should be queried.
Please have a look at on this bot trigger script:
HorseRacingWinToBePlacedData.fsx
Basically your bot has access to all betfair api methods:
myBfexplorer.BfexplorerService.BetfairServiceProvider
So you could be able to write any code against betfair api. The question is, is this approach practical?
Your bot is executed on exact type of market, for instance on horse racing win market, so what markets would you like to open in Bet Event view? Tennis match odds market, or football match odds market?
In any such scenario common sense dictates that you want to open associated market for bet event on which your bot is running, for instance place horse racing market, when your bot runs on win horse racing market and so on.
If you want to build your bespoke app on bfexplorer app, you can do so like I present in this article:
Bfexplorer Plugin Support