diff --git a/tradingstrategy/utils/groupeduniverse.py b/tradingstrategy/utils/groupeduniverse.py index 585329df..9a0804a9 100644 --- a/tradingstrategy/utils/groupeduniverse.py +++ b/tradingstrategy/utils/groupeduniverse.py @@ -189,14 +189,10 @@ def __init__( remove_candles_with_zero_volume=remove_candles_with_zero_volume, forward_fill=forward_fill, ) - if len(groups) > 1: - assert isinstance(self.pairs, DataFrameGroupBy) - # self.pairs = self.df.groupby(by=self.primary_key_column) - self.df = self.pairs.obj - self.pairs = fix_result - else: - self.df = fix_result - self.pairs = fix_result.groupby("pair_id") + + assert isinstance(fix_result, DataFrameGroupBy) + self.df = fix_result.obj + self.pairs = fix_result #: Grouped DataFrame cache for faster lookup self.candles_cache: dict[PrimaryKey, pd.DataFrame] = {} diff --git a/tradingstrategy/utils/wrangle.py b/tradingstrategy/utils/wrangle.py index 7f253477..e51c8a93 100644 --- a/tradingstrategy/utils/wrangle.py +++ b/tradingstrategy/utils/wrangle.py @@ -450,7 +450,7 @@ def fix_dex_price_data( df = _forward_fill(ff_df, freq, forward_fill_until=forward_fill_until, columns=("open", "high", "low", "close")) return df else: - return raw_df + return ff_df def examine_price_between_time_anomalies(