Insight Grades

Analyzes a company’s financial health across 7 areas, assigns A~F grades, detects anomalies, and classifies an overall profile.

Usage

from dartlab.engines.insight import analyze

result = analyze("005930")

# 10-area grades
result.grades()
# {
#   "performance": "A",
#   "profitability": "A",
#   "health": "A",
#   "cashflow": "B",
#   "governance": "A",
#   "risk": "B",
#   "opportunity": "A"
# }

# Summary
result.profile   # "premium"
result.summary   # "삼성전자는 실적, 수익성, 재무건전성 등 대부분..."
result.anomalies # [] (no anomalies)

analyze()

analyze(stockCode: str, company: Company = None) -> AnalysisResult | None
ParameterTypeDescription
stockCodestrStock code (6 digits)
companyCompany (optional)Company instance. Created internally if None

Returns None if data is insufficient.

Analysis Process

  1. Build quarterly/annual financial time series
  2. Calculate financial ratios
  3. Auto-detect financial sector (6 signals: debt ratio, interest income, etc.)
  4. Grade 7 areas
  5. Detect anomalies (8 rules)
  6. Calculate distress scorecard (4-axis composite)
  7. Classify profile
  8. Generate Korean-language summary

7 Analysis Areas

performance (Earnings Growth)

Analyzes revenue and operating income growth rates and volatility.

GradeCriteria
ABoth revenue and operating income growing, low volatility
BOne growing or moderate volatility
CStagnant
DDeclining
FPersistent decline

profitability (Profitability)

Analyzes operating margin, net margin, ROE, and ROA. Sector benchmark adjustments are applied.

GradeCriteria
AOperating margin 10%+, ROE 15%+
BOperating margin 5%+, ROE 8%+
COperating margin positive, ROE positive
DOperating margin or ROE negative
FBoth significantly negative

health (Financial Health)

Analyzes debt ratio and current ratio. Separate criteria applied for financial sector.

GradeGeneral Company Criteria
ADebt ratio below 50%, current ratio above 200%
BDebt ratio below 100%, current ratio above 150%
CDebt ratio below 200%, current ratio above 100%
DDebt ratio below 400%
FDebt ratio above 400% or capital erosion

cashflow (Cash Flow)

Analyzes operating cash flow, free cash flow (FCF), FCF margin, and trends.

GradeCriteria
AOperating CF positive + FCF positive + improving trend
BOperating CF positive + FCF positive
COperating CF positive, FCF negative
DOperating CF negative
FPersistently negative operating CF

governance (Governance)

Analyzes largest shareholder ownership ratio, audit opinion, and dividend status.

GradeCriteria
AUnqualified opinion + stable ownership + dividend
BUnqualified opinion + partially met
CUnqualified opinion, rest unmet
DAudit opinion warning
FAdverse opinion / Disclaimer of opinion

risk (Overall Risk)

Synthesizes risk flags from the other 6 areas.

opportunity (Investment Opportunity)

Synthesizes opportunity flags from the other 6 areas.

AnalysisResult

FieldTypeDescription
corpNamestrCompany name
stockCodestrStock code
isFinancialboolWhether financial sector
performanceInsightResultEarnings growth
profitabilityInsightResultProfitability
healthInsightResultFinancial health
cashflowInsightResultCash flow
governanceInsightResultGovernance
riskInsightResultOverall risk
opportunityInsightResultInvestment opportunity
anomalieslist[Anomaly]List of anomalies
distressDistressResultDistress prediction scorecard
summarystrKorean-language summary
profilestrCompany profile

grades() Method

result.grades() -> dict[str, str]

Returns grades for all 7 areas as a dict.

InsightResult

Analysis result for each area.

FieldTypeDescription
gradestrGrade (A/B/C/D/F, N=no data)
summarystrKorean summary
detailslist[str]Detailed analysis items
riskslist[Flag]Risk flags
opportunitieslist[Flag]Opportunity flags

Anomaly Detection

Detects financial anomaly signals using 8 rules.

CategoryDetection Target
earningsQualityOperating income increasing but operating CF decreasing
workingCapitalRapid increase in trade receivables / inventories
balanceSheetShiftDebt/borrowings/equity changed by more than +/-50%, capital erosion
cashBurnSharp cash decline, operating CF deficit + financing CF positive (debt-dependent)
marginDivergenceOperating margin changed by +/-5%p, non-operating income sharp change
financialSectorFinancial sector debt ratio sharp change, net income sharp decline
trendDeteriorationConsecutive net losses, operating CF losses, ICR below 1, rising debt ratio
cccDeteriorationCash conversion cycle expanding 3+ consecutive years
for a in result.anomalies:
    print(f"[{a.severity}] {a.category}: {a.text}")
    # [warning] earningsQuality: 영업이익은 증가했으나 영업CF는 감소

Anomaly

FieldTypeDescription
severitystr“danger”, “warning”, “info”
categorystrAnomaly type
textstrDetailed description
valuefloat (optional)Numeric value

Distress Prediction Scorecard

The distress field provides a comprehensive distress prediction report with evidence-based formatting.

result = analyze("005930")
print(result.distress)
# === 부실 예측 스코어카드 ===
# 종합: safe (2.1/100) | 신용등급: AAA (투자적격 최상위)
# ...

DistressResult

FieldTypeDescription
levelstrsafe/watch/warning/danger/critical
overallfloatComposite score (0~100)
creditGradestrS&P-mapped credit grade (AAA~D)
creditDescriptionstrGrade description in Korean
axeslist[DistressAxis]4 weighted axes with model details
cashRunwayMonthsfloat?Estimated months of cash runway
liquidityAlertstr?Liquidity alert level
riskFactorslist[str]Structured risk factors
modelCountintNumber of models used
dataQualitystr충분/보통/부족

4 Axes

AxisWeightModels
정량 분석40%Ohlson O-Score, Altman Z”-Score, Altman Z-Score
이익 품질20%Beneish M-Score, Sloan Accrual, Piotroski F-Score
추세 분석30%trendDeterioration, cccDeterioration anomalies
감사 위험10%audit/governance anomalies

Credit Grade Mapping

Overall ScoreGradeDescription
5 미만AAA투자적격 최상위
10 미만AA투자적격 상위
15 미만A투자적격
25 미만BBB투자적격 하한
35 미만BB투기등급
50 미만B투기등급 하위
65 미만CCC상당한 부실 위험
80 미만CC부실 임박
90 미만C부도 직전
90 이상D부도 수준

ModelScore

Each quantitative/quality model produces a ModelScore:

FieldTypeDescription
namestrModel name (e.g., “Ohlson O-Score”)
rawValuefloatRaw computed value
displayValuestrHuman-readable value (e.g., “P(부도) 0.5%“)
zonestrsafe / gray / distress
interpretationstrEvidence-based interpretation
referencestrAcademic reference

DistressAxis

FieldTypeDescription
namestrAxis name
scorefloatNormalized score (0~100)
weightfloatWeight in composite (0.0~1.0)
modelslist[ModelScore]Individual model results
summarystrAxis-level summary

Company Profiles

Classifies companies into one of 6 profiles based on grade combinations.

ProfileCondition
premiumHigh average grade + low risk
growthPerformance / profitability / opportunity all top-tier
stableHealth / risk / profitability all stable
cautionRisk D/F or health F
distressMost areas low-grade
mixedDoes not match above conditions

Examples

from dartlab.engines.insight import analyze

result = analyze("005930")

# Check grades
for area, grade in result.grades().items():
    print(f"{area}: {grade}")

# Profitability details
print(result.profitability.summary)
for d in result.profitability.details:
    print(f"  - {d}")

# Risk flags
for flag in result.risk.risks:
    print(f"[{flag.level}] {flag.category}: {flag.text}")

# Anomalies
if result.anomalies:
    print("=== Anomalies Detected ===")
    for a in result.anomalies:
        print(f"  [{a.severity}] {a.text}")

# Summary
print(f"Profile: {result.profile}")
print(result.summary)