This is an example of how you may modify Max's code to run with environment variables to keep the API key hidden.
We use the dotenv library in Python and the Polygon-api-client library
- Pip
pip install python-dotenv
Make sure to install this version:
- Pip
pip install polygon-api-client==0.2.11
Add your API key to the .env file as api-token = "<insert key>". The code will automatically recognize this API key and use it to form a connection with Polygon.