Back

Live trading question

Dear All,

I have a question about how the algorithm buy stocks in live trading.

Lets say I have 1000 dollars in my account, and my algo emits insight to buy 10 stocks and each stocks price is 500 dollars. Then, does it buy only 2 stocks or does not buy any stocks because I dont have enough funds?

Thanks in advance!

Update Backtest







0

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.


See this page for automatic position sizing. Alternatively if you using the Algorithm Framework, this is handled by the Portfolio Construction Model. Most of the built-in ones use PortfolioTarget and factor in available buying power to scale positions if necessary.

0

Adam,

that is not my question. But thanks!

0

I'm new to quantconnect, but think it is more a broker execution question. I would see what happens when you directly do so on your broker platform and would see what error message you get.

0

Thomas, Yes! Thats what I thought. I backtested with only 500 dollars and let my algo buy 3 stocks which are over 300 dollars. And my algo did not buy any. I think if you don't have enough fund for at least 1 share per each insight, this algorithm does not buy any.

0

Hi Juhwan, 

first of all we should distinguish between Insights and Orders. 

In your posts you talk about Insights, but there is no restriction because no orders are sent when emitting Inisghts. 

Anyway, I assume you meant the submission of orders. Then you are right that nothing happens. You just get an error message "Insufficient Buying Power". 

But I've played around a bit with some minimalist examples and what I find interesting is this: If you take IB as brokerage model with AccountType=Cash Account, then orders are submitted and executed. You get a margin call right after the execution and existing holdings are sold/reversed immediately. 

Not sure if this is a bug ...

1


Dear Juhwan,

When an Insight is created, the number of shares being bought/sold aren't set explicitly, that is decided by the Portfolio Construction Model. That being said, if a portfolio only had $10 in cash, and an Insight is emitted, say, for Apple (AAPL), the algorithm won't buy any shares, as one share costs around $300, but the Insight will still go through. This way, the user can still see if their Insights were correct or not in the Insights tab of a backtest.

Best,
Shile Wen 

1

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.


Update Backtest





0

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.


Loading...

This discussion is closed