feat(Core): update DTOs and shared models
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace FinlyticCore.Dtos.Yahoo;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a Yahoo Finance value wrapper containing raw numerical data alongside formatted strings.
|
||||
/// </summary>
|
||||
public record YahooValueDto
|
||||
{
|
||||
[JsonPropertyName("raw")]
|
||||
public double? Raw { get; init; }
|
||||
|
||||
[JsonPropertyName("fmt")]
|
||||
public string? Fmt { get; init; }
|
||||
|
||||
[JsonPropertyName("longFmt")]
|
||||
public string? LongFmt { get; init; }
|
||||
|
||||
/// <summary>
|
||||
/// Helper property to retrieve Raw as double (or fallback 0.0).
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public double DoubleValue => Raw ?? 0.0;
|
||||
|
||||
/// <summary>
|
||||
/// Helper property to retrieve Raw as decimal (or fallback 0m).
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public decimal DecimalValue => Raw.HasValue ? (decimal)Raw.Value : 0m;
|
||||
|
||||
/// <summary>
|
||||
/// Helper property to retrieve Raw as long (or fallback 0L).
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public long LongValue => Raw.HasValue ? (long)Raw.Value : 0L;
|
||||
}
|
||||
Reference in New Issue
Block a user