Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Register Multiple handel_data like fucntions with different frequencies

Hi,

Can you add functionality so that an algo can listen to multiple data frequencies so that the algo can take up trading at the appropriate frequency. Low volume means we trade at a lower frequency.

Algo may trade different instruments at a different frequency so it is not possible to put this in from the interface.

Also can we have the ability to get bars like 5 min, 10 min, 15 min, etc. than just 1 day and 1 minute.

Suminda

7 responses

That's a cool idea. Although I think it should be possible to create most of that functionality yourself.

If you are running at the 1 minute level you could have a batch transform that is a 1-day rolling window. From that starting point aggregate the data into 5 min, 10 min, 15 min segments.

In handle_data you could call the batch transform once and then hand off the segmented data to helper functions that do the trading.

Since the batch transform gets called every minute you might only return segments at their respective interval. So 10 minute data only gets returned once every 10 times the batch transform is called (at 9:10, 9:20, 9:30, etc but not at 9:11, 9:12, 9:13).

So when you get the results from the batch transform only invoke the helper functions that have new data waiting for them.

I am using batch transform already. Can batch transform be called many times?

You should only call a given batch transform once per handle_data. But you can have multiple batch_transforms in an algo.

Disclaimer

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 Quantopian. In addition, the material offers no opinion with respect to the suitability of any security or specific investment. No information contained herein should be regarded as a suggestion to engage in or refrain from any investment-related course of action as none of Quantopian nor any of its affiliates is undertaking to provide investment advice, act as an adviser to any plan or entity subject to the Employee Retirement Income Security Act of 1974, as amended, individual retirement account or individual retirement annuity, or give advice in a fiduciary capacity with respect to the materials presented herein. If you are an individual retirement or other investor, contact your financial advisor or other fiduciary unrelated to Quantopian about whether any given investment idea, strategy, product or service described herein may be appropriate for your circumstances. All investments involve risk, including loss of principal. Quantopian 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.

This is confusing. Can you give examples of what not to do and what is legal.

I think this area need more documentation as some one like me. I am learning Python to use Quantopian.

You are definitely swimming in the deep end of the pool here - it's the most complex programmatic area that we support. I plan on building out more examples in this area but I haven't gotten around to it.

You pass the entire data object into the batch transform, so anything in data can be used - that means price, volume, returns, etc.

Our docs are dense, but they do cover most of the details. You might try the various code snippets in the main documentation.

We also have two examples to examine, the batch and universe.

Thanks for helping us figure this out. You're blazing some new ground in terms of experience level and coding for us, and I'm sorry that it's not easy enough yet.

Hi Suminda,

In my experience, the batch transform is inefficient (however, my understanding is that the problem is being fixed). So, if you call it every minute, or many times per day, you may find that your algorithm bogs down.

Grant