I wrote a function that takes stock symbols as strings and returns a dataframe, but I get an error that says Arguments must be strings. The information (symbols_arr) I'm passing through this function are Strings, but I still get the same error. The function is called get_RC()
from quantopian.algorithm import attach_pipeline, pipeline_output
import quantopian.algorithm as algo
from quantopian.research import prices, symbols, returns
import quantopian.optimize as opt
from quantopian.pipeline import Pipeline
from quantopian.algorithm import run_pipeline
...........................
def get_RC(x):
STOCK = x
start_date = date.today() + datetime.timedelta(-16)
start_date = start_date.strftime('%Y-%m-%d')
end_date = date.today() + datetime.timedelta(-1)
end_date = end_date.strftime('%Y-%m-%d')
STOCK_dates = prices(
assets=symbols(STOCK),
start=start_date,
end=end_date,
frequency='daily')
STOCK_dates = pd.DataFrame([STOCK_dates])
STOCK_dates = STOCK_dates.transpose()
trading_days_arr = STOCK_dates.index.strftime('%Y-%m-%d')
.............
for i in range(0, len(symbols_arr)):
data = get_RC(symbols_arr[i])
if data['5-day RCA'][-1] > data['10-day RCA'][-1] and data['5-day RCA'][-2] < data['10-day RCA'][-2]:
tradables.append(data)
tradables_symbols.append(symbols_arr[i])