QuantBrasil
Documentação

quantbrasil news analyze

Analisa notícias recentes por relevância e sentimento

Sintaxe

quantbrasil news analyze

Esta é uma operação de leitura. Modos de saída: json, human.

Argumentos e opções

NomeTipoObrigatórioDescriçãoPadrão
--window <days>OpçãoNãoJanela de análise em dias7
--limit <count>OpçãoNãoNúmero máximo de tickers retornados5
--jsonOpçãoNãoMostra a resposta em JSON
--compactOpçãoNãoSaída JSON compacta para agentes

Exemplos

quantbrasil news analyze
quantbrasil news analyze --window 7 --limit 5
quantbrasil news analyze --window 14 --limit 20 --json

Saída (--json)

Estrutura da resposta retornada com --json:

export interface NewsAnalysisResponse {
  ok: boolean;
  window_days: number;
  limit: number;
  total_tickers: number;
  total_mentions: number;
  tickers: NewsAnalysisTicker[];
  warnings: string[];
}

export interface NewsAnalysisTicker {
  asset: AssetNewsAsset;
  mention_count: number;
  current_sentiment_count: number;
  missing_sentiment_count: number;
  positive_count: number;
  negative_count: number;
  neutral_count: number;
  weighted_sentiment_sum: number;
  average_sentiment_score: number | null;
  relevance_score: number;
  overall_sentiment: NewsAnalysisOverallSentiment;
  articles: NewsAnalysisArticle[];
}

export interface AssetNewsAsset {
  id: number;
  ticker: string;
  name: string | null;
  type: string | null;
}

export type NewsAnalysisOverallSentiment =
  | "positive"
  | "negative"
  | "neutral"
  | "mixed"
  | "unavailable";

export interface NewsAnalysisArticle {
  id: number;
  source_slug: string;
  source_name: string;
  title: string;
  summary: string | null;
  url: string;
  published_at: string;
  mentioned_tickers: string[];
  sentiment: AssetNewsSentiment | null;
}

export interface AssetNewsSentiment {
  model: string;
  prompt_version: string;
  sentiment: "positive" | "negative" | "neutral";
  confidence: number | null;
  reason: string | null;
  input_tokens: number | null;
  output_tokens: number | null;
  total_tokens: number | null;
  analyzed_at: string;
}

Exemplo de resposta

{
  "ok": true,
  "window_days": 7,
  "limit": 5,
  "total_tickers": 1,
  "total_mentions": 3,
  "tickers": [
    {
      "asset": {
        "id": 1,
        "ticker": "PETR4",
        "name": "Petrobras PN",
        "type": "B3"
      },
      "mention_count": 3,
      "current_sentiment_count": 3,
      "missing_sentiment_count": 0,
      "positive_count": 2,
      "negative_count": 0,
      "neutral_count": 1,
      "weighted_sentiment_sum": 1.4,
      "average_sentiment_score": 0.47,
      "relevance_score": 0.71,
      "overall_sentiment": "positive",
      "articles": [
        {
          "id": 5001,
          "source_slug": "valor",
          "source_name": "Valor Econômico",
          "title": "Petrobras anuncia novo plano de investimentos",
          "summary": "A companhia detalhou os aportes previstos.",
          "url": "https://exemplo.com.br/noticia/5001",
          "published_at": "2026-07-15T11:30:00Z",
          "mentioned_tickers": ["PETR4"],
          "sentiment": null
        }
      ]
    }
  ],
  "warnings": []
}

Saída (--compact)

Estrutura da resposta retornada com --compact:

export interface NewsAnalysisCompactOutput {
  window_days: number;
  limit: number;
  total_tickers: number;
  total_mentions: number;
  warnings: string[];
  tickers: NewsAnalysisCompactTicker[];
}

export interface NewsAnalysisCompactTicker {
  ticker: string;
  name: string | null;
  mention_count: number;
  positive_count: number;
  negative_count: number;
  neutral_count: number;
  average_sentiment_score: number | null;
  relevance_score: number;
  overall_sentiment: NewsAnalysisOverallSentiment;
}

Exemplo de resposta

{
  "window_days": 7,
  "limit": 5,
  "total_tickers": 1,
  "total_mentions": 3,
  "warnings": [],
  "tickers": [
    {
      "ticker": "PETR4",
      "name": "Petrobras PN",
      "mention_count": 3,
      "positive_count": 2,
      "negative_count": 0,
      "neutral_count": 1,
      "average_sentiment_score": 0.47,
      "relevance_score": 0.71,
      "overall_sentiment": "positive"
    }
  ]
}