News API

Alpaca, in partnership with Benzinga, offers 6+ years of historical news data through a REST API and real-time access through WebSockets.

Use Cases

News API is a versatile tool that can be used to support a variety of use cases, such as building an app with the Broker API or Algorithmic Trading using Sentiment Analysis on News with the Trading API.

  1. News Widgets

    News API can be used to create visual news widgets for web and mobile apps. These widgets can be used to display the latest news for any stock or crypto symbol, and they include different sized images to give your app a visual appeal.

  2. News Sentiment Analysis
    News API can be used to train models that can determine the sentiment of a given headline or news content. This can be done by using historical data from News API to train the model on a variety of different sentiment labels.

  3. Realtime Trading on News
    Real-time news over WebSockets can be used to enable your trading algorithms to react to the latest news across any stock or cryptocurrency. This can be done by subscribing to a WebSockets feed from a news provider, such as News API.

Historical (REST)

News API provides historical news data dating back to 2015. You can expect to receive an average of 130+ news articles per day. All news data is currently provided directly by Benzinga.

With a single endpoint, you can request news for both stocks and cryptocurrency tickers. For a more comprehensive reference of News API, please see the following API reference:

Get Latest News

By calling the News API with no query parameters, you will get the latest 10 news articles from all sources. This means that you will get a mix of news articles about stocks, cryptocurrencies, and other topics.

curl --location --request GET 'https://data.alpaca.markets/v1beta1/news' \
--header 'Apca-Api-Key-Id: <KEY>' \
--header 'Apca-Api-Secret-Key: <SECRET>'

Here is an example of the response you will receive when you call the News API with no query parameters:

{
    "news": [
        {
            "id": 24919570,
            "headline": "Rumble Announces 'Exclusive' Content From AMC Ape Matt Kohrs And Rand Paul, Record Site Numbers Revealed",
            "author": "Chris Katje",
            "created_at": "2022-01-05T22:51:39Z",
            "updated_at": "2022-01-05T23:31:19Z",
            "summary": "Video platform Rumble shared several company updates Wednesday, including new user metrics.",
            "url": "https://www.benzinga.com/news/22/01/24919570/rumble-announces-amc-ape-matt-kohrs-and-rand-paul-joining-record-site-numbers-revealed",
            "images": [
                {
                    "size": "large",
                    "url": "https://cdn.benzinga.com/files/imagecache/2048x1536xUP/images/story/2012/mattkohrsonrumble.png"
                },
                {
                    "size": "small",
                    "url": "https://cdn.benzinga.com/files/imagecache/1024x768xUP/images/story/2012/mattkohrsonrumble.png"
                },
                {
                    "size": "thumb",
                    "url": "https://cdn.benzinga.com/files/imagecache/250x187xUP/images/story/2012/mattkohrsonrumble.png"
                }
            ],
            "symbols": [
                "AMC",
                "AMZN",
                "CFVI",
                "GME",
                "GOOG",
                "GOOGL",
                "TWTR"
            ],
            "source": "benzinga"
        }
    ],
    "next_page_token": "MTY0MTQyMjU0OTAwMDAwMDAwMHwyNDkxNzQzNw=="
}

Get News for Multiple Symbols

To get news articles for multiple stocks or cryptocurrencies, you can provide a comma-separated list of symbols. For example, the following request will get news articles for both Coinbase (COIN) and bitcoin (BTCUSD):

curl --location --request GET 'https://data.alpaca.markets/v1beta1/news?symbols=COIN,BTCUSD' \
--header 'Apca-Api-Key-Id: <KEY>' \
--header 'Apca-Api-Secret-Key: <SECRET>'
{
  "id": 24899683,
  "headline": "Investment Firm Offers Diversified Exposure To Crypto Innovations: Bitcoin, Solana, Avalanche And More",
  "author": "Renato Capelj",
  "created_at": "2022-01-05T20:11:10Z",
  "updated_at": "2022-01-05T20:23:40Z",
  "summary": "It takes time for innovations to penetrate their target markets. The rate of adoption is best characterized by the s-curve, a mathematical graph that plots growth against time.\n\nAt the outset, growth is slow in relation to the time that passes. With time, however, growth accelerates rapidly as the majority adopt the innovation.",
  "url": "https://www.benzinga.com/fintech/22/01/24899683/investment-firm-offers-diversified-exposure-to-crypto-innovations-bitcoin-solana-avalanche-and-more",
   "images": [
      {
         "size": "large",
         "url": "https://cdn.benzinga.com/files/imagecache/2048x1536xUP/images/story/2012/cover_photo_66.png"
      },
      {
         "size": "small",
         "url": "https://cdn.benzinga.com/files/imagecache/1024x768xUP/images/story/2012/cover_photo_66.png"
      },
      {
          "size": "thumb",
          "url": "https://cdn.benzinga.com/files/imagecache/250x187xUP/images/story/2012/cover_photo_66.png"
      }
   ],
   "symbols": [
       "AVAXUSD",
       "BTCUSD",
       "BX",
       "COIN",
       "ETHUSD",
       "SOLUSD"
    ],
    "source": "benzinga"
}

Real-time (STREAMING)

Real-time news streaming over WebSocket delivers between 600 and 900 news articles or headlines per day.

Real-time News

You can use the wscat or websocat command-line tools to test a connection to the news stream.

In the example below, you can see how to authenticate with the server and subscribe to news for any symbol.

wscat -c wss://stream.data.alpaca.markets/v1beta1/news
Connected (press CTRL+C to quit)
< [{"T":"success","msg":"connected"}]

> {"action":"auth","key":"<KEY>","secret":"<SECRET>"}
< [{"T":"success","msg":"authenticated"}]

> {"action":"subscribe","news":["*"]}
< [{"T":"subscription","news":["*"]}]

<[{"T":"n","id":24919710,"headline":"Granite Wins $90M Construction Manager/General Contractor Project In Northern California","summary":"Granite (NYSE:GVA) announced today that it has been selected by the California Department of Transportation (Caltrans) as the Construction Manager/General Contractor (CM/GC) for the approximately $90 million State Route","author":"Benzinga Newsdesk","created_at":"2022-01-05T22:30:29Z","updated_at":"2022-01-05T22:30:30Z","url":"https://www.benzinga.com/news/22/01/24919710/granite-wins-90m-construction-managergeneral-contractor-project-in-northern-california","content":"\u003cp\u003eGranite (NYSE:...","symbols":["GVA"],"source":"benzinga"}]