Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
hack for intra-minute price discovery?

Wondering if anyone has considered a hack to get pricing intra-minute from IB? For example, if an order for zero shares is submitted, is the order rejected by IB, with the current price revealed to the algorithm within the minute? Or if an order for an excessive number of shares is submitted and then rejected by IB, is the price be revealed to the algorithm within the minute?

If so, and the intra-minute price could be discovered without paying a commission, then the price could be used in the algorithm. In fact, a whole series of intra-minute prices could be collected and analyzed, right?

Grant

5 responses

Grant, remember that handle_data() is only called once per minute. Since it runs once per minute, it can't "discover" new prices every few seconds.

Also, remember that when handle_data() runs, it's running with price data is that is very fresh - price data that just came in. Price discovery like you're talking about wouldn't get you "fresher" data, it would just increase the frequency you get the data.

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.

Thanks Dan,

Basically, I'm wondering if there is a backdoor way of trading more frequently than minutely. When an order is sent to IB, what information is returned to the algorithm and when? Say I write a loop that executes every fives seconds to submit an order for a gazillion shares of XYZ. So, every five seconds or so, the algorithm should get a rejection notice along with the XYZ price, right? Or not?

Grant

I don't think this is possible currently. As I understand it, the algos can can only send data and not receive it during each cycle of handle data. It's not a two-way interaction with IB. The data passed to handle_data each minute is what you get. The only way to get finer granularity would be to build your own IB gateway, unless there's something I'm missing.

Hi David,

Some/all of the order processing is asynchronous (ASAP). If I understand the documentation correctly, some information does flow back to the algorithm from Interactive Brokers during a given call to handle_data. The question is, would this be a hack to obtain prices from IB at sub-minute frequency?

Grant

The short answer is no. You wouldn't be able to get price information at a sub-minute frequency and you would not be able to "write a loop that executes every fives seconds to submit an order for a gazillion shares of XYZ". This loop will only run once per minute using handle_data. Dan had a great explanation above on the details of the frequency.

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.