linxus fs fixes
This commit is contained in:
parent
ac23b70146
commit
0b7846fe67
292 changed files with 41947 additions and 41947 deletions
|
|
@ -1,26 +1,26 @@
|
|||
{
|
||||
"name": "@stock-bot/processing-service",
|
||||
"version": "1.0.0",
|
||||
"description": "Combined data processing and technical indicators service",
|
||||
"main": "dist/index.js",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"devvvvv": "bun --watch src/index.ts",
|
||||
"build": "bun build src/index.ts --outdir dist --target node",
|
||||
"start": "bun dist/index.js",
|
||||
"test": "bun test",
|
||||
"clean": "rm -rf dist"
|
||||
},
|
||||
"dependencies": {
|
||||
"@stock-bot/config": "*",
|
||||
"@stock-bot/logger": "*",
|
||||
"@stock-bot/types": "*",
|
||||
"@stock-bot/utils": "*",
|
||||
"@stock-bot/event-bus": "*",
|
||||
"@stock-bot/vector-engine": "*",
|
||||
"hono": "^4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^5.0.0"
|
||||
}
|
||||
}
|
||||
{
|
||||
"name": "@stock-bot/processing-service",
|
||||
"version": "1.0.0",
|
||||
"description": "Combined data processing and technical indicators service",
|
||||
"main": "dist/index.js",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"devvvvv": "bun --watch src/index.ts",
|
||||
"build": "bun build src/index.ts --outdir dist --target node",
|
||||
"start": "bun dist/index.js",
|
||||
"test": "bun test",
|
||||
"clean": "rm -rf dist"
|
||||
},
|
||||
"dependencies": {
|
||||
"@stock-bot/config": "*",
|
||||
"@stock-bot/logger": "*",
|
||||
"@stock-bot/types": "*",
|
||||
"@stock-bot/utils": "*",
|
||||
"@stock-bot/event-bus": "*",
|
||||
"@stock-bot/vector-engine": "*",
|
||||
"hono": "^4.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"typescript": "^5.0.0"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,54 +1,54 @@
|
|||
/**
|
||||
* Processing Service - Technical indicators and data processing
|
||||
*/
|
||||
import { getLogger } from '@stock-bot/logger';
|
||||
import { loadEnvVariables } from '@stock-bot/config';
|
||||
import { Hono } from 'hono';
|
||||
import { serve } from '@hono/node-server';
|
||||
|
||||
// Load environment variables
|
||||
loadEnvVariables();
|
||||
|
||||
const app = new Hono();
|
||||
const logger = getLogger('processing-service');
|
||||
const PORT = parseInt(process.env.PROCESSING_SERVICE_PORT || '3003');
|
||||
|
||||
// Health check endpoint
|
||||
app.get('/health', (c) => {
|
||||
return c.json({
|
||||
service: 'processing-service',
|
||||
status: 'healthy',
|
||||
timestamp: new Date().toISOString()
|
||||
});
|
||||
});
|
||||
|
||||
// Technical indicators endpoint
|
||||
app.post('/api/indicators', async (c) => {
|
||||
const body = await c.req.json();
|
||||
logger.info('Technical indicators request', { indicators: body.indicators });
|
||||
|
||||
// TODO: Implement technical indicators processing
|
||||
return c.json({
|
||||
message: 'Technical indicators endpoint - not implemented yet',
|
||||
requestedIndicators: body.indicators
|
||||
});
|
||||
});
|
||||
|
||||
// Vectorized processing endpoint
|
||||
app.post('/api/vectorized/process', async (c) => {
|
||||
const body = await c.req.json();
|
||||
logger.info('Vectorized processing request', { dataPoints: body.data?.length });
|
||||
|
||||
// TODO: Implement vectorized processing
|
||||
return c.json({
|
||||
message: 'Vectorized processing endpoint - not implemented yet'
|
||||
});
|
||||
});
|
||||
|
||||
// Start server
|
||||
serve({
|
||||
fetch: app.fetch,
|
||||
port: PORT,
|
||||
});
|
||||
|
||||
logger.info(`Processing Service started on port ${PORT}`);
|
||||
/**
|
||||
* Processing Service - Technical indicators and data processing
|
||||
*/
|
||||
import { getLogger } from '@stock-bot/logger';
|
||||
import { loadEnvVariables } from '@stock-bot/config';
|
||||
import { Hono } from 'hono';
|
||||
import { serve } from '@hono/node-server';
|
||||
|
||||
// Load environment variables
|
||||
loadEnvVariables();
|
||||
|
||||
const app = new Hono();
|
||||
const logger = getLogger('processing-service');
|
||||
const PORT = parseInt(process.env.PROCESSING_SERVICE_PORT || '3003');
|
||||
|
||||
// Health check endpoint
|
||||
app.get('/health', (c) => {
|
||||
return c.json({
|
||||
service: 'processing-service',
|
||||
status: 'healthy',
|
||||
timestamp: new Date().toISOString()
|
||||
});
|
||||
});
|
||||
|
||||
// Technical indicators endpoint
|
||||
app.post('/api/indicators', async (c) => {
|
||||
const body = await c.req.json();
|
||||
logger.info('Technical indicators request', { indicators: body.indicators });
|
||||
|
||||
// TODO: Implement technical indicators processing
|
||||
return c.json({
|
||||
message: 'Technical indicators endpoint - not implemented yet',
|
||||
requestedIndicators: body.indicators
|
||||
});
|
||||
});
|
||||
|
||||
// Vectorized processing endpoint
|
||||
app.post('/api/vectorized/process', async (c) => {
|
||||
const body = await c.req.json();
|
||||
logger.info('Vectorized processing request', { dataPoints: body.data?.length });
|
||||
|
||||
// TODO: Implement vectorized processing
|
||||
return c.json({
|
||||
message: 'Vectorized processing endpoint - not implemented yet'
|
||||
});
|
||||
});
|
||||
|
||||
// Start server
|
||||
serve({
|
||||
fetch: app.fetch,
|
||||
port: PORT,
|
||||
});
|
||||
|
||||
logger.info(`Processing Service started on port ${PORT}`);
|
||||
|
|
|
|||
|
|
@ -1,82 +1,82 @@
|
|||
/**
|
||||
* Technical Indicators Service
|
||||
* Leverages @stock-bot/utils for calculations
|
||||
*/
|
||||
import { getLogger } from '@stock-bot/logger';
|
||||
import {
|
||||
sma,
|
||||
ema,
|
||||
rsi,
|
||||
macd
|
||||
} from '@stock-bot/utils';
|
||||
|
||||
const logger = getLogger('indicators-service');
|
||||
|
||||
export interface IndicatorRequest {
|
||||
symbol: string;
|
||||
data: number[];
|
||||
indicators: string[];
|
||||
parameters?: Record<string, any>;
|
||||
}
|
||||
|
||||
export interface IndicatorResult {
|
||||
symbol: string;
|
||||
timestamp: Date;
|
||||
indicators: Record<string, number[]>;
|
||||
}
|
||||
|
||||
export class IndicatorsService {
|
||||
async calculateIndicators(request: IndicatorRequest): Promise<IndicatorResult> {
|
||||
logger.info('Calculating indicators', {
|
||||
symbol: request.symbol,
|
||||
indicators: request.indicators,
|
||||
dataPoints: request.data.length
|
||||
});
|
||||
|
||||
const results: Record<string, number[]> = {};
|
||||
|
||||
for (const indicator of request.indicators) {
|
||||
try {
|
||||
switch (indicator.toLowerCase()) {
|
||||
case 'sma':
|
||||
const smaPeriod = request.parameters?.smaPeriod || 20;
|
||||
results.sma = sma(request.data, smaPeriod);
|
||||
break;
|
||||
|
||||
case 'ema':
|
||||
const emaPeriod = request.parameters?.emaPeriod || 20;
|
||||
results.ema = ema(request.data, emaPeriod);
|
||||
break;
|
||||
|
||||
case 'rsi':
|
||||
const rsiPeriod = request.parameters?.rsiPeriod || 14;
|
||||
results.rsi = rsi(request.data, rsiPeriod);
|
||||
break;
|
||||
|
||||
case 'macd':
|
||||
const fast = request.parameters?.macdFast || 12;
|
||||
const slow = request.parameters?.macdSlow || 26;
|
||||
const signal = request.parameters?.macdSignal || 9;
|
||||
results.macd = macd(request.data, fast, slow, signal).macd;
|
||||
break;
|
||||
|
||||
case 'stochastic':
|
||||
// TODO: Implement stochastic oscillator
|
||||
logger.warn('Stochastic oscillator not implemented yet');
|
||||
break;
|
||||
|
||||
default:
|
||||
logger.warn('Unknown indicator requested', { indicator });
|
||||
}
|
||||
} catch (error) {
|
||||
logger.error('Error calculating indicator', { indicator, error });
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
symbol: request.symbol,
|
||||
timestamp: new Date(),
|
||||
indicators: results
|
||||
};
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Technical Indicators Service
|
||||
* Leverages @stock-bot/utils for calculations
|
||||
*/
|
||||
import { getLogger } from '@stock-bot/logger';
|
||||
import {
|
||||
sma,
|
||||
ema,
|
||||
rsi,
|
||||
macd
|
||||
} from '@stock-bot/utils';
|
||||
|
||||
const logger = getLogger('indicators-service');
|
||||
|
||||
export interface IndicatorRequest {
|
||||
symbol: string;
|
||||
data: number[];
|
||||
indicators: string[];
|
||||
parameters?: Record<string, any>;
|
||||
}
|
||||
|
||||
export interface IndicatorResult {
|
||||
symbol: string;
|
||||
timestamp: Date;
|
||||
indicators: Record<string, number[]>;
|
||||
}
|
||||
|
||||
export class IndicatorsService {
|
||||
async calculateIndicators(request: IndicatorRequest): Promise<IndicatorResult> {
|
||||
logger.info('Calculating indicators', {
|
||||
symbol: request.symbol,
|
||||
indicators: request.indicators,
|
||||
dataPoints: request.data.length
|
||||
});
|
||||
|
||||
const results: Record<string, number[]> = {};
|
||||
|
||||
for (const indicator of request.indicators) {
|
||||
try {
|
||||
switch (indicator.toLowerCase()) {
|
||||
case 'sma':
|
||||
const smaPeriod = request.parameters?.smaPeriod || 20;
|
||||
results.sma = sma(request.data, smaPeriod);
|
||||
break;
|
||||
|
||||
case 'ema':
|
||||
const emaPeriod = request.parameters?.emaPeriod || 20;
|
||||
results.ema = ema(request.data, emaPeriod);
|
||||
break;
|
||||
|
||||
case 'rsi':
|
||||
const rsiPeriod = request.parameters?.rsiPeriod || 14;
|
||||
results.rsi = rsi(request.data, rsiPeriod);
|
||||
break;
|
||||
|
||||
case 'macd':
|
||||
const fast = request.parameters?.macdFast || 12;
|
||||
const slow = request.parameters?.macdSlow || 26;
|
||||
const signal = request.parameters?.macdSignal || 9;
|
||||
results.macd = macd(request.data, fast, slow, signal).macd;
|
||||
break;
|
||||
|
||||
case 'stochastic':
|
||||
// TODO: Implement stochastic oscillator
|
||||
logger.warn('Stochastic oscillator not implemented yet');
|
||||
break;
|
||||
|
||||
default:
|
||||
logger.warn('Unknown indicator requested', { indicator });
|
||||
}
|
||||
} catch (error) {
|
||||
logger.error('Error calculating indicator', { indicator, error });
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
symbol: request.symbol,
|
||||
timestamp: new Date(),
|
||||
indicators: results
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,20 +1,20 @@
|
|||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./dist",
|
||||
"rootDir": "./src"
|
||||
},
|
||||
"include": ["src/**/*"],
|
||||
"exclude": ["node_modules", "dist", "**/*.test.ts", "**/*.spec.ts", "**/test/**", "**/tests/**", "**/__tests__/**"],
|
||||
"references": [
|
||||
{ "path": "../../libs/types" },
|
||||
{ "path": "../../libs/config" },
|
||||
{ "path": "../../libs/logger" },
|
||||
{ "path": "../../libs/utils" },
|
||||
{ "path": "../../libs/data-frame" },
|
||||
{ "path": "../../libs/vector-engine" },
|
||||
{ "path": "../../libs/mongodb-client" },
|
||||
{ "path": "../../libs/event-bus" },
|
||||
{ "path": "../../libs/shutdown" }
|
||||
]
|
||||
}
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"outDir": "./dist",
|
||||
"rootDir": "./src"
|
||||
},
|
||||
"include": ["src/**/*"],
|
||||
"exclude": ["node_modules", "dist", "**/*.test.ts", "**/*.spec.ts", "**/test/**", "**/tests/**", "**/__tests__/**"],
|
||||
"references": [
|
||||
{ "path": "../../libs/types" },
|
||||
{ "path": "../../libs/config" },
|
||||
{ "path": "../../libs/logger" },
|
||||
{ "path": "../../libs/utils" },
|
||||
{ "path": "../../libs/data-frame" },
|
||||
{ "path": "../../libs/vector-engine" },
|
||||
{ "path": "../../libs/mongodb-client" },
|
||||
{ "path": "../../libs/event-bus" },
|
||||
{ "path": "../../libs/shutdown" }
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,20 +1,20 @@
|
|||
{
|
||||
"extends": ["//"],
|
||||
"tasks": {
|
||||
"build": {
|
||||
"dependsOn": [
|
||||
"@stock-bot/types#build",
|
||||
"@stock-bot/config#build",
|
||||
"@stock-bot/logger#build",
|
||||
"@stock-bot/utils#build",
|
||||
"@stock-bot/data-frame#build",
|
||||
"@stock-bot/vector-engine#build",
|
||||
"@stock-bot/mongodb-client#build",
|
||||
"@stock-bot/event-bus#build",
|
||||
"@stock-bot/shutdown#build"
|
||||
],
|
||||
"outputs": ["dist/**"],
|
||||
"inputs": ["src/**", "package.json", "tsconfig.json", "!**/*.test.ts", "!**/*.spec.ts", "!**/test/**", "!**/tests/**", "!**/__tests__/**"]
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
"extends": ["//"],
|
||||
"tasks": {
|
||||
"build": {
|
||||
"dependsOn": [
|
||||
"@stock-bot/types#build",
|
||||
"@stock-bot/config#build",
|
||||
"@stock-bot/logger#build",
|
||||
"@stock-bot/utils#build",
|
||||
"@stock-bot/data-frame#build",
|
||||
"@stock-bot/vector-engine#build",
|
||||
"@stock-bot/mongodb-client#build",
|
||||
"@stock-bot/event-bus#build",
|
||||
"@stock-bot/shutdown#build"
|
||||
],
|
||||
"outputs": ["dist/**"],
|
||||
"inputs": ["src/**", "package.json", "tsconfig.json", "!**/*.test.ts", "!**/*.spec.ts", "!**/test/**", "!**/tests/**", "!**/__tests__/**"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue