I am trying to combine factors from Pipeline data (fundamentals & psychsignal) and Fetcher csv (datetime index & scalar values) by matching asset sids between the pipeline_data index and fetch_csv asset symbols.
Step 1 involves string stripping and splitting from Pipeline data:
stock_indx = map(str, np.array(pipeline_data.index))
for s, stock in enumerate(pipeline_data.index):
pipeline_data.loc[stock, 'sid'] = [i.strip("[])") for i in stock_indx[s].split("(")[-1].split()][0]
Step 2 involves string splitting and slicing from Fetcher csv:
asset = data.current('ML', 'Symbol').split("-")[1]
value = float(data.current('ML', 'Value'))
Where the assets ID match, the factor will be combined from Pipeline alpha (ranked z_score) and Fetcher value (normalised scale) - see attached example for reference.
The reason for the Pythonic indexing and slicing is that
sid(int)
symbol('string')
and
symbols('string1', 'string2', 'stringN')
only accept integer literals or string literals - no dynamic variable can be passed in as a parameter.
Regardless.. I am looking for a better way - appreciate if you can help!