Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Price data glitch due to splits? (EEQ)

I've just noticed that price data for symbol EEQ (SID 24073) is way off from the one I expected / shown online in other places. My algo was placing crazy large orders and I could not figure out why.

Q shows close prices for EEQ in 2015 like $0.30 while the actual price should be around $30. Volume is way off too - Q shows 3-4 million per day while I expect ~200k. The minimal example (I am not sure if I can share an algo which prints out quotes here):

def initialize(context):  
    context.stocks = symbols("EEQ")  
    schedule_function(rebalance, date_rules.every_day(), time_rules.market_open(hours = 1, minutes = 30)) 

def handle_data(context, data):  
    return

def rebalance(context,data):  
    closes = history(1, '1d', 'close_price') # 'price' has the same problem  
    volumes = history(1, '1d', 'volume')  
    for security in data:  
        if security.symbol != "EEQ": # (I know I don't need this)  
            continue  
        yesterday_volume = volumes[security].iloc[-1]  
        yesterday_close = closes[security].iloc[-1]  

By doing binary search and debugging I found that the values come back to normal scale on 2015-11-04 (well, that's the log date, so it means that 2015-11-03 is the first valid data point). I did not go into the past, I only tested my algo since 1/1/2015 when I noticed the problem.

Yahoo finance shows EEQ split on 2015-11-04 = 10215/10000 and another one 2015-02-04 = 1015/1000. Does that mean that Q has some issues adjusting prices on splits?

6 responses

Another question - how do people protect their algorithms from stuff like this in live trading? The only way I can think of - placing a test order (1 buy and 1 sell) and comparing the fill price to the last price. But doing it every day for every stock seems to be pretty expensive. Do people let algorithm trade as is and then verify fill prices after entering positions?

Hi Alex,

This is indeed a data error on our end and we will have to get that fixed. Thanks for bringing it to our attention. In live trading, your trades will be filled by the broker as they would normally fill them, independent of Q price data. However, historical data may still contain errors like these. We do the best that we can to provide you with accurate data but unfortunately there's just no way we can guarantee that's it's correct 100% of the time. For particularly sensitive components of your algorithm, I would suggest using something like a manual guard against unreasonably large jumps.

Let me know if you have any other questions that I can help with!

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.

In live trading does the algorithm still use quotes from Nanex, or it will connect to IB API for market data as well? That's the main question. I don't want orders to be placed based on wrong quotes.

Hi Alex,

That's correct, the algorithm uses live quotes from Nanex. IB is just used as a broker; they fill your orders once they've been placed. You can read more about Nanex on their website. The reality is we cannot make guarantees about the data because sometimes, our vendor passes us a bad print. To this point, we've had many users trading millions of dollars through Quantopian live trading so it's a fairly well tested system. That being said, I would still suggest using certain guards to make your algo robust such as the suggestions made in this post.

Jamie,

What is estimated time between identifying an error and fixing it?

Thank you Jamie. I guess in this context you are referring to this tip:

Protect yourself against bad data prints. Our data vendor, like all
data vendors, sometimes passes us bad data. Those bad prints might
cause an algorithm to place a trade that it shouldn't, or skip a trade
that it would otherwise have made. Check if a price is outside of an
interval - for example 10 standard deviations - before acting on the
signal.

It makes sense, although I am not sure exactly what's the most efficient way to store this information (i.e. store it inside of context or use history to compute std deviation on each bar).

This, however, will not protect from the case like here when the quotes are all wrong since the beginning of the trading day (or as far as history is checked). I guess I will need to monitor fill prices as well and alarm if the fills are way off.