
Security News
ESLint Adds Official Support for Linting HTML
ESLint now supports HTML linting with 48 new rules, expanding its language plugin system to cover more of the modern web development stack.
polygon
: A Complete Polygon.io API Wrapperpolygon
polygon
is a Complete Python Wrapper for Polygon.io APIs. It offers
simple and elegant programmatic access over each endpoint. Functionalities include but not limited to:
and a lot more...
polygon
The complete description of everything you need to know is available in the Documentation which has answers to any question you might have with example uses included wherever needed. Docs are a must-read for most people.
yfinance
. See relevant docs to know how to useBefore you do anything, you'll need to have a polygon account and get your API key. Visit Your Dashboard to get yours.
Next, you'd need to install polygon
pip install polygon
and You're good to Go!
Here are a few quick usage examples.
import polygon
api_key = 'YOUR_KEY'
stocks_client = polygon.StocksClient(api_key)
previous_close = stocks_client.get_previous_close('AMD')
print(previous_close)
import polygon
import asyncio
async def main():
api_key = 'YOUR_KEY'
stocks_client = polygon.StocksClient(api_key, True)
previous_close = await stocks_client.get_previous_close('AMD')
await stocks_client.close() # Recommended to close the httpx session when it's not needed.
print(previous_close)
if __name__ == '__main__':
asyncio.run(main())
import polygon
from polygon.enums import StreamCluster
def my_own_message_handler(ws, msg):
print(f'msg received: {msg}')
def main():
api_key = 'YOUR_KEY'
stream_client = polygon.StreamClient(api_key, StreamCluster.STOCKS, on_message=my_own_message_handler)
stream_client.start_stream_thread()
stream_client.subscribe_stock_trades(['AMD', 'NVDA'])
if __name__ == '__main__':
main()
import asyncio
import polygon
from polygon.enums import StreamCluster
async def stock_trades_handler(msg): # it is possible to create one common message handler for different services.
print(f'msg received: {msg}')
async def main():
api_key = 'YOUR_KEY'
stream_client = polygon.AsyncStreamClient(api_key, StreamCluster.STOCKS)
await stream_client.subscribe_stock_trades(['AMD', 'NVDA'], stock_trades_handler)
while 1:
await stream_client.handle_messages() # the lib provides auto reconnect functionality. See docs for info
if __name__ == '__main__':
asyncio.run(main())
This only scratches the surface of the library.
See the Documentation to start using the library with its full functionalities.
Latest development source code of the library can be found on the development branch
We have a helpful & vibrant community in our Discord Server. Join in to ask a question, share your ideas or observations or to just chat with interesting people, or maybe just for lurking :eyes:
See Getting Help or you can also start a quick discussion
Speed Runners
polygon
is released under the MIT LicenseFAQs
A Complete Python Wrapper for Polygon.io APIs.
We found that polygon demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
ESLint now supports HTML linting with 48 new rules, expanding its language plugin system to cover more of the modern web development stack.
Security News
CISA is discontinuing official RSS support for KEV and cybersecurity alerts, shifting updates to email and social media, disrupting automation workflows.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.