Add market data schema, catalogue, bar storage and quality checks (refs #18 #20 #21 #23)

Migration 0002 adds the market data tables on both engines: daily and
one-minute bars, corporate actions, FX rates, the exchange calendar,
calendar events, mood indicators, spread samples, data issues, source
state and universe members, plus the trading rules on instruments.

The data layer is format-independent so the venue clients can build on
it: the instrument catalogue (rules from the venue, delisted kept), bar
upserts with ON CONFLICT, the SPEC 6.4 checks with an issue register
that blocks entries until a second reading, freshness by age of the last
datum (trap 10), research history in .csv.gz with exact decimals, and
adjusted series anchored at the decision day with level and quantity
conversion across splits and dividends.

Recorded API responses from OKX, the Alpaca docs and the free sources
are kept byte for byte as test fixtures; the secret scan now ignores
pagination cursors such as Alpaca's next_page_token.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-11-10 14:58:44 +01:00
1 parent 67350f091e
commit 3b13a4258d
54 files changed
+3067 -3

No files matched your search

+12 -3
View File
@@ -53,6 +53,8 @@ public sealed partial class SecretScanTests
Assert.IsFalse(LooksLikeSecret("REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}"));
Assert.IsFalse(LooksLikeSecret("private const string SecretKeyVariable = \"ANUBIS_SECRET_KEY\";"));
Assert.IsFalse(LooksLikeSecret("OKX_API_PASSPHRASE=<passphrase-123>"));
Assert.IsFalse(LooksLikeSecret(" \"next_page_token\": \"QUFQTHxNfDIwMjItMDEtMDNUMDk6MDA6MDAuMDAwMDAwMDAwWg==\""));
Assert.IsTrue(LooksLikeSecret("{\"next_page_token\": null, \"api_key\": \"AKZXCVBNMASDFGHJKLQWERTY12\"}"), "a cursor does not hide a key on the same line");
// Code that assigns a computed value is not a secret.
Assert.IsFalse(LooksLikeSecret("var key = RandomNumberGenerator.GetBytes(32);"));
@@ -60,9 +62,16 @@ public sealed partial class SecretScanTests
Assert.IsFalse(LooksLikeSecret("?secret={Base32.Encode(secret)}&issuer=x"));
}
private static bool LooksLikeSecret(string line) =>
PrivateKey().IsMatch(line) || BrokerHeader().IsMatch(line) || TelegramToken().IsMatch(line) || GenericSecret().IsMatch(line)
|| NamedSecret().Matches(line).Any(m => !IsPlaceholder(m.Groups["value"].Value));
private static bool LooksLikeSecret(string line)
{
// Pagination cursors of the APIs (Alpaca's next_page_token in the recorded responses) are not credentials.
line = PageCursor().Replace(line, "");
return PrivateKey().IsMatch(line) || BrokerHeader().IsMatch(line) || TelegramToken().IsMatch(line) || GenericSecret().IsMatch(line)
|| NamedSecret().Matches(line).Any(m => !IsPlaceholder(m.Groups["value"].Value));
}
[GeneratedRegex("""(?i)["']?(next_)?page_token["']?\s*[:=]\s*["']?[A-Za-z0-9/+=_\-]*["']?""")]
private static partial Regex PageCursor();
// Example values in .env.example, compose files and the CI are clearly fake.
private static bool IsPlaceholder(string value) =>