Python SDK FAQs

If you're using the Python SDK, here are answers to some common questions.

How can I extract historical prices for multiple stocks?

There are three ways of retrieving this data.

1. One ticker at a time. This has the advantage of providing the user with direct control and gives pinpoint data availability. However, it requires multiple calls for multiple tickers.

2. Securities screening. This will allow users to retrieve securities data about a number of tickers that all match the user-defined criteria. This requires the use of intricate logic and/or similarities between the securities that are being requested.

3. Bulk download. This will allow users a large set of data including all available tickers to be retrieved. This will, however, include tickers that the user is not looking for and may be far more data than needed.

How can I convert Python SDK responses to XLS or CSV? 

You can find working Python examples in Collaboratory (a Jupyter notebook type browser-based environment) here: https://github.com/intrinio/intrinio-tutorials

Most of the examples there take the SDK response and convert it to a data frame:

Screenshot 2020-10-22 101857

How do I retrieve Average Daily Volume with the Python SDK?

Intrinio covers average daily trade volume as well as end of day volume for stocks. This syntax can help you retrieve Average Daily Volume:

api_response = security_api.get_security_data_point_number(symbol, 'average_daily_volume')

Help! I'm having issues with the type argument in Python.

Some of our users have issues with the type argument in Python when making API calls; whenever they use it, the argument modifies the __builtins__.type variable. 

The issue is one of scope. Setting the type variable changes the immediate definition of "type," so to use the built-in type check function you need to specify that you are using __builtins__.type. For example, to check what type the api_response variable is, use:

__builtins__.type(api_response)

More questions about the Python SDK? Check out our documentation.