Refactor documentazione, versioning e deployment

- Riorganizzato README.md con badge versione, changelog, guida rapida e istruzioni semplificate per Docker/Unraid
- Creato CHANGELOG.md secondo standard Keep a Changelog/SemVer
- Aggiunto script bump-version.ps1 per gestione automatica versioni e tagging Git
- Aggiornate guide deployment: PUBLISHING_GUIDE.md, UNRAID_INSTALL.md e README.md in /deployment
- Modificato unraid-template.xml: porta WebUI configurabile (default 8888), volumi e variabili ambiente semplificati
- Aggiornata PROJECT_STRUCTURE.md con nuova struttura e best practices
- Migliorata chiarezza, professionalità e automazione del workflow di rilascio
This commit is contained in:
2025-12-21 18:31:00 +01:00
parent 121324dfc7
commit 0e64afa1f2
8 changed files with 417 additions and 1606 deletions

View File

@@ -5,414 +5,129 @@
[![.NET 10](https://img.shields.io/badge/.NET-10.0-512BD4)](https://dotnet.microsoft.com/)
[![Blazor](https://img.shields.io/badge/Blazor-Server-512BD4)](https://blazor.net/)
[![Docker](https://img.shields.io/badge/Docker-Ready-2496ED)](https://www.docker.com/)
[![License](https://img.shields.io/badge/License-MIT-green)](LICENSE)
---
## ?? Indice
- [Caratteristiche](#-caratteristiche)
- [Architettura](#-architettura)
- [Quick Start](#-quick-start)
- [Deployment](#-deployment)
- [Sviluppo](#-sviluppo)
- [Documentazione](#-documentazione)
[![Version](https://img.shields.io/badge/version-1.1.0-blue)](https://gitea.encke-hake.ts.net/Alby96/Encelado/-/packages)
---
## ? Caratteristiche
### ?? Trading Algoritmico
- **Simple Moving Average (SMA)** strategy integrata
- **Analisi tecnica** in tempo reale
- **Gestione portfolio** automatizzata
- **Simulazione trading** senza rischi reali
### ?? Dashboard Interattiva
- **Blazor Server UI** reattiva e moderna
- **Real-time updates** ogni 3 secondi
- **Grafici** statistiche di performance
- **Gestione asset** con configurazione granulare
### ?? Gestione Completa
- **15 Criptovalute** supportate (BTC, ETH, BNB, etc.)
- **Configurazione per asset** (importo, strategia)
- **History completa** delle operazioni
- **Settings centralizzate** e persistenti
### ?? Docker-Ready
- **Container ottimizzato** per produzione
- **Health checks** integrati
- **Volume persistente** per dati
- **Gitea Registry** integration
---
## ??? Architettura
```
TradingBot/
??? Components/ # Blazor Components
? ??? Pages/ # Pagine (Dashboard, Market, etc.)
? ??? Layout/ # Layout e ReconnectModal
? ??? Shared/ # Componenti condivisi
??? Services/ # Business Logic
? ??? TradingBotService.cs # Core service
? ??? SimulatedMarketDataService.cs # Market data
? ??? SimpleMovingAverageStrategy.cs # Trading strategy
? ??? SettingsService.cs # Persistenza settings
? ??? TechnicalAnalysis.cs # Indicatori tecnici
??? Models/ # Data Models
? ??? Trade.cs
? ??? MarketPrice.cs
? ??? TradingSignal.cs
? ??? ...
??? wwwroot/ # Static assets
? ??? css/
? ??? lib/
??? Properties/ # Configuration
? ??? PublishProfiles/ # Docker publish profiles
? ??? launchSettings.json
??? docs/ # Documentation
? ??? deployment/ # Deployment guides
??? Dockerfile # Docker multi-stage build
??? docker-compose.yml # Compose configuration
??? Program.cs # App entry point
```
### ?? Data Flow
```
Market Data ? Analysis ? Signal ? Execution ? Portfolio Update ? UI Refresh
? ? ? ? ? ?
Simulated SMA Buy/Sell Simulated Statistics Dashboard
Prices Strategy Hold Trade Update Update
```
- **Trading Algoritmico**: Simple Moving Average (SMA) strategy
- **Dashboard Blazor**: Real-time updates ogni 3 secondi
- **15 Criptovalute**: BTC, ETH, BNB, ADA, SOL, XRP, DOT, DOGE, AVAX, MATIC, LINK, LTC, UNI, ATOM, XLM
- **Analisi Tecnica**: SMA, EMA, RSI, MACD, Bollinger Bands
- **Portfolio Management**: Gestione automatizzata posizioni
- **Docker Ready**: Container ottimizzato con health checks
---
## ?? Quick Start
### Prerequisiti
- [.NET 10 SDK](https://dotnet.microsoft.com/download/dotnet/10.0)
- [Docker Desktop](https://www.docker.com/products/docker-desktop) (per deployment)
- [Visual Studio 2022](https://visualstudio.microsoft.com/) (consigliato) o VS Code
### Esecuzione Locale
### Locale (Development)
```bash
# Clone repository
git clone https://gitea.encke-hake.ts.net/Alby96/Encelado
cd Encelado/TradingBot
# Restore dependencies
dotnet restore
# Run
dotnet run
# Oppure da Visual Studio:
# F5 (Debug) o Ctrl+F5 (senza debug)
```
**Accedi a**: `http://localhost:5243`
Accedi a: `http://localhost:5243`
---
## ?? Deployment
### ?? Docker
#### Build & Run Locale
```bash
# Build image
docker build -t tradingbot:latest .
# Run container
docker run -d \
--name tradingbot \
-p 8080:8080 \
-v tradingbot-data:/app/data \
tradingbot:latest
```
**Accedi a**: `http://localhost:8080`
#### Con Docker Compose
```bash
docker-compose up -d
```
### ?? Unraid
Guida completa: [docs/deployment/UNRAID_NATIVE_INSTALL.md](docs/deployment/UNRAID_NATIVE_INSTALL.md)
**Quick Install**:
```bash
# Login Gitea Registry
docker login gitea.encke-hake.ts.net
# Download template
wget -O /boot/config/plugins/dockerMan/templates-user/TradingBot.xml \
https://gitea.encke-hake.ts.net/Alby96/Encelado/raw/branch/main/TradingBot/deployment/unraid-template.xml
# Install via Unraid Docker UI
```
### ?? Gitea Container Registry
#### Publish da Visual Studio
1. **Build** ? **Configuration Manager** ? **Release**
2. **Build** ? **Publish TradingBot**
3. Seleziona profilo **"Docker"**
4. Click **"Publish"**
Visual Studio automaticamente:
- ? Build immagine Docker
- ? Tag per Gitea Registry
- ? Push su `gitea.encke-hake.ts.net/alby96/encelado/tradingbot`
#### Pull & Deploy
### Docker
```bash
docker pull gitea.encke-hake.ts.net/alby96/encelado/tradingbot:latest
docker run -d -p 8080:8080 gitea.encke-hake.ts.net/alby96/encelado/tradingbot:latest
docker run -d -p 8888:8080 \
-v tradingbot-data:/app/data \
gitea.encke-hake.ts.net/alby96/encelado/tradingbot:latest
```
Accedi a: `http://localhost:8888`
### Unraid
Guida completa: [deployment/UNRAID_INSTALL.md](deployment/UNRAID_INSTALL.md)
```bash
# 1. Login Gitea Registry
docker login gitea.encke-hake.ts.net
# 2. Download template
wget -O /boot/config/plugins/dockerMan/templates-user/TradingBot.xml \
https://gitea.encke-hake.ts.net/Alby96/Encelado/raw/branch/main/TradingBot/deployment/unraid-template.xml
# 3. Install via Unraid Docker UI
```
---
## ?? Sviluppo
## ?? Versioning
### Struttura Progetto
### Current Version: `1.1.0`
- **`.NET 10`** - Latest .NET version
- **`Blazor Server`** - Interactive server-side rendering
- **`C# 14`** - Latest language features
- **`Bootstrap 5`** - Responsive UI framework
```powershell
# Bug fix (1.1.0 ? 1.1.1)
.\bump-version.ps1 patch -Message "Fix memory leak"
### Debug
# New feature (1.1.0 ? 1.2.0)
.\bump-version.ps1 minor -Message "Add RSI strategy"
#### Visual Studio
```
1. Set startup profile: "TradingBot" (HTTP) o "Docker"
2. F5 per debug con breakpoints
3. Hot Reload abilitato per UI changes
# Breaking change (1.1.0 ? 2.0.0)
.\bump-version.ps1 major -Message "New API"
```
#### VS Code
Vedi [CHANGELOG.md](CHANGELOG.md) per release notes complete.
---
## ?? Publishing
### Da Visual Studio
1. **Build** ? **Configuration Manager** ? **Release**
2. **Build** ? **Publish TradingBot** ? Profilo **Docker**
3. Click **Publish**
Il sistema automaticamente:
- ? Build Docker image
- ? Tag: `latest`, `1.1.0`, `1.1.0-20241217`
- ? Push su Gitea Registry
### Deploy su Unraid
```bash
# Install C# Dev Kit extension
# Open folder in VS Code
code .
# F5 per debug
# Docker tab ? TradingBot ? Stop ? Force Update ? Start
```
### Test Locale
```bash
# Run senza debug
dotnet run --no-build
# Watch mode (auto-rebuild on changes)
dotnet watch run
```
### Build Configuration
- **Debug**: Development, verbose logging, no optimizations
- **Release**: Production-ready, optimized, Docker-compatible
---
## ?? Documentazione
### Guide Deployment
- [**Unraid Native Install**](docs/deployment/UNRAID_NATIVE_INSTALL.md) - Installazione su Unraid senza Portainer
- [**Docker Compose**](docker-compose.yml) - Configurazione Docker Compose
- [**Template Unraid**](deployment/unraid-template.xml) - Template XML per Unraid
### API & Architettura
#### Services
- **TradingBotService**: Core trading logic e portfolio management
- **SimulatedMarketDataService**: Generazione dati di mercato simulati
- **SimpleMovingAverageStrategy**: Strategia SMA per segnali trading
- **SettingsService**: Persistenza configurazioni utente
- **TechnicalAnalysis**: Calcolo indicatori tecnici (SMA, EMA, RSI, MACD)
#### Models
- **Trade**: Rappresenta un'operazione di trading
- **MarketPrice**: Snapshot prezzo e volume di un asset
- **TradingSignal**: Segnale generato dalla strategia (Buy/Sell/Hold)
- **PortfolioStatistics**: Statistiche aggregate del portfolio
- **AssetConfiguration**: Configurazione per singolo asset
### Configurazione
#### Environment Variables
```bash
ASPNETCORE_ENVIRONMENT=Production # Development|Production
ASPNETCORE_URLS=http://+:8080 # Bind URL
EXTERNAL_PORT=8080 # External port (docker-compose)
```
#### Ports
- **5243**: HTTP (Development)
- **7241**: HTTPS (Development)
- **8080**: HTTP (Production/Docker)
#### Volumes
- **`/app/data`**: Persistenza dati (settings, trade history)
- **[UNRAID_INSTALL.md](deployment/UNRAID_INSTALL.md)** - Installazione completa su Unraid
- **[CHANGELOG.md](CHANGELOG.md)** - Release notes e versioni
- **[Dockerfile](Dockerfile)** - Docker multi-stage build
- **[docker-compose.yml](deployment/docker-compose.yml)** - Deploy con Compose
---
## ?? Configurazione Avanzata
## ??? Tecnologie
### Custom Strategy
Implementa `ITradingStrategy` per creare strategie personalizzate:
```csharp
public class MyCustomStrategy : ITradingStrategy
{
public string Name => "My Custom Strategy";
public Task<TradingSignal> AnalyzeAsync(string symbol, List<MarketPrice> prices)
{
// Your strategy logic here
return Task.FromResult(new TradingSignal { ... });
}
}
```
Registra nel `Program.cs`:
```csharp
builder.Services.AddSingleton<ITradingStrategy, MyCustomStrategy>();
```
### Asset Configuration
Modifica asset supportati in `TradingBotService.cs`:
```csharp
private void InitializeAssetConfigurations()
{
AssetConfigurations.Add("MYNEWCOIN", new AssetConfiguration
{
Symbol = "MYNEWCOIN",
Name = "My New Coin",
TradingAmount = 1000,
IsEnabled = true
});
}
```
---
## ?? Features Roadmap
### ? Implementato
- [x] Dashboard con statistiche real-time
- [x] Simulazione trading multi-asset
- [x] Simple Moving Average strategy
- [x] Portfolio management
- [x] Trade history
- [x] Settings persistenti
- [x] Docker support
- [x] Unraid template
- [x] Gitea Registry integration
### ?? In Sviluppo
- [ ] Autenticazione utenti
- [ ] Strategie avanzate (RSI, MACD, Bollinger Bands)
- [ ] Backtesting su dati storici
- [ ] API REST per integrazione esterna
- [ ] Notifiche (email, Telegram)
- [ ] Grafici interattivi (ChartJS/ApexCharts)
### ?? Pianificato
- [ ] Integrazione exchange reali (Binance, Coinbase)
- [ ] Machine Learning per prediction
- [ ] Multi-utente con isolation
- [ ] Mobile app (MAUI)
- [ ] Advanced analytics dashboard
---
## ??? Tecnologie Utilizzate
### Backend
- **.NET 10** - Framework applicativo
- **ASP.NET Core** - Web server
- **C# 14** - Linguaggio programmazione
### Frontend
- **Blazor Server** - UI framework
- **Bootstrap 5.3** - CSS framework
- **Bootstrap Icons** - Iconografia
### Infrastructure
- **Docker** - Containerization
- **Gitea** - Git repository & Container Registry
- **Unraid** - Home server platform
- **.NET 10** | **Blazor Server** | **C# 14**
- **Bootstrap 5.3** | **Docker** | **Gitea Registry**
---
## ?? License
Questo progetto è rilasciato sotto licenza MIT. Vedi [LICENSE](LICENSE) per dettagli.
---
## ?? Contributi
Contributi, issues e feature requests sono benvenuti!
1. Fork il progetto
2. Crea un feature branch (`git checkout -b feature/AmazingFeature`)
3. Commit le modifiche (`git commit -m 'Add AmazingFeature'`)
4. Push al branch (`git push origin feature/AmazingFeature`)
5. Apri una Pull Request
MIT License - Copyright © 2024 Alby96
---
## ?? Autore
**Alberto** (Alby96)
- Gitea: [@Alby96](https://gitea.encke-hake.ts.net/Alby96)
- Repository: [Encelado/TradingBot](https://gitea.encke-hake.ts.net/Alby96/Encelado)
---
## ?? Acknowledgments
- [Microsoft .NET](https://dotnet.microsoft.com/) - Amazing framework
- [Blazor](https://blazor.net/) - Modern web UI
- [Bootstrap](https://getbootstrap.com/) - Responsive design
- [Docker](https://www.docker.com/) - Containerization
- [Gitea](https://gitea.io/) - Self-hosted Git service
---
**Made with ?? for algorithmic trading enthusiasts**
?? **Happy Trading!**
**?? Happy Trading!**