Ever wanted to get real-time stock prices or fresh SEC filings straight into your Python scripts, without fighting CSVs or ugly web scraping? Let’s do it together, step by step, using FinFeedAPI (via API Bricks) and some AI magic!
What You’ll Build
- A Python script (or notebook) that fetches live SEC filings and stock info for any ticker
- The ability to summarize those filings using Anthropic’s Claude AI
- A simple foundation for dashboards, alerts, or research tools
Sample output:
Title: 10-K | Date: 2025-03-01
Title: 8-K | Date: 2025-02-15
Summary: "This 10-K filing details Apple's annual financial results, with significant growth in revenue and R&D investments..."
Prerequisites
- Python 3.8+
- API key from FinFeedAPI SEC & Stock MCP (free to start)
- Basic Python skills
- (Optional) Anthropic API key if you want AI-powered summaries
1. Install Your Tools
Fire up your terminal and run:
pip install api-bricks-sdk anthropic
💡 You only need anthropic if you want to add the AI summary step!
2. Grab Your API Key
Go to apibricks.dev and sign up.
Create a project and copy your API key somewhere safe.
(Optional) Grab an Anthropic API key for LLM summaries.
3. Set Up the API Bricks SDK
Let’s connect to the FinFeedAPI and fetch some data.
from apibricks_sdk import FinFeedApiSecAndStockMcpApi
api_key = "YOUR_API_KEY" # paste your API key here
client = FinFeedApiSecAndStockMcpApi(api_key)
4. Fetch Stock Data (The Fun Begins!)
Let’s pull live data for Apple (AAPL):
symbol_info = client.symbols_symbol_get(symbol='AAPL')
print(symbol_info)
Output:
{'symbol': 'AAPL', 'name': 'Apple Inc.', ...}
5. Get Recent SEC Filings
Let’s see Apple’s latest filings:
sec_filings = client.sec_filings_filings_get(symbol='AAPL')
for filing in sec_filings['filings'][:5]:
print(f"Title: {filing['formType']} | Date: {filing['filedAt']}")
Output:
Title: 10-K | Date: 2025-03-01
Title: 8-K | Date: 2025-02-15
...
This is real, live data!
- (Optional) Summarize a Filing With Claude AI Ready for some generative AI? Let’s use Anthropic’s Claude to make sense of those filings:
import anthropic
client_anthropic = anthropic.Client(api_key="YOUR_ANTHROPIC_API_KEY")
response = client_anthropic.completions.create(
prompt=f"Summarize the following SEC filing:\n{sec_filings['filings'][0]['text']}",
model="claude-3-opus-20240229",
max_tokens_to_sample=512,
)
print(response.completion)
Output:
"This 10-K filing details Apple's annual financial results, with significant growth in revenue and R&D investments..."
AI-powered analysis, no manual reading required!
- Error Handling (Because Stuff Happens) Good code checks for trouble:
try:
symbol_info = client.symbols_symbol_get(symbol='AAPL')
except Exception as e:
print("Error fetching symbol info:", e)
What Next? Build Something Cool!
You now have the basics to:
- Power a dashboard with live company data
- Build bots that summarize filings for your team
- Create alerts for new SEC documents
The sky’s the limit. Try plugging in your own tickers, combining with other APIs, or visualizing the data in pandas/matplotlib.
Useful Links
Let’s Chat!
What would you build with live SEC and stock data? Got questions or project ideas? Drop them in the comments - happy to help!
If you enjoyed this, follow for more practical API builds, fintech tools, and AI tricks.
Top comments (0)