Hi,
I want to know if it's possible to check for example at 10:00 the most traded stocks based on Volume of stocks traded. For what I understand this code is not doing that, because it checks for "yesterday" volume, not the volume up to 10:00 of the same day:
def MyCoarseFilterFunction(self, coarse):
sortedByVolume = sorted(coarse, key=lambda x: x.Volume, reverse=True)
filtered = [ x.Symbol for x in sortedByVolume if x.Price > 10 and x.Volume > 50000 ]
return filtered[:100]
What I want is to check for universe of stocks that have more than 50.000 volume traded (not dollars, number of stocks), at 10:00.
I can acomplish this only by setting up "MyCoarseFilterFunction" inside a scheluded function?
Appreciate someone can point me in the right direction.
Derek Melchin
Hi Cristian,
It is not possible to subscribe to security datafeeds through cumulative intraday volume filtering inside a universe selection method. However, we can create a workaround to determine which of the securities in our universe pass the intraday volume requirements by add a universe and a scheduled event to our algorithm.
# Initialize self.AddUniverseSelection(CoarseFundamentalUniverseSelectionModel(self.CoarseSelectionFunction)) self.Schedule.On( self.DateRules.EveryDay("SPY"), self.TimeRules.At(10, 0), self.SelectUniverse ) self.universe = [] self.volume_by_symbol = {}
In the CoarseSelectionFunction, we filter the stocks by the price threshold.
def CoarseSelectionFunction(self, coarse): self.volume_by_symbol = {c.Symbol: 0 for c in coarse if c.Price > 400} return list(self.volume_by_symbol.keys())
We then track the cumulative volume for all the symbols in the universe from the open until 10AM.
def OnData(self, data): if len(self.volume_by_symbol) == 0: # universe is ready. Access with self.universe return for symbol in self.volume_by_symbol.keys(): if data.ContainsKey(symbol): self.volume_by_symbol[symbol] += data[symbol].Volume
Lastly, we define the SelectUniverse method to filter by the intraday volume seen thus far.
def SelectUniverse(self): self.universe = [] for symbol, volume in self.volume_by_symbol.items(): if volume > 50000: self.universe.append(symbol) self.volume_by_symbol.clear()
See the attached backtest for reference. Also, consider reviewing our documentation on scheduled events.
Best,
Derek Melchin
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.
Brian tong
Many thanks for the code illustration Derek. That is very helpful.
I tried to clone the strategy and change only the date range, from the current 2020-1-21 to 2020-1-24 to 2022-12-5 to 2022-12-8. I hit a NonType error. Any idea why does that happen?
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.
Derek Melchin
Hi Brian,
To fix the issue, we just need to replace
with
See the attached backtest for reference.
Best,
Derek Melchin
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.
Derek Tishler
How is the disparity between the 512 mb live trading server and the ram limit in backtesting? Do they have different ram usages or is an institutional plan required for most any algos with medium-large universes to be run live?
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.
Jacob M Shrum
Also, the data sets available on quantopian are very useful - and not available on QuantConnect...
Does quantconnect have plans to expand available services?
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.
Sofyan Saputra
My initial experiences live trading with Quantconnect nearly a year ago honestly wasn't great. The live trading connection for IB Paper glitched for the first week of my subscription and while out of market hours worked on the backtester, the order type could not be submitted on live trading unless I paid for QC to hire a contractor and implement the feature. Fortunately the owner, Jared, is very responsive and active.
With so many people leaving Quantopian, this is a really great opportunity for Quantconnect to step up.
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.
Jared Broad
Welcome all to QC!
Derek Tishler -- the limits are guides only. Your universe can be as you like but if you run out of RAM the system will shut down your algorithm. How much ram you use will depend what you're doing. Are you seeing RAM issues in your backtests? The base line subscription is only $20 and gives you 4GB ram -- basically a 100% mark up on a Google/AWS for providing a live data stream + Equinix hosted algorithm with 0.1ms latency.
Jacob M Shrum -- paid datasets can be imported by coding to the individual company API's. You would need to use the Custom data section to learn more about this.
Sofyan Saputra -- sorry you had a glitch. Its a hard problem to solve but we're in a "period of stability" now. About 80% of the instability comes from undocumented IB API changes. Re: Hiring a contractor -- yes you need to be a programmer to use QC.
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.
Petter Hansson
@Original topic: Hah I would expect something like this April 1st, back to oligopoly practices it seems.
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.
Jared Broad
As a guesture to welcome all Quantopian users the new baseline free tier is 8GB Ram allocation! Enjoy!
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.
Jacob M Shrum
Does QuantConnect ever plan on selling "data packages" or something similar? A sentiment package would be nice (psychSignal, Sentdex, etc.) I'd imagine QuantConnect could lower the price of these data sets (economies of scale) and profit off of them.
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.
Sari Louis
Hi Jared. Another Quantopian user here :) Just signed up to look around. Thanks for the nice gesture. I'm sure there's a lot of information already available in the forums, but given the short amount of time we all have to move things over, perhaps you can create a quick post to help Quantopian newcomers with the switch. It's hard for us to get to know QuantConnect well enough in a short period of time, and I'm sure you've already done your competitive analysis on them. So it would be easier for you to do a cheat sheet of what to look for when moving over.
For me specifically, I'm definitely looking to live trade with IB. I'm curious as to whether 512 MB for live trading is realistically sufficient. Also, would be nice to have pricing avaliable upfront for, say 1GB and 2GB before going into a custom quote scenario.
Much appreciated.
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.
Jared Broad
My response to Quantopian's shutdown:
https://www.quantconnect.com/blog/democratizing-finance-empowering-individuals/
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.
Jared Broad
Welcome Sari Louis! 512mb is sufficient depending on what you're doing. You could manage a few hundred securities easily assuming you're not building massive vectors of data.
QP users will want to check out how we do universe selection. Its slightly different to Quantopian. The best repo of python specific examples is here:
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.
Alexandre Catarino
Hello everyone,
If you look around at this forum, you will see that we have had a lot of recent questions about python algorithms in QuantConnect. We have been able to answer all those questions and help people bring their algorithm from other platforms. On the other hand, we are working hard on our documentation, especially the tutorials. Please check them out.
In order to help Quantopian users, I will give my best to learn its API and make a post to show what changes you need to make.
We are really excited about this. Our community will be much stronger with you.
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.
AMDQuant
Quantopian Migrant here. I'd be interested to know the increase in accounts you all experienced today? lol.
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.
Andrew Kunkel
I came here from Quantopian. Does this site integrate with Robinhood?
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.
Eric Novinson
It looks like the Morningstar data on Quantconnect has a few differences from the data at Quantopian, a few metrics are available on one site and not the other but most of the fundamental data is available on both sites. Also wondering if anyone's using fundamental data from prior quarters in Quantconnect algorithms.
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.
Thomas Chang
Hi,
I am also from QuantOpian. I've registered here more than one year ago. Since I am a Python prgrammer and at that time the Python platform here seems not so strong as that by QuantOpian, I moved to QuantOpian.
Now the QuantOpian is going to shut down and I come back to look for an alternative. I am not sure if QuantConnect has improved its Python enviroment a little bit? :-/
I have to following questions:
1.
I have several linked accounts by IB and on each account I have a live algo running. I am not sure if I can do the same here by QuantConnect? How about the costs?
2.
By live trade by IB, I am not sure if I can get the realtime quotes? Or the 15m-delay ones?
3.
In one of my algos I access the CSV-files from CBOE. I am not sure if I can do the same here?
Cheers
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.
Jared Broad
Derek Tishler - Live requires a fracation of the RAM, in backtesting we spin up multiple threads and cache a few thousand bars of data.
-
Andrew Kunkel - We don't yet but will do when they release the API.
Thomas Chang -
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.
Derek Tishler
Jared Broad thank you for expanding on the ram usage, both literally and figuratively. I look forward to testing my algos out on the platform.
You mentioned the performance benefit of c# in backtesting. Is there any major benefit(aside from current platform stability as python is new) to using c# over python in live trading? I am reminded of Ernest Chan's books on algoriithnic trading where he described his operation of prototyping in a scripting language, such as matlab(or python in our case), and then using a programming language like c# for live trading. Chan also mentioned colocation and execution speed. Does that play into language selection for different types of algos on your platform, or are things like IB's execution speeds more limiting than the cloud network/location and code performance?
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.
Jared Broad
I'd recommend selecting the language you're most comfortable in. Python is a first class citizen in QC with half the team dedicated to making it better and expanding on the documentation, tutorials, feature set etc (4 people -- Alex, Xiang, Xiaowei & Jing).
The LEAN engine is in C# as we can do the heavy data work quickly and maintain a single kernal across multiple languages. The bridge to python is done with PythonNet.
Realistically IB's execution time is far greater than any language difference. The only real speed difference you'll see is in backtesting where C# is 2-3x faster -- this might only matter for options/futures algorithms.
Our backtesting is done on dedicated hardware -- overclocked Intel i7-7700K OC machines running at 4.7-5GHz with NVme disks. Optimizations to the C# stack welcome to make the python go faster!
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.
Warren Harding
Quantopian really shot themselves in the foot on this one. I think cutting brokerage integration was a huge mistake. I'll definitely be using Quantconnect more and Quantopian less.
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.
Jared Broad
As promised! QuantConnect Research is now in public beta!
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!