Update app.py
Browse files
app.py
CHANGED
|
@@ -53,8 +53,9 @@ def parse_opciones_table(df):
|
|
| 53 |
|
| 54 |
return df_clean
|
| 55 |
|
| 56 |
-
def plot_opciones(df_put, df_call,
|
| 57 |
|
|
|
|
| 58 |
puts_itm = df_put[df_put['strike'] > spot_price]
|
| 59 |
puts_otm = df_put[df_put['strike'] <= spot_price]
|
| 60 |
calls_itm = df_call[df_call['strike'] < spot_price]
|
|
@@ -204,7 +205,7 @@ with gr.Blocks(title="Análisis de Opciones") as demo:
|
|
| 204 |
outputs=[output_df_put, output_df_call, df_put_state, df_call_state]
|
| 205 |
).then(
|
| 206 |
fn=plot_opciones,
|
| 207 |
-
inputs=[df_put_state, df_call_state,
|
| 208 |
outputs=output_plot
|
| 209 |
)
|
| 210 |
|
|
|
|
| 53 |
|
| 54 |
return df_clean
|
| 55 |
|
| 56 |
+
def plot_opciones(df_put, df_call, ticker_input, expiration_date):
|
| 57 |
|
| 58 |
+
spot_price = yf.Ticker(ticker_input).info['regularMarketPrice']
|
| 59 |
puts_itm = df_put[df_put['strike'] > spot_price]
|
| 60 |
puts_otm = df_put[df_put['strike'] <= spot_price]
|
| 61 |
calls_itm = df_call[df_call['strike'] < spot_price]
|
|
|
|
| 205 |
outputs=[output_df_put, output_df_call, df_put_state, df_call_state]
|
| 206 |
).then(
|
| 207 |
fn=plot_opciones,
|
| 208 |
+
inputs=[df_put_state, df_call_state, ticker_input, expiration_date],
|
| 209 |
outputs=output_plot
|
| 210 |
)
|
| 211 |
|