Hi there,
So I've already used the framework for some investing strategies and now I'm trying to implement a simple time-series momentum swing trading strategy on commodity CFDs (Market.Oanda).
What I would like to happen is the following:
1) Minute/hourly resolution is used as the main data resolution (set in main.py) with multiple symbols.
2) In the AlphaModel, I would like to consolidate into Daily data and register an indicator to each symbol (example, Donchain Channel) with this consolidated data.
3) Each time (if and only if) a new daily data is consolidated (which should be at the close/open for 24/5 CFDs), check whether the close of that daily bar is higher/lower than the Donchian Channels.
4) Emit insights Up/Down for those symbols that have closed above/below the Channels.
You can see my current progress in the attached code.
Problems:
1) Through Debugging, I have noticed that my current OnDataConsolidated is being called at different times (i.e. "Daily" bars are consolidating at different times). I have followed the trail and the indicators are being registered at the same time, and all contracts should open/close trading at the same time each trading day.
2) Furthermore, the "Daily bars" are all ending at "00:00:00" (bar.EndTime). This is not the "end of trading day close" that I'm after. In all cases, the "Daily bars" are giving an intra-day price (00:00:00) as the "Daily close".
If someone could please help me figure out what is going wrong with my indicator + consolidator combo, and thus help me achieve the process initially outlined above, that would be very much appreciated! I'm not sure if I've explained things in the simplest manner, so please ask any further questions.
Thanks in advance,
Kayne.
Rahul Chowdhury
Hi Kayne,
1. Market hours can vary for Cfds. You can find a list of market hours for each Cfd here. You can find the next market close for a security using
nextMarketClose = security.Exchange.Hours.GetNextMarketClose(security.LocalTime, false)
This and including the fact the your algorithm start date is a holiday explain why the first bar's consolidated time is different for each symbol. By removing self.print = False on line 79 in your AlphaModel, you can see that the consolidated times are more consistent after the first day.
2. Daily bars are created by consolidating intra-day data. These bars are emitted at the end of each day at midnight. This means even for equities, which close trading at 4 pm for non-extended hours, the daily bars are emitted at midnight.
If you have any further issues or concerns, please don't hesistate to reach out!
Best
Rahul
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.
Kayne Eccles
Hi Rahul,
Thank you for your response. After evaluating what you've said, I still have some further questions.
I had not seen that part of the github, so thank you for showing it to me. I removed the print limit as you suggested, but I am still struggling to grasp some things. I will outline this below with a specific example using WTICOUSD.
This is the print statement from the OnDataCosolidated function:
2018-01-24 00:00:00 -- Data Consol. for WTICOUSD: 64.494, Ending: 2018-01-24 00:00:00
I have not changed the algorithm time, so the time is in UTC-4 (correct me if my understanding is wrong).
So, firstly, on 2018-01-24 (a Wednesday), the session for WTICOUSD began at 18:00. The expected close price (close of 2018-01-23) I want to be receiving and evaluating is 64.514.
You've mentioned that "daily" data/bars are consolidated at midnight (in the algorithm time). However, I would like to get and analyse a "daily" data/bar consolidated at the close of the previous trading session, which in this case, is not 00:00 but 18:00.
I can redefine what I am after in more specifics now:
1) Use a lower-than-daily resolution as the main data resolution.
2) In the AlphaModel, at the close of each security's session, receive that previous sessions' "daily" data/bar (which may not always be a 24h period as in the case of Sunday's & Friday's). This same "daily" data/bar should then also be passed into any indicators that need to update with this information.
3) Evaluate this "daily" data/bar alongside any indicators to make Insight decisions.
I am really struggling to implement part 2). Could you please help me understand specifically where my provided code is going wrong in achieving this?
Many thanks,
Kayne.
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.
Rahul Chowdhury
Hey Kayne,
If I understand you correctly, you want a bar for WTICOUSD which is data consolidated from the market open period, meaning a bar which starts at 18:00 Wednesday and closes at 17:00 Thursday, and so on. You can accomplish this using a custom Calendar consolidator. As examples of how Calendar consolidators work, you can see how the weekly and monthly calendar consolidators are created in Calendar.cs.
Best
Rahul
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.
Jack Simonson
Hi Stephane,
To activate it, you need to hit CTRL+Space and then autocomplete will pop up for the current code you are writing. If this doesn't work for you, try emptying the browser cache and doing a hard refresh. This should enable autocomplete for you, and if not please let us know!
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.
Flame
Hi Jack
Do you know how this works on mac? I can't seem to get it to work.
Thanks
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.
Jack Simonson
It should work the same on a Mac. Try a hard refresh, emptying the cache in your browser, and making sure the LEAN engine running in the cloud is the most recent version. If this still doesn't work, let us know and we'll try to pinpoint the issue!
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.
Bjorn
Anyone got this to work on Mac?
I cleared the browser-cache but "CTRL + Space" is not triggering an In-Browser Python Autocomplete (Firefox 64.0.2 (64-Bit) + Chome Version 73.0.3683.103).
Am i missing something?
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.
Flame
I haven’t been able to get it to work
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.
Link Liang
Hi Mac users,
Autocomplete in python is now available on MacOS! Please try it out by CTRL+Space and give us more feedback!
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.
Barry LAM
Autocomplete in Python available now??
I tried clean my browser cache and the autocomplete does not work.
Browser : chrome (Version 74.0.3729.157 (Official Build) (64-bit))
OS :Window 7 pro
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.
Link Liang
Hi Barry,
Could you try to type "self." in a python algorithm and then hit CTRL+SPACE? There should be a list of methods pop up. If it still does not work for you, please let us know and we will be happy to assist 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.
Barry LAM
Hi Link,
I found out the reason. As my company have more than one input language, when i press "CTRL+SPACE", the function is to change the keyboard input language. So, the autocomplete does not work.
For the people have this problem, you can change the "hot key for input language' in "Advanced key setting"
Thanks for your help.
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.
Sergei Laptenok
I'm using Mac, Chrome Version 76.0.3809.132 (Official Build) (64-bit). Autocomplete is painfully inconsistent. Sometimes it works, sometimes it doesn't, couldn't find any apparent pattern yet. Also, 1) when it does, it doesn't show all possible choices, 2) API hint looks to be C#
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.
Sergei Laptenok
Looks like I found the pattern: autocompete works only when the algorithm is built. So the steps are:
1) type "self."
2) wait a couple of seconds until it builds
3) hit CTRL+space
4) wait a second
5) see the list of options
Very inconvenient as is, but also the list is incomplete, as I said. E.g. I want to type self.UniverseSettings.Resolution, this is what I get (see screenshot):
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.
Martin Molinero
Hi Sergei Laptenok,
Once the build process is triggered, autocomplete is started in parallel. The autocomplete suggestions of self. do not include self.UniverseSe∈gs because we are limiting the number of suggestions for performance reasons. Triggering autocomplete on self.U will present UniverseSe∈gs as an option.
Step 2)waitacoup≤ofsecondsuntilitbuilds should not be required because the Terminal will not build until you hit CTRL+space or the build button.
We've just pushed some backend improvements with the objective of making autocomplete suggestions available 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.
Sergei Laptenok
Thank you, Martin!
I might be missing something, but whenever I type anything, the Build button greys out and changes to "Building...". While it does, autocomplete doesn't respond.
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
debug if its something specific to your strategy
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.
Sergei Laptenok
I'm using a free account for now, trying to figure out if the platfrm is suitable for me, so ticket support is not an option. I did create a new algrithm (default template) and the behaviour is the same: build triggers every time I type anything new.
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.
Sherry Yang
Hi Sergei,
Thanks for trying out QuantConnect!
You can definitely keep sharing your questions without purchasing a paid tier. Keep sending your thoughts to the forum and our Quant team and community members can support. You are correct that build triggers every time new code is written. Can you share a bit more about what you’d like to see in the terminal in a new thread?
Thanks!
Sherry
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 Aadarsh,
Autocomplete should work for all of the objects in our API. Follow these instructions to get it setup.
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.
Alberto Esteban
Hello,
Autocomplete in python is not working. I tried all of the above:
tried different browsers: Edge, Chrome and Brave.
tried a different laptop, all three browsers
tried clear cache and cookies. still not working.
Im just getting started, and if autocomplete doesnt work, I woun't be able to get much done. At all.
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.
Dirk Steyn
Hi autocomplete also not working for me (on Crome)
follow all the instruction above.
Please help,
Dirk
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.
Pierre Guilet
Hi,
I have the same problem with python. CTRL+space launch the build but no popup. It does not work in firefox and edge without any adblock. And nothing is attributed tro ctrl+space. And option is activated. I have set up autocomplete in my local environment but it would be nice to have it in browser too.
Regards
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!