phase-7_alpha: legacy code cleanup

This commit is contained in:
Sai Kiran Vella
2026-06-05 22:27:53 -04:00
committed by saikiranvella
parent 357b0c0f6e
commit 93aac355cc
13 changed files with 31 additions and 983 deletions
+4 -3
View File
@@ -25,12 +25,13 @@ export class BenchmarkProvider {
private static pe(summary: any): number | null {
return summary?.summaryDetail?.trailingPE ?? summary?.defaultKeyStatistics?.forwardPE ?? null;
}
private client: YahooFinanceClient;
private cache: { data: MarketContext | null; expiresAt: number };
private logger: Logger;
constructor({ logger }: BenchmarkProviderOptions = {}) {
this.client = new YahooFinanceClient();
constructor(
private readonly client: YahooFinanceClient,
{ logger }: BenchmarkProviderOptions = {},
) {
this.cache = { data: null, expiresAt: 0 };
this.logger = logger ?? (console as unknown as Logger);
}
+1 -5
View File
@@ -11,11 +11,7 @@ import type {
} from '../types';
export class PortfolioAdvisor {
private client: YahooFinanceClient;
constructor() {
this.client = new YahooFinanceClient();
}
constructor(private readonly client: YahooFinanceClient) {}
async advise(
holdings: PortfolioHolding[],
+5 -7
View File
@@ -29,15 +29,13 @@ export class ScreenerEngine {
private static readonly BATCH_SIZE = 5;
private static readonly BATCH_DELAY_MS = 1000;
private client: YahooFinanceClient;
private benchmarkProvider: BenchmarkProvider;
private logger: Logger;
constructor({ logger }: ScreenerEngineOptions = {}) {
this.client = new YahooFinanceClient();
this.benchmarkProvider = new BenchmarkProvider({
logger: logger ?? (console as unknown as Logger),
});
constructor(
private readonly client: YahooFinanceClient,
private readonly benchmarkProvider: BenchmarkProvider,
{ logger }: ScreenerEngineOptions = {},
) {
this.logger = logger ?? {
write: (msg: string) => process.stdout.write(msg),
log: (...args: unknown[]) => console.log(...args),