Trading bot grain (#33)
* Trading bot Grain * Fix a bit more of the trading bot * Advance on the tradingbot grain * Fix build * Fix db script * Fix user login * Fix a bit backtest * Fix cooldown and backtest * start fixing bot start * Fix startup * Setup local db * Fix build and update candles and scenario * Add bot registry * Add reminder * Updateing the grains * fix bootstraping * Save stats on tick * Save bot data every tick * Fix serialization * fix save bot stats * Fix get candles * use dict instead of list for position * Switch hashset to dict * Fix a bit * Fix bot launch and bot view * add migrations * Remove the tolist * Add agent grain * Save agent summary * clean * Add save bot * Update get bots * Add get bots * Fix stop/restart * fix Update config * Update scanner table on new backtest saved * Fix backtestRowDetails.tsx * Fix agentIndex * Update agentIndex * Fix more things * Update user cache * Fix * Fix account load/start/restart/run
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
using Orleans;
|
||||
using static Managing.Common.Enums;
|
||||
|
||||
namespace Managing.Application.Abstractions.Grains;
|
||||
|
||||
/// <summary>
|
||||
/// Orleans grain interface for LiveBotRegistry operations.
|
||||
/// This interface defines the distributed, async operations available for the bot registry.
|
||||
/// The registry acts as a central, durable directory for all LiveTradingBot grains.
|
||||
/// </summary>
|
||||
public interface ILiveBotRegistryGrain : IGrainWithIntegerKey
|
||||
{
|
||||
/// <summary>
|
||||
/// Registers a new bot with its user ID. This should be called by the LiveTradingBotGrain when it is first initialized.
|
||||
/// The initial status will be BotStatus.Up.
|
||||
/// </summary>
|
||||
/// <param name="identifier">The unique identifier of the bot</param>
|
||||
/// <param name="userId">The unique identifier of the user who owns the bot</param>
|
||||
/// <returns>A task that represents the asynchronous operation</returns>
|
||||
Task RegisterBot(Guid identifier, int userId);
|
||||
|
||||
/// <summary>
|
||||
/// Removes a bot from the registry. This should be a full removal, perhaps called when a user permanently deletes a bot.
|
||||
/// </summary>
|
||||
/// <param name="identifier">The unique identifier of the bot to unregister</param>
|
||||
/// <returns>A task that represents the asynchronous operation</returns>
|
||||
Task UnregisterBot(Guid identifier);
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of all bots in the registry. This is for a management dashboard to see all bots in the system.
|
||||
/// </summary>
|
||||
/// <returns>A list of all BotRegistryEntry objects in the registry</returns>
|
||||
Task<List<BotRegistryEntry>> GetAllBots();
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of all bots associated with a specific user. This is the primary method for a user's watchlist.
|
||||
/// </summary>
|
||||
/// <param name="userId">The unique identifier of the user</param>
|
||||
/// <returns>A list of BotRegistryEntry objects for the specified user</returns>
|
||||
Task<List<BotRegistryEntry>> GetBotsForUser(int userId);
|
||||
|
||||
/// <summary>
|
||||
/// A dedicated method for updating only the bot's Status field (Up/Down).
|
||||
/// This will be called by LiveTradingBot's StartAsync and StopAsync methods.
|
||||
/// </summary>
|
||||
/// <param name="identifier">The unique identifier of the bot</param>
|
||||
/// <param name="status">The new status to set for the bot</param>
|
||||
/// <returns>A task that represents the asynchronous operation</returns>
|
||||
Task UpdateBotStatus(Guid identifier, BotStatus status);
|
||||
Task<BotStatus> GetBotStatus(Guid identifier);
|
||||
}
|
||||
Reference in New Issue
Block a user