Skip to main content

getNews

Retrieve the latest cryptocurrency news articles from Alpaca’s news feed.

Parameters

This query does not accept parameters. It returns the latest news articles available.

Response

news
[News]
Array of news articles

Examples

query GetLatestNews {
  news {
    id
    headline
    summary
    author
    source
    symbols
    created_at
    url
  }
}

Use Cases

Filter News by Symbol

While the query doesn’t support server-side filtering, you can filter news articles by cryptocurrency symbol on the client side:
Client-side Filtering
const btcNews = news.filter(article => 
  article.symbols.includes('BTC')
);

Display News Feed

Create a real-time news feed for your cryptocurrency dashboard:
React Example
const { data } = useQuery(GET_NEWS);

return (
  <div>
    {data?.news?.map(article => (
      <NewsCard
        key={article.id}
        headline={article.headline}
        summary={article.summary}
        symbols={article.symbols}
        url={article.url}
        createdAt={article.created_at}
      />
    ))}
  </div>
);

Track Symbol Mentions

Analyze news sentiment by tracking cryptocurrency mentions:
Symbol Tracking
const symbolMentions = news.reduce((acc, article) => {
  article.symbols.forEach(symbol => {
    acc[symbol] = (acc[symbol] || 0) + 1;
  });
  return acc;
}, {});

Integration with Price Rules

Combine news data with price alerts to make informed trading decisions:
query GetMarketOverview {
  news {
    headline
    symbols
    created_at
  }
  
  priceRules(where: { isEnabled: { eq: true } }) {
    nodes {
      name
      instrument {
        symbol
      }
      lastTriggeredAt
    }
  }
}

News Source

News data is provided by Alpaca Markets, aggregating content from reputable cryptocurrency news sources and financial publishers.

Build docs developers (and LLMs) love