Hi,
I am trying to read a csv file as the following and it works but as soon as I set a break point in the code, it generates an error as:
ValueError: Cannot schedule timeout until _SignalManager has started.
There was a runtime error on line 28.
I need to be able to debug my code, can some body look into this and help me. That would be much appreciated.
this is my code
import quantopian.algorithm as algo
from quantopian.pipeline import Pipeline
from quantopian.pipeline.data.builtin import USEquityPricing
from quantopian.pipeline.filters import QTradableStocksUS
import pandas as pd
def preview(df):
log.info(' \n %s ' % df.head(15))
return df
def actual_pre_func(df, context):
context.fetched_data = df
return df
def initialize(context):
schedule_function(myfunc, date_rules.every_day(), time_rules.market_close(minutes=30))
# fetcher for sycurity data-when we have symbol in file
url1 = 'https://dl.dropboxusercontent.com/s/0z640otfr3ltry6/funds.csv'
fetch_csv(url1,date_column='date',symbol_column = 'symbol',
pre_func = preview,
post_func = lambda df: actual_pre_func(df, context),
date_format = '%Y-%m-%d',
usecols=['symbol','fund_ret','fund_name'],
# post_func=rename_col,
)
algo.attach_pipeline(make_pipeline(context), 'pipeline')
def make_pipeline(context):
base_universe = QTradableStocksUS()
yesterday_close = USEquityPricing.close.latest
pipe = Pipeline(
columns={
'close': yesterday_close,
},
screen=base_universe
)
return pipe
def before_trading_start(context, data):
current_date = str(get_datetime('US/Eastern'))[0:10]
todays_data = context.fetched_data.loc[context.fetched_data.index ==current_date]
log.info(' \n %s ' % todays_data.head(2))
log.info(' \n %s ' % todays_data.columns)
context.todays_data = todays_data
def myfunc(context, data):
log.info(' \n %s ' % context.todays_data.head(2))
for d in data.fetcher_assets:
log.info('\n %s %f '%(d,data.current(d, 'fund_ret')))