tarb/betfair_data

(JSON Parse Error) unknown field `batb`

Closed this issue · 2 comments

I am trying to open original downloaded 2020 Tennis Advanced data and getting the error message

(JSON Parse Error) unknown fieldbatb, expected one of id, atb, atl, spn, spf, spb, spl, trd, tv, ltp, hc at line 1 column 7

The very same market loads with no error using the original downloaded 2020 Tennis Basic data and getting the error message

I am OK, with not supporting (some) extra fields in the Advanced and Pro data, but those sets also have more updates for the market. So it would be beneficial to be able load those data even ignoring the not known fields instead of quitting the parsing process.

tarb commented

Hi, currently this only supports PRO and self recorded stream files which subscribed using atb and atl.
Supporting batb, batl, bdatb, bdatl would be a pretty worthy goal for self recorded files, and as a bonus I imagine it would make the advanced data work as well.

The one design decision that needs answering is what to do when/if a recorded file has requested multiple different types of ladder. It's a pretty niche case, but does happen, normally when you want the full ladder AND the virtual bets.

For most users we'd only ever have 1 exchange/(price ladder fields) for a Runner object and use whatever fields they subscribed with to construct it.

Theres a few options I can think of, but I think my favourite is
Add atb, batb and bdatb fields (and corresponding lays) to the exchange object

class RunnerBookEX():
    available_to_back: List[PriceSize]
    available_to_lay: List[PriceSize]
    traded_volume: List[PriceSize]

    atb: Optional[List[PriceSize]]
    atl: Optional[List[PriceSize]]
    batb: Optional[List[PriceSize]]
    batl: Optional[List[PriceSize]]
    bdatb: Optional[List[PriceSize]]
    bdatl: Optional[List[PriceSize]]

and then have available_to_back and available_to_lay be references to one of the ladders, probably with a priority atb->bdatb->batb if they're available.

This way the behaviour would stay the same for the common use case for the vast majority of people, but if you wanted multiple ladders then that could also be supported.

Hi, many thx for the very fast answer. All makes sense. Meanwhile I understood the difference between batb is position keyed, and a triplet vs atb is price keyed and duples, so my recommendation "just ignoring batb" is not a working idea.