A modern, robust Python project template designed for building AI-driven trading bots. This template comes pre-configured with industry-standard tools for linting, formatting, testing, and automated environment management.
- Automated Environment Setup: Uses run.sh to automatically create a virtual environment, install dependencies, and run the application.
- Modern Linting & Formatting: Powered by Ruff, configured in pyproject.toml for lightning-fast code quality checks.
- Pre-commit Hooks: Automated checks on every commit via .pre-commit-config.yaml to ensure code consistency.
- Testing Framework: Ready-to-use pytest configuration with example tests in the tests/ directory.
- Clean Structure: Organized directory layout following Python best practices.
ai-trade-bot/
├── src/ # Source code
│ ├── __init__.py
│ └── main.py # Entry point
├── tests/ # Test suite
│ ├── __init__.py
│ └── test_main.py
├── .gitignore # Standard Python git ignore rules
├── .pre-commit-config.yaml # Pre-commit hook definitions
├── pyproject.toml # Tooling configuration (Ruff, etc.)
├── requirements.txt # Project dependencies
├── run.sh # One-click setup and run script
└── README.md # Project documentation
- Python 3.11 or higher
- Git
The easiest way to get started is to use the provided shell script:
chmod +x run.sh
./run.shThis script will:
- Create a
.venvdirectory if it doesn't exist. - Activate the virtual environment.
- Install dependencies from
requirements.txt. - Run the main application (
src/main.py).
We use Ruff for both linting and formatting. You can run it manually:
# Linting
ruff check .
# Formatting
ruff format .Run the test suite using pytest:
pytestTo set up pre-commit hooks, run:
pre-commit installThis ensures that Ruff lints and formats your code automatically before every commit.
This project is licensed under the MIT License - see the LICENSE file for details (if applicable).