Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -109,7 +109,7 @@ def plot_stock_price_with_earnings(stock_data, earnings_dates, ticker):
|
|
| 109 |
added_negative_legend = True
|
| 110 |
|
| 111 |
fig.add_trace(go.Scatter(x=[date], y=[stock_data.loc[date, 'Close']], mode='markers',
|
| 112 |
-
marker=dict(symbol='triangle-up' if marker == '^' else 'triangle-down', size=
|
| 113 |
name=name, showlegend=name is not None))
|
| 114 |
|
| 115 |
fig.update_layout(title=f'{ticker} Stock Price with Earnings Surprise',
|
|
@@ -310,7 +310,7 @@ def monte_carlo_simulation(ticker, annual_iv, days_to_earnings, upper_target, lo
|
|
| 310 |
fig.add_trace(go.Scatter(x=[0, days_to_earnings-1], y=[lower_target, lower_target], mode='lines', line=dict(color='green', dash='dash'), name=f'Lower Target: {round(lower_target, 2)}'))
|
| 311 |
fig.add_trace(go.Scatter(x=[0, 0], y=[price_paths.min(), price_paths.max()], mode='lines', line=dict(color='red', dash='dash'), showlegend=False))
|
| 312 |
|
| 313 |
-
fig.add_annotation(x=0.05, y=0.95, xref='paper', yref='paper', text=f'P(>{round(upper_target, 2)}): {prob_above:.2%}<br>P(<{round(lower_target, 2)}): {prob_below:.2%}<br>P({round(lower_target, 2)}-{round(upper_target, 2)}): {prob_between:.2%}', showarrow=False, font=dict(size=12), bordercolor='black', borderwidth=1, bgcolor='white')
|
| 314 |
fig.update_layout(title=f"Monte Carlo Simulation of {ticker}'s Stock Price Over {days_to_earnings} Days", xaxis_title='Days', yaxis_title='Stock Price', template='plotly_white', height=600, width=1200, showlegend=True)
|
| 315 |
return fig
|
| 316 |
|
|
|
|
| 109 |
added_negative_legend = True
|
| 110 |
|
| 111 |
fig.add_trace(go.Scatter(x=[date], y=[stock_data.loc[date, 'Close']], mode='markers',
|
| 112 |
+
marker=dict(symbol='triangle-up' if marker == '^' else 'triangle-down', size=1 if name is not None else marker_size, color=color),
|
| 113 |
name=name, showlegend=name is not None))
|
| 114 |
|
| 115 |
fig.update_layout(title=f'{ticker} Stock Price with Earnings Surprise',
|
|
|
|
| 310 |
fig.add_trace(go.Scatter(x=[0, days_to_earnings-1], y=[lower_target, lower_target], mode='lines', line=dict(color='green', dash='dash'), name=f'Lower Target: {round(lower_target, 2)}'))
|
| 311 |
fig.add_trace(go.Scatter(x=[0, 0], y=[price_paths.min(), price_paths.max()], mode='lines', line=dict(color='red', dash='dash'), showlegend=False))
|
| 312 |
|
| 313 |
+
fig.add_annotation(x=0.05, y=0.95, xref='paper', yref='paper', text=f'P(>{round(upper_target, 2)}): {prob_above:.2%}<br>P(<{round(lower_target, 2)}): {prob_below:.2%}<br>P({round(lower_target, 2)}-{round(upper_target, 2)}): {prob_between:.2%}', showarrow=False, font=dict(size=12), bordercolor='black', borderwidth=1)#, bgcolor='white')
|
| 314 |
fig.update_layout(title=f"Monte Carlo Simulation of {ticker}'s Stock Price Over {days_to_earnings} Days", xaxis_title='Days', yaxis_title='Stock Price', template='plotly_white', height=600, width=1200, showlegend=True)
|
| 315 |
return fig
|
| 316 |
|