@showr/core
Version:
Core library for Showr
30 lines (29 loc) • 1.08 kB
TypeScript
import { Dataset, Strategy } from './';
import { BacktestReport } from './backtestReport';
export interface BacktestConfiguration {
capital: number;
tradingQuantity: number;
attribute?: string;
name?: string;
}
/**
* Back-tests the strategy over a given dataset.
*/
export declare class Backtest<P = unknown, T = number> {
protected _dataset: Dataset<T>;
protected _strategy: Strategy<P, T>;
/**
* Runs back-test over a dataset for a given strategy that can be analyzed.
* @param dataset - `Dataset` over which strategy should be back-tested.
* @param strategy - `Strategy` that should be back-tested.
*/
constructor(dataset: Dataset<T>, strategy: Strategy<P, T>);
get strategy(): Strategy<P, T>;
get dataset(): Dataset<T>;
/**
* Creates a report with profit and other metrics over a back-tested dataset.
* @param configuration - `BacktestConfiguration` with trading quantity and capital.
* @returns `BacktestReport`.
*/
analyze(configuration: BacktestConfiguration): BacktestReport;
}