Skip to content

Commit 9c4d5aa

Browse files
committed
Fix: Vectorized strategy logic, Fee management implementation, and Dashboard logs tab.
1 parent 1e7646e commit 9c4d5aa

2 files changed

Lines changed: 26 additions & 20 deletions

File tree

dashboard/Home.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,10 @@
1515

1616
# Usiamo un container colorato per evidenziare la strategia
1717
with st.container():
18-
c_badge, c_link = st.columns([3, 1])
18+
c_badge, _ = st.columns([3, 1])
1919
with c_badge:
2020
st.info(f"🧠 **Active Intelligence:** The system is currently running on **{active_strat}** strategy.")
21-
with c_link:
22-
# Purtroppo Streamlit non ha link interni facili, usiamo un testo guida
23-
st.caption("Change Strategy in:")
24-
st.page_link("pages/control_panel.py", label="🕹️ Control Panel", icon="🔧")
21+
2522
except Exception as e:
2623
st.error(f"⚠️ Error loading configuration: {e}")
2724

docs/README.md

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Automated trading data pipeline & decision support system. Fetches market data,
1616
![License](https://img.shields.io/badge/license-MIT-green)
1717

1818
**Last Update:** January 2026
19-
**Version:** 1.3.0 (Dynamic Config & Backtest Lab)
19+
**Version:** 1.4.0 (Vectorized Engine & Fee-Adjusted Backtesting)
2020
**Wiki:** [Complete Documentation](https://github.com/leoBitto/petunia/wiki)
2121

2222
---
@@ -27,10 +27,21 @@ Automated trading data pipeline & decision support system. Fetches market data,
2727

2828
### Key Features
2929
* 🐳 **Containerized Architecture:** Isolated Docker environments for App and Database (PostgreSQL).
30-
* 📈 **Strategy Factory:** Plug-and-play strategy engine (Currently supporting **EMA Crossover** & **RSI Mean Reversion**).
31-
* 🧪 **Backtest Lab:** Advanced simulation engine with Benchmark capabilities and Plotly visualizations.
30+
* 📈 **Strategy Factory:** Plug-and-play strategy engine with **Vectorized Execution** for high performance (Currently supporting **EMA Crossover** & **RSI Mean Reversion**).
31+
* 🧪 **Backtest Lab:** Realistic simulation engine with **Fee/Commission structure** (Fixed + Variable), Benchmark capabilities, and detailed metrics (ROI, Max Drawdown).
3232
* 🛡️ **Risk First:** Built-in Risk Manager enforcing the 2% Rule and ATR-based volatility stops.
33-
* 📊 **Interactive Dashboard:** Streamlit UI for portfolio monitoring, strategy configuration, and system control.
33+
* 📊 **Interactive Dashboard:** Streamlit UI for portfolio monitoring, strategy configuration, system control, and log inspection.
34+
35+
---
36+
37+
## ⚙️ Configuration (`config/strategies.json`)
38+
39+
The system behavior is fully customizable via JSON, manageable directly from the **Control Panel**:
40+
41+
- **`active_strategy`**: Selects the logic to run in production (e.g., "RSI").
42+
- **`risk_params`**: Controls capital exposure (Risk % per trade, Stop Loss ATR multiplier).
43+
- **`fees_config`**: Simulates broker costs (Fixed fee + % per trade) for realistic backtests and net-profit calculation.
44+
- **`strategies_params`**: Specific parameters for each algorithm (e.g., RSI Period, EMA Windows).
3445

3546
---
3647

@@ -67,8 +78,8 @@ Once running, access the Dashboard at **`http://localhost:8501`** to initialize
6778
Detailed documentation is available in the **[GitHub Wiki](https://github.com/leoBitto/petunia/wiki)**.
6879

6980
* **[Strategy Playbook](https://www.google.com/search?q=https://github.com/leoBitto/petunia/wiki/Strategy-Playbook):** Deep dive into EMA and RSI logic.
70-
* **[Risk Management](https://www.google.com/search?q=https://github.com/leoBitto/petunia/wiki/Risk-Management-Bible):** How position sizing works.
71-
* **[Architecture](https://www.google.com/search?q=https://github.com/leoBitto/petunia/wiki/Architecture-%26-Data-Flow):** System internals and data pipeline.
81+
* **[Risk Management](https://www.google.com/search?q=https://github.com/leoBitto/petunia/wiki/Risk-Management-Bible):** How position sizing and Fee calculation works.
82+
* **[Architecture](https://www.google.com/search?q=https://github.com/leoBitto/petunia/wiki/Architecture-%2526-Data-Flow):** System internals and data pipeline.
7283
* **[Developer Guide](https://www.google.com/search?q=https://github.com/leoBitto/petunia/wiki/Developer-Guide):** Project structure and contribution guidelines.
7384

7485
---
@@ -78,17 +89,16 @@ Detailed documentation is available in the **[GitHub Wiki](https://github.com/le
7889
### v1.x - Expansion & Testing (Completed)
7990

8091
| Status | Module | Description |
81-
| :---: | :--- | :--- |
92+
| --- | --- | --- |
8293
|| **Core v1.0** | Stable Docker Architecture, Risk Manager |
83-
|| **Testing** | Full PyTest Suite: Unit, Mocking, and DB Integration |
8494
|| **Strategies** | Implemented Trend Following (EMA) & Mean Reversion (RSI) Logic |
85-
|| **Dynamic Config** | Allow Strategy selection via Frontend (DB-backed Settings) |
86-
|| **Backtest Lab** | Unified Benchmark Engine & Interactive Plotly Charts |
95+
|| **Dynamic Config** | Allow Strategy & Fee selection via Frontend |
96+
|| **Backtest Lab** | Vectorized Engine, Max Drawdown Metrics & Fee Adjustment |
8797

8898
### v2.0 - Cloud Native & DevOps (Next Up)
8999

90100
| Status | Module | Description |
91-
| :---: | :--- | :--- |
101+
| --- | --- | --- |
92102
| 🔮 | **IaC** | Terraform for GCP Infrastructure provisioning |
93103
| 🔮 | **Cloud Deploy** | Production deployment on GCP Compute Engine |
94104
| 🔮 | **Secret Mgr** | Migration to Google Secret Manager (No more .env) |
@@ -98,18 +108,17 @@ Detailed documentation is available in the **[GitHub Wiki](https://github.com/le
98108

99109
* **Grid Search Optimization:** Automated finding of best parameters (e.g., Best RSI period for Apple vs Tesla).
100110
* **Universe Expansion:** Scaling data engine to handle 500+ tickers (S&P 500).
101-
* **New Strategies:** Bollinger Bands, MACD, and Volume-based strategies.
102-
* **Deep Analytics:** Sharpe Ratio, Max Drawdown, and Calmar Ratio metrics in Dashboard.
111+
* **Deep Analytics:** Sharpe Ratio, Calmar Ratio, and Monte Carlo simulations.
103112

104113
### v4.0 - AI Agent & Alternative Data
105114

106115
* **Sentiment Analysis:** LLM-based analysis of financial news and social sentiment.
107-
* **AI Oracle:** An autonomous agent that selects the best strategy based on current market regime (Bull/Bear/Crab).
116+
* **AI Oracle:** An autonomous agent that selects the best strategy based on current market regime.
108117
* **Headless Mode:** Full autonomy with reduced UI dependency.
118+
109119
---
110120

111121
## 📄 License
112122

113123
Released under the **MIT License**.
114124
© 2026 Leonardo Bitto
115-

0 commit comments

Comments
 (0)