stock-bot/test/fixtures/historical-v2/dataset.ts
Boki b4af840d4e feat(research): add financial contracts and availability-aware datasets
Implement reviewed F01/D01 foundations without changing active trading runtimes. Validate strict Rust/TypeScript financial wire contracts, decimal postings, versioned datasets, explicit calendars, provenance, and v1 compatibility.
2026-10-22 20:51:25 -04:00

85 lines
2.5 KiB
TypeScript

import type { HistoricalDatasetInputV2 } from '../../../libs/core/types/src/historical-data';
const time = (value: string) => Date.parse(value);
/** Synthetic retained table for regression testing, not a production calendar authority. */
export function datasetInput(): HistoricalDatasetInputV2 {
return {
metadata: {
calendars: [
{
id: 'test-us-equities',
venue: 'XNYS',
timeZone: 'America/New_York',
revision: 'test-sessions-2024-v1',
source: 'synthetic-regression-fixture',
startDate: '2024-03-01',
endDate: '2024-12-01',
sessions: [
{
date: '2024-03-08',
open: time('2024-03-08T14:30:00Z'),
close: time('2024-03-08T21:00:00Z'),
},
{
date: '2024-03-11',
open: time('2024-03-11T13:30:00Z'),
close: time('2024-03-11T20:00:00Z'),
},
{
date: '2024-11-29',
open: time('2024-11-29T14:30:00Z'),
close: time('2024-11-29T18:00:00Z'),
},
],
},
],
series: [
{
id: 'A.US:daily:raw',
instrumentId: 'A.US',
interval: '1d',
calendarId: 'test-us-equities',
venue: 'XNYS',
source: { provider: 'eod', revision: 'historical-normalization-v1' },
timestamp: 'session-date',
availability: 'interval-end-assumption',
adjustment: 'raw',
},
],
executionSeries: [{ instrumentId: 'A.US', seriesId: 'A.US:daily:raw' }],
bounds: {
warmupStart: time('2024-03-08T14:30:00Z'),
tradeStart: time('2024-03-11T13:30:00Z'),
tradeEnd: time('2024-11-29T18:00:00Z'),
},
universe: {
selection: 'point-in-time',
asOf: time('2024-03-01T00:00:00Z'),
revision: 'test-universe-v1',
instrumentIds: ['A.US'],
},
corporateActions: [
{
instrumentId: 'A.US',
status: 'action-free',
start: time('2024-03-01T00:00:00Z'),
end: time('2024-12-01T00:00:00Z'),
revision: 'test-action-coverage-v1',
actions: [],
},
],
},
bars: ['2024-03-08', '2024-03-11', '2024-11-29'].map((timestamp, sourceSequence) => ({
seriesId: 'A.US:daily:raw',
timestamp,
sourceSequence,
open: 100,
high: 110,
low: 90,
close: 105,
volume: 1000,
...(sourceSequence === 1 ? { vwap: 101 } : {}),
})),
};
}