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
|
|
@ -1,54 +1,22 @@
|
|||
/** Explicit trusted producer boundary. No legacy timestamp repair or broker capabilities. */
|
||||
import { z } from 'zod';
|
||||
import {
|
||||
deployedPaperConfigurationSchema,
|
||||
paperPolicySchema,
|
||||
} from '@stock-bot/stock-config/paper-deployments';
|
||||
import { parseFinancialDecimal } from '@stock-bot/types';
|
||||
import { builtinStrategySelectionSchema } from './builtin-strategy';
|
||||
import { canonicalMatchingConfigSchema, matchingCommandSchema } from './canonical-execution';
|
||||
import { replayConfigSchema, stepSchema } from './native-replay';
|
||||
import { stepSchema } from './native-replay';
|
||||
|
||||
const id = matchingCommandSchema.shape.key.shape.instrumentId;
|
||||
const time = matchingCommandSchema.shape.key.shape.at;
|
||||
const counter = matchingCommandSchema.shape.key.shape.sourceSequence;
|
||||
const duration = counter.refine(value => value > 0, 'Duration must be positive');
|
||||
const decimal = z.string().transform(value => parseFinancialDecimal(value));
|
||||
|
||||
export const paperPolicySchema = z
|
||||
.object({
|
||||
version: z.literal(1),
|
||||
sourceId: id,
|
||||
priceBasis: z.literal('raw'),
|
||||
maxFeedAgeMs: duration,
|
||||
observations: z.array(
|
||||
z
|
||||
.object({
|
||||
seriesId: id,
|
||||
instrumentId: id,
|
||||
intervalMs: duration,
|
||||
staleAfterMs: counter,
|
||||
})
|
||||
.strict()
|
||||
),
|
||||
cadence: z.array(z.object({ ownerId: id, seriesIds: z.array(id).min(1) }).strict()),
|
||||
calendars: z
|
||||
.array(
|
||||
z
|
||||
.object({
|
||||
instrumentId: id,
|
||||
calendarId: id,
|
||||
revision: id,
|
||||
sessions: z
|
||||
.array(z.object({ sessionId: id, opensAt: time, closesAt: time }).strict())
|
||||
.min(1),
|
||||
})
|
||||
.strict()
|
||||
)
|
||||
.min(1),
|
||||
riskBoundaries: z.array(
|
||||
replayConfigSchema.shape.matching.shape.risk.shape.ledger.shape.riskSession
|
||||
),
|
||||
})
|
||||
.strict();
|
||||
export { paperPolicySchema } from '@stock-bot/stock-config/paper-deployments';
|
||||
|
||||
export const paperConfigurationSchema = z
|
||||
const legacyPaperConfigurationSchema = z
|
||||
.object({
|
||||
version: z.literal(1),
|
||||
matching: canonicalMatchingConfigSchema,
|
||||
|
|
@ -57,6 +25,11 @@ export const paperConfigurationSchema = z
|
|||
})
|
||||
.strict();
|
||||
|
||||
export const paperConfigurationSchema = z.union([
|
||||
legacyPaperConfigurationSchema,
|
||||
deployedPaperConfigurationSchema,
|
||||
]);
|
||||
|
||||
/** availableAt is the producer's atomic release time for the whole quote frame.
|
||||
* Quotes retain their original physical timestamp and source sequence. The
|
||||
* supplied completed bars were available by this release; quotes never synthesize bars. */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue