88 lines
3.8 KiB
C#
88 lines
3.8 KiB
C#
using System;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using FinlyticAssets.Models;
|
|
using FinlyticCore.Models.Assets;
|
|
|
|
namespace FinlyticAssets.Entities;
|
|
|
|
/// <summary>
|
|
/// Represents the global synchronization and timing configurations for the Trade Republic asset scanner.
|
|
/// </summary>
|
|
public class Settings
|
|
{
|
|
/// <summary>
|
|
/// Gets or sets the unique identifier for the settings record.
|
|
/// </summary>
|
|
[Key]
|
|
public Guid Id { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets a value indicating whether the very first full scan of all assets has been completed.
|
|
/// Used to switch from fast initial discovery delays to stealthy incremental update delays.
|
|
/// </summary>
|
|
public bool FinishedInitialScan { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the minimum number of days to wait before an asset becomes eligible for re-validation.
|
|
/// Combined with <see cref="MaxRandomUpdateDay"/> to achieve a flat 2-to-3-month rotation cycle.
|
|
/// </summary>
|
|
public int MinRandomUpdateDay { get; set; } = 60;
|
|
|
|
/// <summary>
|
|
/// Gets or sets the maximum number of days to wait before an asset must be re-validated (roughly 3 months).
|
|
/// </summary>
|
|
public int MaxRandomUpdateDay { get; set; } = 90;
|
|
|
|
/// <summary>
|
|
/// Gets or sets the earliest hour (0-23) of the day when background synchronization is allowed to execute.
|
|
/// Prevents unusual nocturnal API traffic.
|
|
/// </summary>
|
|
public int UpdateDayTimeStart { get; set; } = 8;
|
|
|
|
/// <summary>
|
|
/// Gets or sets the latest hour (0-23) of the day when background synchronization is allowed to execute.
|
|
/// </summary>
|
|
public int UpdateDayTimeStop { get; set; } = 21;
|
|
|
|
/// <summary>
|
|
/// Gets or sets the maximum number of assets requested per single API pagination call.
|
|
/// Values around 100 look like standard dynamic-scrolling payloads from a real client device.
|
|
/// </summary>
|
|
public int TradeRepublicMaxRequestPageSize { get; set; } = 100;
|
|
|
|
/// <summary>
|
|
/// Gets or sets the idle delay in seconds between switching from one full asset category to another (e.g., from Stocks to Crypto)
|
|
/// during standard maintenance mode. (Default 12000s = ~3.3 hours).
|
|
/// </summary>
|
|
public int AssetUpdateTypeDelay { get; set; } = 12000;
|
|
|
|
/// <summary>
|
|
/// Gets or sets the idle delay in seconds between switching asset categories during the initial setup scan.
|
|
/// Faster than standard mode but kept high enough to prevent early rate limiting. (Default 3600s = 1 hour).
|
|
/// </summary>
|
|
public int InitAssetUpdateTypeDelay { get; set; } = 3600;
|
|
|
|
/// <summary>
|
|
/// Gets or sets the baseline delay in seconds between sequential page requests of the same asset type during the initial setup scan.
|
|
/// (Default 120s = 2 minutes).
|
|
/// </summary>
|
|
public int InitBatchAssetUpdateDelay { get; set; } = 120;
|
|
|
|
/// <summary>
|
|
/// Gets or sets the standard baseline delay in seconds between sequential page requests of the same asset type during recurring incremental updates.
|
|
/// Spreads pagination widely over time to blend into regular human traffic profiles. (Default 600s = 10 minutes).
|
|
/// </summary>
|
|
public int BatchAssetUpdateDelay { get; set; } = 600;
|
|
|
|
/// <summary>
|
|
/// Gets or sets the asset type that is currently being processed by the full scan.
|
|
/// Acts as a live pointer for recovery after a service interruption.
|
|
/// </summary>
|
|
public AssetType CurrentScanningType { get; set; } = AssetType.Stock;
|
|
|
|
/// <summary>
|
|
/// Gets or sets the page number of the <see cref="CurrentScanningType"/> that is currently being fetched or was just processed.
|
|
/// Trade Republic uses 1-based pagination. A value of 0 means the scan is currently idle or between types.
|
|
/// </summary>
|
|
public int CurrentScanningPage { get; set; } = 0;
|
|
} |