Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prediction algorithms can return negative stock prices #45

Closed
Bainsbe opened this issue Feb 26, 2021 · 3 comments · Fixed by #453
Closed

Prediction algorithms can return negative stock prices #45

Bainsbe opened this issue Feb 26, 2021 · 3 comments · Fixed by #453

Comments

@Bainsbe
Copy link

Bainsbe commented Feb 26, 2021

Issue outlined in the title, may be worth setting a bottom bound on the prices to default to 0 if prediction is <0

image

@jamesphillipturpin
Copy link

jamesphillipturpin commented Feb 26, 2021

I think the more natural solution is to (have an options to) use logarithmic/exponential fit rather than linear fit. Fit to y=np.log(price) and then predict y. Return to the user price=np.exp(y). You could still get a price of 0.00 by rounding, say, 0.002 down to 0.00. It is a more realistic model for compound losses or compound gains. 75% loss is twice as bad as 50% loss. 100% loss is infinitely worse. And 100% gain offsets a 50% loss.

I'd also like to make predictions on volatility measures rather than just price. I would guess that sometimes it is easier to figure out just that a price may move more than usual rather than which direction. Volatility measures might also be bounded by zero.

I see we also get negative numbers for the lower bollinger bands curve for GME recently. Doing Bollinger Bands within a logarithmic/exponential pre-/post-processing framework could fix that such that you get useful levels not just zero. Having that as some kind of optional flag would allow users to use it only when they want it, and maybe use it modularly across different TA and prediction options with very little code modification.

@DidierRLopes
Copy link
Collaborator

Hey guys,

Thank you @Bainsbe for pointing this out!

And thank you @jamesphillipturpin for this solution. I'll label this ticker as a new feature and will work on that flag as well soon.

Regardless, I think that the right thing to do if the prediction of the stock price is negative, is to output "Invalid prediction" or similar. As realistically, a stock wouldn't go to 0 either.

@Bainsbe Bainsbe changed the title Prediction algorithims can return negative stock prices Prediction algorithms can return negative stock prices Feb 27, 2021
@aia
Copy link
Contributor

aia commented May 18, 2021

Assuming this has been addressed in PR #436

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants