Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Quantopian API - timestamp information lost?

If I've followed all of the details, the Quantopian API paradigm is to trade on "Quantopian time" by executing handle_data every minute (presumably all algorithms are synchronized in some fashion to the same clock). External data are timestamped according to the algorithm clock:

  • OHLCV bars carry minutely timestamps
  • The timing of orders, etc. to and from Interactive Brokers in reported as minutely

The problem I see is that information is being lost to the algorithm.

On https://www.quantopian.com/faq, it states:

For paper trading and real-money trading, we get a realtime feed of
trades from Nanex's NxCore product. Those trades are bundled into
one-minute bars and fed to the trading algorithms. Paper trading data
is provided on a 15-minute delay. Real-money trading is processed
without delay.

So, it appears that Quantopian has access to the Nanex NxCore timestamps of the OHLC data for the minute, but does not provide them to the algorithm. My suggestion is that the actual OHLC timestamps be available to the algorithm, since the OHLC data are actually time series data. One would expect the O/C values to fall close to the Quantopian minutely start/stop, however, the timing of the H/L values is lost.

Regarding information from Interactive Brokers, I get the sense that there is a bunch of time-stamped data available that is not returned to the algorithm. For example, as Alisa clarified on https://www.quantopian.com/posts/position-entry-date, the actual timestamp of the order fulfillment is not provided to the algorithm.

I sort of have a feel for the architectural decision to run algorithms on minutely "Quantopian time" but it appears that in trying to simplify trading (and provide a universal API), some information is selectively excluded. My advice is not to hold back, since you never know if a useful "indicator" might be derived from the information. If Quantopian members are sophisticated enough to write profitable algorithms, they'll be able to handle the additional information (and maybe even figure out clever ways to use it that you had not anticipated).

Grant

5 responses

Hello Grant,

This is interesting. I'm guessing that OHLC minute bars are created by Quantopian from Nanex tick data timestamped to milliseconds.See: http://www.nanex.net/API_Explain.html

P.

Hi Grant,

We don't stamp the data streaming in with Quantopian Time, we use the timestamp provided by Nanex. We bundle the data into minutely bars and feed them into the algorithm. So we are providing the Nanex time to the algorithm but we're not providing individual trade timestamps - rather we're providing the collective bar's timestamp. The OHLC values are still available to you for the minute bar and you can call them in your algo.

Cheers,
Alisa

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 Alisa,

I follow that you just have a timestamped stream of Nanex price and volume data coming in, from which you generate the minutely bars. Each bar consists of OHLCV for one minute, and you assign a single minutely timestamp to each OHLCV set, correct? However, I suspect that "open" and "close" are misnomers, since you must be reporting the first trade price within the minute, and the last.

I understand your point about the minutely bar timestamp being derived from the Nanex data stream.

What I'm suggesting here is that you consider not throwing out the original Nanex timestamps, but rather make them available to the algorithm.

Grant

Hi Grant,

We aggregate the Nanex data into timestamped minutely bars, which we feed into the algorithms. Each minute bar has an open price (the price at the start of the bar) and a close price (the price at the end of the bar) so I do not believe these are misnomers. And we do not throw out any information, we simply aggregate the values - otherwise if we provided tick data that would trend toward HFT, which we do not support. All the timestamp information is passed on to you - you see all minute level activity and information.

Thanks Alisa,

You do throw out information, since each Nanex OHLC price value has a timestamp provided by Nanex, right? In the aggregation process, you drop the timestamps. So, the bar data you currently provide could be supplemented with the timestamps (and probably some additional information about the volume versus time over the minute), without changing your basic architecture. Just a suggestion...no need to follow up further.

Grant