Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -1,42 +1,56 @@
|
|
1 |
import streamlit as st
|
2 |
-
import
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
from model_inference import generate_forex_signals
|
4 |
-
from config import RISK_LEVELS
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
|
6 |
-
#
|
7 |
-
st.title("AI Forex Bot")
|
8 |
st.sidebar.header("User Input")
|
9 |
|
10 |
-
#
|
11 |
-
trading_capital = st.sidebar.number_input(
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
)
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
)
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
st.write(f"**Exit Time**: {exit_time.strftime('%Y-%m-%d %H:%M:%S')}")
|
41 |
-
st.write(f"**ROI**: {forex_signals['roi']}%")
|
42 |
-
st.write(f"**Signal Strength**: {forex_signals['signal_strength']}")
|
|
|
1 |
import streamlit as st
|
2 |
+
import os
|
3 |
+
import sys
|
4 |
+
|
5 |
+
# Add the 'utils' directory to sys.path so Python can find modules within it
|
6 |
+
sys.path.append(os.path.join(os.path.dirname(__file__), "utils"))
|
7 |
+
|
8 |
+
# Importing the necessary function from model_inference.py
|
9 |
from model_inference import generate_forex_signals
|
10 |
+
from config import RISK_LEVELS # Assuming config.py is in the root directory
|
11 |
+
|
12 |
+
# Streamlit page configuration
|
13 |
+
st.set_page_config(page_title="AI Forex Bot", page_icon=":guardsman:", layout="wide")
|
14 |
+
|
15 |
+
# Title of the application
|
16 |
+
st.title("AI Forex Trading Bot")
|
17 |
+
|
18 |
+
# Description of how the bot works
|
19 |
+
st.markdown("""
|
20 |
+
This AI-powered Forex Bot provides real-time trading signals using a combination of historical data, sentiment analysis, and macroeconomic factors.
|
21 |
+
You can enter your trading capital and select a risk level to get personalized trading recommendations.
|
22 |
+
""")
|
23 |
|
24 |
+
# Sidebar for user inputs
|
|
|
25 |
st.sidebar.header("User Input")
|
26 |
|
27 |
+
# Get user trading capital (1 USD to 10,000 USD)
|
28 |
+
trading_capital = st.sidebar.number_input("Enter Trading Capital (USD)", min_value=1, max_value=10000, value=1000)
|
29 |
+
|
30 |
+
# Get user market risk level (Low, Medium, High)
|
31 |
+
market_risk = st.sidebar.selectbox("Select Market Risk Level", options=["Low", "Medium", "High"])
|
32 |
+
|
33 |
+
# Get user's preferred timezone (this can be used to adjust entry/exit time)
|
34 |
+
user_timezone = st.sidebar.text_input("Enter Your Timezone (e.g., UTC, EST, PST)", "UTC")
|
35 |
+
|
36 |
+
# Display the inputs
|
37 |
+
st.write(f"**Trading Capital**: ${trading_capital}")
|
38 |
+
st.write(f"**Market Risk Level**: {market_risk}")
|
39 |
+
st.write(f"**Timezone**: {user_timezone}")
|
40 |
+
|
41 |
+
# When user presses the "Get Trading Signals" button, run the model inference
|
42 |
+
if st.sidebar.button("Get Trading Signals"):
|
43 |
+
# Call the function to generate forex signals from model_inference.py
|
44 |
+
try:
|
45 |
+
signals = generate_forex_signals(trading_capital, market_risk, user_timezone)
|
46 |
+
|
47 |
+
# Display the results in the main area
|
48 |
+
st.subheader("Recommended Forex Trade")
|
49 |
+
st.write(f"**Currency Pair**: {signals['currency_pair']}")
|
50 |
+
st.write(f"**Entry Time**: {signals['entry_time']}")
|
51 |
+
st.write(f"**Exit Time**: {signals['exit_time']}")
|
52 |
+
st.write(f"**ROI**: {signals['roi']}%")
|
53 |
+
st.write(f"**Signal Strength**: {signals['signal_strength']}")
|
54 |
+
|
55 |
+
except Exception as e:
|
56 |
+
st.error(f"Error: {str(e)}")
|
|
|
|
|
|