Why does passing a list of securities that contains duplicates to BLP.HISTORY cause an error in R2011b?

1 view (last 30 days)
I get error upon retrieving data from Bloomberg using the HISTORY command. The list of assets is loaded from list.mat as follows:
load('list.mat');
c = blp;
data = history(c,list,'LAST PRICE','8/01/99','8/10/2011','daily');
I expected the variable data to contain 42 cells with historical price (there are 42 assets in the list). Instead I get the following error:
In an assignment A(I) = B, the number of elements in B and I must be the same.
Error in blp/history (line 277)
outInd(i) = find(strcmp(s(i),sec));
Error in testblp_master (line 10)
data = history(c,list,'LAST PRICE','8/01/99','8/10/2011','daily');
The same script works fine in R2010b and I obtain the data as expected. I would like to know how I can solve this issue.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 15 Sep 2011
The error occurs because you are passing a list of securities that contains duplicates. The BLP.HISTORY method now sorts the output data. When the function tries sorting the data based on the order of your input list, it is finding duplicate entries in some cases. You can solve this problem by using the following code:
load('list.mat');
list = unique(list);
c = blp;
data = history(c,list,'LAST PRICE','8/01/99','8/10/2011','daily');

More Answers (0)

Products


Release

R2011b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!