이 스킬
뉴스 sentiment cross-section factor + IC + 5분위 spread
시장 전종목 (KRX listing × news archive) lookback news headline 의 평균 sentiment score 를 cross-section factor 로 격상. 종목별 corpName keyword 필터 → mean sentiment → forward return cross-section IC (Pearson + Spearman + t-stat). 5분위 long-short spread 동행. Tetlock 2007 "Giving Content to Investor Sentiment" 표준. 트리거 — 'news sentiment factor', '뉴스 alpha', 'newsSentimentFactor'.
이어 가기
절차
실행 순서
- 1
`@withMemoryBudget(500)` — universe build RSS delta 상한
- 2
`BoundedCache _news_sentiment_universe_*` LRU 50 / 400MB
- 3
기본 `sentimentModel="lm_dict"` — 대량 cross-section CPU 비용 가드
- 4
archive 7 일 이내 lookback 은 분산 부족 — 30 일 권장.
- 5
lm_dict 만 사용 시 동음이의·문맥 무시. transformers 모델 (`sentimentModel="auto"`) 은 GPU 권장.
- 6
forward return horizon 너무 길면 (>20 일) IC 약화.
예시
이런 질문이 들어오면 이 skill 을 쓴다
- KR 시장 30 일 lookback newsSentiment IC + 5분위 spread
- newsSentiment factor 가 PER/PBR 보다 forward 5d 수익 더 잘 정렬하나
출력
기대 결과
- ic_pearson / ic_spearman / t_stat / is_significant
- quintile_spread (top - bottom 평균 수익률)
- n_long / n_short 종목 수
공개 호출 방식
from dartlab.quant.factor.newsSentimentFactor import newsSentimentIC
result = newsSentimentIC(
market="KR",
lookbackDays=30,
forwardDays=5,
)
print(f"IC pearson: {result['ic_pearson']:.4f} (t={result['t_stat']:.2f})")
print(f"5분위 spread: {result['quintile_spread']:.4f} (n_long={result['n_long']})")
print(f"유의: {result['is_significant']}") 출력 schema
| key | 의미 |
|---|---|
ic_pearson / ic_spearman | Pearson + Spearman cross-section IC |
t_stat / is_significant | t-stat + |
n_stocks | universe × forward return 공통 종목 |
quintile_spread | top - bottom 5분위 평균 수익률 |
n_long / n_short | 5분위 종목 수 |
메모리 가드
@withMemoryBudget(500)— universe build RSS delta 상한BoundedCache _news_sentiment_universe_*LRU 50 / 400MB- 기본
sentimentModel="lm_dict"— 대량 cross-section CPU 비용 가드
한계
- archive 7 일 이내 lookback 은 분산 부족 — 30 일 권장.
- lm_dict 만 사용 시 동음이의·문맥 무시. transformers 모델 (
sentimentModel="auto") 은 GPU 권장. - forward return horizon 너무 길면 (>20 일) IC 약화.
연계 절차
- 본 recipe → news sentiment 팩터 빌드 + IC / 분위 스프레드 검증.
engines.gather뉴스 archive +engines.quant팩터 프레임 결합.recipes.news.newsImpact이벤트 임팩트와 교차 검증.recipes.sentiment.priceMomentumGap과 결합해 모멘텀-센티먼트 갭 점검.
런타임
실행 환경별 호환성
| 환경 | 상태 | 비고 / 제한 |
|---|---|---|
| Local Python | supported | · |
| Server | supported | · |
| MCP | supported | · |
| Web AI | limited | · |
| Pyodide | limited | · |
실패 회피
흔한 실패 · 절대 금지
- news archive Phase A/D 미실행
- KRX listing × archive 매칭 종목 < 10
- forward return horizon ohlcv 부족
- n_stocks < 10 IC 결과로 alpha 검증 단정 금지
- lm_dict 단일 모델로 sentiment 의미 단정 금지