Remove dataset input caps and simplify preparation
This commit is contained in:
parent
6bd671d92a
commit
007e35c747
17 changed files with 175 additions and 620 deletions
|
|
@ -1,15 +1,6 @@
|
|||
import { EventEmitter } from 'node:events';
|
||||
import {
|
||||
datasetLimits,
|
||||
PREPARATION_BATCH_SIZE,
|
||||
preparationCheckpoint,
|
||||
type DatasetLimits,
|
||||
} from '../data/dataset-limits';
|
||||
import {
|
||||
assertNativeDatasetBudget,
|
||||
resolveDataset,
|
||||
type DatasetResolver,
|
||||
} from '../data/historical-dataset';
|
||||
import { resolveDataset, type DatasetResolver } from '../data/historical-dataset';
|
||||
import { PREPARATION_BATCH_SIZE, preparationCheckpoint } from '../data/preparation';
|
||||
import { StorageService } from '../services/StorageService';
|
||||
import { BacktestConfigSchema, type BacktestConfig, type OrchestratorServices } from '../types';
|
||||
import {
|
||||
|
|
@ -29,7 +20,6 @@ export class RustBacktestAdapter extends EventEmitter implements BacktestExecuti
|
|||
private readonly storageService: StorageService;
|
||||
private readonly worker: NativeBacktestWorker;
|
||||
private readonly timeoutMs: number;
|
||||
private readonly datasetLimits: Readonly<DatasetLimits>;
|
||||
private active: { controller: AbortController; finished: Promise<void> } | undefined;
|
||||
private closing = false;
|
||||
private progress = 0;
|
||||
|
|
@ -37,10 +27,9 @@ export class RustBacktestAdapter extends EventEmitter implements BacktestExecuti
|
|||
|
||||
constructor(
|
||||
private readonly container: OrchestratorServices,
|
||||
options: { timeoutMs?: number; workerUrl?: URL; datasetLimits?: Partial<DatasetLimits> } = {}
|
||||
options: { timeoutMs?: number; workerUrl?: URL } = {}
|
||||
) {
|
||||
super();
|
||||
this.datasetLimits = datasetLimits(options.datasetLimits);
|
||||
this.timeoutMs = options.timeoutMs ?? 300_000;
|
||||
if (
|
||||
!Number.isInteger(this.timeoutMs) ||
|
||||
|
|
@ -128,10 +117,8 @@ export class RustBacktestAdapter extends EventEmitter implements BacktestExecuti
|
|||
resolver?: DatasetResolver
|
||||
): Promise<NativeWorkerRequest['data']> {
|
||||
signal.throwIfAborted();
|
||||
const options = { limits: this.datasetLimits, signal };
|
||||
const dataset = await resolveDataset(this.storageService, config, resolver, options);
|
||||
const dataset = await resolveDataset(this.storageService, config, resolver, signal);
|
||||
signal.throwIfAborted();
|
||||
assertNativeDatasetBudget(dataset, config, options);
|
||||
const data: NativeWorkerRequest['data'] = [];
|
||||
for (const bar of dataset.bars) {
|
||||
data.push({ ...bar, type: 'bar' });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue