Closes #023-warn - Implement PEAD fallback transparency warning badge
This commit is contained in:
@@ -27,6 +27,7 @@ interface TickerDetails {
|
||||
epsConsensus?: number;
|
||||
surprisePercent?: number;
|
||||
driftStatus?: string;
|
||||
isLiveApi?: boolean;
|
||||
}
|
||||
|
||||
// 14-day Welles Wilder RSI solver
|
||||
@@ -412,6 +413,7 @@ function getSimulatedPEAD(ticker: string): {
|
||||
epsConsensus: number;
|
||||
surprisePercent: number;
|
||||
driftStatus: 'Active Drift' | 'Consolidating';
|
||||
isLiveApi: boolean;
|
||||
} {
|
||||
const getSector = (t: string) => {
|
||||
const tech = ['AAPL', 'MSFT', 'NVDA', 'AMD', 'SMCI', 'ADBE', 'CRM', 'AVGO', 'QCOM', 'TXN', 'INTC', 'MU', 'AMAT', 'LRCX', 'PLTR'];
|
||||
@@ -438,7 +440,8 @@ function getSimulatedPEAD(ticker: string): {
|
||||
epsActual: 0,
|
||||
epsConsensus: 0,
|
||||
surprisePercent: 0,
|
||||
driftStatus: 'Consolidating'
|
||||
driftStatus: 'Consolidating',
|
||||
isLiveApi: false
|
||||
};
|
||||
}
|
||||
|
||||
@@ -464,7 +467,8 @@ function getSimulatedPEAD(ticker: string): {
|
||||
epsActual,
|
||||
epsConsensus,
|
||||
surprisePercent,
|
||||
driftStatus
|
||||
driftStatus,
|
||||
isLiveApi: false
|
||||
};
|
||||
}
|
||||
|
||||
@@ -476,6 +480,7 @@ async function fetchFmpEarningsSurprise(ticker: string, apiKey: string): Promise
|
||||
epsConsensus: number;
|
||||
surprisePercent: number;
|
||||
driftStatus: 'Active Drift' | 'Consolidating';
|
||||
isLiveApi: boolean;
|
||||
}> {
|
||||
const getSector = (t: string) => {
|
||||
const tech = ['AAPL', 'MSFT', 'NVDA', 'AMD', 'SMCI', 'ADBE', 'CRM', 'AVGO', 'QCOM', 'TXN', 'INTC', 'MU', 'AMAT', 'LRCX', 'PLTR'];
|
||||
@@ -502,7 +507,8 @@ async function fetchFmpEarningsSurprise(ticker: string, apiKey: string): Promise
|
||||
epsActual: 0,
|
||||
epsConsensus: 0,
|
||||
surprisePercent: 0,
|
||||
driftStatus: 'Consolidating'
|
||||
driftStatus: 'Consolidating',
|
||||
isLiveApi: false
|
||||
};
|
||||
}
|
||||
|
||||
@@ -536,7 +542,8 @@ async function fetchFmpEarningsSurprise(ticker: string, apiKey: string): Promise
|
||||
epsActual,
|
||||
epsConsensus,
|
||||
surprisePercent,
|
||||
driftStatus
|
||||
driftStatus,
|
||||
isLiveApi: true
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -545,7 +552,10 @@ async function fetchFmpEarningsSurprise(ticker: string, apiKey: string): Promise
|
||||
}
|
||||
|
||||
// Fallback to deterministic simulation
|
||||
return getSimulatedPEAD(ticker);
|
||||
return {
|
||||
...getSimulatedPEAD(ticker),
|
||||
isLiveApi: false
|
||||
};
|
||||
}
|
||||
|
||||
export async function GET(request: Request) {
|
||||
|
||||
Reference in New Issue
Block a user