Spaces:
Sleeping
Sleeping
| import streamlit as st | |
| import os | |
| import sys | |
| # Add the 'utils' directory to sys.path so Python can find modules within it | |
| sys.path.append(os.path.join(os.path.dirname(__file__), "utils")) | |
| # Importing the necessary function from model_inference.py | |
| from model_inference import generate_forex_signals | |
| from config import RISK_LEVELS # Assuming config.py is in the root directory | |
| # Streamlit page configuration | |
| st.set_page_config(page_title="AI Forex Bot", page_icon=":guardsman:", layout="wide") | |
| # Title of the application | |
| st.title("AI Forex Trading Bot") | |
| # Description of how the bot works | |
| st.markdown(""" | |
| This AI-powered Forex Bot provides real-time trading signals using a combination of historical data, sentiment analysis, and macroeconomic factors. | |
| You can enter your trading capital and select a risk level to get personalized trading recommendations. | |
| """) | |
| # Sidebar for user inputs | |
| st.sidebar.header("User Input") | |
| # Get user trading capital (1 USD to 10,000 USD) | |
| trading_capital = st.sidebar.number_input("Enter Trading Capital (USD)", min_value=1, max_value=10000, value=1000) | |
| # Get user market risk level (Low, Medium, High) | |
| market_risk = st.sidebar.selectbox("Select Market Risk Level", options=["Low", "Medium", "High"]) | |
| # Get user's preferred timezone (this can be used to adjust entry/exit time) | |
| user_timezone = st.sidebar.text_input("Enter Your Timezone (e.g., UTC, EST, PST)", "UTC") | |
| # Display the inputs | |
| st.write(f"**Trading Capital**: ${trading_capital}") | |
| st.write(f"**Market Risk Level**: {market_risk}") | |
| st.write(f"**Timezone**: {user_timezone}") | |
| # When user presses the "Get Trading Signals" button, run the model inference | |
| if st.sidebar.button("Get Trading Signals"): | |
| # Call the function to generate forex signals from model_inference.py | |
| try: | |
| signals = generate_forex_signals(trading_capital, market_risk, user_timezone) | |
| # Display the results in the main area | |
| st.subheader("Recommended Forex Trade") | |
| st.write(f"**Currency Pair**: {signals['currency_pair']}") | |
| st.write(f"**Entry Time**: {signals['entry_time']}") | |
| st.write(f"**Exit Time**: {signals['exit_time']}") | |
| st.write(f"**ROI**: {signals['roi']}%") | |
| st.write(f"**Signal Strength**: {signals['signal_strength']}") | |
| except Exception as e: | |
| st.error(f"Error: {str(e)}") | |