Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Upcoming Feature: Daily Bars, feedback needed!

Dear Quantopians,

We will soon be launching a new feature which allows you to run your algorithm easily with daily or minutely bars. During testing, I noticed that switching between minute and daily had very large differences in behavior. Initially, it appeared that my algorithms were never trading on the daily bars. What I discovered was that trades were happening, but in tiny proportions. Imagine a trivial example where you buy N shares of a single stock on every invocation of handle_events. In a daily simulation, you buy N shares per day. In a minute-ly simulation, you buy 390*N shares per day!

In testing, I've just been multiplying the volume of orders by 390 when I do a day calculation, but this is very tedious and hard to remember. I was wondering what you would like as an interface for this switching. One idea we have is to transparently multiply all order amounts by 390 when you run a daily backtest. That way order(sid(123), 100) would be scaled up in the daily case would be equivalent to:order(sid(123), 3900).

This is based on our expectation that members will want to do iterative development using daily bars, which provide faster results, but then switch to minute data for a fine-grained backtest.

Let us know what you think, and thank you for your help!

thanks,
fawce

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.

9 responses

Math mistake in the equivalent order - 390*100 is 39000. I guess I really do need this feature :).

In the function order_in_cash() the number of shares is calculated from the price and cash you want to invest. So certainly a fixed multplication of shares if operating on daily ticks would break this functionality.

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.

@Thomas, how do you arrive at the amount of cash you want to place for a given order?

Here is the example code.

very nice - different time frames are really important i hope you will add more!

@defc0n1 - which others would you like to see? hour? week? month?

@fawce
hourly and weekly would be very useful

@defc0n1 do you expect to test the same algorithm over different time frames? Or would you run the same algo on just one of the time frames?

@fawce

In my proprietary algorithms I use different time frames in the same strategy from time to time for example to verify that a short term intraday signal is only traded in the direction of the long term trend.