docker files fixes from liaqat
This commit is contained in:
39
src/Managing.Domain/Strategies/Base/EmaBaseStrategy.cs
Normal file
39
src/Managing.Domain/Strategies/Base/EmaBaseStrategy.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using Managing.Common;
|
||||
using Managing.Domain.Candles;
|
||||
using Skender.Stock.Indicators;
|
||||
|
||||
namespace Managing.Domain.Strategies.Base;
|
||||
|
||||
public abstract class EmaBaseStrategy : Strategy
|
||||
{
|
||||
protected EmaBaseStrategy(string name, Enums.Timeframe timeframe, Enums.StrategyType type) : base(name, timeframe, type)
|
||||
{
|
||||
}
|
||||
|
||||
protected List<CandleEma> MapEmaToCandle(List<EmaResult> ema, IEnumerable<Candle> candles)
|
||||
{
|
||||
var emaList = new List<CandleEma>();
|
||||
foreach (var candle in candles)
|
||||
{
|
||||
var currentEma = ema.Find(candle.Date);
|
||||
if (currentEma != null && currentEma.Ema.HasValue)
|
||||
{
|
||||
emaList.Add(new CandleEma()
|
||||
{
|
||||
Close = candle.Close,
|
||||
Open = candle.Open,
|
||||
Date = candle.Date,
|
||||
Ticker = candle.Ticker,
|
||||
Exchange = candle.Exchange,
|
||||
Ema = currentEma.Ema.Value,
|
||||
});
|
||||
}
|
||||
}
|
||||
return emaList;
|
||||
}
|
||||
|
||||
public class CandleEma : Candle
|
||||
{
|
||||
public double Ema { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user