Restricting the exchange houses in fundamental analysis

Hi,

Is it possible to restrict the exchange houses when retrieving fundamental data for the stocks? Say, I am only interested in AMEX and NASDAQ. I have noticed that this is possible with sectors (using .filter and morningstar's sector code). But I haven't been able to find a similar metric that tells which exchange does the stock trade on.

6 responses

Here's an example for NASDAQ:

    fundamental_df = get_fundamentals(
query(
fundamentals.valuation.market_cap,
)
.filter(fundamentals.company_reference.primary_exchange_id == 'NAS')
.filter(fundamentals.valuation.market_cap != None)
.order_by(fundamentals.valuation.market_cap.desc()).limit(50))


Thank you!

Where do you find the list of primary_exchange_ids that can be used?

Just by guessing I figured out NYSE simply NYSE, so that was easy, but a full list would be great is someone knows where to get one.

Alright and if anyone ends up on this thread and is wondering how to query for data across multiple exchanges you can do the following:

.filter(fundamentals.company_reference.primary_exchange_id.in_(['NYSE','NAS']))


Here is a list of primary_exchange_id mappings.

https://www.quantopian.com/help/fundamentals#exchangecodes

Also, it looks like NYSE is simply NYS. Not sure if your code is actually bringing in NYSE data.