graph LR
Core_Trading_Engine["Core Trading Engine"]
Exchange_Integration["Exchange Integration"]
Trading_Logic_Control["Trading Logic & Control"]
Data_State_Management["Data & State Management"]
Configuration_Component_Resolution["Configuration & Component Resolution"]
User_Interface_Reporting["User Interface & Reporting"]
Optimization_Simulation["Optimization & Simulation"]
Core_Trading_Engine -- "Orchestrates" --> Exchange_Integration
Core_Trading_Engine -- "Orchestrates" --> Trading_Logic_Control
Core_Trading_Engine -- "Orchestrates" --> Data_State_Management
Core_Trading_Engine -- "Orchestrates" --> User_Interface_Reporting
Core_Trading_Engine -- "Configured By" --> Configuration_Component_Resolution
Exchange_Integration -- "Provides Live Data To" --> Data_State_Management
Exchange_Integration -- "Receives Order Requests From" --> Core_Trading_Engine
Trading_Logic_Control -- "Receives Data From" --> Data_State_Management
Trading_Logic_Control -- "Provides Signals/Rules To" --> Core_Trading_Engine
Data_State_Management -- "Fetches Live Data From" --> Exchange_Integration
Data_State_Management -- "Provides Data To" --> Core_Trading_Engine
Data_State_Management -- "Provides Data To" --> Trading_Logic_Control
Data_State_Management -- "Provides Data To" --> Optimization_Simulation
Data_State_Management -- "Provides Data To" --> User_Interface_Reporting
Configuration_Component_Resolution -- "Provides Settings To" --> Core_Trading_Engine
Configuration_Component_Resolution -- "Resolves Components For" --> Trading_Logic_Control
User_Interface_Reporting -- "Interacts With" --> Core_Trading_Engine
User_Interface_Reporting -- "Queries Data From" --> Data_State_Management
Optimization_Simulation -- "Uses Data From" --> Data_State_Management
Optimization_Simulation -- "Applies Logic From" --> Trading_Logic_Control
click Core_Trading_Engine href "https://github.com/CodeBoarding/GeneratedOnBoardings/blob/main//freqtrade/Core_Trading_Engine.md" "Details"
click Exchange_Integration href "https://github.com/CodeBoarding/GeneratedOnBoardings/blob/main//freqtrade/Exchange_Integration.md" "Details"
click Trading_Logic_Control href "https://github.com/CodeBoarding/GeneratedOnBoardings/blob/main//freqtrade/Trading_Logic_Control.md" "Details"
click Data_State_Management href "https://github.com/CodeBoarding/GeneratedOnBoardings/blob/main//freqtrade/Data_State_Management.md" "Details"
click Configuration_Component_Resolution href "https://github.com/CodeBoarding/GeneratedOnBoardings/blob/main//freqtrade/Configuration_Component_Resolution.md" "Details"
click User_Interface_Reporting href "https://github.com/CodeBoarding/GeneratedOnBoardings/blob/main//freqtrade/User_Interface_Reporting.md" "Details"
click Optimization_Simulation href "https://github.com/CodeBoarding/GeneratedOnBoardings/blob/main//freqtrade/Optimization_Simulation.md" "Details"
Here's the final architecture analysis for freqtrade, consolidating the components into a high-level overview with their responsibilities, key source files, and critical relationships.
The central orchestrator of the Freqtrade application. It manages the main trading loop, initializes and coordinates all other core components, handles trade entry and exit logic, and ensures the overall flow of operations. It's the "brain" that drives the trading decisions and actions.
Related Classes/Methods:
Provides an abstraction layer for interacting with various cryptocurrency exchanges. It handles all low-level communication, including fetching market data (OHLCV, tickers, order books), placing and cancelling orders, and managing account balances and leverage.
Related Classes/Methods:
freqtrade.exchange.exchange(0:0)freqtrade.exchange(0:0)
Defines the core trading logic, including indicator calculation, generation of entry and exit signals, and management of trade positions. It also integrates AI/ML models for predictive analysis, implements various safety measures to prevent excessive losses or overtrading, and dynamically manages the list of tradable pairs.
Related Classes/Methods:
freqtrade.strategy.interface(0:0)freqtrade.templates(0:0)freqtrade.freqai.freqai_interface(0:0)freqtrade.freqai.prediction_models(0:0)freqtrade.plugins.pairlistmanager(0:0)freqtrade.plugins.protectionmanager(0:0)
Manages all market data (live and historical), and the application's persistent state, including open/closed trades, orders, pair locks, and the bot's financial state (wallet balances, profit/loss). It ensures data integrity and provides data to other components.
Related Classes/Methods:
freqtrade.data.dataprovider(0:0)freqtrade.data.history.datahandlers.idatahandler(0:0)freqtrade.data.history.datahandlers(0:0)freqtrade.persistence.models(0:0)freqtrade.persistence.trade_model(0:0)freqtrade.persistence.pairlock_middleware(0:0)freqtrade.wallets(0:0)
Responsible for loading, parsing, and validating the bot's configuration from various sources (files, environment variables, command-line arguments). It also dynamically locates and loads various components (strategies, exchanges, pairlists, protections, FreqAI models) based on their configured names or paths.
Related Classes/Methods:
freqtrade.configuration.configuration(0:0)freqtrade.resolvers.iresolver(0:0)freqtrade.resolvers(0:0)
Centralizes all remote procedure call (RPC) functionalities, command-line interface (CLI) parsing, and web API services. It enables external control and notifications through various channels like Telegram, Discord, Webhook, and a Web API, allowing users to interact with and monitor the bot.
Related Classes/Methods:
freqtrade.rpc.rpc_manager(0:0)freqtrade.commands.arguments(0:0)freqtrade.commands(0:0)freqtrade.rpc.api_server.webserver(0:0)
Provides tools for evaluating trading strategies without risking real capital. The Backtesting Engine simulates trading on historical data, while the Hyperoptimization Engine automates the process of finding optimal strategy parameters by running numerous backtests.
Related Classes/Methods: