I wasn't able to find anything regarding this. I am trying to call only a specific timeframe of the day, for example the last one hour of data in resolution minutes for the past couple of months.
The main reason I am doing this is to analyse a specific timeframe of the day without overloading the system, which can happen specially with the tick data.
Any help pointing in the direction is appreciated.
Mia Alissi
To analyze a specific timeframe of the day, you can use the
Schedule.On
method in QuantConnect. This allows you to trigger events at specific times. However, the extracts provided do not contain a direct example of this.For example, if you want to analyze the last hour of each trading day, you can schedule an event to trigger at that time. In this event, you can then analyze the data of the past hour.
Here is a basic example in Python:
In this example,
AnalyzeLastHour
is a method that will be called at 3 PM (15:00) every trading day. You can replace"SPY"
with the symbol you are interested in.However, please note that this will not reduce the amount of data that your algorithm processes. Even if you schedule an event to trigger only at a specific time, your algorithm will still receive data for the entire trading day. If you are using minute or tick resolution, this can indeed be a lot of data.
If you are concerned about overloading the system, you might want to consider using a higher resolution (like hourly or daily) or consolidating the data into larger bars. For example, you can use a
TradeBarConsolidator
to consolidate minute data into hourly bars, as discussed in the forum discussion here.Please note that the code and strategies provided are based on the information available in the extracts and may need to be adjusted to fit your specific needs.
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.
Farshad Fahimi
Thank you Mia, this is helpful. Actually as you pointed out, I am trying to calculate buy and sell volume aggregations which as far as I know is only available on tick level.
Is there a way to get the buy/sell ratio on second or minute level data?
I reference this point for detail on my question:
Ashutosh
Hi Farshad Fahimi , you can have a second and minute resolution sell and buy volume but it would be one where you put in various assumptions and not 100% exactly the sell and buy volume indicator.
One straightforward approach is to analyze the Close and Open values of each bar and establish a basic condition where "bar.Close > bar.Open" signifies buy volume, and "bar.Close < bar.Open" indicates sell volume. However, this method is simplistic and lacks accuracy.
As discussed in the post, tick data offers more reliable buy and sell volume information. Each quote can only represent either a buy or a sell, containing either a BidPrice or an AskPrice while the other remains at 0. If the last quote is a sell before a trade, it will always represent sellVolume.
Rather than computing this data for the entire day, you can analyze it at the second and minute levels. However, it's important to note that using tick data can significantly slow down the program.
Best,
Ashutosh
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.
Farshad Fahimi
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!