Python client for TradingView’s news feed API. Wraps the
https://news-mediator.tradingview.com/news-flow/v2/news endpoint.
[!NOTE]
Requires Python 3.14+.
pip install tradingview-news-feed
pip install git+https://github.com:Siddhesh-Agarwal/tradingview-news-feed.git
from tradingview import TradingViewNewsFeed
feed = TradingViewNewsFeed()
result = feed.fetch()
for item in result.items:
print(item.title, item.published)
TradingViewNewsFeedConstructor parameters (all keyword-only):
| Parameter | Type | Default | Description |
|---|---|---|---|
economic_categories |
list[Economics] | None |
None |
Filter by economic categories (comma-joined) |
priorities |
list[FeedFormat] | None |
None |
Filter by priority/format (comma-joined) |
symbol |
str | None |
None |
Filter by symbol in EXCHANGE:TICKER format (e.g. NSE:TCS) |
markets |
list[Market] | None |
None |
Filter by market types (comma-joined) |
market_countries |
list[str] | None |
None |
Filter by market country codes (comma-joined) |
sectors |
list[MarketSector] | None |
None |
Filter by market sectors (comma-joined) |
The client applies the following default filters:
lang:enclient=screenerstreaming=falseuser_prostatus=non_profetch() -> Feed
Synchronous request. Returns a Feed instance. Raises httpx.HTTPError on transport or HTTP errors.
feed = TradingViewNewsFeed(markets=[Market.CRYPTO])
result = feed.fetch()
fetch_async() -> Feed
Asynchronous equivalent. Requires an async context.
import asyncio
from tradingview import TradingViewNewsFeed
async def main():
feed = TradingViewNewsFeed(markets=[Market.CRYPTO])
result = await feed.fetch_async()
for item in result.items:
print(item.title)
asyncio.run(main())
FeedTop-level response model.
| Field | Type | Description |
|---|---|---|
items |
list[FeedItem] |
List of news items |
FeedItemA single news article.
| Field | Type | Description |
|---|---|---|
id |
str |
Unique identifier |
title |
str |
Article headline |
published |
int |
Unix timestamp of publication |
urgency |
int |
Urgency level |
link |
HttpUrl | None |
Link to full article |
permission |
Literal["headline", "provider", "preview"] |
Access permission level |
storyPath |
HttpUrl |
Full URL to the story on TradingView |
relatedSymbols |
list[FeedItemRelatedSymbol] |
Related ticker symbols |
provider |
FeedItemProvider |
Source of the article |
FeedItemProvider| Field | Type | Description |
|---|---|---|
id |
str |
Provider identifier |
name |
str |
Provider display name |
logo_id |
str |
Logo identifier |
FeedItemRelatedSymbol| Field | Type | Description |
|---|---|---|
symbol |
str |
Ticker symbol |
logoid |
str | None |
Logo identifier |
currency_logoid |
str | None |
Currency logo identifier (alias currency-logoid) |
base_currency_logoid |
str | None |
Base currency logo identifier (alias base-currency-logoid) |
FeedFormat| Value | Description |
|---|---|
FLASH |
Flash news |
INPORTANT |
Important news |
TOP_STORIES |
Top stories |
KEY_FACTS |
Key facts |
Market| Value | Description |
|---|---|
STOCKS |
stock |
ETFS |
etf |
CRYPTO |
crypto |
FOREX |
forex |
INDICES |
index |
FUTURES |
futures |
GOVERNMENT_BONDS |
bond |
CORPORATE_BONDS |
corp_bond |
ECONOMY |
economic |
MarketSector| Value | Description |
|---|---|
COMMERCIAL_SERVICES |
Commercial Services |
COMMUNICATIONS |
Communications |
CONSUMER_DURABLES |
Consumer Durables |
CONSUMER_NON_DURABLES |
Consumer Non-Durables |
CONSUMER_SERVICES |
Consumer Services |
DISTRIBUTION_SERVICES |
Distribution Services |
ELECTRONIC_TECH |
Electronic Technology |
ENERGY_MINERALS |
Energy Minerals |
FINANCE |
Finance |
GOVERNMENT |
Government |
HEALTH_SERVICES |
Health Services |
HEALTH_TECH |
Health Technology |
INDUSTRIAL_SERVICES |
Industrial Services |
MISCELLANEOUS |
Miscellaneous |
NON_ENERGY_MINERALS |
Non-Energy Minerals |
PROCESS_INDUSTRIES |
Process Industries |
PRODUCER_MANUFACTURING |
Producer Manufacturing |
RETAIL_TRADE |
Retail Trade |
TECH_SERVICES |
Technology Services |
TRANSPORTATION |
Transportation |
UTILITIES |
Utilities |
Economics| Value | Description |
|---|---|
GDP |
Gross Domestic Product |
LABOR |
Labor |
PRICES |
Prices |
HEALTH |
Health |
MONEY |
Money |
TRADE |
Trade |
GOVERNMENT |
Government |
BUSINESS |
Business |
CONSUMER |
Consumer |
HOUSING |
Housing |
TAXES |
Taxes |
httpx.HTTPError — raised by fetch() and fetch_async() for connection failures, timeouts, non-2xx responsespydantic.ValidationError — raised during response parsing if the API returns unexpected dataWrap calls to handle cleanly:
from httpx import HTTPError
from pydantic import ValidationError
try:
result = feed.fetch()
except HTTPError:
print("Request failed")
except ValidationError:
print("Unexpected response format")