Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Is it possible to fetch_csv in before_trading_start() ?

Is there a way to get custom data before market open ?


def before_trading_start(context, data):  
    fetch_csv(...)  

Fetcher function runs at midnight. But it might be good to do it before market open.
I thought one way to do it is re_deploying the whole algorithm at around 9:29 so the fetcher function will get the data needed. But it's very inconvenient. Any ideas?

2 responses

It looks like before_trading_start still runs too earlier at 8:45 AM. I am thinking if it's possible to get custom data at around 9:30 AM ?

def initialize(context):  
  schedule_function(  
    myfunc,  
    date_rules.every_day(),  
    time_rules.market_open(minutes=0)  
  )

def myfunc(context,data):  
  fetch_csv(...)  

Or maybe

def handle_data(context, data):  
    if str(get_datetime()) == '9:30 AM':  
        fetch_csv(custom data...)