Forum Article

Market Depth Price/Volume Levels

With Market Depth, using Stefan's code to Place Bet At Empty Price, I have added a count variable to it so that you can check price at different Market Depth levels:

https://github.com/PeterEsgate/BfexplorerTestBots/blob/master/Market%20Depth%20Levels

And with the volume:

https://github.com/PeterEsgate/BfexplorerTestBots/blob/master/Market%20Depth%20Volume

 

My question is: Why is volume a float?

 

  • Add Your Comment

    +

    Please login to your bfexplorer account, if you want to add a comment to this article.

Comments ( 6 )


  • Betfair Bot
    9.10.2019 9:52:19

    Programming languages use different syntax, and of course set of types. In F# float is C# double, and as F# is .net language you have got access to anything from .net framework.

    https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/literals

  • peteresgate@outlook.com
    16.10.2019 3:13:24

    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
    16.10.2019 20:38:18

    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
    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.  

    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)

     

     

  • peteresgate@outlook.com
    17.10.2019 9:13:56

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

     

  • Betfair Bot
    17.10.2019 9:41:41

    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.