Spaces:
Running
Running
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from utils.data_preprocessing import preprocess_data
|
3 |
+
from utils.model_inference import generate_forex_signals
|
4 |
+
from utils.sentiment_analysis import fetch_sentiment
|
5 |
+
|
6 |
+
# Load models and data
|
7 |
+
import os
|
8 |
+
from dotenv import load_dotenv
|
9 |
+
load_dotenv()
|
10 |
+
|
11 |
+
# APIs from .env
|
12 |
+
NEWS_API_KEY = os.getenv("NEWS_API_KEY")
|
13 |
+
FMP_API_KEY = os.getenv("FMP_API_KEY")
|
14 |
+
|
15 |
+
# Streamlit UI
|
16 |
+
st.title("AI Forex Bot")
|
17 |
+
st.sidebar.header("User Input")
|
18 |
+
|
19 |
+
# User inputs
|
20 |
+
trading_capital = st.sidebar.number_input("Trading Capital (USD)", min_value=100.0, step=10.0)
|
21 |
+
risk_level = st.sidebar.selectbox("Market Risk Level", ["Low", "Medium", "High"])
|
22 |
+
|
23 |
+
if st.sidebar.button("Generate Signals"):
|
24 |
+
# Backend logic
|
25 |
+
forex_signals = generate_forex_signals(trading_capital, risk_level)
|
26 |
+
sentiment = fetch_sentiment(forex_signals['currency_pair'], NEWS_API_KEY)
|
27 |
+
st.write("### Results")
|
28 |
+
st.write(f"Profitable Currency Pair: {forex_signals['currency_pair']}")
|
29 |
+
st.write(f"Entry Time: {forex_signals['entry_time']}")
|
30 |
+
st.write(f"Exit Time: {forex_signals['exit_time']}")
|
31 |
+
st.write(f"ROI: {forex_signals['roi']}%")
|
32 |
+
st.write(f"Signal Strength: {forex_signals['signal_strength']}")
|
33 |
+
st.write(f"Market Sentiment: {sentiment}")
|