A-Zero is a modular, data-driven, and safety-oriented framework written in Java for building, backtesting, and deploying automated crypto trading strategies.
This project provides the core infrastructure needed to apply a systematic and rigorous approach to algorithmic trading. It is built with an "Open Core" philosophy: the framework itself is open-source, allowing you to build your own proprietary trading strategies on a robust and well-tested foundation.
Our core guiding principles are:
- Safety First: Emphasizing risk management, robust error handling, and a phased approach to deployment.
- Modularity: A clean, microservice-ready architecture that separates concerns like data ingestion, signal generation, and execution.
- Testability: A powerful backtesting engine is at the heart of the project, enabling data-driven validation of all strategies before they ever touch a live market.
- Command-Line Backtester: A powerful and fast CLI tool to run your strategies against historical data and generate performance reports.
- Declarative Strategy Definition: Define complex trading strategies in simple, human-readable YAML files using a rules-based approach.
- Realistic Simulation Engine: A backtesting library with a portfolio margin model, trading costs (fees, slippage), and forced liquidation for margin calls.
- Data Ingestion Utility: A simple CLI tool for downloading historical K-line data from exchanges like Binance.
- Pluggable Strategy Interface: Define your trading logic by implementing a simple
Strategyinterface. - Clean, Modern Java: Built with modern Java and a minimal set of dependencies, ready for integration with frameworks like Spring.
This project maintains a high standard of code quality through a Continuous Integration (CI) pipeline powered by GitHub Actions. Every push and pull request to our main development branches is automatically built and verified by running a comprehensive test suite.
For detailed logs and a history of all recent builds, please visit the Actions tab.
This project is in its early stages. Our planned development path is:
- v0.1: Foundational libraries and data ingestion utility.
-
a0-core: Shared data models and interfaces. -
a0-data-ingestor: CLI tool for downloading historical data. -
a0-backtester: Core library for strategy simulation.
-
- v0.2: Command-Line Backtester and Strategy Integration.
-
a0-backtester: Implement strategy loading and execution within theBacktestEngine. -
a0-strategy-rules-engine: Build the engine to parse YAML-based strategies. -
a0-backtester-cli: Build the command-line application to run backtests.
-
- v0.3: Initial hooks and interfaces for sentiment analysis modules.
- v0.4: Integration with exchange Testnet APIs for paper trading.
- v1.0: A stable, production-ready framework for live spot trading.
The A-Zero framework is under active development. It currently provides two primary command-line tools: a data ingestor and a backtester.
- Clone the repository:
git clone https://github.com/impatient0/a-zero.git - Navigate to the project directory:
cd a-zero - Build the project using Maven:
mvn clean package - Run the data ingestor tool:
java -jar a0-data-ingestor/target/a0-data-ingestor-0.1.0-SNAPSHOT.jar --symbol=BTCUSDT --timeframe=1h --start-date=2023-01-01
This will create a BTCUSDT-1h.csv file in your project root, ready for use with the backtesting engine.
Once you have data, you can run a simulation using the backtester-cli.
-
Define a Strategy: Create a strategy configuration file (e.g.,
my-strategy.yaml). You can use the example in thea0-strategy-rules-engineREADME as a template. -
Run the Backtester: Execute the backtester JAR, pointing it to your strategy and data files.
java -jar a0-backtester-cli/target/a0-backtester-cli-*.jar \ --strategy-file=my-strategy.yaml \ --data-file=data/BTCUSDT-1h.csv \ --symbol=BTCUSDT \ --account-mode=MARGIN \ --leverage=10This will run the simulation and print a performance summary to your console.
This project is licensed under the Apache License 2.0. See the LICENSE file for details.