Skip to content

Commit 133428a

Browse files
committed
정리: 죽은 이름을 부르던 남은 두 자리를 정리한다
스위프 잔여 후보를 하나씩 실행해 진짜와 오탐을 갈랐다. 예측 입력의 발행주식수가 진짜였다. `company.profile.sharesOutstanding` 을 읽는데 `profile` 은 표면에서 빠진 이름이라 늘 None 이었다. `capital` 축의 발행주식총수로 잇는다. 삼성전자 기준 250 억 주가 나온다. 서버의 topic 요약 엔드포인트에는 죽은 폴백이 있었다. `panel` 이 실패하면 `show` 로 한 번 더 시도하는데, `show` 는 계약에서 빠진 이름이라 부르면 AttributeError 로 떨어지고 그것도 같은 자리에서 삼켜졌다. 결과가 늘 같았으니 있어 보이기만 하는 가지다. 걷어냈다. 나머지는 오탐이었다. `_notesAccessor` 와 `industry` 는 실재하고, `_docs` 여덟 곳은 전부 EDGAR 경로라 그쪽 회사 객체가 실제로 갖고 있다. 한 자리는 남겨 둔다. 예측 입력의 부문별 매출과 수주는 `부문` 열과 연도 열을 가진 표를 요구하는데 지금 panel 은 원문이라 형태가 다르다. 배선으로 될 일이 아니라 추출을 새로 짜야 해서 손대지 않는다.
1 parent 9b7b170 commit 133428a

2 files changed

Lines changed: 18 additions & 11 deletions

File tree

‎src/dartlab/analysis/financial/_forecastCalcsInputs.py‎

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,20 @@ def _getSeriesAndMeta(company: Any) -> tuple[dict, str | None, str | None, str,
3131

3232

3333
def _getShares(company: Any) -> int | None:
34-
"""발행주식수 추출."""
35-
profile = getattr(company, "profile", None)
36-
if profile:
37-
sharesVal = getattr(profile, "sharesOutstanding", None)
38-
if sharesVal:
39-
return int(sharesVal)
40-
return None
34+
"""발행주식수 추출. 없으면 None.
35+
36+
예전에는 `company.profile.sharesOutstanding` 을 읽었다. `profile` 은 표면에서 빠진
37+
이름이라 늘 None 이었고, 이 함수가 어느 회사에서도 주식수를 못 냈다. 지금 공급원은
38+
`capital` 축의 발행주식총수다.
39+
"""
40+
try:
41+
df = company.capital()
42+
except (AttributeError, KeyError, OSError, RuntimeError, TypeError, ValueError):
43+
return None
44+
if df is None or getattr(df, "height", 0) == 0:
45+
return None
46+
value = df.row(0, named=True).get("발행주식총수")
47+
return int(value) if value else None
4148

4249

4350
def _buildCompanyDataBundle(company: Any):

‎src/dartlab/server/api/company.py‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -641,13 +641,13 @@ async def apiCompanyTopicSummary(
641641
except HANDLED_API_ERRORS as exc:
642642
raise HTTPException(status_code=404, detail=guideDetail(exc)) from exc
643643

644+
# 예전에는 `panel` 이 실패하면 `show` 로 한 번 더 시도했다. `show` 는 공개 계약에서
645+
# 빠진 이름이라 부르면 AttributeError 로 떨어지고, 그것도 여기서 삼켜져 결과가 늘
646+
# 같았다. 있어 보이기만 하는 폴백이라 걷어낸다.
644647
try:
645648
overview = company.panel(topic)
646649
except (AttributeError, KeyError, TypeError, ValueError):
647-
try:
648-
overview = company.show(topic)
649-
except (AttributeError, KeyError, TypeError, ValueError):
650-
overview = None
650+
overview = None
651651
if overview is None:
652652
raise HTTPException(status_code=404, detail=f"topic '{topic}' 데이터 없음")
653653

0 commit comments

Comments
 (0)