"Petunia" is a playful derivative of the Latin word Pecunia (money/wealth),
symbolizing organic growth in a digital financial environment.
Automated trading data pipeline & decision support system. Fetches market data, executes technical strategies, and manages portfolio risk — featuring a fully Dockerized architecture, a visual Dashboard, and "Shadow Execution".
Last Update: January 2026 Version: 1.4.0 (Vectorized Engine & Fee-Adjusted Backtesting) Wiki: Complete Documentation
Petunia is a modular trading system designed to act as a "Shadow Automator" for retail trading. It doesn't execute orders directly on the broker but manages the logic, risk, and accounting, syncing with manual execution via Google Sheets.
- 🐳 Containerized Architecture: Isolated Docker environments for App and Database (PostgreSQL).
- 📈 Strategy Factory: Plug-and-play strategy engine with Vectorized Execution for high performance (Currently supporting EMA Crossover & RSI Mean Reversion).
- 🧪 Backtest Lab: Realistic simulation engine with Fee/Commission structure (Fixed + Variable), Benchmark capabilities, and detailed metrics (ROI, Max Drawdown).
- 🛡️ Risk First: Built-in Risk Manager enforcing the 2% Rule and ATR-based volatility stops.
- 📊 Interactive Dashboard: Streamlit UI for portfolio monitoring, strategy configuration, system control, and log inspection.
The system behavior is fully customizable via JSON, manageable directly from the Control Panel:
active_strategy: Selects the logic to run in production (e.g., "RSI").risk_params: Controls capital exposure (Risk % per trade, Stop Loss ATR multiplier).fees_config: Simulates broker costs (Fixed fee + % per trade) for realistic backtests and net-profit calculation.strategies_params: Specific parameters for each algorithm (e.g., RSI Period, EMA Windows).
- Docker & Docker Compose (v2+)
- Google Cloud Service Account (JSON Key)
# 1. Clone & Config
git clone [https://github.com/leoBitto/petunia.git](https://github.com/leoBitto/petunia.git)
cd petunia
cp .env.example .env
# 2. Add Credentials
mkdir -p config/credentials
cp /path/to/your/key.json config/credentials/service_account.json
# 3. Build & Run
./manager.sh setup
./manager.sh start
Once running, access the Dashboard at http://localhost:8501 to initialize the database.
Detailed documentation is available in the GitHub Wiki.
- Strategy Playbook: Deep dive into EMA and RSI logic.
- Risk Management: How position sizing and Fee calculation works.
- Architecture: System internals and data pipeline.
- Developer Guide: Project structure and contribution guidelines.
| Status | Module | Description |
|---|---|---|
| ✅ | Core v1.0 | Stable Docker Architecture, Risk Manager |
| ✅ | Strategies | Implemented Trend Following (EMA) & Mean Reversion (RSI) Logic |
| ✅ | Dynamic Config | Allow Strategy & Fee selection via Frontend |
| ✅ | Backtest Lab | Vectorized Engine, Max Drawdown Metrics & Fee Adjustment |
| Status | Module | Description |
|---|---|---|
| 🔮 | Grid Search Optimization: | Automated finding of best parameters (e.g., Best RSI period for Apple vs Tesla). |
| 🔮 | Universe Expansion: | Scaling data engine to handle 500+ tickers (S&P 500). |
| 🔮 | Deep Analytics: | Sharpe Ratio, Calmar Ratio, and Monte Carlo simulations. |
| Status | Module | Description |
|---|---|---|
| 🔮 | IaC | Terraform for GCP Infrastructure provisioning |
| 🔮 | Cloud Deploy | Production deployment on GCP Compute Engine |
| 🔮 | Secret Mgr | Migration to Google Secret Manager (No more .env) |
| 🔮 | Automation | Systemd services & Auto-healing pipelines |
- Sentiment Analysis: LLM-based analysis of financial news and social sentiment.
- AI Oracle: An autonomous agent that selects the best strategy based on current market regime.
- Headless Mode: Full autonomy with reduced UI dependency.
Released under the MIT License. © 2026 Leonardo Bitto