Back

Updating universe is great ! but slow ?

Hey QC Community

Thank you so much for releasing the new updating universe feature, its basically a game changer and seems to work flawlessly (almost). I want to run this backtest which buys four stocks at open and sells them on close based on the data in the linked dropbox file.

When I push the test above 3 months the algorithm seems to be unable to handle it, and I need it to run for 4 years.

The calculation seems very easy so I am really not sure what it is thinking about so much, especially when the excel file is cached meaning it only downloads once. Maybe some stocks which are not in the QC universe give it problems but it seems to ignore those and move on.

Would really appreciate some help in optimizing this so it runs smoothly and able to process through the entire excel period!

Thanks
Update Backtest








Hey Daniel! It looks like you've configured the universe to fire every minute! The resolution parameter in the AddUniverse method call is the resolution we should check for universe changes, not the resolution of added securities. Modify the resolution in your AddUniverse method call to Resolution.Daily and it will go much faster! The UniverseSettings.Resolution value is the value used for securities added via the universe.
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.


Hey Michael

Thanks, that worked like magic. I am now one step closer.

As I am loading the assets from the excel I quickly reach my 500 limit. I figured the algorithm would remove them from the universe if I hold no position but as I understand this is not the case.

My question is if possible at all, how do I remove stocks who have already been added ? So Trade 4 today and remove the ones I used to trade yesterday.

Much appreciated.

Daniel
0

Stocks will be automatically removed from the universe when the following conditions are met:
1. The stock is not returned via the universe selection function, and unchanged was not specified
2. There are no existing holdings in the stock
3. There are no existing open order for the stock

What I like to do is save off the 'SecurityChanges' and then loop over the 'RemovedSecurities' and liquidate and cancel all open orders to ensure they get removed.
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.


Hi Michael

Thansk for the fast response.

As far as I can tell I am meeting all the criteria. I attached my algo perhaps you can tell me where im wrong.

I always liquidate everything before market close and clear the orders after their fills

if (Time.TimeOfDay == new TimeSpan(10, 15, 00)){
MyLimitOrders.Clear();
}
BTW for the community -> this is a day trading mod of the DropboxUniverseSelectionAlgorithm, feel free to use it as long as you play with under 500 stocks :)
1


Hey Daniel, you'll need to call the 'Cancel' method on the OrderTicket in order to actually cancel the order. You can also call Transactions.CancelOpenOrders(symbol) to cancel all open orders for a specific symbol.

That being said, there's still certainly a bug here :/ We should have a fix deployed for you tomorrow. I'll post back here and let you know.
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.


Bug terminated :) This fix will be available in the next deploy! Thanks for letting us know!
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.


Great thanks a lot!
0

Hi Michael

I believe the next version is still bugged.

I even cancel all orders

foreach (var tradeBar in data.Values)
{
Transactions.CancelOpenOrders(tradeBar.Symbol);
}

Still getting the 500 securities limit, suggestions ?
0


This is what I get for testing with different resolution data :/ Turns out we weren't limiting hourly/daily data in the way you're being restricted. I've fixed (promise!) the bug and it will be available in the next deploy.
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.


I've a question to this topic.
One of my strategy ideas is filtering through stocks in order to find some "gold fishes".
In fact, I'm not too demanding and I"m accepting also some silver ones ;-)
Because of 500 max stocks condition many fishes are avoiding my nets.

What are the chances to extend it in the future?
Is the physical memory the only limitation?
I can only imagine that we can't discriminate the strategy because of number of stocks in the scope. For sure exist some more demanding for memory strategies with i.e. 10 stocks.

What in case of paper and live trading? Is this limitation also valid?
I mean if I've subscribed and have some CPU in cloud for my usage - shouldn't be then possible to do with "my" memory what I want?
0

Hi @Daniel -- the latest version 2.1.6.3 fixes this bug and will look at the active data subscriptions to determine the number of securities. Your algorithm should work now :)

@Andrzej, we've put a limit on the number of securities for backtesting and live for memory and load sharing reasons. We will probably increase this for subscribers in the next few weeks.
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.


Regarding new engine v.2.1.6.3 ... my indicators stopped to work compared to yesterday.
I don't know if the others have same situation?
0

Hey Andrzej, no changes were made that should affect the way indicators function. If you're sure there's a bug, please share an algorithm showcasing the issue.
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.


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