fix: simulation conditions now check properly from first iteration
The first price check was always skipped because last_price was None. Now first iteration primes last_price, subsequent iterations check conditions.
This commit is contained in:
@@ -69,10 +69,12 @@ class SimulateEngine:
|
||||
current_volume = float(price_data.get("volume", 0))
|
||||
|
||||
if current_price > 0:
|
||||
# Only check conditions if we have a previous price to compare
|
||||
if self.last_price is not None:
|
||||
await self._check_conditions(
|
||||
current_price, current_volume, price_data
|
||||
)
|
||||
|
||||
# Update last price AFTER checking (so next iteration has comparison data)
|
||||
self.last_price = current_price
|
||||
self.last_volume = current_volume
|
||||
|
||||
|
||||
Reference in New Issue
Block a user