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

[Bug/Feature]: long-short.py - Qty should be calculated relative to price of stock #579

Open
1 task done
Dylan-86 opened this issue Feb 24, 2022 · 1 comment
Open
1 task done
Labels
enhancement New feature or request

Comments

@Dylan-86
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

When opening new positions, the long-short.py opens all the positioning with approximately the same qty in terms of shares (ie: with 100k capital, each position is 160 shares). This does not make sense, the position should be calculated based on the price of the stock.

For example, the code tries to open a long position for AMZN for 160 shares (2.880$/each) and this goes way above the available liquidity. Likewise, it opens a position of 160 shares for GM (44.85$/each).

I've tried to fix the code but I'm not sure about all the references, so it'd be cool if someone from Alpaca could fix this.

Expected Behavior

No response

Steps To Reproduce

No response

Anything else?

No response

@Dylan-86
Copy link
Author

To be clear:
image

@drew887 drew887 added the enhancement New feature or request label Apr 29, 2022
@drew887 drew887 changed the title [Bug]: long-short.py - Qty is completely wrong [Bug/Feature/]: long-short.py - Qty is completely wrong Apr 29, 2022
@drew887 drew887 changed the title [Bug/Feature/]: long-short.py - Qty is completely wrong [Bug/Feature]: long-short.py - Qty should be calculated relative to price of stock Apr 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants