Add Genetic workers
This commit is contained in:
@@ -0,0 +1,57 @@
|
||||
using Managing.Domain.Backtests;
|
||||
using Managing.Domain.Users;
|
||||
|
||||
namespace Managing.Application.Abstractions.Repositories;
|
||||
|
||||
/// <summary>
|
||||
/// Repository interface for genetic algorithm requests
|
||||
/// </summary>
|
||||
public interface IGeneticRepository
|
||||
{
|
||||
/// <summary>
|
||||
/// Inserts a genetic request for a user
|
||||
/// </summary>
|
||||
/// <param name="user">The user</param>
|
||||
/// <param name="geneticRequest">The genetic request to insert</param>
|
||||
void InsertGeneticRequestForUser(User user, GeneticRequest geneticRequest);
|
||||
|
||||
/// <summary>
|
||||
/// Gets all genetic requests for a user
|
||||
/// </summary>
|
||||
/// <param name="user">The user to get requests for</param>
|
||||
/// <returns>Collection of genetic requests</returns>
|
||||
IEnumerable<GeneticRequest> GetGeneticRequestsByUser(User user);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a specific genetic request by ID for a user
|
||||
/// </summary>
|
||||
/// <param name="user">The user</param>
|
||||
/// <param name="id">The request ID</param>
|
||||
/// <returns>The genetic request or null if not found</returns>
|
||||
GeneticRequest GetGeneticRequestByIdForUser(User user, string id);
|
||||
|
||||
/// <summary>
|
||||
/// Updates a genetic request
|
||||
/// </summary>
|
||||
/// <param name="geneticRequest">The genetic request to update</param>
|
||||
void UpdateGeneticRequest(GeneticRequest geneticRequest);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a genetic request by ID for a user
|
||||
/// </summary>
|
||||
/// <param name="user">The user</param>
|
||||
/// <param name="id">The request ID</param>
|
||||
void DeleteGeneticRequestByIdForUser(User user, string id);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes all genetic requests for a user
|
||||
/// </summary>
|
||||
/// <param name="user">The user</param>
|
||||
void DeleteAllGeneticRequestsForUser(User user);
|
||||
|
||||
/// <summary>
|
||||
/// Gets all pending genetic requests across all users
|
||||
/// </summary>
|
||||
/// <returns>Collection of pending genetic requests</returns>
|
||||
IEnumerable<GeneticRequest> GetPendingGeneticRequests();
|
||||
}
|
||||
@@ -2,6 +2,7 @@
|
||||
using Managing.Domain.Bots;
|
||||
using Managing.Domain.Candles;
|
||||
using Managing.Domain.Users;
|
||||
using static Managing.Common.Enums;
|
||||
|
||||
namespace Managing.Application.Abstractions.Services
|
||||
{
|
||||
@@ -48,5 +49,26 @@ namespace Managing.Application.Abstractions.Services
|
||||
Backtest GetBacktestByIdForUser(User user, string id);
|
||||
bool DeleteBacktestByUser(User user, string id);
|
||||
bool DeleteBacktestsByUser(User user);
|
||||
|
||||
// Genetic algorithm request methods
|
||||
GeneticRequest CreateGeneticRequest(
|
||||
User user,
|
||||
Ticker ticker,
|
||||
Timeframe timeframe,
|
||||
DateTime startDate,
|
||||
DateTime endDate,
|
||||
decimal balance,
|
||||
int populationSize,
|
||||
int generations,
|
||||
double mutationRate,
|
||||
string selectionMethod,
|
||||
int elitismPercentage,
|
||||
double maxTakeProfit,
|
||||
List<IndicatorType> eligibleIndicators);
|
||||
|
||||
IEnumerable<GeneticRequest> GetGeneticRequestsByUser(User user);
|
||||
GeneticRequest GetGeneticRequestByIdForUser(User user, string id);
|
||||
void UpdateGeneticRequest(GeneticRequest geneticRequest);
|
||||
void DeleteGeneticRequestByIdForUser(User user, string id);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
using Managing.Domain.Backtests;
|
||||
using Managing.Domain.Users;
|
||||
using static Managing.Common.Enums;
|
||||
|
||||
namespace Managing.Application.Abstractions.Services;
|
||||
|
||||
/// <summary>
|
||||
/// Service for managing genetic algorithm requests
|
||||
/// </summary>
|
||||
public interface IGeneticService
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates a new genetic request for a user
|
||||
/// </summary>
|
||||
/// <param name="user">The user creating the request</param>
|
||||
/// <param name="ticker">The ticker to optimize for</param>
|
||||
/// <param name="timeframe">The timeframe to use</param>
|
||||
/// <param name="startDate">The start date for the backtest period</param>
|
||||
/// <param name="endDate">The end date for the backtest period</param>
|
||||
/// <param name="balance">The starting balance</param>
|
||||
/// <param name="populationSize">The population size for the genetic algorithm</param>
|
||||
/// <param name="generations">The number of generations to evolve</param>
|
||||
/// <param name="mutationRate">The mutation rate (0.0 - 1.0)</param>
|
||||
/// <param name="selectionMethod">The selection method to use</param>
|
||||
/// <param name="elitismPercentage">The percentage of elite individuals to preserve</param>
|
||||
/// <param name="maxTakeProfit">The maximum take profit percentage</param>
|
||||
/// <param name="eligibleIndicators">The list of eligible indicators</param>
|
||||
/// <returns>The created genetic request</returns>
|
||||
GeneticRequest CreateGeneticRequest(
|
||||
User user,
|
||||
Ticker ticker,
|
||||
Timeframe timeframe,
|
||||
DateTime startDate,
|
||||
DateTime endDate,
|
||||
decimal balance,
|
||||
int populationSize,
|
||||
int generations,
|
||||
double mutationRate,
|
||||
string selectionMethod,
|
||||
int elitismPercentage,
|
||||
double maxTakeProfit,
|
||||
List<IndicatorType> eligibleIndicators);
|
||||
|
||||
/// <summary>
|
||||
/// Gets all genetic requests for a user
|
||||
/// </summary>
|
||||
/// <param name="user">The user to get requests for</param>
|
||||
/// <returns>Collection of genetic requests</returns>
|
||||
IEnumerable<GeneticRequest> GetGeneticRequestsByUser(User user);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a specific genetic request by ID for a user
|
||||
/// </summary>
|
||||
/// <param name="user">The user</param>
|
||||
/// <param name="id">The request ID</param>
|
||||
/// <returns>The genetic request or null if not found</returns>
|
||||
GeneticRequest GetGeneticRequestByIdForUser(User user, string id);
|
||||
|
||||
/// <summary>
|
||||
/// Updates a genetic request
|
||||
/// </summary>
|
||||
/// <param name="geneticRequest">The genetic request to update</param>
|
||||
void UpdateGeneticRequest(GeneticRequest geneticRequest);
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a genetic request by ID for a user
|
||||
/// </summary>
|
||||
/// <param name="user">The user</param>
|
||||
/// <param name="id">The request ID</param>
|
||||
void DeleteGeneticRequestByIdForUser(User user, string id);
|
||||
|
||||
/// <summary>
|
||||
/// Gets all pending genetic requests across all users
|
||||
/// </summary>
|
||||
/// <returns>Collection of pending genetic requests</returns>
|
||||
IEnumerable<GeneticRequest> GetPendingGeneticRequests();
|
||||
}
|
||||
Reference in New Issue
Block a user