Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Question on Historical Data

Pretty new here so apologies if this is a dumb question..

I know we're not supposed to trade them for the contest, but why do stocks like NUGT and DUST seem to be completely misplaced historically? Because of the natural decay of these leveraged ETFs, if they're $25 today, they will have been the equivalent of $15,000 10 years ago or so. Can someone explain to me why Quantopian kind of pegs them in a range and doesn't adjust for this?

Cheers.

1 response

First off welcome!

The pricing issue you allude to is all about 'adjusted' price (and volume). The Quantopian platform does adjust volume and price data for dividends and splits. However one needs to know when, and then from what date, those adjustments are made.

The three main methods to get price data are 1) pipeline 2) data.history and 3) get_pricing. The first two are generally used in an algorithm while the third, get_pricing, is generally used in notebooks. Because of this, the first two methods don't explicitly have a way to set the as-of adjustment date. The prices are always adjusted as of the date they are run in a backtester. The last date is the 'real' price and all previous prices are adjusted as of that last date. The reason for this is simple. If one adjusted for a future price then this would introduce lookahead bias. Moreover, any absolute price or volume comparisons (eg price > $5) would be meaningless.

The get_pricing method however, adjusts prices as of the end date. The end date is the actual 'real' price and all data before that is adjusted for any splits and dividends. So, it depends upon if one wants to look at 'adjusted' or 'real' data. Simply, set the end date to the date one wants prices adjusted from.

Attached is a notebook showing exactly the scenario with NUGT. The 2010 prices adjusted as of 2018 are indeed in the $14000-15000 range. However, the 'real' prices back in 2010 were in the $30-40 range. By setting the end date one can set the as-of adjust date.

Hope that helps.