35 lines
1.4 KiB
Dart
35 lines
1.4 KiB
Dart
/// Defaults for RTH session-half market history ([MarketHistorySessionSlot]).
|
||
/// Env overrides via [MarketHistoryEnv] in [ServerEnv.load].
|
||
abstract final class MarketHistoryConfig {
|
||
/// Rolling window length in US trading days (Mon–Fri; holidays skipped).
|
||
static const int windowDays = 5;
|
||
|
||
/// Stored bar timeframe (two aggregates per US trading day).
|
||
static const String barTimeframe = 'sessionHalf';
|
||
|
||
/// Alpaca fetch granularity for backfill (aggregated into [barTimeframe]).
|
||
static const String alpacaFetchTimeframe = '1Min';
|
||
|
||
/// Symbols per Alpaca `GET /v2/stocks/bars` request (max ~100).
|
||
static const int historySyncBatchSize = 100;
|
||
|
||
/// Hard cap on symbols synced per run (Alpaca Basic rate-limit safety).
|
||
static const int historySyncMaxSymbols = 2000;
|
||
|
||
/// Minimum session-half bars required before a symbol is eligible for the
|
||
/// guess-the-move question rule.
|
||
static const int minBarsForGuess = 5;
|
||
|
||
/// Hours before the same symbol can fire another guess question.
|
||
static const int guessCooldownHours = 24;
|
||
|
||
/// Rows deleted per cleanup loop iteration (Postgres batched DELETE).
|
||
static const int retentionBatchSize = 5000;
|
||
|
||
/// Max Alpaca HTTP calls per rolling minute during history backfill.
|
||
static const int apiRequestsPerMinute = 200;
|
||
|
||
/// Wait after HTTP 429 before retrying the same bars request.
|
||
static const Duration rateLimitCooldown = Duration(minutes: 1);
|
||
}
|