tttarun commited on
Commit
7535b30
1 Parent(s): 250f679

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -80,12 +80,14 @@ def calculate_profit_loss(stock_data,days_to_monitor):
80
 
81
  dft = pd.DataFrame(buy_sell_actions)
82
 
83
- dff = pd.DataFrame()
84
  dff['+ve trade probability'] = len(dft[dft['Profit/Loss (%)'] > 0])
85
  dff['Mean returns'] = dft['Profit/Loss (%)'].mean()
86
  dff['Median returns'] = dft['Profit/Loss (%)'].median()
87
  dff['Best return'] = dft['Profit/Loss (%)'].max()
88
- dff['worst return'] = dft['Profit/Loss (%)'].min()
 
 
89
 
90
 
91
  return dft, dff
@@ -180,8 +182,8 @@ with gr.Blocks() as demo:
180
  stock_input = gr.Textbox(label="Enter Stock Symbol", placeholder="e.g., CANBK", lines=1)
181
  rsi_window_slider = gr.Slider(minimum=1, maximum=30, value=14, label="RSI Window (Days)", step=1)
182
  days_to_monitor = gr.Slider(minimum=1, maximum=30, value=8, label="Days to monitor stock once condition is met", step=1)
183
- previous_n_days = gr.Slider(minimum=1, maximum=180, value=30, label="Previous n days RSI threshold to check", step=1)
184
  rsi_threshold1 = gr.Slider(minimum=1, maximum=100, value=65, label="Previous RSI threshold", step=1)
 
185
  rsi_threshold2 = RangeSlider(label="Current RSI Range", minimum=0, maximum=100, value=[65, 70])
186
  text1 = "## The range is: {min} to {max}"
187
  range_ = gr.Markdown(value=text1.format(min=0, max=100))
 
80
 
81
  dft = pd.DataFrame(buy_sell_actions)
82
 
83
+ dff = pd.DataFrame(columns = ['+ve trade probability','Median returns','Mean returns','Best return','Worst return'])
84
  dff['+ve trade probability'] = len(dft[dft['Profit/Loss (%)'] > 0])
85
  dff['Mean returns'] = dft['Profit/Loss (%)'].mean()
86
  dff['Median returns'] = dft['Profit/Loss (%)'].median()
87
  dff['Best return'] = dft['Profit/Loss (%)'].max()
88
+ dff['Worst return'] = dft['Profit/Loss (%)'].min()
89
+
90
+ print(dff.head())
91
 
92
 
93
  return dft, dff
 
182
  stock_input = gr.Textbox(label="Enter Stock Symbol", placeholder="e.g., CANBK", lines=1)
183
  rsi_window_slider = gr.Slider(minimum=1, maximum=30, value=14, label="RSI Window (Days)", step=1)
184
  days_to_monitor = gr.Slider(minimum=1, maximum=30, value=8, label="Days to monitor stock once condition is met", step=1)
 
185
  rsi_threshold1 = gr.Slider(minimum=1, maximum=100, value=65, label="Previous RSI threshold", step=1)
186
+ previous_n_days = gr.Slider(minimum=1, maximum=180, value=30, label="N -> days to check for RSI threshold", step=1)
187
  rsi_threshold2 = RangeSlider(label="Current RSI Range", minimum=0, maximum=100, value=[65, 70])
188
  text1 = "## The range is: {min} to {max}"
189
  range_ = gr.Markdown(value=text1.format(min=0, max=100))