clear; clc; close all;

[~, ~, raw] = xlsread("y9999.xlsx");
prices = [raw{4 : end, 2}];
dates = datetime(raw(4 : end, 1), "format", "yyyy/MM/dd");

plot(dates, prices); grid on;
ylabel("TWSE:IND");
annotation(gcf, "arrow", [0.4 0.88], [0.28 0.65]);

return_rates = diff(prices) ./ prices(1 : end - 1);
figure;
histogram(return_rates * 100);
xlabel("Return rate (%)");
ylabel("Frequency");
grid on;
