Quick Start Guide
This guide walks you through making your first FinBrain API calls. By the end, you’ll know how to retrieve AI price predictions, insider trading data, and sentiment scores.
Prerequisites
Section titled “Prerequisites”- A FinBrain API key (sign up here)
- Python 3.7+ or any HTTP client
Step 1: Set Up Authentication
Section titled “Step 1: Set Up Authentication”All FinBrain API v2 endpoints use Bearer token authentication. Include your API key in the Authorization header of every request:
Authorization: Bearer YOUR_API_KEYStep 2: Set Up Your Environment
Section titled “Step 2: Set Up Your Environment”import requests
API_KEY = "YOUR_API_KEY"headers = {"Authorization": f"Bearer {API_KEY}"}Step 3: Fetch Data
Section titled “Step 3: Fetch Data”Get AI Price Predictions
Section titled “Get AI Price Predictions”Retrieve deep learning price forecasts for any ticker:
from finbrain import FinBrainClient
fb = FinBrainClient(api_key="YOUR_API_KEY")
# Get daily predictions for Apple as DataFramedf = fb.predictions.ticker("AAPL", prediction_type="daily", as_dataframe=True)print(df)# mid lower upper# date# 2025-11-04 201.33 197.21 205.45# 2025-11-05 202.77 196.92 208.61import requests
API_KEY = "YOUR_API_KEY"headers = {"Authorization": f"Bearer {API_KEY}"}
response = requests.get( "https://api.finbrain.tech/v2/predictions/daily/AAPL", headers=headers)data = response.json()print(data)Sample JSON Output:
{ "success": true, "data": { "ticker": "AAPL", "name": "Apple Inc.", "predictions": [ { "date": "2025-11-04", "mid": 201.33, "lower": 197.21, "upper": 205.45 }, { "date": "2025-11-05", "mid": 202.77, "lower": 196.92, "upper": 208.61 }, { "date": "2025-11-06", "mid": 203.99, "lower": 196.90, "upper": 211.08 } ], "metadata": { "expectedShortTerm": 0.22, "expectedMidTerm": 0.58, "expectedLongTerm": 0.25, "type": "daily", "lastUpdated": "2025-11-01T23:24:18.371Z" } }, "meta": { "timestamp": "2025-11-02T10:15:30.000Z" }}const response = await fetch( "https://api.finbrain.tech/v2/predictions/daily/AAPL", { headers: { "Authorization": "Bearer YOUR_API_KEY" } });const data = await response.json();console.log(data);curl -H "Authorization: Bearer YOUR_API_KEY" \ "https://api.finbrain.tech/v2/predictions/daily/AAPL"Get Insider Trading Data
Section titled “Get Insider Trading Data”Track executive purchases and sales from SEC Form 4 filings:
from finbrain import FinBrainClient
fb = FinBrainClient(api_key="YOUR_API_KEY")
# Get insider transactions for Tesla as DataFramedf = fb.insider_transactions.ticker("TSLA", as_dataframe=True)print(df.head())import requests
API_KEY = "YOUR_API_KEY"headers = {"Authorization": f"Bearer {API_KEY}"}
response = requests.get( "https://api.finbrain.tech/v2/insider-trading/TSLA", headers=headers)data = response.json()print(data)Sample JSON Output:
{ "success": true, "data": { "ticker": "TSLA", "name": "Tesla Inc.", "transactions": [ { "date": "2025-01-10", "insider": "Elon Musk", "relationship": "CEO", "transactionType": "Sale", "pricePerShare": 245.50, "shares": 50000, "totalValue": 12275000, "sharesOwned": 715000000, "filingUrl": "https://sec.gov/..." } ] }, "meta": { "timestamp": "2025-01-12T08:30:00.000Z" }}const response = await fetch( "https://api.finbrain.tech/v2/insider-trading/TSLA", { headers: { "Authorization": "Bearer YOUR_API_KEY" } });const data = await response.json();console.log(data);curl -H "Authorization: Bearer YOUR_API_KEY" \ "https://api.finbrain.tech/v2/insider-trading/TSLA"Get Sentiment Scores
Section titled “Get Sentiment Scores”Access AI-powered sentiment analysis from financial news:
from finbrain import FinBrainClient
fb = FinBrainClient(api_key="YOUR_API_KEY")
# Get sentiment for Microsoft as DataFramedf = fb.sentiments.ticker("MSFT", as_dataframe=True)print(df.tail())import requests
API_KEY = "YOUR_API_KEY"headers = {"Authorization": f"Bearer {API_KEY}"}
response = requests.get( "https://api.finbrain.tech/v2/sentiment/MSFT", headers=headers)data = response.json()print(data)Sample JSON Output:
{ "success": true, "data": { "ticker": "MSFT", "name": "Microsoft Corporation", "sentiments": [ { "date": "2025-01-15", "score": 0.72 }, { "date": "2025-01-14", "score": 0.68 }, { "date": "2025-01-13", "score": 0.65 }, { "date": "2025-01-12", "score": 0.70 }, { "date": "2025-01-11", "score": 0.63 } ] }, "meta": { "timestamp": "2025-01-16T06:00:00.000Z" }}const response = await fetch( "https://api.finbrain.tech/v2/sentiment/MSFT", { headers: { "Authorization": "Bearer YOUR_API_KEY" } });const data = await response.json();console.log(data);curl -H "Authorization: Bearer YOUR_API_KEY" \ "https://api.finbrain.tech/v2/sentiment/MSFT"Get Congressional Trades
Section titled “Get Congressional Trades”Monitor US House Representatives trading activity:
from finbrain import FinBrainClient
fb = FinBrainClient(api_key="YOUR_API_KEY")
# Get House trades for NVIDIA as DataFramedf = fb.house_trades.ticker("NVDA", as_dataframe=True)print(df.head())import requests
API_KEY = "YOUR_API_KEY"headers = {"Authorization": f"Bearer {API_KEY}"}
response = requests.get( "https://api.finbrain.tech/v2/congress/house/NVDA", headers=headers)data = response.json()print(data)Sample JSON Output:
{ "success": true, "data": { "ticker": "NVDA", "name": "NVIDIA Corporation", "trades": [ { "date": "2025-01-08", "politician": "Nancy Pelosi", "transactionType": "Purchase", "amount": "$1,000,001 - $5,000,000", "chamber": "house" } ] }, "meta": { "timestamp": "2025-01-10T12:00:00.000Z" }}const response = await fetch( "https://api.finbrain.tech/v2/congress/house/NVDA", { headers: { "Authorization": "Bearer YOUR_API_KEY" } });const data = await response.json();console.log(data);curl -H "Authorization: Bearer YOUR_API_KEY" \ "https://api.finbrain.tech/v2/congress/house/NVDA"Step 4: Filter by Date Range
Section titled “Step 4: Filter by Date Range”Most endpoints support date filtering:
from finbrain import FinBrainClient
fb = FinBrainClient(api_key="YOUR_API_KEY")
df = fb.sentiments.ticker( "AAPL", date_from="2025-01-01", date_to="2025-01-31", as_dataframe=True)print(df)import requests
API_KEY = "YOUR_API_KEY"headers = {"Authorization": f"Bearer {API_KEY}"}
response = requests.get( "https://api.finbrain.tech/v2/sentiment/AAPL", headers=headers, params={"startDate": "2025-01-01", "endDate": "2025-01-31"})data = response.json()print(data)curl -H "Authorization: Bearer YOUR_API_KEY" \ "https://api.finbrain.tech/v2/sentiment/AAPL?startDate=2025-01-01&endDate=2025-01-31"Complete Example
Section titled “Complete Example”Here’s a complete script that fetches multiple datasets for a ticker:
from finbrain import FinBrainClient
fb = FinBrainClient(api_key="YOUR_API_KEY")
ticker = "AAPL"print(f"Analyzing {ticker}...\n")
# AI Predictionspredictions_df = fb.predictions.ticker(ticker, as_dataframe=True)print("AI Predictions:")print(predictions_df.head())
# Insider Transactionsinsiders_df = fb.insider_transactions.ticker(ticker, as_dataframe=True)print("\nInsider Transactions:")print(insiders_df.head())
# Sentimentsentiment_df = fb.sentiments.ticker(ticker, as_dataframe=True)print("\nSentiment Scores:")print(sentiment_df.tail())
# Congressional Tradestrades_df = fb.house_trades.ticker(ticker, as_dataframe=True)print("\nCongressional Trades:")print(trades_df.head())import requests
API_KEY = "YOUR_API_KEY"BASE_URL = "https://api.finbrain.tech/v2"headers = {"Authorization": f"Bearer {API_KEY}"}
ticker = "AAPL"print(f"Analyzing {ticker}...\n")
# AI Predictionsresp = requests.get(f"{BASE_URL}/predictions/daily/{ticker}", headers=headers)predictions = resp.json()if predictions["success"]: for p in predictions["data"]["predictions"][:3]: print(f" {p['date']}: mid={p['mid']}, range=[{p['lower']}, {p['upper']}]")
# Insider Transactionsresp = requests.get(f"{BASE_URL}/insider-trading/{ticker}", headers=headers)insiders = resp.json()if insiders["success"]: print("\nInsider Transactions:") for txn in insiders["data"]["transactions"][:3]: print(f" {txn['date']}: {txn['insider']} - {txn['transactionType']} " f"{txn['shares']} shares @ ${txn['pricePerShare']}")
# Sentimentresp = requests.get(f"{BASE_URL}/sentiment/{ticker}", headers=headers)sentiment = resp.json()if sentiment["success"]: print("\nSentiment Scores:") for s in sentiment["data"]["sentiments"][:5]: print(f" {s['date']}: {s['score']}")
# Congressional Tradesresp = requests.get(f"{BASE_URL}/congress/house/{ticker}", headers=headers)congress = resp.json()if congress["success"]: print("\nCongressional Trades:") for t in congress["data"]["trades"][:3]: print(f" {t['date']}: {t['politician']} - {t['transactionType']} ({t['amount']})")Next Steps
Section titled “Next Steps”Now that you’ve made your first API calls, explore more:
- Datasets - Detailed dataset documentation
- API Reference - Complete endpoint reference
- Python SDK - Full SDK documentation