mberk / betfairutil

Utility functions for working with Betfair data
MIT License
30 stars 9 forks source link

remove_bet_from_runner_book fails in simulation #47

Open georgedanker opened 1 month ago

georgedanker commented 1 month ago

The function "remove_bet_from_runner_book" is written with an "if" clause which diverts the code into two possible routes depending on whether the input runner_book is a dictionary or a RunnerBook object.

When it is a RunnerBook object, the code proceeds to assume that the price-size objects inside the runner-book will all be PriceSize objects. However, this is not always the case. I have just used this function in my simulation and it threw an AttributeError because the price-size objects inside my RunnerBook object were all dictionaries, not PriceSize objects.

mberk commented 1 month ago

@liampauling says this is due to "a flumine specific optimisation" whereby the priceSize elements nested within the RunnerBook objects are dictionaries and not full blown PriceSize objects. I will make the required changes