recipes.sentiment.newsSentimentFactor Recipes Recipe drafted

뉴스 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'.

이 스킬

뉴스 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'.

Recipes drafted recipes.sentiment.newsSentimentFactor

이어 가기

절차

실행 순서

  1. 1

    `@withMemoryBudget(500)` — universe build RSS delta 상한

  2. 2

    `BoundedCache _news_sentiment_universe_*` LRU 50 / 400MB

  3. 3

    기본 `sentimentModel="lm_dict"` — 대량 cross-section CPU 비용 가드

  4. 4

    archive 7 일 이내 lookback 은 분산 부족 — 30 일 권장.

  5. 5

    lm_dict 만 사용 시 동음이의·문맥 무시. transformers 모델 (`sentimentModel="auto"`) 은 GPU 권장.

  6. 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_spearmanPearson + Spearman cross-section IC
t_stat / is_significantt-stat +
n_stocksuniverse × forward return 공통 종목
quintile_spreadtop - bottom 5분위 평균 수익률
n_long / n_short5분위 종목 수

메모리 가드

  • @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 약화.

연계 절차

  1. 본 recipe → news sentiment 팩터 빌드 + IC / 분위 스프레드 검증.
  2. engines.gather 뉴스 archive + engines.quant 팩터 프레임 결합.
  3. recipes.news.newsImpact 이벤트 임팩트와 교차 검증.
  4. 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 의미 단정 금지