feat: Add signal dates to sunnyband scanner output
This commit is contained in:
parent
516533800f
commit
5afd77b9a0
@ -265,7 +265,9 @@ def run_sunny_scanner(min_price: float, max_price: float, min_volume: int, portf
|
|||||||
bullish_signals.append(signal_data)
|
bullish_signals.append(signal_data)
|
||||||
# Update print output format
|
# Update print output format
|
||||||
dollar_risk = position['potential_loss'] * -1
|
dollar_risk = position['potential_loss'] * -1
|
||||||
print(f"\n🟢 {ticker} @ ${current_price:.2f}")
|
signal_date = df.iloc[-1]['date'] # Get the date of the signal
|
||||||
|
signal_data['signal_date'] = signal_date # Add to signal data
|
||||||
|
print(f"\n🟢 {ticker} @ ${current_price:.2f} on {signal_date.strftime('%Y-%m-%d %H:%M')}")
|
||||||
print(f" Size: {position['shares']} shares (${position['position_value']:.2f})")
|
print(f" Size: {position['shares']} shares (${position['position_value']:.2f})")
|
||||||
print(f" Stop: ${signal_data['stop_loss']:.2f} (-7%) | Target: ${target_price:.2f}")
|
print(f" Stop: ${signal_data['stop_loss']:.2f} (-7%) | Target: ${target_price:.2f}")
|
||||||
print(f" Risk/Reward: 1:{position['risk_reward_ratio']:.1f} | Risk: ${dollar_risk:.2f}")
|
print(f" Risk/Reward: 1:{position['risk_reward_ratio']:.1f} | Risk: ${dollar_risk:.2f}")
|
||||||
@ -274,13 +276,15 @@ def run_sunny_scanner(min_price: float, max_price: float, min_volume: int, portf
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
elif results['bearish_signal'].iloc[-1]:
|
elif results['bearish_signal'].iloc[-1]:
|
||||||
|
signal_date = df.iloc[-1]['date']
|
||||||
bearish_signals.append({
|
bearish_signals.append({
|
||||||
'ticker': ticker,
|
'ticker': ticker,
|
||||||
'price': current_price,
|
'price': current_price,
|
||||||
'volume': current_volume,
|
'volume': current_volume,
|
||||||
|
'signal_date': signal_date,
|
||||||
'last_update': datetime.fromtimestamp(last_update/1000000000)
|
'last_update': datetime.fromtimestamp(last_update/1000000000)
|
||||||
})
|
})
|
||||||
print(f"\n🔴 {ticker} at ${current_price:.2f}")
|
print(f"\n🔴 {ticker} @ ${current_price:.2f} on {signal_date.strftime('%Y-%m-%d %H:%M')}")
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Error processing {ticker}: {str(e)}")
|
print(f"Error processing {ticker}: {str(e)}")
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user