Implement reviewed F02/D02: exact owner accounting, atomic funding checks, idempotent receipts and ledger checkpoints; connect existing EOD intraday storage through validated research admission without active financial-engine cutover.
72 lines
2.3 KiB
TypeScript
72 lines
2.3 KiB
TypeScript
import type { HistoricalDatasetMetadataV2 } from '@stock-bot/types';
|
|
|
|
export const identity = { symbol: 'FIXTURE', exchange: 'TEST', eodSearchCode: 'FIXTURE.TEST' };
|
|
export const start = new Date('2024-03-11T13:30:00.000Z');
|
|
export const end = new Date('2024-03-11T20:00:00.000Z');
|
|
|
|
/** Synthetic provider response matching fetchIntraday's retained fields; not market evidence. */
|
|
export function intradayResponse() {
|
|
return Array.from({ length: 78 }, (_, index) => {
|
|
const timestamp = start.getTime() / 1000 + index * 300;
|
|
const close = 100 + Math.sin((index * Math.PI) / 6) * 8;
|
|
return {
|
|
timestamp,
|
|
datetime: new Date(timestamp * 1000).toISOString().slice(0, 19).replace('T', ' '),
|
|
gmtoffset: 0,
|
|
open: close - 0.1,
|
|
high: close + 1,
|
|
low: close - 1,
|
|
close,
|
|
volume: 100_000,
|
|
};
|
|
});
|
|
}
|
|
|
|
/** Pinned by the research caller; storage must not invent calendars or eligibility. */
|
|
export function metadata(): HistoricalDatasetMetadataV2 {
|
|
return {
|
|
calendars: [
|
|
{
|
|
id: 'test-session',
|
|
venue: 'TEST',
|
|
timeZone: 'UTC',
|
|
revision: 'fixture-session-v1',
|
|
source: 'synthetic-regression-fixture',
|
|
startDate: '2024-03-11',
|
|
endDate: '2024-03-12',
|
|
sessions: [{ date: '2024-03-11', open: start.getTime(), close: end.getTime() }],
|
|
},
|
|
],
|
|
series: [
|
|
{
|
|
id: 'fixture-5m',
|
|
instrumentId: identity.eodSearchCode,
|
|
interval: '5m',
|
|
calendarId: 'test-session',
|
|
venue: 'TEST',
|
|
source: { provider: 'eod', revision: 'synthetic-response-v1' },
|
|
timestamp: 'interval-start',
|
|
availability: 'interval-end-assumption',
|
|
adjustment: 'raw',
|
|
},
|
|
],
|
|
executionSeries: [{ instrumentId: identity.eodSearchCode, seriesId: 'fixture-5m' }],
|
|
bounds: { warmupStart: start.getTime(), tradeStart: start.getTime(), tradeEnd: end.getTime() },
|
|
universe: {
|
|
selection: 'unknown',
|
|
asOf: null,
|
|
revision: 'fixture-universe-v1',
|
|
instrumentIds: [identity.eodSearchCode],
|
|
},
|
|
corporateActions: [
|
|
{
|
|
instrumentId: identity.eodSearchCode,
|
|
status: 'unknown',
|
|
start: start.getTime(),
|
|
end: end.getTime(),
|
|
revision: 'fixture-action-coverage-v1',
|
|
actions: [],
|
|
},
|
|
],
|
|
};
|
|
}
|