work on new engine
This commit is contained in:
parent
44476da13f
commit
a1e5a21847
126 changed files with 3425 additions and 6695 deletions
|
|
@ -1,9 +1,9 @@
|
|||
import { EventEmitter } from 'events';
|
||||
import { IServiceContainer } from '@stock-bot/di';
|
||||
import { BacktestEngine as RustEngine } from '@stock-bot/core';
|
||||
import { BacktestConfig, BacktestResult } from '../types';
|
||||
import { BacktestEngine as RustEngine } from '@stock-bot/engine';
|
||||
import { EventEmitter } from 'events';
|
||||
import { StorageService } from '../services/StorageService';
|
||||
import { StrategyExecutor, SMACrossoverStrategy } from '../strategies/StrategyExecutor';
|
||||
import { SMACrossoverStrategy, StrategyExecutor } from '../strategies/StrategyExecutor';
|
||||
import { BacktestConfig, BacktestResult } from '../types';
|
||||
|
||||
/**
|
||||
* Adapter that bridges the orchestrator with the Rust backtest engine
|
||||
|
|
@ -208,7 +208,7 @@ export class RustBacktestAdapter extends EventEmitter {
|
|||
}
|
||||
|
||||
private registerStrategy(strategyName: string, parameters: any): void {
|
||||
if (!this.currentEngine) return;
|
||||
if (!this.currentEngine) {return;}
|
||||
|
||||
this.container.logger.info('Registering strategy', {
|
||||
strategyName,
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import { BacktestEngine as RustEngine } from '@stock-bot/core';
|
||||
import { RustStrategy } from '../strategies/RustStrategy';
|
||||
import { MarketData, BacktestConfig } from '../types';
|
||||
import { StorageService } from '../services/StorageService';
|
||||
import { IServiceContainer } from '@stock-bot/di';
|
||||
import { BacktestEngine as RustEngine } from '@stock-bot/engine';
|
||||
import { StorageService } from '../services/StorageService';
|
||||
import { RustStrategy } from '../strategies/RustStrategy';
|
||||
import { BacktestConfig } from '../types';
|
||||
|
||||
export interface RustBacktestConfig {
|
||||
name: string;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
import { TradingEngine } from '@stock-bot/core';
|
||||
import { IServiceContainer } from '@stock-bot/di';
|
||||
import { TradingMode, ModeConfig, BacktestConfigSchema, PaperConfigSchema, LiveConfigSchema } from '../types';
|
||||
import { MarketDataService } from '../services/MarketDataService';
|
||||
import { ExecutionService } from '../services/ExecutionService';
|
||||
import { StorageService } from '../services/StorageService';
|
||||
import { TradingEngine } from '@stock-bot/engine';
|
||||
import { EventEmitter } from 'events';
|
||||
import { ExecutionService } from '../services/ExecutionService';
|
||||
import { MarketDataService } from '../services/MarketDataService';
|
||||
import { StorageService } from '../services/StorageService';
|
||||
import { BacktestConfigSchema, LiveConfigSchema, ModeConfig, PaperConfigSchema, TradingMode } from '../types';
|
||||
|
||||
export class ModeManager extends EventEmitter {
|
||||
private mode: TradingMode = 'paper';
|
||||
|
|
@ -148,7 +148,7 @@ export class ModeManager extends EventEmitter {
|
|||
}
|
||||
|
||||
async shutdown(): Promise<void> {
|
||||
if (!this.isInitialized) return;
|
||||
if (!this.isInitialized) {return;}
|
||||
|
||||
this.container.logger.info(`Shutting down ${this.mode} mode...`);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { TechnicalIndicators, IncrementalSMA, IncrementalEMA, IncrementalRSI, MacdResult, BollingerBandsResult, StochasticResult } from '@stock-bot/core';
|
||||
import { BollingerBandsResult, IncrementalEMA, IncrementalRSI, IncrementalSMA, MacdResult, StochasticResult, TechnicalIndicators } from '@stock-bot/engine';
|
||||
|
||||
/**
|
||||
* Wrapper class for the Rust TA library with TypeScript-friendly interfaces
|
||||
|
|
@ -57,7 +57,7 @@ export class TechnicalAnalysis {
|
|||
|
||||
// Helper to check for crossovers
|
||||
static crossover(series1: number[], series2: number[]): boolean {
|
||||
if (series1.length < 2 || series2.length < 2) return false;
|
||||
if (series1.length < 2 || series2.length < 2) {return false;}
|
||||
const prev1 = series1[series1.length - 2];
|
||||
const curr1 = series1[series1.length - 1];
|
||||
const prev2 = series2[series2.length - 2];
|
||||
|
|
@ -66,7 +66,7 @@ export class TechnicalAnalysis {
|
|||
}
|
||||
|
||||
static crossunder(series1: number[], series2: number[]): boolean {
|
||||
if (series1.length < 2 || series2.length < 2) return false;
|
||||
if (series1.length < 2 || series2.length < 2) {return false;}
|
||||
const prev1 = series1[series1.length - 2];
|
||||
const curr1 = series1[series1.length - 1];
|
||||
const prev2 = series2[series2.length - 2];
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
import { IServiceContainer } from '@stock-bot/di';
|
||||
import { TradingEngine } from '@stock-bot/engine';
|
||||
import { EventEmitter } from 'events';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
import { IServiceContainer } from '@stock-bot/di';
|
||||
import { ModeConfig, OrderRequest, OrderRequestSchema } from '../types';
|
||||
import { TradingEngine } from '@stock-bot/core';
|
||||
import axios from 'axios';
|
||||
import { StorageService } from './StorageService';
|
||||
|
||||
interface ExecutionReport {
|
||||
|
|
@ -233,7 +232,7 @@ export class ExecutionService extends EventEmitter {
|
|||
}
|
||||
|
||||
private async processFills(executionReport: ExecutionReport): Promise<void> {
|
||||
if (!this.tradingEngine) return;
|
||||
if (!this.tradingEngine) {return;}
|
||||
|
||||
for (const fill of executionReport.fills) {
|
||||
// Update position in engine
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import { BacktestEngine } from '@stock-bot/core';
|
||||
import { BacktestEngine } from '@stock-bot/engine';
|
||||
import { MarketData } from '../types';
|
||||
|
||||
export interface Signal {
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import { EventEmitter } from 'events';
|
||||
import { IServiceContainer } from '@stock-bot/di';
|
||||
import { MarketData, StrategyConfig, OrderRequest } from '../types';
|
||||
import { TradingEngine } from '@stock-bot/engine';
|
||||
import { EventEmitter } from 'events';
|
||||
import { MarketData, OrderRequest, StrategyConfig } from '../types';
|
||||
import { BaseStrategy } from './BaseStrategy';
|
||||
import { TradingEngine } from '@stock-bot/core';
|
||||
|
||||
export class StrategyManager extends EventEmitter {
|
||||
private strategies = new Map<string, BaseStrategy>();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue