feat(TA): update technical analysis service

This commit is contained in:
2026-08-09 21:01:42 +02:00
parent 05d55a324c
commit c74a4456af
18 changed files with 2288 additions and 0 deletions
@@ -0,0 +1,21 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace FinlyticTechnicalAnalysis.Entities;
[Table("CachedAnalyses")]
public class CachedAnalysisEntity
{
[Key]
[MaxLength(20)]
public string Isin { get; set; } = string.Empty;
[MaxLength(20)]
public string Ticker { get; set; } = string.Empty;
[Column(TypeName = "jsonb")]
public string AnalysisJson { get; set; } = "{}";
public DateTime CalculatedAt { get; set; } = DateTime.UtcNow;
}
@@ -0,0 +1,24 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace FinlyticTechnicalAnalysis.Entities;
[Table("MacroData")]
public class MacroDataEntity
{
[Key]
[MaxLength(20)]
public string Symbol { get; set; } = string.Empty; // "^VIX", "^GSPC", "DX-Y.NY"
[Column(TypeName = "decimal(18, 6)")]
public decimal Value { get; set; }
[Column(TypeName = "decimal(18, 6)")]
public decimal PreviousClose { get; set; }
[MaxLength(50)]
public string TrendState { get; set; } = "Neutral";
public DateTime LastUpdatedAt { get; set; } = DateTime.UtcNow;
}
@@ -0,0 +1,43 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace FinlyticTechnicalAnalysis.Entities;
[Table("MarketCandles")]
public class MarketCandleEntity
{
[Key]
public long Id { get; set; }
[Required]
[MaxLength(20)]
public string Symbol { get; set; } = string.Empty; // e.g. "US5398301094" or "AAPL" or "^VIX"
[Required]
[MaxLength(10)]
public string Interval { get; set; } = "1d"; // "1h", "1d"
[Required]
public DateTime Timestamp { get; set; }
[Column(TypeName = "decimal(18, 6)")]
public decimal Open { get; set; }
[Column(TypeName = "decimal(18, 6)")]
public decimal High { get; set; }
[Column(TypeName = "decimal(18, 6)")]
public decimal Low { get; set; }
[Column(TypeName = "decimal(18, 6)")]
public decimal Close { get; set; }
public long Volume { get; set; }
[Column(TypeName = "decimal(18, 6)")]
public decimal? Bid { get; set; }
[Column(TypeName = "decimal(18, 6)")]
public decimal? Ask { get; set; }
}
@@ -0,0 +1,22 @@
using System;
using System.ComponentModel.DataAnnotations;
namespace FinlyticTechnicalAnalysis.Entities;
/// <summary>
/// Entity representing global indicator and strategy settings for FinlyticTechnicalAnalysis.
/// Persisted in PostgreSQL and updated dynamically via Admin Panel MQTT events.
/// </summary>
public class TaSettingsEntity
{
[Key]
public Guid Id { get; set; }
public int EmaShortPeriod { get; set; } = 20;
public int SmaMediumPeriod { get; set; } = 50;
public int SmaLongPeriod { get; set; } = 200;
public double RsiOverboughtLimit { get; set; } = 70.0;
public double RsiOversoldLimit { get; set; } = 30.0;
public double SupertrendMultiplier { get; set; } = 3.0;
public DateTime UpdatedAt { get; set; } = DateTime.UtcNow;
}