refactor: Improve target price calculation for more aggressive trading signals

This commit is contained in:
Bobby Abellana (aider) 2025-02-06 23:09:51 -08:00
parent 53ebc1767c
commit fe2b13dff5
No known key found for this signature in database
GPG Key ID: 647714CC45F3647B

View File

@ -355,10 +355,13 @@ def run_sunny_scanner(min_price: float, max_price: float, min_volume: int, portf
try:
entry_price = last_day['close']
upper_band = results['upper_band'].iloc[-1]
print(f"Debug: Entry: ${entry_price:.2f}, Upper Band: ${upper_band:.2f}") # Debug line
# Calculate a more aggressive target price (2x the distance to upper band)
band_distance = upper_band - entry_price
target_price = entry_price + (band_distance * 2)
print(f"Debug: Entry: ${entry_price:.2f}, Upper Band: ${upper_band:.2f}, Target: ${target_price:.2f}") # Debug line
position = calculator.calculate_position_size(
entry_price=entry_price,
target_price=upper_band
target_price=target_price
)
# Format debug position output with rounded values
debug_position = {k: round(float(v), 2) if isinstance(v, (float, np.float64)) else v