Font size
WorksheetsFinTech 05-2 APIs
Total questions: 10
Worksheet time: 5mins
What were the objectives of Day 2 of APIs?
Set authentication for the Alpaca SDK
Use SDKs to analyze financial data
Create a real-time portfolio tracker
Register for an API key and use the requests library for authenticated requests
How should you hide your API keys?
Hardcode and then delete them before submitting any work
Store them in environmental variables
Blur out the keys
Use a dummy key
Which APIs did we discuss during that class?
Alpaca
Plaid
Yahoo Finance
Quandl
Which is the typical syntax used to pass an API key through a url?
?api_key=____
#api_key=____
{api_key = ____ }
It's not safe to pass your API key through a url.
Which package do we use to set environmental variables?
requests
os
dotenv
pathlib
What function do we use to call an environmental variable?
response.get()
read_key()
load_dotenv()
os.getenv()
What is the recommended way to check that your api key loaded correctly?
Print it
Save it to a variable
Check the type or length
Make an API call
Which is the correct sequence of steps to make a call to the Alpaca API?
Call SDK functions to get data (like get_barsets)
Create an Alpaca object (using REST)
Load environmental variables
Call, create, load
Load, create, call
Create, call, load
Load, call, create
How was unit 5-2 for you?
Any suggestions for improvement?
