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

[WIP] Order price can now be 0 to accommodate unusual scenarios #161

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

davidandreoletti
Copy link

Awesome lib!

Example scenario: Closing a position at 100% loss such as simulating an open position on a stock (price > 0) and then "closing" said position when the stock is delisted (ie stock price is 0)

…tion means selling a $0 position. Eg: Simulating a open position on a stock (price > 0) and then "closing" said position when the stock is delisted (ie stock price is 0)
@davidandreoletti davidandreoletti changed the title Order price can now be 0 to accommodate unusual scenarios [WIP] Order price can now be 0 to accommodate unusual scenarios Jun 7, 2021
@polakowo
Copy link
Owner

polakowo commented Jun 7, 2021

It's not as simple as that. Your current change would allow filling literally any order of any size when the price is zero. See #83 for a workaround.

Edit: what can work is automatically replacing any zero price with nan; this way any order will be ignored while the ticker is delisted. But with one exception: if some special condition is met (e.g., the size type is target shares and the size is 0), it will close the position at 100% loss. Then you as a user are responsible for selecting an appropriate timestamp to close the position. Or we could automatically close any position if the price hits zero and ignore all subsequent order requests, but this would rule out re-entering the same position in case of relisting.

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 this pull request may close these issues.

None yet

2 participants