Skip to content

Instantly share code, notes, and snippets.

@janlukasschroeder
Last active February 12, 2022 05:18
Show Gist options
  • Save janlukasschroeder/abc4931e50e9311695df5c5627cc9dfd to your computer and use it in GitHub Desktop.
Save janlukasschroeder/abc4931e50e9311695df5c5627cc9dfd to your computer and use it in GitHub Desktop.
SEC EDGAR Filings API - Live Feed Example.
python-socketio[client]
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Developing a live feed of new SEC EDGAR filings"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This notebook is used in my Medium article [here](https://medium.com/@jan_5421/crawling-new-filings-on-sec-edgar-using-python-and-socket-io-in-real-time-5cba8c6a3eb8).\n",
"\n",
"If you’re looking to query historical filings using Python, check out my other Medium article [here](https://medium.com/@jan_5421/sec-edgar-api-2-b2cfb82c1d9e) or see the offical documentation on https://sec-api.io/docs"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import socketio\n",
" \n",
"sio = socketio.Client()\n",
" \n",
"@sio.on('connect', namespace='/all-filings')\n",
"def on_connect():\n",
" print(\"Connected to https://socket.sec-api.io/all-filings\")\n",
" \n",
"@sio.on('filing', namespace='/all-filings')\n",
"def on_filings(filing):\n",
" print(filing)\n",
" \n",
"sio.connect('https://socket.sec-api.io?apiKey=YOUR_API_KEY', namespaces=['/all-filings'])\n",
"sio.wait()"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.7"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment