Betfair Exchange API : Streaming API - Last Traded Amount

Post Reply
User avatar
northbound
Posts: 736
Joined: Mon Mar 20, 2017 11:22 pm

Thu Dec 06, 2018 6:28 pm

I started experimenting with the Betfair streaming API, writing some simple NodeJs software to spot certain things in the market.

How would you calculate the Last Traded Amount (LTA)?

My initial algorithm calculates it for a runner using his total traded volume (tv):

(tv Current Message - tv Prev Message) / 2

I set conflation to 20ms, heartbeat to 500ms, subscribe to far less than 50 markets at a time.

However my formula returns some weirdly big amounts, it feels as though Betfair server doesn’t really send me a message every time there’s a change for the runner.

So, how do you guys calculate LTA?

LinusP
Posts: 1741
Joined: Mon Jul 02, 2012 10:45 pm
Contact:

Thu Dec 06, 2018 8:08 pm

Set conflate to None/0, Betfair will send you data as quick as you can pull it off the socket or they will start conflating it for you regardless. Conflate will be True on the response if this has occurred.

What do you consider to be weird? You have the site to compare by checking out the graphs for a rough idea.

User avatar
ShaunWhite
Posts: 6188
Joined: Sat Sep 03, 2016 3:42 am

Thu Dec 06, 2018 10:01 pm

I'm a bit confused by conflation. I thought I means to combine data from various sources but in the context of the streaming api, does it mean some sort of buffering or combining/summerising of multiple marketMessages into a single 'catch up' message?

Jukebox
Posts: 1289
Joined: Thu Sep 06, 2012 8:07 pm

Thu Dec 06, 2018 10:12 pm

ShaunWhite wrote:
Thu Dec 06, 2018 10:01 pm
I'm a bit confused by conflation. I thought I means to combine data from various sources but in the context of the streaming api, does it mean some sort of buffering or combining/summerising of multiple marketMessages into a single 'catch up' message?
Outside of computing it does mean to put more than one thing together - but the outcome is erroneous or ambiguous

User avatar
northbound
Posts: 736
Joined: Mon Mar 20, 2017 11:22 pm

Thu Dec 06, 2018 10:19 pm

Thanks Linus, I’ll try it.

Basically this bit of software is the very first one I write that reads a stream. It’s a simple algo that keeps track of the current tv of a runner and also the previous one. If the difference is above a certain threshold, it generates a log entry.

Weird stuff:

- Observing my logs and BetAngel in real time: there were preplay horse racing instances of a £3k LTA on BetAngel (streaming 500ms) while on my software it was £10k plus (streaming 20ms).

- Observing Betfair charts on a greyhound race’s very early trades, I could see a lay spike of £500+ on the Betfair chart. My software (streaming 20ms), instructed to create a log entry when a spike of £200+ occurred, never did it.

There’s an 80% the fault is mine somehow.

Going back to my original question: would you say my way of calculating LTA is correct?

User avatar
northbound
Posts: 736
Joined: Mon Mar 20, 2017 11:22 pm

Thu Dec 06, 2018 11:08 pm

ShaunWhite wrote:
Thu Dec 06, 2018 10:01 pm
I'm a bit confused by conflation. I thought I means to combine data from various sources but in the context of the streaming api, does it mean some sort of buffering or combining/summerising of multiple marketMessages into a single 'catch up' message?
My basic understanding is as follows.

Imagine a runner whose traded volume increases by exactly £100 every one second.

If you set conflate to 1000ms, you will get one message per second, with the vol figure being £100 bigger than the previous message’s.

If you set conflate to 3000ms, you will get one message every 3secs, with the vol figure being £300 bigger than the previous message’s.

User avatar
ShaunWhite
Posts: 6188
Joined: Sat Sep 03, 2016 3:42 am

Fri Dec 07, 2018 1:33 am

Thx northbound,
Pretty much what I thought, always worth checking though.

User avatar
ShaunWhite
Posts: 6188
Joined: Sat Sep 03, 2016 3:42 am

Fri Dec 07, 2018 1:52 am

northbound wrote:
Thu Dec 06, 2018 10:19 pm
Thanks Linus, I’ll try it.

Basically this bit of software is the very first one I write that reads a stream. It’s a simple algo that keeps track of the current tv of a runner and also the previous one. If the difference is above a certain threshold, it generates a log entry.

Weird stuff:

- Observing my logs and BetAngel in real time: there were preplay horse racing instances of a £3k LTA on BetAngel (streaming 500ms) while on my software it was £10k plus (streaming 20ms).

- Observing Betfair charts on a greyhound race’s very early trades, I could see a lay spike of £500+ on the Betfair chart. My software (streaming 20ms), instructed to create a log entry when a spike of £200+ occurred, never did it.

There’s an 80% the fault is mine somehow.

Going back to my original question: would you say my way of calculating LTA is correct?
On the 2nd observation, the spike on the bf chart could well have been over a longer time frame, you might even have had 4 x £125's 20ms apart.
Not sure about the first, if you were able to say exactly where/when it was I might be able to look in my saved stream and shed some light. I'm a bit of a beginner though so 'might' is the operative word.

The logic seems sound to me but have you thought about comparing the tv with trd, as a cross check.

User avatar
northbound
Posts: 736
Joined: Mon Mar 20, 2017 11:22 pm

Fri Dec 07, 2018 8:01 am

ShaunWhite wrote:
Fri Dec 07, 2018 1:52 am
have you thought about comparing the tv with trd, as a cross check.
Yep, it’s on my list of things to try.

On greyhound races, I’ll probably also try and log every message received, spot a spike on Betfair chart, stop the logger and look into recent messages to see what did Betfair stream actually send.

poklius
Posts: 102
Joined: Sun May 17, 2009 11:58 am

Fri Dec 07, 2018 8:31 am

betfair charts doesnt log every volume spike, they conflate them in chunks. I wouldnt be very practical to draw graphs with 100s of thousands little spikes. Check if your stream volumes updates match betangles or web volumes, if they do, you are good, ignore betfair graphs

Post Reply

Return to “Betfair Exchange API”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 2 guests