From f50931cfab0247f7bbc67a4d69e33d03cfdfbed6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20L=C3=B6ffler?= Date: Tue, 7 May 2024 13:50:20 +0300 Subject: [PATCH] Fix orders cache --- betfair_parser/cache.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/betfair_parser/cache.py b/betfair_parser/cache.py index 218eea2..527dbc2 100644 --- a/betfair_parser/cache.py +++ b/betfair_parser/cache.py @@ -251,7 +251,7 @@ def update(self, orc: OrderRunnerChange) -> None: if orc.mb: ladder_update_mo(self.matched_backs, orc.mb) if orc.ml: - ladder_update_mo(self.matched_backs, orc.ml) + ladder_update_mo(self.matched_lays, orc.ml) class MarketOrders(_DefaultDict): @@ -284,6 +284,9 @@ def update(self, ocm: OCM) -> None: if oc.closed: # TODO: Call some hooks? self.orders.pop(oc.id, None) + if not oc.orc: + # on closed markets + continue for orc in oc.orc: if orc.full_image: self.orders[oc.id].pop(orc.id, None)