stocks: 미국 주식 지원(개별 종목) + datacollect LLM 직접 호출 + 백엔드 기본 NAS

미국 주식 (개별 종목 조회 — add/check/judge/analysis/position):
- marketUtils: KR(6자리)/US(티커) 시장 판별, 통화·시총 포매팅($/원, B·T/억·조)
- yahooClient: US는 raw 티커(.KQ/.KS 미부착), 심볼 라우팅 분리
- yahooFundamentals: Yahoo quoteSummary(무키) cookie+crumb 핸드셰이크로 ROE/PER/PBR/마진/성장/부채 fetch (429·crumb 하드닝)
- fundamentalsRouter: 심볼별 Naver(KR)/Yahoo(US) 분기
- criteriaEval: market-aware — US는 유보율 미보고라 유동성·안정성을 부채비율(D/E)·시총($B)으로 대체
- types: Stock.market 필드; slashStocks/llmJudge: 통화·라우팅·프롬프트 US 대응
- 테스트: stocksMarket + criteriaEval US 케이스 (전체 통과)

datacollect/llm.ts: LLM을 확장(PC)에서 직접 호출(과거 bridge /api/lm 프록시 제거)
 → 백엔드 NAS 이전 시 PC→NAS→PC 실패 제거, 스크래핑=NAS·LLM 추론=PC 분리

package.json: datacollectBridge 기본값 nas + https://dc.koritips.com; 버전 2.2.261

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-07-01 18:43:04 +09:00
parent 4288b212d5
commit e6d780be61
13 changed files with 531 additions and 119 deletions
+10 -2
View File
@@ -30,10 +30,18 @@ export interface Fundamentals {
per?: number;
pbr?: number;
eps?: number;
marketCapEok?: number; // 억 단위
marketCapEok?: number; // 억 단위 (한국 경로 전용 — 미국은 marketCapNative 사용)
currentPrice?: number;
/** 업종 hint — 사용 가능하면 채움 ("기술력" 키워드 매칭 용). */
sectorHint?: string;
/** 시장 — 'KR'(Naver) | 'US'(Yahoo). 미지정 시 호출자가 심볼로 판별. */
market?: 'KR' | 'US';
/** 시가총액 native 단위 (US=USD). KR 은 marketCapEok 사용. */
marketCapNative?: number;
/** 통화 — currentPrice/marketCapNative 의 단위. */
currency?: 'KRW' | 'USD';
/** 데이터 출처 라벨 — 'Naver' | 'Yahoo quoteSummary'. 정확도/투명성 표기용. */
source?: string;
}
interface NaverIntegrationResponse {
@@ -114,7 +122,7 @@ export async function fetchFundamentals(symbol: string, timeoutMs = 10000): Prom
]);
if (!integ && !fin) return null;
const out: Fundamentals = { symbol };
const out: Fundamentals = { symbol, market: 'KR', currency: 'KRW', source: 'Naver' };
// integration — totalInfos 의 code 로 추출 (key 한글 텍스트보다 안정적).
if (integ?.totalInfos) {