The first step is to calculate the average capital in each of the cash account and the shares over the full year period. These should sum to the $10,000 average capital of the portfolio as a whole. From the average capital of each of the two components of the portfolio, we can calculate weights. The weight of the cash account is the average capital of the cash account, divided by the average capital ($10,000) of the portfolio, and the weight of the shares is the average capital of the shares over the whole year, divided by the average capital of the portfolio.