QuantConnect / Lean

Lean Algorithmic Trading Engine by QuantConnect (Python, C#)
https://lean.io
Apache License 2.0
9.86k stars 3.27k forks source link

Implement RemoveSecurities for Coarse and Fine Universes #3581

Open EmilioFreire opened 5 years ago

EmilioFreire commented 5 years ago

Current Behaviour

Currently Lean only allows to remove securities from a User-Defined Universe

Requested Behavior

Allow to use RemoveSecurities also for Coarse and Fine Universes.

A Few Use Cases

A potential solution to this scenario would be the ability to tag the securities as Long/Short (or any other tags) in Universe in order for the Alpha to know what to do with them.

  1. Performing a basic preliminary selection in Universe based on price, volume and fundamentals and keep a few hundred of assets. This Universe will then be sent to Alpha for calculations to select the few Longs and Shorts. This process looks more elegant as the calculations are only performed once, however the algorithm would be really slow and inefficient since most of the securities in the Universe won't be traded and therefore useless to stay in the Universe. Actually, with normal capacity, the maximum number of assets that could be in Universe with minute data would be around 100 and that with risk of crashing already.

I believe the second scenario makes a more general case, and that simply being able to get rid of the useless securities from the Universe (once the decision of trading has been made) would fix the issue.

The solution would be again to remove those remaining securities from Universe.

Checklist

jordizle commented 5 years ago

It would defiantly be beneficial to remove securities from the universe (intraday) in order to improve the general performance of algorithms that use universe selection.

jaredbroad commented 1 year ago