Files
managing-apps/src/Managing.Application.Abstractions/Repositories/ISynthRepository.cs
Oda a547c4a040 Add synthApi (#27)
* Add synthApi

* Put confidence for Synth proba

* Update the code

* Update readme

* Fix bootstraping

* fix github build

* Update the endpoints for scenario

* Add scenario and update backtest modal

* Update bot modal

* Update interfaces for synth

* add synth to backtest

* Add Kelly criterion and better signal

* Update signal confidence

* update doc

* save leaderboard and prediction

* Update nswag to generate ApiClient in the correct path

* Unify the trading modal

* Save miner and prediction

* Update messaging and block new signal until position not close when flipping off

* Rename strategies to indicators

* Update doc

* Update chart + add signal name

* Fix signal direction

* Update docker webui

* remove crypto npm

* Clean
2025-07-03 00:13:42 +07:00

59 lines
2.3 KiB
C#

using Managing.Domain.Synth.Models;
namespace Managing.Application.Abstractions.Repositories;
/// <summary>
/// Repository interface for Synth-related data operations
/// Provides MongoDB persistence for leaderboard and individual predictions data
/// </summary>
public interface ISynthRepository
{
/// <summary>
/// Gets cached leaderboard data by cache key
/// </summary>
/// <param name="cacheKey">The cache key to search for</param>
/// <returns>Cached leaderboard data if found, null otherwise</returns>
Task<SynthMinersLeaderboard?> GetLeaderboardAsync(string cacheKey);
/// <summary>
/// Saves leaderboard data to MongoDB
/// </summary>
/// <param name="leaderboard">The leaderboard data to save</param>
Task SaveLeaderboardAsync(SynthMinersLeaderboard leaderboard);
/// <summary>
/// Gets individual cached prediction data by asset, parameters, and miner UIDs
/// </summary>
/// <param name="asset">Asset symbol</param>
/// <param name="timeIncrement">Time increment in seconds</param>
/// <param name="timeLength">Time length in seconds</param>
/// <param name="minerUids">List of miner UIDs to get predictions for</param>
/// <param name="isBacktest">Whether this is backtest data</param>
/// <param name="signalDate">Signal date for backtest data</param>
/// <returns>List of cached individual predictions</returns>
Task<List<SynthPrediction>> GetIndividualPredictionsAsync(
string asset,
int timeIncrement,
int timeLength,
List<int> minerUids,
bool isBacktest,
DateTime? signalDate);
/// <summary>
/// Saves individual prediction data to MongoDB
/// </summary>
/// <param name="prediction">The individual prediction data to save</param>
Task SaveIndividualPredictionAsync(SynthPrediction prediction);
/// <summary>
/// Saves multiple individual predictions to MongoDB in batch
/// </summary>
/// <param name="predictions">The list of individual predictions to save</param>
Task SaveIndividualPredictionsAsync(List<SynthPrediction> predictions);
/// <summary>
/// Cleans up old cached data beyond the retention period
/// </summary>
/// <param name="retentionDays">Number of days to retain data</param>
Task CleanupOldDataAsync(int retentionDays = 30);
}