Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Problem with closing prices

Hi, I have been trying to create a DPO signal, to realize that the closing prices that I get for SPY and Tesla are not the same as in Yahoo finance or charting service. Is there something that I do wrong?
I added comments to my code only to keep the current_price data.
When I log.info the data it doesnt match with other references.
Can someone help?
Thanks

3 responses

You didn't show the actual problem, i.e. the difference between the data you see on Yahoo finance and the prices you log with your script.

At first look it seems you're printing out a running value (the close price of a day 30 minutes into the trading day) so you end with a difference at the end of the day.

Either log the previous day's price by indexing [-2] or move that log call into before_trading_start().

Thanks a lot, I moved the logic inside before trading start and it worked.
thank you !!

You're welcome, as future reference I suggest checking this link about asking questions.