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
This commit is contained in:
Oda
2025-07-03 00:13:42 +07:00
committed by GitHub
parent 453806356d
commit a547c4a040
103 changed files with 9916 additions and 810 deletions

View File

@@ -0,0 +1,119 @@
using System.ComponentModel.DataAnnotations;
using static Managing.Common.Enums;
namespace Managing.Api.Models.Requests;
/// <summary>
/// Simplified trading bot configuration request with only primary properties
/// </summary>
public class TradingBotConfigRequest
{
/// <summary>
/// The account name to use for trading
/// </summary>
[Required]
public string AccountName { get; set; }
/// <summary>
/// The ticker/symbol to trade
/// </summary>
[Required]
public Ticker Ticker { get; set; }
/// <summary>
/// The timeframe for trading decisions
/// </summary>
[Required]
public Timeframe Timeframe { get; set; }
/// <summary>
/// Whether this bot is for watching only (no actual trading)
/// </summary>
[Required]
public bool IsForWatchingOnly { get; set; }
/// <summary>
/// The initial trading balance for the bot
/// </summary>
[Required]
public decimal BotTradingBalance { get; set; }
/// <summary>
/// The type of bot (SimpleBot, ScalpingBot, FlippingBot)
/// </summary>
[Required]
public BotType BotType { get; set; }
/// <summary>
/// The name/identifier for this bot
/// </summary>
[Required]
public string Name { get; set; }
/// <summary>
/// Cooldown period between trades (in candles)
/// </summary>
[Required]
public int CooldownPeriod { get; set; }
/// <summary>
/// Maximum consecutive losses before stopping the bot
/// </summary>
[Required]
public int MaxLossStreak { get; set; }
/// <summary>
/// The scenario configuration (takes precedence over ScenarioName)
/// </summary>
public ScenarioRequest? Scenario { get; set; }
/// <summary>
/// The scenario name to load from database (only used when Scenario is not provided)
/// </summary>
public string? ScenarioName { get; set; }
/// <summary>
/// The money management name to load from database (only used when MoneyManagement is not provided)
/// </summary>
public string? MoneyManagementName { get; set; }
/// <summary>
/// The money management object to use for the bot
/// </summary>
public MoneyManagementRequest? MoneyManagement { get; set; }
/// <summary>
/// Maximum time in hours that a position can remain open before being automatically closed
/// </summary>
public decimal? MaxPositionTimeHours { get; set; }
/// <summary>
/// Whether to close positions early when they become profitable
/// </summary>
public bool CloseEarlyWhenProfitable { get; set; } = false;
/// <summary>
/// Whether to only flip positions when the current position is in profit
/// </summary>
public bool FlipOnlyWhenInProfit { get; set; } = true;
/// <summary>
/// Whether to use Synth API for predictions and risk assessment
/// </summary>
public bool UseSynthApi { get; set; } = false;
/// <summary>
/// Whether to use Synth predictions for position sizing adjustments
/// </summary>
public bool UseForPositionSizing { get; set; } = true;
/// <summary>
/// Whether to use Synth predictions for signal filtering
/// </summary>
public bool UseForSignalFiltering { get; set; } = true;
/// <summary>
/// Whether to use Synth predictions for dynamic stop-loss/take-profit adjustments
/// </summary>
public bool UseForDynamicStopLoss { get; set; } = true;
}