equal weight strategy with monthly rebalance

3 views (last 30 days)
I have a dataset with 12 asset class from 1997 to 2014 and daily data. (Below there is a part of sample) [T N]=size(mydataset) T=4529, N=12
Date MSCI US MSCI EAFE MSCI EUROPE MSCI JAPAN MSCI EM NASDAQ 100 S&PREIT 1/2/97 564.95 664 716.08 905.44 15,136.38 815.6 134.7 1/3/97 570 667.16 722.1 905.44 15,217.15 848.08 134.45 1/6/97 569.65 670.91 725.41 911.73 15,305.96 853.24 135.1 1/7/97 570.97 665.59 723.97 892.39 15,458.17 864.55 135.59 1/8/97 569.11 665.71 729.19 880.59 15,629.97 853.09 135.74 1/9/97 574.08 659.9 730.97 854.38 15,670.28 856.95 136.27 1/10/97 576.98 651.28 730.69 820.5 15,733.25 865.58 136.41
I have to use an equally weighted strategy with monthly rebalance. So every month I want to compound return and volatility for every asset with the same weights (1/12=0,0833).
If someone can help me i would be grate.

Answers (1)

Amish
Amish on 1 Oct 2024
Hi Francesca,
You can do the calculation for compound return and volatility for every asset with the same weights in MATLAB. I am attaching a sample code for your provided data below:
% Sample data
dates = {'1/2/97', '1/3/97', '1/6/97', '1/7/97', '1/8/97', '1/9/97', '1/10/97'};
MSCI_US = [564.95, 570, 569.65, 570.97, 569.11, 574.08, 576.98];
MSCI_EAFE = [664, 667.16, 670.91, 665.59, 665.71, 659.9, 651.28];
MSCI_EUROPE = [716.08, 722.1, 725.41, 723.97, 729.19, 730.97, 730.69];
MSCI_JAPAN = [905.44, 905.44, 911.73, 892.39, 880.59, 854.38, 820.5];
MSCI_EM = [15136.38, 15217.15, 15305.96, 15458.17, 15629.97, 15670.28, 15733.25];
NASDAQ_100 = [815.6, 848.08, 853.24, 864.55, 853.09, 856.95, 865.58];
SP_REIT = [134.7, 134.45, 135.1, 135.59, 135.74, 136.27, 136.41];
% Convert dates to datetime format
dates = datetime(dates, 'InputFormat', 'MM/dd/yy');
% Create a table
data = table(dates', MSCI_US', MSCI_EAFE', MSCI_EUROPE', MSCI_JAPAN', MSCI_EM', NASDAQ_100', SP_REIT', ...
'VariableNames', {'Date', 'MSCI_US', 'MSCI_EAFE', 'MSCI_EUROPE', 'MSCI_JAPAN', 'MSCI_EM', 'NASDAQ_100', 'SP_REIT'});
% Calculate daily returns
returns = diff(log(data{:, 2:end}));
% Resample to monthly frequency
monthly_dates = dates(2:end);
monthly_dates = dateshift(monthly_dates, 'start', 'month');
[unique_months, ~, idx] = unique(monthly_dates);
monthly_returns = accumarray(idx, returns, [], @(x) prod(1 + x) - 1);
% Calculate equally weighted compounded return and volatility
equal_weight = 1 / size(returns, 2);
compounded_return = sum(monthly_returns * equal_weight, 2);
volatility = std(monthly_returns, 0, 2) * equal_weight;
This will help you calculate the compounded return and volatility for each asset using an equally weighted strategy with monthly rebalance.
Hope this helps!

Categories

Find more on MATLAB Mobile in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!