Architecture
Directory Structure
High-Level Directory Structure
arduinoCopy code<root dir>/
├── ats/
│ ├── apis/
│ ├── database/
│ ├── exceptions/
│ ├── exchanges/
│ ├── indicators/
│ ├── logs/
│ ├── saved_states/
│ ├── state/
│ ├── static/
│ ├── strategies/
│ ├── templates/
│ ├── tests/
│ ├── trading_job/
│ ├── utils/
│ ├── __init__.py
│ ├── main.py
│ ├── test.py
├── custom_modules/
│ ├── exchanges/
│ ├── fees/
│ ├── indicators/
│ ├── strategies/
├── .env
├── environment.yml
├── requirements.txt
├── setup.sh
├── start.sh
└── README.mdCore Application: ats/
ats/The ats folder contains the core application code, organized into multiple subdirectories for modularity and maintainability.
Key Folders
apis/Handles API endpoints, requests to external APIs, and response processing logic.database/Manages database interactions, including models, schemas, connections, and CRUD operations.exceptions/Custom exception classes for handling specific errors throughout the application.exchanges/Connectors and integrations for interacting with various financial or crypto exchanges. Each built-in exchange resides inexchanges/exchanges/<exchange_name>and implements anExchangeclass extending theBaseExchangeclass.indicators/Implementations of technical indicators used in trading strategies, such as Moving Averages, RSI, or MACD. Each indicator must extend theBaseIndicatorclass.logs/Contains application logs for debugging and monitoring performance.saved_states/Stores serialized states or checkpoint data to maintain consistency across runs or allow resuming processes.state/Serializable classes extending theSimpleStateclass for managing and persisting application states.static/Static assets like CSS, JavaScript, and images for the trading UI.strategies/Built-in trading strategies, each implemented as a class that extends theBaseStrategyclass. Strategies should reside instrategies/<strategy_name>and must define aStrategyclass in astrategy.pyfile.templates/Template files (e.g., HTML files) for rendering dynamic content in the trading UI.tests/Unit tests, integration tests, and other test-related files to verify application correctness.trading_job/Core logic and classes for managing and executing trading jobs.utils/Utility functions and helper modules for reusable functionalities like file operations, data transformations, and logging.
Custom Modules: custom_modules/
custom_modules/The custom_modules directory is dedicated to user-defined customizations. It allows users to add their own exchange connectors, strategies, indicators, and fee models. These modules override the core ones in the ats folder if there is a naming conflict.
Key Folders
exchanges/Custom exchange implementations. Each exchange must:Be placed in
custom_modules/exchanges/<exchange_name>.py.Implement an
Exchangeclass extending theBaseExchangeclass.
fees/Custom fee models for defining unique fee structures. Each fee model must:Be placed in
custom_modules/fees/<fee_model_name>.py.Implement a class extending the
BaseFeesclass.
indicators/Custom technical indicators. Each indicator must:Be placed in
custom_modules/indicators/<indicator_name>.py.Implement a class extending the
BaseIndicatorclass.
strategies/Custom trading strategies. Each strategy must:Be placed in
custom_modules/strategies/<strategy_name>/strategy.py.Implement a
Strategyclass extending theBaseStrategyclass.
Root-Level Files
.envContains environment-specific variables, such as API keys and configurations.environment.ymlSpecifies dependencies for setting up the project environment with Conda.requirements.txtPython dependencies for the application, used withpip.setup.shA shell script for initializing and configuring the application environment.start.shA shell script for starting the application.
Last updated