在函数week_period_strategy中,调用了自身,导致了递归调用的死循环,需要修改该部分代码。

正确的代码应该是:

def week_period_strategy(stock_code,timefrequency,start_date,end_date): data = pd.read_csv('D:\\lh\\' + str(stock_code)+ ".csv") data.index = data.iloc[:, 0] data.index = pd.to_datetime(data.index, format='%Y/%m/%d') # 进行具体的策略操作 ...

if name =='main': stock_code='000002.XSHE' data = pd.read_csv('D:\\lh\\' + str(stock_code)+ ".csv") data.index = data.iloc[:, 0] data.index = pd.to_datetime(data.index, format='%Y/%m/%d') data=data['2022-01-01':'2022-12-30'] result = week_period_strategy(stock_code=stock_code, timefrequency='D', start_date=data.index[0], end_date=data.index[-1]) # 对result进行后续操作 ...

请帮我指出出错的位置ndef-week_period_strategystock_codetimefrequencystart_dateend_daten----data-=-pdread_csvDlh-+-strstock_code+-csvn----dataindex-=-datailoc-0n----dataindex-=-pdto_datetimedataindex-format=Ymdn----data-=-week_period_strategystock_code=stock_co

原文地址: http://www.cveoy.top/t/topic/p2V 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录