Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Broker Volumes vs Quantopian Volumes

The other night I was wondering why the daily trading volumes I receive from brokers and see on market data websites is different than the volumes I see on Quantopian.

Here are two examples from the past few days.

SPY
Date......Broker Volume.......Quantopian......% Difference
12-Jun........86,108,102.......57,082,069......-34%
9-Jun........132,256,362.....103,552,885.....-22%
8-Jun..........65,950,691.......48,049,822.....-27%
7-Jun..........54,144,311.......38,597,399.....-29%

TSLA
Date......Broker Volume......Quantopian......% Difference
12-Jun.......10,517,660........8,528,736......-19%
9-Jun.........17,261,435......14,322,826......-17%
8-Jun...........9,061,496........7,489,685......-17%
7-Jun...........9,397,959........7,850,442......-16%

The Quantopian code I'm using is:

context.spy = sid(8554)  
data.history(context.spy, ['volume'], 14, '1d')  

Looking at some minute bars for these days, it quickly became apparent that the Quantopian data doesn't include after-hours volumes, which is documented on the API Reference page. The first few minutes after the close appear to be the most significant source of the difference, which I'm assuming is the closing auction. I simply never realized how large of a percentage of the total daily trading volume occurred at the close and after-hours. Thought others might find this interesting.

I personally think excluding after-hours volumes makes sense for many intents and purposes, but wonder if there is also a way in Quantopian to get the full daily volume should it be useful. Thoughts?

1 response

You've got a good understanding of what's driving the differences in volumes. There is an added differentiation that many data sources are EOD data v. as-traded, but that is going to be more noticeable in the price data than volume.

Changing this involves two feature requests:

  1. adding after-hours trading volume to the data set
  2. supporting after-hours trading on Quantopian

We can do the first without the second, but the second one definitely requires the first. They're both on the list of feature requests, but neither of them is currently prioritized for work.

Until then, one option would be to bring in after-hours trading volume using Fetcher every morning. That would be a reasonable way to use the after-hours trading volume as a signal for the following day.

Disclaimer

The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances.