Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions apps/aggregator/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
tsconfigRootDir: __dirname,
sourceType: 'module',
},
plugins: ['@typescript-eslint/eslint-plugin'],
extends: [
'plugin:@typescript-eslint/recommended',
],
root: true,
env: {
node: true,
jest: true,
},
ignorePatterns: ['.eslintrc.js'],
rules: {
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
},
};
24 changes: 24 additions & 0 deletions apps/api/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
tsconfigRootDir: __dirname,
sourceType: 'module',
},
plugins: ['@typescript-eslint/eslint-plugin'],
extends: [
'plugin:@typescript-eslint/recommended',
],
root: true,
env: {
node: true,
jest: true,
},
ignorePatterns: ['.eslintrc.js'],
rules: {
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
},
};
2 changes: 0 additions & 2 deletions apps/api/src/app.controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { AppService } from './app.service';

describe('AppController', () => {
let controller: AppController;
let service: AppService;

beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
Expand All @@ -13,7 +12,6 @@ describe('AppController', () => {
}).compile();

controller = module.get<AppController>(AppController);
service = module.get<AppService>(AppService);
});

it('should be defined', () => {
Expand Down
24 changes: 24 additions & 0 deletions apps/ingestor/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
tsconfigRootDir: __dirname,
sourceType: 'module',
},
plugins: ['@typescript-eslint/eslint-plugin'],
extends: [
'plugin:@typescript-eslint/recommended',
],
root: true,
env: {
node: true,
jest: true,
},
ignorePatterns: ['.eslintrc.js'],
rules: {
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
},
};
3 changes: 2 additions & 1 deletion apps/ingestor/src/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { Module } from '@nestjs/common';
import { PricesModule } from './modules/prices.module';

@Module({
imports: [],
imports: [PricesModule],
controllers: [],
providers: [],
})
Expand Down
18 changes: 18 additions & 0 deletions apps/ingestor/src/controllers/prices.controller.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Controller, Get, Logger } from '@nestjs/common';
import { PriceFetcherService, RawPrice } from '../services/price-fetcher.service';

@Controller('prices')
export class PricesController {
private readonly logger = new Logger(PricesController.name);

constructor(private readonly priceFetcherService: PriceFetcherService) {}

@Get('raw')
async getRawPrices(): Promise<RawPrice[]> {
this.logger.log('GET /prices/raw endpoint called');
await this.priceFetcherService.fetchRawPrices();
const rawPrices = this.priceFetcherService.getRawPrices();
this.logger.log(`Returning ${rawPrices.length} raw prices`);
return rawPrices;
}
}
10 changes: 10 additions & 0 deletions apps/ingestor/src/modules/prices.module.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Module } from '@nestjs/common';
import { PricesController } from '../controllers/prices.controller';
import { PriceFetcherService } from '../services/price-fetcher.service';

@Module({
controllers: [PricesController],
providers: [PriceFetcherService],
exports: [PriceFetcherService],
})
export class PricesModule {}
45 changes: 45 additions & 0 deletions apps/ingestor/src/services/price-fetcher.service.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { Injectable, Logger } from '@nestjs/common';

export interface RawPrice {
symbol: string;
price: number;
timestamp: number;
source: string;
}

@Injectable()
export class PriceFetcherService {
private readonly logger = new Logger(PriceFetcherService.name);
private rawPrices: RawPrice[] = [];

async fetchRawPrices(): Promise<RawPrice[]> {
const symbols = ['AAPL', 'GOOGL', 'MSFT', 'TSLA'];
const sources = ['AlphaVantage', 'YahooFinance', 'Finnhub'];

this.rawPrices = symbols.flatMap(symbol =>
sources.map(source => ({
symbol,
price: this.generateMockPrice(),
timestamp: Date.now(),
source,
}))
);

this.logger.log(`Fetched ${this.rawPrices.length} raw prices from external APIs`);
this.rawPrices.forEach(price => {
this.logger.debug(
`${price.source} - ${price.symbol}: $${price.price.toFixed(2)} at ${new Date(price.timestamp).toISOString()}`
);
});

return this.rawPrices;
}

getRawPrices(): RawPrice[] {
return this.rawPrices;
}

private generateMockPrice(): number {
return parseFloat((Math.random() * 1000 + 50).toFixed(2));
}
}
24 changes: 24 additions & 0 deletions apps/transactor/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
module.exports = {
parser: '@typescript-eslint/parser',
parserOptions: {
project: 'tsconfig.json',
tsconfigRootDir: __dirname,
sourceType: 'module',
},
plugins: ['@typescript-eslint/eslint-plugin'],
extends: [
'plugin:@typescript-eslint/recommended',
],
root: true,
env: {
node: true,
jest: true,
},
ignorePatterns: ['.eslintrc.js'],
rules: {
'@typescript-eslint/interface-name-prefix': 'off',
'@typescript-eslint/explicit-function-return-type': 'off',
'@typescript-eslint/explicit-module-boundary-types': 'off',
'@typescript-eslint/no-explicit-any': 'off',
},
};
Loading