COM SP Question

Please post any questions regarding the program here.

Moderator: 2020vision

COM SP Question

Postby nanook » Sat May 14, 2011 3:07 am

Hi Gary,

I want to access the SP back and lay amounts for each price before the SP reconciliation - i.e. 1.01 has the SP backers amount, 1000 the SP layers amount and limit SP bets, if any, are in between.

Does GetMarketDepthComplete contain that information in the price object?
I don't see a reference to this in the user guide.

Excuse my ignorance if I'm missing something obvious.

Thanks,
Nanook
nanook
 
Posts: 45
Joined: Sat Jan 14, 2006 5:48 am

Postby GaryRussell » Sat May 14, 2011 6:06 am

Sorry, that information is not available from the API. The COM interface returns the following two values and here is Betfair's description. They are named totalBSPBackAmountAvailable and totalBSPLayAmountAvailable in the COM interface.

Total BSP Lay Liability
The total liability of BSP lay bets. Pre-reconcilation, this field is zero for all prices except 1000 (for Market on Close bets) and at the limit price for any Limit on Close bets. Post-reconcilation, this field is zero for all prices

Total BSP Backers’ Stake Volume
The total backers’ stake of BSP back bets. Pre-reconcilation, this field is zero for all prices except 1.01 (for Market on Close bets) and at the limit price for any Limit on Close bets. Post-reconcilation, this field is zero for all prices.
User avatar
GaryRussell
Site Admin
 
Posts: 9872
Joined: Fri Nov 18, 2005 8:09 pm
Location: Birmingham, UK

Postby nanook » Sat May 14, 2011 7:24 am

I found a visual basic program on the internet that does (I think) return this information and is available from the free API. See the module below. When I run this I get non-zero values for .totalBspBackAmount and .totalBspLayAmount (at least for prices 1.01 and 1000) before the market goes in play and the SP is calculated. The values returned are the values in the Betfair price page for each horse under the Betfair Starting Price Backers' stake and Layers' liability columns. Depending on liquidity, there is usually a non-zero value for price = 1.01 (SP Backers' stake) and price = 1000 (Layers' liability). There are sometimes values for prices in between which I assume are SP limit bets.

This actually appears to work fine. The problem I'm having is getting the data into the excel sheet that contains my VBA code and that's why I started looking at the BA COM feature hoping there was something equivalent and I could get the data directly from BA. But as I'm probably the only nutcase on the planet thinking about this, don't worry about it - I'll look for a workaround. Thanks anyway.


Module Unpack2
Class RunnerInfoType
Public selectionID As Integer
Public sortOrder As Integer
Public totalAmountMatched As Double
Public lastPriceMatched As Double
Public handicap As Double
Public reductionFactor As Double
Public vacant As Boolean
Public asianLineID As Integer
Public farBSP As Double
Public nearBSP As Double
Public actualBSP As Double
Public prices As PricesType()
End Class

Class PricesType
Public price As Double
Public backAmount As Double
Public layAmount As Double
Public totalBspBackAmount As Double
Public totalBspLayAmount As Double
End Class

Class UnpackCompleteMarketPricesCompressed
Public marketID As Integer
Public delay As Integer
Public removedRunners As String
Public runnerInfo As RunnerInfoType() = {}
Private Const ColonCode = "&%^@" 'the substitute code for "\:"

Sub New(ByVal MarketPrices As String) 'Unpack the data string
Dim Mprices, Field, Part As String(), k, n, m As Integer

Mprices = MarketPrices.Replace("\:", ColonCode).Split(":") 'Split the runner data fields
Field = Mprices(0).Replace("\~", "-").Split("~") 'Split the market data fields
marketID = Field(0) 'assign the market data
delay = Field(1)
removedRunners = Field(2).Replace(ColonCode, ":")

n = UBound(Mprices) - 1
ReDim runnerInfo(n)
For i = 0 To n 'for each runner
Part = Mprices(i + 1).Split("|") 'split runner string into 2 parts
Field = Part(0).Split("~") 'split runner into fields
runnerInfo(i) = New RunnerInfoType
With runnerInfo(i) 'assign the runner parameters
.selectionID = Field(0)
.sortOrder = Field(1)
.totalAmountMatched = Val(Field(2))
.lastPriceMatched = Val(Field(3))
.handicap = Val(Field(4))
.reductionFactor = Val(Field(5))
.vacant = (Field(6).ToLower = "true")
.asianLineID = Field(7)
.farBSP = Val(Field(8))
.nearBSP = Val(Field(9))
.actualBSP = Val(Field(10))

Field = Part(1).Split("~") 'split price info
m = UBound(Field) \ 5 - 1 'm = number of prices - 1
ReDim .prices(m) : k = 0
For j = 0 To m
.prices(j) = New PricesType
With .prices(j) 'load the price array
.price = Val(Field(k + 0))
.backAmount = Val(Field(k + 1))
.layAmount = Val(Field(k + 2))
.totalBspBackAmount = Val(Field(k + 3))
.totalBspLayAmount = Val(Field(k + 4))
k += 5
End With
Next
End With
Next
End Sub
End Class

End Module
nanook
 
Posts: 45
Joined: Sat Jan 14, 2006 5:48 am


Return to Help

Who is online

Users browsing this forum: Google [Bot] and 57 guests

Sports betting software from Gruss Software


The strength of Gruss Software is that it’s been designed by one of you, a frustrated sports punter, and then developed by listening to dozens of like-minded enthusiasts.

Gruss is owned and run by brothers Gary and Mark Russell. Gary discovered Betfair in 2004 and soon realised that using bespoke software to place bets was much more efficient than merely placing them through the website.

Gary built his own software and then enhanced its features after trialling it through other Betfair users and reacting to their improvement ideas, something that still happens today.

He started making a small monthly charge so he could work on it full-time and then recruited Mark to help develop the products and Gruss Software was born.

We think it’s the best of its kind and so do a lot of our customers. But you can never stand still in this game and we’ll continue to improve the software if any more great ideas emerge.