alpaca-trade-api-python
alpaca-trade-api-python copied to clipboard
[Bug/Feature]: long-short.py - Qty should be calculated relative to price of stock
Is there an existing issue for this?
- [X] 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
To be clear:
