betcode-org / betfair

betfairlightweight - Betfair API-NG python wrapper (with streaming)
MIT License
418 stars 146 forks source link

Streaming market book total_matched is different from polled total_matched #513

Closed wattsjs closed 1 year ago

wattsjs commented 1 year ago

When receiving a MarketBook over the streaming API (using the example in this repo), the total_matched attribute seems to be off. The sum of all the matched volumes are incorrect and don't match between the two methods. I've confirmed that my API key is not delayed and I am also processing the data fast enough as I have confirmed this when subscribing to only a single market. The total volume results in the manual_book match what is presented on the Betfair website.

image

Is this expected behavior or is there something else I may be doing wrong here?

wattsjs commented 1 year ago

Issue was that the volumes returned from the streaming API are in GBP (£) - so need to be converted to local currency.

You can use the trading.account.list_currency_rates() method to get the current rates 👍