Rename strategy to indicators

This commit is contained in:
2025-06-16 22:09:23 +07:00
parent e4f4d078b2
commit 0f7df04813
45 changed files with 477 additions and 474 deletions

View File

@@ -0,0 +1,70 @@
using System.Text.Json.Serialization;
using Managing.Core.FixedSizedQueue;
using Managing.Domain.Candles;
using Managing.Domain.Scenarios;
using Managing.Domain.Strategies.Base;
using Managing.Domain.Users;
using static Managing.Common.Enums;
namespace Managing.Domain.Strategies
{
public class Indicator : IIndicator
{
public Indicator(string name, IndicatorType type)
{
Name = name;
Type = type;
SignalType = ScenarioHelpers.GetSignalType(type);
Candles = new FixedSizeQueue<Candle>(500);
}
public string Name { get; set; }
[JsonIgnore] public FixedSizeQueue<Candle> Candles { get; set; }
public IndicatorType Type { get; set; }
public SignalType SignalType { get; set; }
public int MinimumHistory { get; set; }
public int? Period { get; set; }
public int? FastPeriods { get; set; }
public int? SlowPeriods { get; set; }
public int? SignalPeriods { get; set; }
public double? Multiplier { get; set; }
public int? SmoothPeriods { get; set; }
public int? StochPeriods { get; set; }
public int? CyclePeriods { get; set; }
public User User { get; set; }
public virtual List<Signal> Run()
{
return new List<Signal>();
}
public virtual IndicatorsResultBase GetStrategyValues()
{
return new IndicatorsResultBase();
}
public void UpdateCandles(HashSet<Candle> newCandles)
{
if (newCandles == null || newCandles.Count == 0)
{
return;
}
lock (Candles)
{
foreach (var item in newCandles.ToList())
{
if (Candles.All(c => c.Date != item.Date))
{
Candles.Enqueue(item);
}
}
}
}
public string GetName()
{
return Name;
}
}
}