Fix all audit issues: survival check performance, display consistency, atomic config write, credential validation, TP null handling, highest_open preservation, stale docstring
This commit is contained in:
@@ -106,10 +106,16 @@ class BotState:
|
||||
) / 2.0
|
||||
|
||||
# Highest open position entry price
|
||||
# When no positions are open, keep the last known value rather than
|
||||
# falling back to current price — this prevents the grid floor from
|
||||
# collapsing to current_price * 0.40 after all positions close.
|
||||
open_prices = [pos_level(p) for p in positions]
|
||||
self.highest_open_price = (
|
||||
max(open_prices) if open_prices else self.current_price
|
||||
)
|
||||
if open_prices:
|
||||
self.highest_open_price = max(open_prices)
|
||||
elif self.highest_open_price == 0.0:
|
||||
# First run with no positions — use current price as seed
|
||||
self.highest_open_price = self.current_price
|
||||
# else: keep existing highest_open_price from previous loop
|
||||
|
||||
# Lowest level across all positions and orders
|
||||
order_prices = [ord_level(o) for o in orders]
|
||||
|
||||
Reference in New Issue
Block a user