feat(research): isolate candidates and add reviewed paper promotion
This commit is contained in:
parent
26b97265c6
commit
25b5cbf481
128 changed files with 13038 additions and 1388 deletions
|
|
@ -15,6 +15,7 @@ import {
|
|||
} from '@stock-bot/stock-config/backtest';
|
||||
import {
|
||||
canonicalRunRequestSchema,
|
||||
canonicalStrategyExecution,
|
||||
parseCanonicalFinancialResult,
|
||||
type CanonicalReproductionComparison,
|
||||
type CanonicalReproductionPreview,
|
||||
|
|
@ -862,7 +863,7 @@ export class BacktestServiceV2 {
|
|||
saved.backtestId !== row.backtest_id ||
|
||||
saved.status !== 'completed' ||
|
||||
saved.financialEngine !== 'rust' ||
|
||||
saved.strategyExecution !== 'typescript-retained-builtin/v1' ||
|
||||
saved.strategyExecution !== canonicalStrategyExecution(request) ||
|
||||
!Number.isFinite(Date.parse(saved.completedAt)) ||
|
||||
!Number.isFinite(saved.executionTime) ||
|
||||
saved.executionTime < 0 ||
|
||||
|
|
@ -884,15 +885,21 @@ export class BacktestServiceV2 {
|
|||
|
||||
async canonicalCapability(id: string): Promise<CanonicalRunCapability> {
|
||||
try {
|
||||
await this.container.postgres.transaction(async client => {
|
||||
const execution = await this.container.postgres.transaction(async client => {
|
||||
const row = (await client.query('SELECT * FROM backtests WHERE id=$1 FOR UPDATE', [id]))
|
||||
.rows[0];
|
||||
if (!row || row.archived_at !== null) {
|
||||
throw new Error('Backtest is missing or archived');
|
||||
}
|
||||
await admitCanonicalRequest(client, this.container, this.mapBacktest(row), id);
|
||||
const request = await admitCanonicalRequest(
|
||||
client,
|
||||
this.container,
|
||||
this.mapBacktest(row),
|
||||
id
|
||||
);
|
||||
return request.strategy.origin === 'candidate' ? request.strategy.execution : undefined;
|
||||
});
|
||||
return { available: true, reason: null };
|
||||
return { available: true, reason: null, ...(execution ? { execution } : {}) };
|
||||
} catch (error) {
|
||||
return {
|
||||
available: false,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue