News Beta
The News endpoint is still in beta and has not yet been optimized for performance. Use caution before adding this endpoint in a prodution environment.
Get news for a stock.
Endpoint
https://api.marketdata.app/v1/stocks/news/{symbol}/
Method
GET
Request Example
- HTTP
- NodeJS
- Python
- Go
fetch("https://api.marketdata.app/v1/stocks/news/AAPL/")
.then((res) => {
console.log(res);
})
.catch((err) => {
console.log(err);
});
import requests
url = "https://api.marketdata.app/v1/stocks/news/AAPL/"
response = requests.request("GET", url)
print(response.text)
import (
"fmt"
api "github.com/MarketDataApp/sdk-go"
)
func ExampleStockNewsRequest_get() {
news, err := StockNews().Symbol("AAPL").Get()
if err != nil {
fmt.Print(err)
return
}
for _, article := range news {
fmt.Println(article)
}
}
Response Example
{
"s":"ok",
"symbol": "AAPL",
"headline": "Whoa, There! Let Apple Stock Take a Breather Before Jumping in Headfirst.",
"content": "Apple is a rock-solid company, but this doesn't mean prudent investors need to buy AAPL stock at any price.",
"source": "https://investorplace.com/2023/12/whoa-there-let-apple-stock-take-a-breather-before-jumping-in-headfirst/",
"updated": 1703041200
}
Request Parameters
- Required
- Optional
-
symbol
string
The company's ticker symbol.
-
from
date
The earliest news to include in the output. If you use countback,
from
is not required. Accepted timestamp inputs: ISO 8601, unix, spreadsheet. -
to
date
The latest news to include in the output. Accepted timestamp inputs: ISO 8601, unix, spreadsheet.
-
countback
number
Countback will fetch a specific number of news before
to
. If you usefrom
, countback is not required. -
date
date
Retrieve news for a specific day. Accepted timestamp inputs: ISO 8601, unix, spreadsheet.
Response Attributes
- Success
- No Data
- Error
-
s
string
Will always be
ok
when there is data for the symbol requested. -
symbol
array[string]
The symbol of the stock.
-
headline
array[string]
The headline of the news article.
-
content
array[string]
The content of the article, if available.
tipPlease be aware that this may or may not include the full content of the news article. Additionally, it may include captions of images, copyright notices, syndication information, and other elements that may not be suitable for reproduction without additional filtering.
-
source
array[url]
The source URL where the news appeared.
-
publicationDate
array[date]
The date the news was published on the source website.
-
s
string
Status will be
no_data
if no news can be found for the symbol.
-
s
string
Status will be
error
if the request produces an error response. -
errmsg
string
An error message.