UNPKG

skayn-trading-sdk

Version:

Professional Bitcoin trading strategy backtesting framework with institutional-grade architecture

60 lines (54 loc) 1.47 kB
/** * Backtest Engine Interface * Defines contract for backtesting implementations */ class IBacktestEngine { /** * Initialize the backtest engine * @param {Object} config - Backtest configuration */ async initialize(config = {}) { throw new Error('IBacktestEngine.initialize() must be implemented'); } /** * Set the strategy to backtest * @param {Object} strategy - Strategy instance */ setStrategy(strategy) { throw new Error('IBacktestEngine.setStrategy() must be implemented'); } /** * Run a backtest * @param {Object} config - Backtest configuration * @returns {Promise<Object>} Backtest results */ async runBacktest(config = {}) { throw new Error('IBacktestEngine.runBacktest() must be implemented'); } /** * Get backtest performance metrics * @param {Array} trades - Array of completed trades * @returns {Promise<Object>} Performance metrics */ async calculatePerformanceMetrics(trades) { throw new Error('IBacktestEngine.calculatePerformanceMetrics() must be implemented'); } /** * Get backtest engine metadata * @returns {Object} Engine information */ getBacktestEngineMetadata() { return { name: 'Unknown Backtest Engine', version: '1.0.0', description: 'Base backtest engine interface' }; } /** * Cleanup resources */ async cleanup() { // Optional cleanup - override if needed } } module.exports = IBacktestEngine;