Quant0 commited on
Commit
d83cc2c
·
verified ·
1 Parent(s): 21664cd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -6
app.py CHANGED
@@ -99,7 +99,7 @@ def plot_opciones(df_put, df_call, ticker_input, expiration_date):
99
  ))
100
 
101
 
102
- fig1.update_layout(title=f"Didtribución del Volumen {ticker_input}, fecha: {expiration_date}",
103
  xaxis_title='Strike',
104
  yaxis_title='Volumen',
105
  barmode='stack',
@@ -130,7 +130,7 @@ def plot_opciones(df_put, df_call, ticker_input, expiration_date):
130
  fig2.add_vline(x=spot_price, line_width=2, line_dash="dot", line_color="black")
131
 
132
  fig2.update_layout(
133
- title=f"Volatilidad Implícita por Strike {ticker_input} fecha: {expiration_date}",
134
  xaxis_title='Strike',
135
  yaxis_title='Volatilidad Implícita',
136
  template='plotly_white'
@@ -226,7 +226,7 @@ with gr.Blocks(title="Análisis de Opciones") as demo:
226
  ticker_input = gr.Textbox(label="Ticker (ej. GOOGL)", value="MSTR")
227
  expiration_date = gr.Textbox(label="Fecha de vencimiento (formato: aaaa-mm-dd)", value = "" )
228
  size_of_the_window = gr.Slider(minimum=1, maximum=30, value=16, step=1, label="Tamaño de la ventana")
229
- btn_mostrar = gr.Button('Cargar Datos')
230
 
231
 
232
 
@@ -267,13 +267,14 @@ with gr.Blocks(title="Análisis de Opciones") as demo:
267
  '''
268
  with gr.Tab("Plots"):
269
 
270
- btn_plot = gr.Button("Mostrar Plot")
271
 
272
  with gr.Row():
273
  output_plot1 = gr.Plot(label="Distribución de Volumen de las opciones")
274
  output_plot2 = gr.Plot(label = 'Volatilidad Implícita por strike')
275
 
276
- btn_plot.click(
 
277
  fn=plot_opciones,
278
  inputs=[df_put_state, df_call_state, ticker_input, expiration_date],
279
  outputs=[output_plot1, output_plot2]
@@ -293,7 +294,8 @@ with gr.Blocks(title="Análisis de Opciones") as demo:
293
  inputs=[ticker_input, expiration_date, size_of_the_window],
294
  outputs=[output_file, output_msg]
295
  )
296
- btn_mostrar.click(
 
297
  fn=generar_todo,
298
  inputs=[ticker_input, expiration_date, size_of_the_window],
299
  outputs= [ output_df_put, df_put_state, output_df_call, df_call_state]
 
99
  ))
100
 
101
 
102
+ fig1.update_layout(title=f"Didtribución del Volumen {ticker_input}",
103
  xaxis_title='Strike',
104
  yaxis_title='Volumen',
105
  barmode='stack',
 
130
  fig2.add_vline(x=spot_price, line_width=2, line_dash="dot", line_color="black")
131
 
132
  fig2.update_layout(
133
+ title=f"Volatilidad Implícita por Strike {ticker_input}",
134
  xaxis_title='Strike',
135
  yaxis_title='Volatilidad Implícita',
136
  template='plotly_white'
 
226
  ticker_input = gr.Textbox(label="Ticker (ej. GOOGL)", value="MSTR")
227
  expiration_date = gr.Textbox(label="Fecha de vencimiento (formato: aaaa-mm-dd)", value = "" )
228
  size_of_the_window = gr.Slider(minimum=1, maximum=30, value=16, step=1, label="Tamaño de la ventana")
229
+ #btn_mostrar = gr.Button('Cargar Datos')
230
 
231
 
232
 
 
267
  '''
268
  with gr.Tab("Plots"):
269
 
270
+ #btn_plot = gr.Button("Mostrar Plot")
271
 
272
  with gr.Row():
273
  output_plot1 = gr.Plot(label="Distribución de Volumen de las opciones")
274
  output_plot2 = gr.Plot(label = 'Volatilidad Implícita por strike')
275
 
276
+ gr.on(
277
+ trigers = None,
278
  fn=plot_opciones,
279
  inputs=[df_put_state, df_call_state, ticker_input, expiration_date],
280
  outputs=[output_plot1, output_plot2]
 
294
  inputs=[ticker_input, expiration_date, size_of_the_window],
295
  outputs=[output_file, output_msg]
296
  )
297
+ gr.on(
298
+ triggers = None,
299
  fn=generar_todo,
300
  inputs=[ticker_input, expiration_date, size_of_the_window],
301
  outputs= [ output_df_put, df_put_state, output_df_call, df_call_state]