Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
No Logs output in Minute Backtests

I'm trying out minute runs. why doesn't this script generate logs? Neither when building or running the detailed backtest.

import datetime  
import pytz

def initialize(context):  
    context.isBought = False  
    context.isSold = False  
    context.buyDate = datetime.datetime(2014,3,27,12,15,0,0,pytz.timezone('US/Eastern'))  
    context.sellDate = datetime.datetime(2014,3,27,13,30,0,0,pytz.timezone('US/Eastern'))  
    log.info("hello")  
    pass

def handle_data(context, data):  
    if not context.isBought and get_datetime() >= context.buyDate:  
        context.isBought=True  
        order_target_percent(sid(26578), 0.50) # GOOG, 50%  
        log.info("buy at {0}".format(data[sid(26578)].close_price))  
    if not context.isSold and get_datetime() >= context.sellDate:  
        context.isSold = True  
        order_target_percent(sid(26578), 0.0) # GOOG  
        log.info("sell at {0}".format(data[sid(26578)].close_price))  
8 responses

... now I click my posts's backtest results, the logs now appear.....

edit: but still doesn't appear when building. I guess there's some quantopian internal infrastructure at the moment.

ok yeah, i think i figured it out. Bug with Quantopian backtester. If I set the timeframe to be 3 weeks, I get logs. If I set the timeframe to be 2 weeks or less (my original attempt was 2 days) the logs won't be captured.

Hi Jason,

It looks like you unfortunately ran into one of our known bugs. Your code is indeed generating logs but you're not seeing it. You need to toggle between the more/less button in the log box to see the full logs. This behavior is not dependent on the length of the backtest (2 weeks vs 3 weeks).

Of course, this solution is less than ideal. We're aware of it and its on our list of things to fix!

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.

Hi Alisa, thanks for the reply.

While the issues may be related, they seem slightly different. FYI my 3week+ backtest is an effective mitigation for my issue, though I also see the issue you describe now that I know to look for it. (But it is in addition to my originally reported symptoms)

Hi Jason,

I reached out to you privately to continue debug your 2 week vs 3 week log issue - we'll get to the bottom of it!

Now we've fixed the log display bug, so you will no longer need to toggle between more/less to view the complete log output.

If you're having a log window issue try Build always with the Less button showing and click that button to reveal the graph only when the Backtesting progress bar shows beyond 0%, I'm about 40 for 40 with that here so far doing Daily which had the intermittent problem.

Does anyone know if this is still an issue? My logs not showing anything

This was fixed earlier this year, but if you're still having issues viewing your logs in a backtest, shoot us an email to [email protected]. We'll debug and see what's causing the behavior.