mirror of
https://github.com/shawnkim1997/All-in-one-Financial-Analysis.git
synced 2026-08-25 16:28:04 +00:00
feat: add 4-tier auto-valuation system for negative FCF companies + platform-wide improvements
Report page now auto-detects valuation tier based on company financials: - Tier 1 (FCF > 0): Traditional DCF analysis - Tier 2 (EBITDA > 0): EV/EBITDA relative valuation with Bear/Base/Bull scenarios - Tier 3 (Rev Growth > 10%): P/S revenue-based valuation - Tier 4 (all weak): P/B / NAV approach Includes RelativeValuationSection, PathToProfitability components, margin trajectory chart, and cash runway analysis. Also includes fixes across earnings, macro, screener, technical, filings pages and backend routers. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
8fe3aaf771
commit
ec2c5b37a2
@@ -2,11 +2,47 @@
|
||||
ATLAS Terminal — FastAPI Backend
|
||||
Unified entry point with PostgreSQL + SQLite support.
|
||||
"""
|
||||
import json
|
||||
import math
|
||||
import os
|
||||
import logging
|
||||
from contextlib import asynccontextmanager
|
||||
from typing import Any
|
||||
|
||||
from fastapi import FastAPI
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
from fastapi.responses import JSONResponse
|
||||
|
||||
|
||||
class _NanSafeEncoder(json.JSONEncoder):
|
||||
"""Replace NaN/Inf with None so JSON serialization never crashes."""
|
||||
|
||||
def default(self, o: Any) -> Any:
|
||||
return super().default(o)
|
||||
|
||||
def encode(self, o: Any) -> str:
|
||||
return super().encode(_sanitize(o))
|
||||
|
||||
|
||||
def _sanitize(obj: Any) -> Any:
|
||||
if isinstance(obj, float):
|
||||
if math.isnan(obj) or math.isinf(obj):
|
||||
return None
|
||||
return obj
|
||||
if isinstance(obj, dict):
|
||||
return {k: _sanitize(v) for k, v in obj.items()}
|
||||
if isinstance(obj, (list, tuple)):
|
||||
return [_sanitize(v) for v in obj]
|
||||
return obj
|
||||
|
||||
|
||||
class NanSafeJSONResponse(JSONResponse):
|
||||
def render(self, content: Any) -> bytes:
|
||||
return json.dumps(
|
||||
_sanitize(content),
|
||||
ensure_ascii=False,
|
||||
separators=(",", ":"),
|
||||
).encode("utf-8")
|
||||
|
||||
logging.basicConfig(level=logging.INFO)
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -28,6 +64,7 @@ app = FastAPI(
|
||||
description="Personal Bloomberg Terminal — Hybrid AI + Quantitative Analysis",
|
||||
version="2.0.0",
|
||||
lifespan=lifespan,
|
||||
default_response_class=NanSafeJSONResponse,
|
||||
)
|
||||
|
||||
# CORS — allow local frontend
|
||||
|
||||
Reference in New Issue
Block a user