Before you start
- An email address
Create your NewsAPI API key
- 1
Register
Go to newsapi.org/register, enter your name, email and a password, and accept the terms.
- 2
Copy your key
Your API key is shown right after registration and on your Account page. Save it as
NEWS_API_KEY. - 3
Set a news query
In AlgoGP set
news_queryin config.json (e.g.bitcoin OR btc) and enablefilters.sentimentwith thenewssource. Backtests use the keyless archive; the key adds NewsAPI headlines whenlive.pyruns.
Test the key
Before wiring the key into a strategy, make one request by hand. It separates “the key is wrong” from “my code is wrong”.
curl -s -H "X-Api-Key: $NEWS_API_KEY" \
"https://newsapi.org/v2/everything?q=bitcoin&pageSize=3&sortBy=publishedAt""status":"ok" with articles means the key works; apiKeyInvalid means it does not.Add the key to your AlgoGP project
- 1
Open your project’s APIs & keys tab
Open the strategy project and select APIs & keys in the workspace tabs.
- 2
Paste each value
Paste the values into
NEWS_API_KEYand click Save. Values are encrypted at rest, never shown again and never written into code or exports. - 3
Run locally with the same names
Exported projects read the same names from
.env(copy.env.example). Keep.envout of version control.
NEWS_API_KEY=paste-your-value-hereTroubleshooting
rateLimited- More than 100 requests today on the free plan.
parameterInvalid(date)- A
fromdate older than your plan allows. corsNotAllowed- Browser requests are only allowed from localhost on the free plan; call it from server code.
Frequently asked questions
Is a NewsAPI key free?
Yes, the Developer plan key is free for development with 100 requests per day.
Add NewsAPI signals to a strategy
Combine price rules with news and sentiment filters, test them point-in-time so nothing leaks from the future, and export the code.
- Sentiment filters that block entries on bad news
- Point-in-time replay in every backtest
- Exported Python reads the same feed live
Free plan, no card required.
AlgoGP is not affiliated with NewsAPI. Menus get renamed from time to time; if a label differs, the official documentation has the current path.