User Comments

    17.10.2019 9:13:56

    I got it to work using another of your codes that I found from weight of money :)


    17.10.2019 7:48:57

    Hi Stefan,

    Yes thanks it will get the odds at specified levels now thanks. 

    But with the volume it is different.


    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)



    16.10.2019 3:13:24

    Please see the code here:

    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?

    11.10.2019 11:54:39

     That is a great explanation thanks :). I have noticed 1 thing with my bot and I see it doesn't seem to do what I think it should (I'm blaming my code) so I just wanted to ask that after it performs an executeOnSelection, mySelection1 and I change status <- goToMyNextTrigger and I have another executeOnSelection mySelection2 (when new conditions are true), it can do multiple executions with different selections right?  It may be because my action happens near the end of the race but I only ever see 1 bet.

    11.10.2019 6:32:39

    I didn't explain properly sorry.  What I mean is I can see it create the bot and it has bot.Start to place the trades.  Then the next part I don't understand.  You run Update, which from what I can see only changes the parameters, so how did the bot place trades again and use the new parameters?  I can't see how it executed new trades based on what is in  the Update()

    10.10.2019 11:28:39

    I've been looking at the scalping bot and the way it creates the bots, I like it a lot.  Do you have another example of creating a bot with parameters like the scalping bot, but with a method call to execute on mySelection from within member_execute?  For example 1 method call I would have parameters and betType lay for mySelection and another method call would have different parameters for a different mySelection betType back  etc.  From your examples I am learning a lot, but I couldn't find one like this.

    5.10.2019 7:29:57

    Actually, I think I can work it out thanks, but could you please show me how to get trigger to "get" past strategy results.  Thanks

    5.10.2019 4:51:26

    Is there a way to

    match getMySelection() with
    | Some mySortedSelection -> (where mySortedSelection is a list?) 

    instead of having a lot of

     match getMySelection() with
    | Some mySelection1 ->

     match getMySelection() with
    | Some mySelection2 ->

     match getMySelection() with
    | Some mySelection3 ->........................etc


    4.10.2019 4:07:02

    Please see Your Code for Part 2 (with some additions and comments)  There is 1 thing that I cannot see in the code (line 187 - 192), and that is when a horse has improved in position, then I don't want it in mySelection.  I only want to lay it if it is in the same position or has worsened in position, (and not in top 3 which is coded on line 194).  Is it somewhere that I cannot see?

    2.10.2019 12:38:50

    Thanks Stefan, Yes I would really appreciate if you could design the bot that works on past results, and I will endeavour to thoroughly understand the code and learn f# so that I can do this myself in the future from what you have taught and shown in this tutorial series :)

    2.10.2019 10:59:40

     Oh ok.  I sort of grabbed your code from My Staking Plan . Could you please explain the mechanism of how to run the console script and also have MyBotTrigger "get" the information from it?  And 1 other question- with my C sharp bot or my f sharp bot, would they require the console script as well for past bot results?


    2.10.2019 10:09:05

    Please see my attempt at Part 4. I added lines 75, 76, and 178 to 184.

    I basically wanted to have parameter maxLossesInRow and if the number of losses in row is less or equal to this parameter, then continue to execute bot, or else exit. Unfortunately it has some errors that hopefully can be corrected thanks?

    1.10.2019 11:48:55

    That's great to hear Stefan.  Bfexplorer truly is the best- no other software can do what Bfexplorer can.  For my non programming brain I wonder "how", but with your knowledge you always "know".  I very much look forward to the final solution :)

    1.10.2019 10:24:50

    Thanks Stefan.  I do have more understanding now, but have a long long way to go.  Thanks for your help.  With Part 4 in which the bot "counts" it's losses before shutting down, is this possible?  I question it because I see in the console bot started and bot ended, so I don't understand the mechanism of how it stores the losses if the bot ends.

    1.10.2019 10:01:51

    'F' grade for me this time.  Thanks for the solution to Part 2 :)    What homework would you like me to submit before the final reveal in Part 4? - I hope to redeem myself

    1.10.2019 8:59:15

    I am not a programmer, but this is the part 1 with the Last Price Traded added to output

    I am looking forward to viewing Stefan's code with Part 2 combined into Part 1 :)

    30.9.2019 13:51:49

    Sorry about the formatting.  I copied and pasted the working code and it looked good on my side with the correct indentations etc,, but the website changed it to the posted result that is there now.  I'll look at setting up GitHub and reposting the link to the code so others who are following/learning can view and get it.

    30.9.2019 2:52:29
    The following is the Part 1 code with the last price traded added. In Part 2, we will build triggers into this that react to our selection position change from starting point (x seconds in play) to trigger point (The number 1 and 2 position horses both have back odds less then X (and our selection is not position 1,2 or 3) module BfexplorerBot //(* #I @"C:\Program Files (x86)\BeloSoft\Bfexplorer\" #r "BeloSoft.Data.dll" #r "BeloSoft.Betfair.API.dll" #r "BeloSoft.Bfexplorer.Domain.dll" #r "BeloSoft.Bfexplorer.Trading.dll" #r "BeloSoft.Bfexplorer.Service.Core.dll" //*) open System open BeloSoft.Data open BeloSoft.Bfexplorer.Domain open BeloSoft.Bfexplorer.Trading let toIndexes (value : string) = try value.Split(',') |> Int32.Parse |> List.ofArray with | _ -> List.empty /// /// HorseRacingBotTrigger /// type HorseRacingBotTrigger(market : Market, _selection : Selection, _botName : string, botTriggerParameters : BotTriggerParameters, _myBfexplorer : IMyBfexplorer) = let allowedSelectionIndexes = toIndexes (defaultArg (botTriggerParameters.GetParameter("AllowedSelectionIndexes")) "1,2,3") let isHorseRacingMarket() = market.MarketInfo.BetEventType.Id = 7 && market.MarketDescription.MarketType = "WIN" let getActiveSelections() = market.Selections |> Seq.filter isActiveSelection |> Seq.toList let getMySelectionsData() = maybe { if allowedSelectionIndexes.Length > 0 then let selections = getActiveSelections() let mumberOfSelections = selections.Length let maximalIndex = allowedSelectionIndexes |> List.max if mumberOfSelections >= maximalIndex then return allowedSelectionIndexes |> (fun index -> selections.[index - 1]), mumberOfSelections } interface IBotTrigger with member __.Execute() = if isHorseRacingMarket() then match getMySelectionsData() with | Some (selections, mumberOfSelections) -> let mySelectionNames = selections |> (fun mySelection -> mySelection.Name) |> String.concat ", " let mySelectionBookValue = selections |> (fun mySelection -> mySelection.LastPriceTraded) |> List.sum TriggerResult.EndExecutionWithMessage (sprintf "\nMy selections: %s %f\nNumber of runners: %d" mySelectionNames mySelectionBookValue mumberOfSelections) | None -> TriggerResult.EndExecutionWithMessage "Failed to make my selections!" else TriggerResult.EndExecutionWithMessage "You can run this bot on a horse racing market only!" member __.EndExecution() = ()
    27.9.2019 23:57:23

    That is a great explanation :)

    Thanks for clearing that up for me.  

    27.9.2019 23:57:02

    After for example 20 seconds in play, I would like to check the position of the horse (using it's odds). When (if) 2 horses achieve odds less then x ( 2 for example), then re-check the position of our selection and compare it to the position it was at at 20 seconds. So if at 20 seconds, it is at position 2 and then when trigger is 2 horses are at odds below 2, it re-checks the selection and sees that it is at position 5, the selection has dropped in position.