work on market-data-gateway

This commit is contained in:
Bojan Kucera 2025-06-03 09:57:11 -04:00
parent 405b818c86
commit b957fb99aa
87 changed files with 7979 additions and 99 deletions

View file

@ -15,7 +15,8 @@
"@stock-bot/event-bus": "workspace:*",
"@stock-bot/api-client": "workspace:*",
"@stock-bot/config": "*",
"ws": "^8.18.0"
"ws": "^8.18.0",
"axios": "^1.6.2"
},
"devDependencies": {
"bun-types": "^1.2.15",

View file

@ -0,0 +1,22 @@
{
"name": "signal-engine",
"version": "1.0.0",
"description": "Real-time signal generation and processing engine",
"main": "src/index.ts",
"scripts": {
"dev": "bun run --watch src/index.ts",
"start": "bun run src/index.ts",
"test": "bun test --timeout 10000 src/tests/**/*.test.ts",
"test:watch": "bun test --watch src/tests/**/*.test.ts"
},
"dependencies": {
"hono": "^4.6.3",
"@stock-bot/config": "*",
"@stock-bot/shared-types": "*",
"ws": "^8.18.0"
},
"devDependencies": {
"bun-types": "^1.2.15",
"@types/ws": "^8.5.12"
}
}

View file

@ -7,14 +7,14 @@
"start": "bun run src/index.ts",
"test": "bun test --timeout 10000 src/tests/**/*.test.ts",
"test:watch": "bun test --watch src/tests/**/*.test.ts"
},
"dependencies": {
}, "dependencies": {
"hono": "^4.6.3",
"ioredis": "^5.4.1",
"@stock-bot/config": "*",
"@stock-bot/shared-types": "*",
"ws": "^8.18.0",
"node-cron": "^3.0.3"
"node-cron": "^3.0.3",
"axios": "^1.6.2"
},
"devDependencies": {
"bun-types": "^1.2.15",

View file

@ -140,11 +140,10 @@ export class StrategyController {
});
return;
}
// Update properties
// Update properties
if (name !== undefined) strategy.name = name;
if (description !== undefined) strategy.description = description;
if (symbols !== undefined) (strategy as any).symbols = symbols; // Hack since symbols is readonly
if (symbols !== undefined) strategy.symbols = symbols;
if (parameters !== undefined) strategy.parameters = parameters;
res.json({

View file

@ -69,9 +69,9 @@ export interface StrategyMetrics {
export abstract class BaseStrategy extends EventEmitter {
public readonly id: string;
public readonly name: string;
public readonly description: string;
public readonly symbols: string[];
public name: string;
public description: string;
public symbols: string[];
public parameters: StrategyParameters;
protected context: StrategyContext;

View file

@ -7,7 +7,6 @@ import { StrategyRegistry } from './core/strategies/StrategyRegistry';
import { BacktestService, BacktestRequest } from './core/backtesting/BacktestService';
import { BacktestResult } from './core/backtesting/BacktestEngine';
import { PerformanceAnalytics } from './core/backtesting/PerformanceAnalytics';
import { StrategyController } from './controllers/StrategyController';
const app = new Hono();
const redis = new Redis({
@ -58,9 +57,6 @@ interface StrategySignal {
// In-memory strategy registry (in production, this would be persisted)
const strategies = new Map<string, TradingStrategy>();
// Initialize strategy controller
const strategyController = new StrategyController();
// Health check endpoint
app.get('/health', (c) => {
return c.json({
@ -180,11 +176,10 @@ app.put('/api/strategies/:id', async (c) => {
if (!strategy) {
return c.json({ success: false, error: `Strategy with ID ${id} not found` }, 404);
}
// Update properties
// Update properties
if (name !== undefined) strategy.name = name;
if (description !== undefined) strategy.description = description;
if (symbols !== undefined) (strategy as any).symbols = symbols; // Hack since symbols is readonly
if (symbols !== undefined) strategy.symbols = symbols;
if (parameters !== undefined) strategy.parameters = parameters;
return c.json({