This commit is contained in:
Boki 2025-06-11 10:35:15 -04:00
parent d85cd58acd
commit 597c6efc9b
91 changed files with 2224 additions and 1400 deletions

View file

@ -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"
}
}

View file

@ -33,27 +33,31 @@ export class IndicatorsService {
for (const indicator of request.indicators) {
try {
switch (indicator.toLowerCase()) {
case 'sma':
case 'sma': {
const smaPeriod = request.parameters?.smaPeriod || 20;
results.sma = sma(request.data, smaPeriod);
break;
}
case 'ema':
case 'ema': {
const emaPeriod = request.parameters?.emaPeriod || 20;
results.ema = ema(request.data, emaPeriod);
break;
}
case 'rsi':
case 'rsi': {
const rsiPeriod = request.parameters?.rsiPeriod || 14;
results.rsi = rsi(request.data, rsiPeriod);
break;
}
case 'macd':
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

View file

@ -1,20 +1,28 @@
{
"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" }
]
}