* Start building with orlean * Add missing file * Serialize grain state * Remove grain and proxies * update and add plan * Update a bit * Fix backtest grain * Fix backtest grain * Clean a bit
76 lines
2.1 KiB
C#
76 lines
2.1 KiB
C#
using System.ComponentModel.DataAnnotations;
|
|
using System.Globalization;
|
|
using Managing.Core;
|
|
using Managing.Domain.Candles;
|
|
using Orleans;
|
|
using static Managing.Common.Enums;
|
|
|
|
[GenerateSerializer]
|
|
public class LightSignal : ValueObject
|
|
{
|
|
public LightSignal(Ticker ticker, TradeDirection direction, Confidence confidence, Candle candle, DateTime date,
|
|
TradingExchanges exchange, IndicatorType indicatorType, SignalType signalType, string indicatorName)
|
|
{
|
|
Direction = direction;
|
|
Confidence = confidence;
|
|
Candle = candle;
|
|
Date = date;
|
|
Ticker = ticker;
|
|
Exchange = exchange;
|
|
Status = SignalStatus.WaitingForPosition;
|
|
IndicatorType = indicatorType;
|
|
IndicatorName = indicatorName;
|
|
SignalType = signalType;
|
|
|
|
Identifier =
|
|
$"{indicatorName}-{indicatorType}-{direction}-{ticker}-{candle?.Close.ToString(CultureInfo.InvariantCulture)}-{date:yyyyMMdd-HHmmss}";
|
|
}
|
|
|
|
[Id(0)]
|
|
[Required] public SignalStatus Status { get; set; }
|
|
|
|
[Id(1)]
|
|
[Required] public TradeDirection Direction { get; }
|
|
|
|
[Id(2)]
|
|
[Required] public Confidence Confidence { get; set; }
|
|
|
|
[Id(3)]
|
|
[Required] public Timeframe Timeframe { get; }
|
|
|
|
[Id(4)]
|
|
[Required] public DateTime Date { get; private set; }
|
|
|
|
[Id(5)]
|
|
[Required] public Candle Candle { get; }
|
|
|
|
[Id(6)]
|
|
[Required] public string Identifier { get; }
|
|
|
|
[Id(7)]
|
|
[Required] public Ticker Ticker { get; }
|
|
|
|
[Id(8)]
|
|
[Required] public TradingExchanges Exchange { get; set; }
|
|
|
|
[Id(9)]
|
|
[Required] public IndicatorType IndicatorType { get; set; }
|
|
|
|
[Id(10)]
|
|
[Required] public SignalType SignalType { get; set; }
|
|
|
|
[Id(11)]
|
|
[Required] public string IndicatorName { get; set; }
|
|
|
|
protected override IEnumerable<object> GetEqualityComponents()
|
|
{
|
|
yield return Direction;
|
|
yield return Confidence;
|
|
yield return Date;
|
|
}
|
|
|
|
public void SetConfidence(Confidence confidence)
|
|
{
|
|
Confidence = confidence;
|
|
}
|
|
} |