refactor: Remove duplicate position details section and use upper band as target price
This commit is contained in:
parent
48745fbd34
commit
d1a48dfb25
@ -415,22 +415,6 @@ def run_sunny_scanner(min_price: float, max_price: float, min_volume: int, portf
|
|||||||
print(f"Volume: {signal['volume']:,}")
|
print(f"Volume: {signal['volume']:,}")
|
||||||
print(f"Target (Upper Band): ${signal['upper_band']:.2f}")
|
print(f"Target (Upper Band): ${signal['upper_band']:.2f}")
|
||||||
|
|
||||||
if 'shares' in signal:
|
|
||||||
print("\nPosition Details:")
|
|
||||||
print(f"Shares: {signal['shares']}")
|
|
||||||
print(f"Position Value: ${float(signal['position_value']):.2f}")
|
|
||||||
print(f"Stop Loss: ${float(signal['stop_loss']):.2f}")
|
|
||||||
print(f"Risk Amount: ${abs(float(signal['potential_loss'])):.2f}")
|
|
||||||
|
|
||||||
# Calculate percentages
|
|
||||||
entry_value = signal['price'] * signal['shares']
|
|
||||||
profit_potential = float(signal['potential_profit'])
|
|
||||||
profit_percentage = (profit_potential / entry_value) * 100
|
|
||||||
|
|
||||||
print(f"Target Price: ${float(signal['target_price']):.2f}")
|
|
||||||
print(f"Potential Profit: ${profit_potential:.2f} ({profit_percentage:.1f}%)")
|
|
||||||
print(f"Risk/Reward Ratio: ${float(signal['risk_reward_ratio']):.2f}")
|
|
||||||
|
|
||||||
if 'shares' in signal:
|
if 'shares' in signal:
|
||||||
# Convert numpy float64 to regular float if needed
|
# Convert numpy float64 to regular float if needed
|
||||||
position_value = float(signal['position_value'])
|
position_value = float(signal['position_value'])
|
||||||
@ -438,6 +422,7 @@ def run_sunny_scanner(min_price: float, max_price: float, min_volume: int, portf
|
|||||||
potential_loss = float(signal['potential_loss'])
|
potential_loss = float(signal['potential_loss'])
|
||||||
potential_profit = float(signal['potential_profit'])
|
potential_profit = float(signal['potential_profit'])
|
||||||
risk_reward = float(signal['risk_reward_ratio'])
|
risk_reward = float(signal['risk_reward_ratio'])
|
||||||
|
target_price = float(signal['upper_band']) # Use upper band as target
|
||||||
|
|
||||||
# Calculate percentage gains/losses
|
# Calculate percentage gains/losses
|
||||||
profit_percentage = (potential_profit / position_value) * 100
|
profit_percentage = (potential_profit / position_value) * 100
|
||||||
@ -448,7 +433,7 @@ def run_sunny_scanner(min_price: float, max_price: float, min_volume: int, portf
|
|||||||
print(f"Position Size: ${position_value:,.2f}")
|
print(f"Position Size: ${position_value:,.2f}")
|
||||||
print(f"Entry Price: ${signal['price']:.2f}")
|
print(f"Entry Price: ${signal['price']:.2f}")
|
||||||
print(f"Stop Loss: ${stop_loss:.2f} (-6%)")
|
print(f"Stop Loss: ${stop_loss:.2f} (-6%)")
|
||||||
print(f"Target Price: ${signal['upper_band']:.2f}")
|
print(f"Target Price: ${target_price:.2f}")
|
||||||
print(f"Risk Amount: ${abs(potential_loss):,.2f} ({loss_percentage:.1f}%)")
|
print(f"Risk Amount: ${abs(potential_loss):,.2f} ({loss_percentage:.1f}%)")
|
||||||
print(f"Potential Profit: ${potential_profit:,.2f} ({profit_percentage:.1f}%)")
|
print(f"Potential Profit: ${potential_profit:,.2f} ({profit_percentage:.1f}%)")
|
||||||
print(f"Risk/Reward Ratio: {risk_reward:.2f}")
|
print(f"Risk/Reward Ratio: {risk_reward:.2f}")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user