The Oracle Financial Analysis Platform is a sophisticated algorithmic trading system that combines data fetching, technical analysis, evolutionary optimization, and database management. The platform is designed to optimize financial trading strategies through genetic algorithms and provides a complete framework for backtesting and parameter tuning.
The Oracle platform follows a layered architecture with clear separation of concerns across multiple components:
- Application Layer: Main application initialization and command-line interface
- Data Pipeline: Market data fetching and processing from Yahoo Finance
- Analysis Engine: Technical indicators (Ichimoku, MACD, RSI) with plugin system
- Optimization Engine: Evolutionary algorithm for parameter tuning (WIP. Will be added in the Future)
- Database Layer: MySQL with SQLAlchemy ORM for data persistence
The platform requires Python 3.x with the following key dependencies:
- Data Processing: pandas (2.2.3), numpy (2.1.3), pandas_ta (0.3.14b0)
- Logic: apscheduler (~3.11.0)
- Database: SQLAlchemy (~2.0.36)
- CLI: typer['all'] (~0.15.1), prompt-toolkit(~3.0.48), rich (~13.9.4), pydantic (~2.10.4)
- Testing: pytest (~8.3.3)
Create/Edit the configuration file at backend/config/config.json with the following structure:
{
"DB_CONFIG": {
"host": "localhost",
"user": "your_username",
"password": "your_password",
"database": "oracle"
},
"LOG_CONFIG": {
"level": "INFO",
"path": "logs/oracle.log"
}
} The system manages four core entities:
- Profile: Trading profiles with wallet and strategy settings
- Trading Components: [Technical indicators | Strategies | Patterns | AiComponents] with parameters and performance metrics. (Contains Simple news AI)
- Plugin: Strategy plugins with configurations
- Order: Trading orders with type, ticker, quantity, and price information
-
Install Python Dependencies:
pip install poetry
Inside Oralce/backend:
poetry install
-
Setup MySQL Database:
- Install MySQL Server
- Create a database user with appropriate permissions
- Configure connection parameters in
backend/config/config.json
-
Initialize Application: When inside 'poetry shell' using
oraclestarts the cli and initlizes the app
The platform implements several sophisticated technical indicators:
- MACD: Moving Average Convergence Divergence
- SMA: Simple Moving Average
And many more...
Each indicator inherits from a base class and implements standardized methods for evaluation and backtesting.
The platform's core strength lies in its evolutionary optimization capabilities. The genetic algorithm optimizes parameters for financial indicators through multiple generations:
- Population-based optimization: Evolves parameter sets over generations
- Mutation and crossover: Generates offspring with improved characteristics
- Performance-based selection: Retains top performers for reproduction
- Configurable parameters: Adjustable population size, generations, and mutation rates
❗ Combination of some Settings may result in Overfitting!
❗ WIP
The platform integrates with multiple external data sources:
- Yahoo Finance: News for Ai News Evaluator (Scrappy)
- Binance: For Fetching Trading Data and Trading with Broker
❗ WIP
- Data Fetching: Retrieves historical market data
- Data Modification: Processes and validates data integrity
- Interval Determination: Optimizes data granularity
- Analysis Integration: Feeds processed data to indicators
The platform includes comprehensive testing coverage:
test_algorithms/: Tests for technical indicators and optimizationtest_api/: Tests for data fetching and API integrationtest_database/: Tests for database operations and modelstest_exceptions/: Tests for error handling and edge cases
❗ Not Finished
pytest backend/tests/ The application starts with the init_app() function after running
poetry shell
oraclecommand which orchestrates system initialization:
- Logger Setup: Configures application logging
- Indicator Registration: Loads all technical indicators
- Service Initialization: Starts database services
- Interface Setup: Activates command-line interface
The platform provides comprehensive CRUD operations for all entities:
- Profile Management: Create, read, update, delete trading profiles
- Order Management: Track trading orders with timestamps
- Plugin Configuration: Manage strategy plugins and settings
- Indicator Tracking: Monitor indicator performance and parameters
-
NOTE:
❗ This isn't a finilized Version and is still strongly under development! -
Trading Frequency: The current implementation may run trading operations every 20 seconds for development Purposes. This can be adjusted in the strategy settings later.
-
Parameter Optimization: The evolutionary algorithm is not yet implemented!
-
External API Limits: Binance API Endpoints have limits, which we cannot bypass!
-
Testing Coverage: Not everything is covered by tests yet!
-
Frontend: To Date, The backend has to be written first, so no code availalbe currently!
- Database Credentials: Never commit database credentials to version control
- API Keys: Store external API keys securely and rotate them regularly
- Input Validation: All user inputs are validated before database operations
For more detailed implementation guides and advanced usage scenarios, visit https://deepwiki.com/MrCode200/oracle
❗ The detailed Documentation is written by AI, and not all is covered correctly (~95% correct)! (Most of the Information is correct though)
The evolutionary algorithm implementation is particularly noteworthy, providing a robust framework for parameter optimization that can be applied to various financial indicators and trading strategies. The database layer offers comprehensive CRUD operations with proper error handling and transaction management, ensuring data integrity throughout the application lifecycle. To see the semi-developmt code, visit miniOracleAlpha Repository under /Optimization