Files

91 lines
2.8 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using FinlyticCore.Dtos.TechnicalAnalysis;
namespace FinlyticTechnicals.Entities;
[Table("fta_technical_setups")]
public class FtaTechnicalSetupEntity
{
[Key]
public Guid SetupId { get; set; } = Guid.NewGuid();
[Required]
[MaxLength(20)]
public string Isin { get; set; } = string.Empty;
[MaxLength(30)]
public string Symbol { get; set; } = string.Empty;
[Required]
[MaxLength(10)]
public string Timeframe { get; set; } = "15m";
[Required]
[MaxLength(50)]
public string StrategyKey { get; set; } = string.Empty;
[MaxLength(100)]
public string StrategyName { get; set; } = string.Empty;
[MaxLength(10)]
public string Direction { get; set; } = "Buy";
[Column(TypeName = "decimal(6,2)")]
public decimal QualityScore { get; set; }
[Column(TypeName = "decimal(18,4)")]
public decimal CurrentPrice { get; set; }
[Column(TypeName = "decimal(18,4)")]
public decimal EntryPrice { get; set; }
[Column(TypeName = "decimal(18,4)")]
public decimal InvalidationPrice { get; set; }
[Column(TypeName = "decimal(18,4)")]
public decimal CurrentAtr { get; set; }
[Column(TypeName = "decimal(8,2)")]
public decimal EstimatedRiskRewardRatio { get; set; }
public ExitPlan ExitPlan { get; set; } = null!;
public string TechnicalRationale { get; set; } = string.Empty;
public List<PatternResultDto> TriggeringPatterns { get; set; } = [];
public Dictionary<string, decimal> IndicatorSnapshot { get; set; } = [];
public bool IsTopPick { get; set; }
[MaxLength(5)]
public string Rating { get; set; } = "B";
public bool IsActive { get; set; } = true;
[Required]
public DateTime CreatedAtUtc { get; set; } = DateTime.UtcNow;
[Required]
public DateTime ExpiresAtUtc { get; set; }
/// <summary>
/// String form of the <c>UniverseSource</c> this ISIN was being monitored under when this setup was
/// computed (favorite/discovery/sentiment-spike), or <see langword="null"/> for an ad hoc analysis (e.g. a
/// manual "Analyze now" call for an ISIN not currently in the scan universe). See
/// <c>FinlyticCore.Dtos.TechnicalAnalysis.StrategyResultDto.UniverseSource</c>.
/// </summary>
[MaxLength(20)]
public string? UniverseSource { get; set; }
/// <summary>When the ISIN above entered that scan universe, alongside <see cref="UniverseSource"/>.</summary>
public DateTime? UniverseEnteredAtUtc { get; set; }
/// <summary>String form of the <c>MarketRegime</c> at analysis time. See <c>StrategyResultDto.Regime</c>.</summary>
[MaxLength(30)]
public string? Regime { get; set; }
}