Fix run time
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
using Orleans;
|
||||||
using static Managing.Common.Enums;
|
using static Managing.Common.Enums;
|
||||||
|
|
||||||
namespace Managing.Application.Abstractions.Models;
|
namespace Managing.Application.Abstractions.Models;
|
||||||
@@ -5,98 +6,117 @@ namespace Managing.Application.Abstractions.Models;
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Platform-wide statistics without individual agent details
|
/// Platform-wide statistics without individual agent details
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[GenerateSerializer]
|
||||||
public class PlatformSummaryViewModel
|
public class PlatformSummaryViewModel
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Total number of agents on the platform
|
/// Total number of agents on the platform
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[Id(0)]
|
||||||
public required int TotalAgents { get; set; }
|
public required int TotalAgents { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Total number of active strategies across all agents
|
/// Total number of active strategies across all agents
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[Id(1)]
|
||||||
public required int TotalActiveStrategies { get; set; }
|
public required int TotalActiveStrategies { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Total platform-wide profit and loss in USD
|
/// Total platform-wide profit and loss in USD
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[Id(2)]
|
||||||
public required decimal TotalPlatformPnL { get; set; }
|
public required decimal TotalPlatformPnL { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Total volume traded across all agents in USD
|
/// Total volume traded across all agents in USD
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[Id(3)]
|
||||||
public required decimal TotalPlatformVolume { get; set; }
|
public required decimal TotalPlatformVolume { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Total volume traded across all agents in the last 24 hours in USD
|
/// Total volume traded across all agents in the last 24 hours in USD
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[Id(4)]
|
||||||
public required decimal TotalPlatformVolumeLast24h { get; set; }
|
public required decimal TotalPlatformVolumeLast24h { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Total open interest across all positions in USD
|
/// Total open interest across all positions in USD
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[Id(5)]
|
||||||
public required decimal TotalOpenInterest { get; set; }
|
public required decimal TotalOpenInterest { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Total number of open positions across all strategies
|
/// Total number of open positions across all strategies
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[Id(6)]
|
||||||
public required int TotalPositionCount { get; set; }
|
public required int TotalPositionCount { get; set; }
|
||||||
|
|
||||||
// 24-hour changes
|
// 24-hour changes
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Change in agent count over the last 24 hours
|
/// Change in agent count over the last 24 hours
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[Id(7)]
|
||||||
public required int AgentsChange24h { get; set; }
|
public required int AgentsChange24h { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Change in strategy count over the last 24 hours
|
/// Change in strategy count over the last 24 hours
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[Id(8)]
|
||||||
public required int StrategiesChange24h { get; set; }
|
public required int StrategiesChange24h { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Change in PnL over the last 24 hours
|
/// Change in PnL over the last 24 hours
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[Id(9)]
|
||||||
public required decimal PnLChange24h { get; set; }
|
public required decimal PnLChange24h { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Change in volume over the last 24 hours
|
/// Change in volume over the last 24 hours
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[Id(10)]
|
||||||
public required decimal VolumeChange24h { get; set; }
|
public required decimal VolumeChange24h { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Change in open interest over the last 24 hours
|
/// Change in open interest over the last 24 hours
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[Id(11)]
|
||||||
public required decimal OpenInterestChange24h { get; set; }
|
public required decimal OpenInterestChange24h { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Change in position count over the last 24 hours
|
/// Change in position count over the last 24 hours
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[Id(12)]
|
||||||
public required int PositionCountChange24h { get; set; }
|
public required int PositionCountChange24h { get; set; }
|
||||||
|
|
||||||
// Breakdowns
|
// Breakdowns
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Volume breakdown by asset/ticker
|
/// Volume breakdown by asset/ticker
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[Id(13)]
|
||||||
public required Dictionary<string, decimal> VolumeByAsset { get; set; }
|
public required Dictionary<string, decimal> VolumeByAsset { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Position count breakdown by asset/ticker
|
/// Position count breakdown by asset/ticker
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[Id(14)]
|
||||||
public required Dictionary<string, int> PositionCountByAsset { get; set; }
|
public required Dictionary<string, int> PositionCountByAsset { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Position count breakdown by direction (Long/Short)
|
/// Position count breakdown by direction (Long/Short)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[Id(15)]
|
||||||
public required Dictionary<TradeDirection, int> PositionCountByDirection { get; set; }
|
public required Dictionary<TradeDirection, int> PositionCountByDirection { get; set; }
|
||||||
|
|
||||||
// Metadata
|
// Metadata
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// When the data was last updated
|
/// When the data was last updated
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[Id(16)]
|
||||||
public required DateTime LastUpdated { get; set; }
|
public required DateTime LastUpdated { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// When the last 24-hour snapshot was taken
|
/// When the last 24-hour snapshot was taken
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[Id(17)]
|
||||||
public required DateTime Last24HourSnapshot { get; set; }
|
public required DateTime Last24HourSnapshot { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -148,6 +148,11 @@ public static class ApiBootstrap
|
|||||||
options.ConnectionString = postgreSqlConnectionString;
|
options.ConnectionString = postgreSqlConnectionString;
|
||||||
options.Invariant = "Npgsql";
|
options.Invariant = "Npgsql";
|
||||||
})
|
})
|
||||||
|
.AddAdoNetGrainStorage("platform-summary-store", options =>
|
||||||
|
{
|
||||||
|
options.ConnectionString = postgreSqlConnectionString;
|
||||||
|
options.Invariant = "Npgsql";
|
||||||
|
})
|
||||||
.ConfigureServices(services =>
|
.ConfigureServices(services =>
|
||||||
{
|
{
|
||||||
// Register existing services for Orleans DI
|
// Register existing services for Orleans DI
|
||||||
@@ -173,7 +178,7 @@ public static class ApiBootstrap
|
|||||||
services.AddScoped<ISettingsService, SettingsService>();
|
services.AddScoped<ISettingsService, SettingsService>();
|
||||||
services.AddScoped<IUserService, UserService>();
|
services.AddScoped<IUserService, UserService>();
|
||||||
services.AddScoped<IGeneticService, GeneticService>();
|
services.AddScoped<IGeneticService, GeneticService>();
|
||||||
services.AddSingleton<IBotService, BotService>();
|
services.AddScoped<IBotService, BotService>();
|
||||||
services.AddScoped<IWorkerService, WorkerService>();
|
services.AddScoped<IWorkerService, WorkerService>();
|
||||||
services.AddScoped<ISynthPredictionService, SynthPredictionService>();
|
services.AddScoped<ISynthPredictionService, SynthPredictionService>();
|
||||||
services.AddScoped<ISynthApiClient, SynthApiClient>();
|
services.AddScoped<ISynthApiClient, SynthApiClient>();
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ public static class WorkersBootstrap
|
|||||||
services.AddScoped<ISettingsService, SettingsService>();
|
services.AddScoped<ISettingsService, SettingsService>();
|
||||||
services.AddScoped<IUserService, UserService>();
|
services.AddScoped<IUserService, UserService>();
|
||||||
services.AddScoped<IGeneticService, GeneticService>();
|
services.AddScoped<IGeneticService, GeneticService>();
|
||||||
services.AddSingleton<IBotService, BotService>();
|
services.AddScoped<IBotService, BotService>();
|
||||||
services.AddScoped<IWorkerService, WorkerService>();
|
services.AddScoped<IWorkerService, WorkerService>();
|
||||||
services.AddScoped<ISynthPredictionService, SynthPredictionService>();
|
services.AddScoped<ISynthPredictionService, SynthPredictionService>();
|
||||||
services.AddScoped<ISynthApiClient, SynthApiClient>();
|
services.AddScoped<ISynthApiClient, SynthApiClient>();
|
||||||
|
|||||||
Reference in New Issue
Block a user