Hi,
I would like to know how I can short a position with my custom data feed?
I am using AddData<T>() for adding my data and saw that market hast to be set to short(I think), but there is no market to select.
I have the market string for my data..
-What I thought how it works
For shorting Order(symbol, -quantity)
For long position Order(symbol, quantity)
when I use the negative quantity I get an error saying it gets rounded to 1 because there is no brokrage set.
From Console: "20200718 16:05:30.934 ERROR:: Warning: Due to brokerage limitations, orders will be rounded to the nearest lot size of 1"
How can I do it correctly?
Shile Wen
Hi Amir,
I was unable to replicate the warning by shorting an integer number of shares of custom data, but I was able to get the warning by shorting a non-integer number of shares. This is the default behavior because the algorithm doesn't allow orders that don't meet the minimum price variation.
To make the warning disappear, we can round down the number of shares we would like to short to an integer, which I’ve shown in the example in the backtest.
Best,
Shile Wen
Amir Awak
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!