Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Explain 'volume' property

The docs define the volume property as "Integer: The whole number of shares traded in the most recent market event for this security." but I am not clear on how to interpret this.

A random data pull for Apple Inc gave me the number "53018987"

If I am using daily time steps does that mean that the last order of the day had that many shares in it? Or does that mean that is the total number of market orders that were made all day? Also I assume "most recent" refers to the closing transaction?

5 responses

If you're grabbing daily data for a particular day, then the volume is the number of shares traded during that day.

If you're requesting minute data for a particular minute, then the volume is the number of shares traded in that minute.

Is there any way to grab avg volume over a certain time frame, like the past 90 days?

Bailey: yes, certainly. Are you working in research or in the algorithm IDE?

I am working in the IDE, and just realized the history() method is probably what I want to use. I'm trying to read and understand its usage now.

My particular use case is I have a set of stocks that I would like to order by average volume over the last 90 days. So stocks with a higher volume in that time period would be first in my list, stocks with the least amount of volume at the bottom of the list.

Yep, history() is what you want. In particular, you'll probably want something like:

volume_history = history(bar_count=90, frequency='1d', field='volume')
average_volume = volume_history.mean()

Note: concerning your use case, you may want to think about using vwap, calculating dollar-volume traded, or looking at moving averages for volume. I have no idea what you're working on, but maybe those could be useful.