Skip to content

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.

  • A FinBrain API key (sign up here)
  • Python 3.7+ (for SDK) or any HTTP client

The fastest way to get started is with our official Python SDK:

Terminal window
pip install finbrain-python
from finbrain import FinBrainClient
# Replace with your actual API key
fb = FinBrainClient(api_key="YOUR_API_KEY")

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 DataFrame (recommended)
df = fb.predictions.ticker("AAPL", prediction_type="daily",
as_dataframe=True)
print(df)
# main lower upper
# date
# 2024-11-04 201.33 197.21 205.45
# 2024-11-05 202.77 196.92 208.61
# 2024-11-06 203.99 196.90 211.08
# Or get raw JSON response
predictions = fb.predictions.ticker("AAPL", prediction_type="daily")
print(predictions)

Sample JSON Output:

{
"ticker": "AAPL",
"name": "Apple Inc.",
"prediction": {
"2024-11-04": "201.33,197.21,205.45",
"2024-11-05": "202.77,196.92,208.61",
"2024-11-06": "203.99,196.90,211.08",
"expectedShort": "0.22",
"expectedMid": "0.58",
"expectedLong": "0.25",
"type": "daily",
"lastUpdate": "2024-11-01T23:24:18.371Z"
},
"sentimentAnalysis": {
"2024-11-04": "0.186",
"2024-11-01": "0.339",
"2024-10-31": "0.565"
}
}

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 DataFrame (recommended)
df = fb.insider_transactions.ticker("S&P 500", "TSLA",
as_dataframe=True)
print(df.head())
# insiderTradings relationship transaction shares cost USDValue
# date
# 2024-01-10 Elon Musk CEO Sale 50000 245.50 12275000
# Or get raw JSON response
insiders = fb.insider_transactions.ticker("S&P 500", "TSLA")
print(insiders)

Sample JSON Output:

{
"ticker": "TSLA",
"name": "Tesla Inc.",
"insiderTransactions": [
{
"date": "2024-01-10",
"insiderTradings": "Elon Musk",
"relationship": "CEO",
"transaction": "Sale",
"cost": 245.50,
"shares": 50000,
"USDValue": 12275000,
"totalShares": 715000000,
"SECForm4Date": "2024-01-11",
"SECForm4Link": "https://sec.gov/..."
}
]
}

Access AI-powered sentiment analysis from financial news:

from finbrain import FinBrainClient
fb = FinBrainClient(api_key="YOUR_API_KEY")
# Get sentiment for Microsoft as DataFrame (recommended)
df = fb.sentiments.ticker("S&P 500", "MSFT", as_dataframe=True)
print(df.tail())
# sentiment
# date
# 2024-01-15 0.72
# 2024-01-14 0.68
# Or get raw JSON response
sentiment = fb.sentiments.ticker("S&P 500", "MSFT")
print(sentiment)

Sample JSON Output:

{
"ticker": "MSFT",
"name": "Microsoft Corporation",
"sentimentAnalysis": {
"2024-01-15": "0.72",
"2024-01-14": "0.68",
"2024-01-13": "0.65",
"2024-01-12": "0.70",
"2024-01-11": "0.63"
}
}

Monitor US House Representatives trading activity:

from finbrain import FinBrainClient
fb = FinBrainClient(api_key="YOUR_API_KEY")
# Get congressional trades for NVIDIA as DataFrame (recommended)
df = fb.house_trades.ticker("S&P 500", "NVDA", as_dataframe=True)
print(df.head())
# representative type amount
# date
# 2024-01-08 Nancy Pelosi Purchase $1,000,001 - $5,000,000
# Or get raw JSON response
trades = fb.house_trades.ticker("S&P 500", "NVDA")
print(trades)

Sample JSON Output:

{
"ticker": "NVDA",
"name": "NVIDIA Corporation",
"houseTrades": [
{
"date": "2024-01-08",
"representative": "Nancy Pelosi",
"type": "Purchase",
"amount": "$1,000,001 - $5,000,000"
}
]
}

Most endpoints support date filtering:

from finbrain import FinBrainClient
fb = FinBrainClient(api_key="YOUR_API_KEY")
# Get sentiment for a specific date range as DataFrame
df = fb.sentiments.ticker(
"S&P 500",
"AAPL",
date_from="2024-01-01",
date_to="2024-01-31",
as_dataframe=True
)
print(df)

Or with the REST API:

Terminal window
curl "https://api.finbrain.tech/v1/ticker/AAPL/predictions/daily?token=YOUR_API_KEY&dateFrom=2024-01-01&dateTo=2024-01-31"

Here’s a complete script that fetches multiple datasets as DataFrames:

from finbrain import FinBrainClient
# Initialize client
fb = FinBrainClient(api_key="YOUR_API_KEY")
# Define ticker to analyze
ticker = "AAPL"
market = "S&P 500"
print(f"Analyzing {ticker}...\n")
# AI Predictions
predictions_df = fb.predictions.ticker(ticker,
prediction_type="daily",
as_dataframe=True)
print("AI Predictions:")
print(predictions_df.head())
# Insider Transactions
insiders_df = fb.insider_transactions.ticker(market, ticker,
as_dataframe=True)
print("\nInsider Transactions:")
print(insiders_df.head())
# Sentiment
sentiment_df = fb.sentiments.ticker(market, ticker,
as_dataframe=True)
print("\nSentiment Scores:")
print(sentiment_df.tail())
# Analyst Ratings
ratings_df = fb.analyst_ratings.ticker(market, ticker,
as_dataframe=True)
print("\nAnalyst Ratings:")
print(ratings_df.head())

Now that you’ve made your first API calls, explore more: