zainulabedin949 commited on
Commit
fdf52b9
·
verified ·
1 Parent(s): b56d185

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -7
app.py CHANGED
@@ -58,7 +58,7 @@ def background_worker(pair: str, timeframe: str):
58
  entry = f"{timestamp} | {direction} | Close: {candle_data['close']:.5f}"
59
  state.append(entry)
60
 
61
- # Generate new recommendation every 5 seconds
62
  if len(state) % 5 == 0:
63
  recommendation = analyze_candle_pattern(candles)
64
  trade_recommendations.append(f"⏱️ {timestamp} | {recommendation}")
@@ -91,6 +91,7 @@ with gr.Blocks(title="Quotex Trading Bot") as demo:
91
  pair = gr.Dropdown(["EURUSD", "USDJPY", "BTCUSD"], label="Select Currency Pair")
92
  timeframe = gr.Dropdown(["5s", "15s", "1m", "5m"], label="Select Timeframe")
93
  start_btn = gr.Button("Start Bot")
 
94
 
95
  status = gr.Textbox(label="Status")
96
  gr.Markdown("### 🕯️ Latest Candles")
@@ -103,15 +104,15 @@ with gr.Blocks(title="Quotex Trading Bot") as demo:
103
  inputs=[pair, timeframe],
104
  outputs=status
105
  )
106
- demo.load(
 
107
  fn=get_latest_candles,
108
- outputs=candle_output,
109
- every=2
110
  )
111
- demo.load(
 
112
  fn=get_latest_recommendations,
113
- outputs=recommendation_output,
114
- every=5
115
  )
116
 
117
  if __name__ == "__main__":
 
58
  entry = f"{timestamp} | {direction} | Close: {candle_data['close']:.5f}"
59
  state.append(entry)
60
 
61
+ # Generate new recommendation every 5 candles
62
  if len(state) % 5 == 0:
63
  recommendation = analyze_candle_pattern(candles)
64
  trade_recommendations.append(f"⏱️ {timestamp} | {recommendation}")
 
91
  pair = gr.Dropdown(["EURUSD", "USDJPY", "BTCUSD"], label="Select Currency Pair")
92
  timeframe = gr.Dropdown(["5s", "15s", "1m", "5m"], label="Select Timeframe")
93
  start_btn = gr.Button("Start Bot")
94
+ refresh_btn = gr.Button("Refresh Data")
95
 
96
  status = gr.Textbox(label="Status")
97
  gr.Markdown("### 🕯️ Latest Candles")
 
104
  inputs=[pair, timeframe],
105
  outputs=status
106
  )
107
+
108
+ refresh_btn.click(
109
  fn=get_latest_candles,
110
+ outputs=candle_output
 
111
  )
112
+
113
+ refresh_btn.click(
114
  fn=get_latest_recommendations,
115
+ outputs=recommendation_output
 
116
  )
117
 
118
  if __name__ == "__main__":