Back to Community
Prices without dividend adjustment?


I am trying to implement a simple limit pricing strategy for live trading. While buying, offer up to 10% over the average price over the last 10 days. And while selling accept up to 10% under the average price over the last 10 days. Here's the code for getting prices:

    context.all_prices_10days = data.history(all_stocks, 'price', 10, '1d')  

Using dividend adjusted prices of course skews my limit pricing strategy quite a bit. How can I get the real current price? I'm using Robinhood, in case that matters.

Edit: real price for last 10 days, not real current price.



2 responses

The strategy as a whole doesn't make intuitive sense to me - you're willing to buy high, and sell low, and that's the way you lose money!

Even in limit orders, I'm curious why you'd want to do that. For instance, if a company gives a 10% dividend, and you offer 10% over the unadjusted price, you're essentially certain to buy that stock - the price just dropped 10%. Logically, you'd want to place a limit order that is 10% over the adjusted price.

All that said, there isn't a direct way to access unadjusted historical prices. What you can do, if you want, is store the close price at the end of each day in a list, and that will obviously be a list of unadjusted, as-traded prices. The downside to that is that your algorithm has to run for 10 days before you can fill your 10-day window.


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.

Dan, the strategy is a buy-and-hold one, where in this case I'm holding for an year. A small price premium is quite acceptable. Using a 10 day mean price helps avoid buying during a short term spike. I had tried a few different values in my backtests for the premium to offer, and this had produced the best results. 10% does seem a little high, I shall re-test that theory.

I've been trying to debug this on my own as well, and the problem does not appear to be adjusted pricing. I might have to post a follow up in a few days if my problem persists.

Thanks for the tips.