Skip to content

Rogendo/LSTMs-with-Stock-Exchange

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FX-Predict: AI-Powered Forex Analysis Dashboard

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.

FX-Predict Dashboard

Features

  • 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.h5 files 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.

Tech Stack

  • 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.

Setup and Installation

Follow these steps to set up and run the project locally.

1. Prerequisites

  • Python 3.8+
  • pip for package management

2. Clone the Repository

git clone https://github.com/your-username/fx-predict.git
cd fx-predict

3. Create a Virtual Environment

It's highly recommended to use a virtual environment to manage project dependencies.

On macOS/Linux:

python3 -m venv venv
source venv/bin/activate

On Windows:

python -m venv venv
.\venv\Scripts\activate

4. Install Dependencies

Install all the required Python packages using the requirements.txt file.

pip install -r requirements.txt

Usage

The application has two main components: the model training script and the web application server.

1. Train the Models (Optional)

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 (.h5 files) and their associated feature lists (.pkl files) are saved in the root directory.

To run the training script:

python train_model.py

2. Run the Web Application

Start the FastAPI server using app.py. This will also launch the Uvicorn ASGI server.

python app.py

The application will be available at http://127.0.0.1:8000. Open this URL in your web browser to access the dashboard.

3. Using the Dashboard

  1. Select a Model: Use the dropdown menu to choose a currency pair and time interval.
  2. Select Chart Period: Choose the amount of historical data you want to see on the chart.
  3. Generate Prediction: Click the "Generate Prediction" button.
  4. Analyze: The dashboard will update with the latest prediction, chart, and analysis data.

Disclaimer

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.

About

Long-Short-Term-Memory Recurrent Neural Networks with Stock Exchange time series data

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published