Rename strategy to indicators
This commit is contained in:
@@ -249,12 +249,12 @@ public class RunBacktestRequest
|
||||
public bool Save { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// The name of the money management strategy to use (optional if MoneyManagement is provided)
|
||||
/// The name of the money management to use (optional if MoneyManagement is provided)
|
||||
/// </summary>
|
||||
public string? MoneyManagementName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The money management strategy details (optional if MoneyManagementName is provided)
|
||||
/// The money management details (optional if MoneyManagementName is provided)
|
||||
/// </summary>
|
||||
public MoneyManagement? MoneyManagement { get; set; }
|
||||
}
|
||||
@@ -28,7 +28,7 @@ public class ScenarioController : BaseController
|
||||
/// <param name="userService">The service for user-related operations.</param>
|
||||
public ScenarioController(
|
||||
IScenarioService scenarioService,
|
||||
IUserService userService)
|
||||
IUserService userService)
|
||||
: base(userService)
|
||||
{
|
||||
_scenarioService = scenarioService;
|
||||
@@ -52,7 +52,8 @@ public class ScenarioController : BaseController
|
||||
/// <param name="strategies">A list of strategy names to include in the scenario.</param>
|
||||
/// <returns>The created scenario.</returns>
|
||||
[HttpPost]
|
||||
public async Task<ActionResult<Scenario>> CreateScenario(string name, List<string> strategies, int? loopbackPeriod = null)
|
||||
public async Task<ActionResult<Scenario>> CreateScenario(string name, List<string> strategies,
|
||||
int? loopbackPeriod = null)
|
||||
{
|
||||
var user = await GetUser();
|
||||
return Ok(_scenarioService.CreateScenarioForUser(user, name, strategies, loopbackPeriod));
|
||||
@@ -83,31 +84,31 @@ public class ScenarioController : BaseController
|
||||
/// </summary>
|
||||
/// <returns>A list of strategies.</returns>
|
||||
[HttpGet]
|
||||
[Route("strategy")]
|
||||
public async Task<ActionResult<IEnumerable<Strategy>>> GetStrategies()
|
||||
[Route("indicator")]
|
||||
public async Task<ActionResult<IEnumerable<Indicator>>> GetIndicators()
|
||||
{
|
||||
var user = await GetUser();
|
||||
return Ok(_scenarioService.GetStrategiesByUser(user));
|
||||
return Ok(_scenarioService.GetIndicatorsByUser(user));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new strategy with specified parameters for the authenticated user.
|
||||
/// Creates a new indicator with specified parameters for the authenticated user.
|
||||
/// </summary>
|
||||
/// <param name="strategyType">The type of the strategy.</param>
|
||||
/// <param name="name">The name of the strategy.</param>
|
||||
/// <param name="period">The period for the strategy (optional).</param>
|
||||
/// <param name="fastPeriods">The fast periods for the strategy (optional).</param>
|
||||
/// <param name="slowPeriods">The slow periods for the strategy (optional).</param>
|
||||
/// <param name="signalPeriods">The signal periods for the strategy (optional).</param>
|
||||
/// <param name="multiplier">The multiplier for the strategy (optional).</param>
|
||||
/// <param name="stochPeriods">The stochastic periods for the strategy (optional).</param>
|
||||
/// <param name="smoothPeriods">The smooth periods for the strategy (optional).</param>
|
||||
/// <param name="cyclePeriods">The cycle periods for the strategy (optional).</param>
|
||||
/// <returns>The created strategy.</returns>
|
||||
/// <param name="indicatorType">The type of the indicator.</param>
|
||||
/// <param name="name">The name of the indicator.</param>
|
||||
/// <param name="period">The period for the indicator (optional).</param>
|
||||
/// <param name="fastPeriods">The fast periods for the indicator (optional).</param>
|
||||
/// <param name="slowPeriods">The slow periods for the indicator (optional).</param>
|
||||
/// <param name="signalPeriods">The signal periods for the indicator (optional).</param>
|
||||
/// <param name="multiplier">The multiplier for the indicator (optional).</param>
|
||||
/// <param name="stochPeriods">The stochastic periods for the indicator (optional).</param>
|
||||
/// <param name="smoothPeriods">The smooth periods for the indicator (optional).</param>
|
||||
/// <param name="cyclePeriods">The cycle periods for the indicator (optional).</param>
|
||||
/// <returns>The created indicator.</returns>
|
||||
[HttpPost]
|
||||
[Route("strategy")]
|
||||
public async Task<ActionResult<Strategy>> CreateStrategy(
|
||||
StrategyType strategyType,
|
||||
[Route("indicator")]
|
||||
public async Task<ActionResult<Indicator>> CreateIndicator(
|
||||
IndicatorType indicatorType,
|
||||
string name,
|
||||
int? period = null,
|
||||
int? fastPeriods = null,
|
||||
@@ -119,9 +120,9 @@ public class ScenarioController : BaseController
|
||||
int? cyclePeriods = null)
|
||||
{
|
||||
var user = await GetUser();
|
||||
return Ok(_scenarioService.CreateStrategyForUser(
|
||||
return Ok(_scenarioService.CreateIndicatorForUser(
|
||||
user,
|
||||
strategyType,
|
||||
indicatorType,
|
||||
name,
|
||||
period,
|
||||
fastPeriods,
|
||||
@@ -134,23 +135,23 @@ public class ScenarioController : BaseController
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deletes a strategy by name for the authenticated user.
|
||||
/// Deletes a indicator by name for the authenticated user.
|
||||
/// </summary>
|
||||
/// <param name="name">The name of the strategy to delete.</param>
|
||||
/// <param name="name">The name of the indicator to delete.</param>
|
||||
/// <returns>An ActionResult indicating the outcome of the operation.</returns>
|
||||
[HttpDelete]
|
||||
[Route("strategy")]
|
||||
public async Task<ActionResult> DeleteStrategy(string name)
|
||||
[Route("indicator")]
|
||||
public async Task<ActionResult> DeleteIndicator(string name)
|
||||
{
|
||||
var user = await GetUser();
|
||||
return Ok(_scenarioService.DeleteStrategyByUser(user, name));
|
||||
return Ok(_scenarioService.DeleteIndicatorByUser(user, name));
|
||||
}
|
||||
|
||||
// Update strategy
|
||||
// Update indicator
|
||||
[HttpPut]
|
||||
[Route("strategy")]
|
||||
public async Task<ActionResult> UpdateStrategy(
|
||||
StrategyType strategyType,
|
||||
[Route("indicator")]
|
||||
public async Task<ActionResult> Updateindicator(
|
||||
IndicatorType indicatorType,
|
||||
string name,
|
||||
int? period = null,
|
||||
int? fastPeriods = null,
|
||||
@@ -162,9 +163,9 @@ public class ScenarioController : BaseController
|
||||
int? cyclePeriods = null)
|
||||
{
|
||||
var user = await GetUser();
|
||||
return Ok(_scenarioService.UpdateStrategyByUser(
|
||||
return Ok(_scenarioService.UpdateIndicatorByUser(
|
||||
user,
|
||||
strategyType,
|
||||
indicatorType,
|
||||
name,
|
||||
period,
|
||||
fastPeriods,
|
||||
|
||||
Reference in New Issue
Block a user