diff --git a/src/exchange_data_manager/cache/manager.py b/src/exchange_data_manager/cache/manager.py index f2e399a..73c165c 100644 --- a/src/exchange_data_manager/cache/manager.py +++ b/src/exchange_data_manager/cache/manager.py @@ -189,6 +189,20 @@ class CacheManager: source = "exchange" if exchange_candles else "memory" return result, source + # Step 2b: Handle SINCE mode (start provided, no end) + # Gaps with end=None need to be fetched from exchange directly + import time as time_module + now = int(time_module.time()) + normalized_gaps = [] + for gap_start, gap_end in gaps_to_fill: + if gap_start is not None and gap_end is None: + # SINCE mode: fetch from start to now + normalized_gaps.append((gap_start, now)) + elif gap_start is not None and gap_end is not None: + normalized_gaps.append((gap_start, gap_end)) + # Skip gaps where start is None (shouldn't happen with proper request) + gaps_to_fill = normalized_gaps if normalized_gaps else gaps_to_fill + db_hit = False exchange_hit = False