Cannot import StockDataStream

Getting the error “ImportError: cannot import name ‘StockDataStream’ from ‘’” for the following code.

alpaca-py is installed.

from import StockDataStream

from api import *

# keys are required for live data

#crypto_stream = CryptoDataStream("api-key", "secret-key")

# keys required

stock_stream = StockDataStream(ALPACA_API_KEY_ID,ALPACA_API_SECRET_KEY)

1 Like

Hi, did you fix it? I’m getting the same error- alpaca-py is installed

@dana The imports from from the alpaca-py SDK can be challenging. In this specific case try the following

from import StockDataStream

A general approach to finding where to import things from is to check out the reference section of the documentation. For example, the StockDataStream class is documented here and shown below.

Notice the full path to the class is provided. This is true of all the classes. Simply include that full path in your import statement. There often can be shortcuts but that will always work.