FX-Predict is a web-based application that uses a Long Short-Term Memory (LSTM) neural network to predict forex price movements. It provides a comprehensive dashboard with interactive charts, trading signals, performance metrics, and a toolkit for traders.
- AI-Powered Predictions: Utilizes LSTM models to forecast price changes and generate trading signals (Buy, Sell, Hold).
- Dynamic Model Loading: Automatically discovers and loads all available
_model.h5files at startup. - Interactive Financial Charts:
- Powered by TradingView's Lightweight Charts.
- Switch between Candlestick and Line chart types.
- Overlays for predictions and technical indicators (e.g., Simple Moving Average).
- Comprehensive Dashboard: Displays key data points including current price, predicted change, confidence scores, and model performance metrics (MAE, RMSE, etc.).
- Trading Toolkit:
- Multi-Zone Clocks: Live clocks for Nairobi (EAT), London (GMT), and New York (ET).
- Market Session Indicator: Shows the current status (Open/Closed) of the Sydney, Tokyo, London, and New York forex sessions.
- Profit/Loss Calculator: Interactively calculate potential profit and loss in pips and USD based on lot size.
- Risk Management: Automatically calculates suggested Stop Loss and Take Profit levels based on the prediction.
- Backend: Python, FastAPI, TensorFlow/Keras, Pandas, yfinance
- Frontend: HTML5, CSS3, JavaScript
- Charting Library: TradingView Lightweight Charts
- Machine Learning: LSTM (Long Short-Term Memory) for time-series forecasting.
Follow these steps to set up and run the project locally.
- Python 3.8+
pipfor package management
git clone https://github.com/your-username/fx-predict.git
cd fx-predictIt's highly recommended to use a virtual environment to manage project dependencies.
On macOS/Linux:
python3 -m venv venv
source venv/bin/activateOn Windows:
python -m venv venv
.\venv\Scripts\activateInstall all the required Python packages using the requirements.txt file.
pip install -r requirements.txtThe application has two main components: the model training script and the web application server.
The project comes with pre-trained models. However, you can retrain them or train new ones using the train_model.py script.
- The script will train models for a predefined list of currency pairs and time intervals.
- The trained models (
.h5files) and their associated feature lists (.pklfiles) are saved in the root directory.
To run the training script:
python train_model.pyStart the FastAPI server using app.py. This will also launch the Uvicorn ASGI server.
python app.pyThe application will be available at http://127.0.0.1:8000. Open this URL in your web browser to access the dashboard.
- Select a Model: Use the dropdown menu to choose a currency pair and time interval.
- Select Chart Period: Choose the amount of historical data you want to see on the chart.
- Generate Prediction: Click the "Generate Prediction" button.
- Analyze: The dashboard will update with the latest prediction, chart, and analysis data.
This is an educational and experimental tool. The predictions are based on historical data and are not a guarantee of future results. Do not use this application for live trading. Financial markets are volatile and subject to unpredictable changes. Always conduct your own research and consult with a qualified financial advisor before making any investment decisions.
