clear; clc; close all;

scr = "data/";
list = dir(scr);
filenames = {list(:).name};
mask = endsWith(filenames, ".xlsx");
filenames = filenames(mask);
N = length(filenames);
stock_pool = cell(N, 2);

for i = 1 : N
    
    filename = filenames(i);
    target = scr + filename;
    [~, ~, raw] = xlsread(target);
    raw = raw(4 : end, :);
    Date = datetime(string(raw(:, 1)), "format", "yyyy/MM/dd");
    Price = [raw{:, 2}]';
    Volume = [raw{:, 3}]';
    tbl = table(Date, Price, Volume);
    tokens = split(filename, ".");
    Stock_name = string(tokens(1));
    
    stock_pool{i, 1} = Stock_name;
    stock_pool{i, 2} = tbl;
    
end

save("stock_pool.mat", "stock_pool");