Closed JoePierce96 closed 4 years ago
Hi and thanks for bringing this to my attention. So far FinQuant only supports "WIKI/..." data from Quandl. That should clearly be changed.
Started working on it in a feature branch. Gotta do something else now, but will continue later today.
Hi @JoePierce96 , please download the updated master branch and check if it is working now. I just pushed a fix.
When trying to get data from Quandl I get the an error (made sure ticker names are correct beforehand):
`d = { 0: {"Name": "XLON/BP_", "Allocation": 1000000}, 1: {"Name": "XLON/III", "Allocation": 1000000}, 2: {"Name": "XLON/GSK", "Allocation": 1000000}, 3: {"Name": "XLON/OCDO", "Allocation": 1000000}, 4: {"Name": "XLON/RBS", "Allocation": 2000000}, 5: {"Name": "XLON/SVT", "Allocation": 1000000}, }
pf_allocation = pd.DataFrame.from_dict(d, orient="index")
set list of names based on names
names = pf_allocation["Name"].values.tolist()`
This is the error message:
`runfile('C:/Users/Joe Shiafa Pierce/.spyder-py3/FinQuant POM project.py', wdir='C:/Users/Joe Shiafa Pierce/.spyder-py3') Traceback (most recent call last):
File "", line 1, in
runfile('C:/Users/Joe Shiafa Pierce/.spyder-py3/FinQuant POM project.py', wdir='C:/Users/Joe Shiafa Pierce/.spyder-py3')
File "C:\Users\Joe Shiafa Pierce\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 786, in runfile execfile(filename, namespace)
File "C:\Users\Joe Shiafa Pierce\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 110, in execfile exec(compile(f.read(), filename, 'exec'), namespace)
File "C:/Users/Joe Shiafa Pierce/.spyder-py3/FinQuant POM project.py", line 40, in
names=names, pf_allocation=pf_allocation, start_date=start, end_date=end
File "C:\Users\Joe Shiafa Pierce\Anaconda3\lib\site-packages\finquant\portfolio.py", line 1153, in build_portfolio pf = _build_portfolio_from_api(**kwargs)
File "C:\Users\Joe Shiafa Pierce\Anaconda3\lib\site-packages\finquant\portfolio.py", line 935, in _build_portfolio_from_api pf = _build_portfolio_from_df(data, pf_allocation)
File "C:\Users\Joe Shiafa Pierce\Anaconda3\lib\site-packages\finquant\portfolio.py", line 1035, in _build_portfolio_from_df data = _get_stocks_data_columns(data, pf_allocation.Name.values, datacolumns)
File "C:\Users\Joe Shiafa Pierce\Anaconda3\lib\site-packages\finquant\portfolio.py", line 869, in _get_stocks_data_columns raise ValueError("Could not find column labels in given dataframe.")
ValueError: Could not find column labels in given dataframe.`
Thanks for your help,