This repository serves as a template for developing, testing, and deploying trading algorithms. It provides a structured framework that includes components for backtesting, live trading, and a dashboard interface. The core utilities, configurations, and strategies are organized to ensure modularity and ease of maintenance.
├── README.md
├── backtesting
│ ├── backTesting-Algo.ipynb
│ ├── data
│ └── dataFormaters
├── dashboard
│ └── algoDashboard
│ ├── app.py
│ ├── static
│ │ └── styles.css
│ └── templates
│ └── index.html
├── docs
│ └── setup_guide.md
├── liveEngine
│ ├── config
│ │ └── config.ini
│ ├── data
│ │ ├── memoryData
│ │ └── savedData
│ ├── logs
│ │ └── logs.log
│ └── src
│ ├── core
│ ├── main.py
│ ├── strategy
│ └── utils
└── requirements.txt
-
backtesting: Contains notebooks, scripts, and data for simulating trading strategies using historical data. This helps in evaluating the performance of algorithms before deploying them live.
backtesting-algo.ipynb
: Jupyter notebook for running backtests and analyzing results.data
: Stores historical market data used for backtesting.data-formatters
: Scripts or tools to format and preprocess raw data for backtesting.
-
dashboard: Houses the web-based dashboard for visualizing algorithm performance and monitoring live trading activities.
algo-dashboard
: Main directory for dashboard code.static
: Contains static files like CSS, JavaScript, and images.templates
: HTML templates for the dashboard's user interface.
-
docs: Documentation for setting up, configuring, and using the algorithms.
setup_guide.md
: Guide to help users set up the environment and get started with the algorithms.
-
live-engine: Core engine for live trading, including configuration, data management, and execution logic.
-
logs
: Directory for storing log files generated during live trading.logs.log
: Example log file for tracking trades, errors, and other events.
-
config
: Configuration files required for setting up and running the algorithms.config.ini
: Sample configuration file with parameters for live trading, such as API keys, trading pairs, risk management settings, etc.
-
data
: Folder for storing runtime data, including in-memory data and saved data for later analysis.memory-data
: Temporary data stored during live trading.- saved-data`: Persistent data storage for logs, historical trade data, and analysis results.
-
src
: Source code directory containing all modules required for live trading.core
: Core functionalities shared across different strategies, such as order execution and data fetching.strategy
: Implementations of specific trading strategies.utils
: Utility functions and helper scripts.main.py
: Starting point of the script
-
-
requirements.txt: Lists all Python dependencies required to run the algorithms. Install using
pip install -r requirements.txt
.
To get started with this repository, follow these steps:
-
Clone the Repository:
git clone https://github.com/your-username/trading-algorithms-template.git cd trading-algorithms-template
-
Install Dependencies: Make sure you have Python installed. Then, install the required packages using pip:
pip install -r requirements.txt
-
Configure Your Environment: Edit the
config/config.ini
file to set up your API keys, trading pairs, and other parameters according to your trading strategy and environment. -
Run Backtests: Use the Jupyter notebook in the
backtesting
folder to test your trading strategies with historical data. Open the notebook with:jupyter notebook backtesting/backtesting-algo.ipynb
-
Deploy Live Trading: Ensure your environment is properly configured and run the live trading engine. Navigate to the
live-engine/src
folder and execute your main trading script:python live-engine/src/main.py
-
Monitor Performance: Launch the dashboard to monitor your trading algorithm in real-time. Navigate to the
dashboard
directory and start the web server:python -m http.server
how to run dashboard: python app.py