From 2fbc083c690b2a78768b01ed488021c4ef378d51 Mon Sep 17 00:00:00 2001 From: Mikko Ohtamaa Date: Tue, 14 Jan 2025 14:17:49 +0100 Subject: [PATCH] Fix liquidity_time_bucket attribute on Universe (#194) - Needs to be an alias --- tradingstrategy/universe.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tradingstrategy/universe.py b/tradingstrategy/universe.py index b146aa27..d19b1707 100644 --- a/tradingstrategy/universe.py +++ b/tradingstrategy/universe.py @@ -65,9 +65,6 @@ class to pass around information of its available data. #: Historical candles for the decision making candles: Optional[GroupedCandleUniverse] = None - #: Liquidity data granularity - liquidity_time_bucket: Optional[TimeBucket] = None - #: Historical liquidity samples. #: #: Might not be loaded if the strategy does not need to access @@ -137,6 +134,14 @@ def __post_init__(self): for c in self.chains: assert isinstance(c, ChainId), f"Expected ChainId object, got {c.__class__}: {c}" + @property + def liquidity_time_bucket(self) -> TimeBucket: + """Alias for liquidity.time_bucket. + + Legacy code compat. + """ + return self.liquidity.time_bucket + @property def lending_reserves(self) -> LendingReserveUniverse | None: """Each lending metric is paired with a copy of the universe