Back

Adjusted Pricing

Just an notice -- we changed the pricing to use adjusted pricing. This gives continuity of pricing makes it much easier for indicator calculations, and means you don't need to adjust the stock price for splits and dividends.

However also it means the fee calculations may be slightly off -- e.g. In 1999 an Apple share was $60, so purchasing $6,000 worth would give you 100 shares. With Interactive Brokers fee model this equates to a $1 fees per order. The adjusted price in 1999 was $15, which would give you 400 shares for $6,000 and the fee would be $4.

Its a small trade off but worth while in our opinion! Feel free to give us feedback here if you'd like the raw price.
Update Backtest






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 QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect 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. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.



You could add member PriceScaleFactor on TradeBar and Tick objects and a function to convert adjusted price back to raw price. We would use adjusted or raw price for indicator calculations and raw price for calculating shares and fees (on SetHoldings function, for example).
0

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 QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect 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. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Great idea Alexandre; this was originally a post from 2013 but I've added it on the issue list on github.
0

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 QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect 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. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


I am faced with that exact issue and am conflicted about the proper approach. I discovered how the priceScalingFactor was being used when running an indicator I am writing that uses a RollingWindow. I was looking at the output of the OHLC and the indicator and comparing it to the raw values read in from the minute file for the SPY. I noticed that the price in my algo was different than the raw price in the sample data from 2010. So my investigations led me to the pricesScalingFactor code and the factors file.

As an aside, for a short period last night, I was convinced the scaling factor was off by one date until I realized that the factor associated with a date is the factor before the date not after the date. So the factor is 1 before 20501231, then 0.995216 before 20140619 and so forth.

Anyway, I got to thinking about what would happen to my indicator when a la
0

Sorry, I clicked the Post button by accident.

Anyway, I got to thinking about what would happen to my indicator when a large event like a 2:1 split occurs.

In back test, I would use automatically use the adjusted price and not worry about commission/fees affecting my results. The impact of the fees would not significantly affect my returns. But, as Alex points out, the factor could affect the size of my SetHoldings call if my algo used price as a percentage of my portfolio value to calculate the size of my SetHoldings call. The algo could invest more than I intended or could afford and that would affect the returns.

However, unless the algo is using adjusted prices, the algo could prematurely liquidate and report a loss.

As an more concrete example, suppose I am testing Resolution.Daily and the stock splits 2:1 overnight. If I am not using adjusted prices, the price would go roughly in half at the open and I would get stopped out by my risk strategy and report a large loss when the algo liquidates half of my shares because my portfolio did not adjust for the split.

In live trading, which always uses a factor of 1, the split event would affect my indicator in perhaps in money-losing ways. If my algo knows about the event, then I can compensate for it by adjusting the values in the RollingWindow. But how will it know about the event? I don't know.

I guess I agree with Alexandre, that it would be good to be able to set _hasScaleFactors depending upon how the factors are being used.
0

Update Backtest





0

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 QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect 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. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.


Loading...

This discussion is closed