I am a newbie here and can't find any documentation about short positions in general. How do I short a stock with SetHoldings or a MarketOrder?
QUANTCONNECT COMMUNITY
I am a newbie here and can't find any documentation about short positions in general. How do I short a stock with SetHoldings or a MarketOrder?
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
Aaron Janeiro Stone
In the order set quantity to a negative value (e.g., self.MarketOrder("SPY",-1))
Ashraf Said
HI Aaron , but how does it work in case say I have set cash to 10,000 and now I have to divide that capital between say 10 instruments , with half of them short and others long , while keeping a buffer of 0.05 percent of the capital invested ?
your input is highly appreciated
Vladimir
Ilja Afonin,
-→I have set cash to 10,000 and now I have to divide that capital between say 10 instruments , with half of them short and others long , while keeping a buffer of 0.05 percent of the capital invested?
"Long-Short static sample portfolio" does exactly what you're looking for.
If you are satisfied with my answer, please accept it and don't forget to like it.
Vladimir
Here is the code snippet from the backtest attached above
Ashraf Said
thanks Vladimir for the response , however , what shall be changed if I wanted to buy few cents above the current price of these longs and sell few cents below the current price for the shorts, let say 5 cents in each case , of course all of them on 15 minutes before the close on the start of the month as you have indicated and one more technical point , can I use the following syntax(in python) I noticed it threw in an error and as a result the backrest did not show up , basically i wanna choose specific days in a month using numbered day property ?!
BY the way , I have noticed that you did not include within “Self.Schedule.On” date and time rules for the short positions , why is that ?
and is “rebalance ” method you showed above as a key argument means that the proceeds out of each trade will be reinvested in total or not in to the next trade ?
lastly , is there any tool within the platform to allow me to filter those stocks which shared by many underlying tradable ETFs and are optionable at the same time ? for example I would like to know in how many ETFs HSBC stock feature as a constituent within the corresponding ETFs and whether it is optionable or not ?
your input is highly appreciated
Vladimir
Ashraf Said,
I have created the an algorithm exactly per your requirement
→I have set cash to 10,000 and now I have to divide that capital between say
10 instruments , with half of them short and others long , while keeping
a buffer of 0.05 percent of the capital invested?
You can add anything you want to improve it.
Ashraf Said
No worries I will pose these additional questions on the forum
Ilja Afonin
The material on this website is provided for informational purposes only and does not constitute an offer to sell, a solicitation to buy, or a recommendation or endorsement for any security or strategy, nor does it constitute an offer to provide investment advisory services by QuantConnect. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. QuantConnect makes no guarantees as to the accuracy or completeness of the views expressed in the website. The views are subject to change, and may have become unreliable for various reasons, including changes in market conditions or economic circumstances. All investments involve risk, including loss of principal. You should consult with an investment professional before making any investment decisions.
To unlock posting to the community forums please complete at least 30% of Boot Camp.
You can continue your Boot Camp training progress from the terminal. We hope to see you in the community soon!