Retrieve Factor Rank Data for Portfolio Selection
This example shows how to retrieve ranking data from IHS Markit® for use in portfolio selection or an existing model. Retrieve percentile rank data for ticker security identifiers of a factor code. Then, use the rank information for portfolio selection or further analysis in an existing model. The example assumes that you have IHS Markit credentials. For credentials, see the IHS Markit website.
Create an IHS Markit connection using your user name and password. c
is an
ihsmarkitrs
object.
username = 'ABCDEF'; password = 'ABC123'; c = ihsmarkitrs(username,password);
Retrieve signal information for the last 10 days using the IHS Markit connection. Specify the ABR
factor code and US
Total Cap
universe. Also, specify the ticker security type and percentile data
format. The percentile format provides factor ranking data. d
is a
table that contains signal information and the date
and
data
variables.
code = 'ABR'; universeid = 'US Total Cap'; startdate = datetime('today')-10; enddate = datetime('today'); identifier = 'ticker'; datatype = 'percentile'; d = signals(c,code,universeid,startdate,enddate,identifier,datatype);
Access the first few rows of ranking data for the first day in the date range by using
the data
variable.
data = d.data{1}; head(data)
ans = 8×2 table ticker value ______ _____ 'SVU' 1 'LBY' 1 'TLRY' 1 'WIFI' 1 'TCS' 1 'AOBC' 1 'TTD' 1 'ZOES' 1
The variables of the resulting table are ticker
and
value
. The ticker
variable contains the ticker
security identifiers. The value
variable contains the factor ranking
data.
Find all ticker security identifiers in data
that have the most
attractive value using rank values 1
through 10
.
Create a table to store the rank values and perform an inner join to retrieve the most
attractive securities. Display the last few attractive securities.
value = 1:10; % Define array of ranks 1 through 10 T = table(value','VariableNames',{'value'}); % Create table of the ranks in one variable securities = innerjoin(data,T); % Perform inner join to find securities within the ranks tail(securities)
ans = 8×2 table ticker value _______ _____ 'CDPYF' 10 'CNXN' 10 'DRNA' 10 'PSX' 10 'BRC' 10 'ICHR' 10 'MNLO' 10 'MBI' 10
Use the factor rank data in your portfolio selection process or further analysis in your existing model.