- Sidebar portfolio con metriche dettagliate (Totale, Investito, Disponibile, P&L, ROI) e aggiornamento real-time - Sistema multi-strategia: 8 strategie assegnabili per asset, voting decisionale, pagina Trading Control - Nuova pagina Posizioni: gestione, chiusura manuale, P&L non realizzato, notifiche - Sistema indicatori tecnici: 7+ indicatori configurabili, segnali real-time, raccomandazioni, storico segnali - Refactoring TradingBotService per capitale, P&L, ROI, eventi - Nuovi modelli e servizi per strategie/indicatori, persistenza configurazioni - UI/UX: navigazione aggiornata, widget, modali, responsive - Aggiornamento README e CHANGELOG con tutte le novità
61 lines
1.7 KiB
C#
61 lines
1.7 KiB
C#
using TradingBot.Components;
|
|
using TradingBot.Services;
|
|
|
|
var builder = WebApplication.CreateBuilder(args);
|
|
|
|
// Configure Kestrel - Solo in Development usa porte da launchSettings
|
|
// In Production/Docker usa porta 8080 su tutte le interfacce
|
|
if (builder.Environment.IsProduction() || builder.Environment.EnvironmentName == "Docker")
|
|
{
|
|
builder.WebHost.ConfigureKestrel(serverOptions =>
|
|
{
|
|
serverOptions.ListenAnyIP(8080);
|
|
});
|
|
}
|
|
|
|
// Add services to the container.
|
|
builder.Services.AddRazorComponents()
|
|
.AddInteractiveServerComponents();
|
|
|
|
// Trading Bot Services - Using Simulated Market Data
|
|
builder.Services.AddSingleton<IMarketDataService, SimulatedMarketDataService>();
|
|
builder.Services.AddSingleton<ITradingStrategy, SimpleMovingAverageStrategy>();
|
|
builder.Services.AddSingleton<TradeHistoryService>();
|
|
builder.Services.AddSingleton<LoggingService>();
|
|
builder.Services.AddSingleton<IndicatorsService>();
|
|
builder.Services.AddSingleton<TradingStrategiesService>();
|
|
builder.Services.AddSingleton<TradingBotService>();
|
|
builder.Services.AddSingleton<SettingsService>();
|
|
|
|
// Register background service for graceful shutdown
|
|
builder.Services.AddHostedService<TradingBotBackgroundService>();
|
|
|
|
// Add health checks for Docker
|
|
builder.Services.AddHealthChecks();
|
|
|
|
var app = builder.Build();
|
|
|
|
// Configure the HTTP request pipeline.
|
|
if (!app.Environment.IsDevelopment())
|
|
{
|
|
app.UseExceptionHandler("/Error", createScopeForErrors: true);
|
|
app.UseHsts();
|
|
}
|
|
|
|
// HTTPS redirect solo in Development
|
|
if (app.Environment.IsDevelopment())
|
|
{
|
|
app.UseHttpsRedirection();
|
|
}
|
|
|
|
app.UseStaticFiles();
|
|
app.UseAntiforgery();
|
|
|
|
// Health check endpoint
|
|
app.MapHealthChecks("/health");
|
|
|
|
app.MapRazorComponents<App>()
|
|
.AddInteractiveServerRenderMode();
|
|
|
|
app.Run();
|