feat(research): run retained strategies through durable canonical engine
This commit is contained in:
parent
d929db707a
commit
618fb9e33c
58 changed files with 6596 additions and 779 deletions
91
test/fixtures/canonical-research.ts
vendored
Normal file
91
test/fixtures/canonical-research.ts
vendored
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
import type { CanonicalResearchSettings } from '@stock-bot/stock-config/canonical-research';
|
||||
import { createDatasetV2 } from '../../apps/stock/orchestrator/src/data/historical-dataset-v2';
|
||||
|
||||
export const canonicalSettings: CanonicalResearchSettings = {
|
||||
version: 1,
|
||||
seed: 42,
|
||||
ownerBudget: '40',
|
||||
feeRate: '0.01',
|
||||
halfSpreadRate: '0',
|
||||
slippageRate: '0',
|
||||
latencyMs: 0,
|
||||
participationRate: '1',
|
||||
maxOrderQuantity: '10000',
|
||||
maxPositionQuantity: '10000',
|
||||
maxSymbolExposure: '10000',
|
||||
maxGrossExposure: '10000',
|
||||
maxDailyLoss: '10000',
|
||||
maxDrawdownAmount: '10000',
|
||||
maxMarkAgeMs: 345600000,
|
||||
periodsPerYear: 252,
|
||||
annualRiskFreeRate: 0,
|
||||
};
|
||||
|
||||
/** Explicit retained exchange sessions straddle US DST; labels are never UTC midnights. */
|
||||
export function canonicalDailyDataset() {
|
||||
const sessions = [
|
||||
{
|
||||
date: '2024-03-08',
|
||||
open: Date.parse('2024-03-08T14:30:00Z'),
|
||||
close: Date.parse('2024-03-08T21:00:00Z'),
|
||||
},
|
||||
{
|
||||
date: '2024-03-11',
|
||||
open: Date.parse('2024-03-11T13:30:00Z'),
|
||||
close: Date.parse('2024-03-11T20:00:00Z'),
|
||||
},
|
||||
];
|
||||
const start = sessions[0]!.open,
|
||||
end = sessions[1]!.close;
|
||||
return createDatasetV2({
|
||||
metadata: {
|
||||
calendars: [
|
||||
{
|
||||
id: 'retained-test-calendar',
|
||||
venue: 'TEST',
|
||||
timeZone: 'America/New_York',
|
||||
revision: 'dst-fixture-v1',
|
||||
source: 'synthetic',
|
||||
startDate: '2024-03-08',
|
||||
endDate: '2024-03-12',
|
||||
sessions,
|
||||
},
|
||||
],
|
||||
series: [
|
||||
{
|
||||
id: 'X0.US:1d',
|
||||
instrumentId: 'X0.US',
|
||||
interval: '1d',
|
||||
calendarId: 'retained-test-calendar',
|
||||
venue: 'TEST',
|
||||
source: { provider: 'synthetic', revision: 'v1' },
|
||||
timestamp: 'session-date',
|
||||
availability: 'explicit',
|
||||
adjustment: 'raw',
|
||||
},
|
||||
],
|
||||
executionSeries: [{ instrumentId: 'X0.US', seriesId: 'X0.US:1d' }],
|
||||
bounds: { warmupStart: start, tradeStart: sessions[1]!.open, tradeEnd: end },
|
||||
universe: {
|
||||
selection: 'point-in-time',
|
||||
asOf: start,
|
||||
revision: 'v1',
|
||||
instrumentIds: ['X0.US'],
|
||||
},
|
||||
corporateActions: [
|
||||
{ instrumentId: 'X0.US', status: 'action-free', start, end, revision: 'v1', actions: [] },
|
||||
],
|
||||
},
|
||||
bars: sessions.map((session, index) => ({
|
||||
seriesId: 'X0.US:1d',
|
||||
timestamp: session.date,
|
||||
availableAt: session.close,
|
||||
sourceSequence: index,
|
||||
open: 10,
|
||||
high: 12,
|
||||
low: 9,
|
||||
close: 11,
|
||||
volume: 1000,
|
||||
})),
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue