quantbrasil news analyze
Analisa notícias recentes por relevância e sentimento
Sintaxe
quantbrasil news analyzeEsta é uma operação de leitura. Modos de saída: json, human.
Argumentos e opções
| Nome | Tipo | Obrigatório | Descrição | Padrão |
|---|---|---|---|---|
--window <days> | Opção | Não | Janela de análise em dias | 7 |
--limit <count> | Opção | Não | Número máximo de tickers retornados | 5 |
--json | Opção | Não | Mostra a resposta em JSON | — |
--compact | Opção | Não | Saída JSON compacta para agentes | — |
Exemplos
quantbrasil news analyze
quantbrasil news analyze --window 7 --limit 5
quantbrasil news analyze --window 14 --limit 20 --jsonSaí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"
}
]
}