Aggregation theorems hold if endowments are endogenous? I have a specific question about considering a representative agent. According to Rubinstein 1974, in an inter-temporal economy with $N$ individuals each one with initial endowment $e_i$ and everything else homogeneous. The intertemporal constraints of the investor are:
$c_{0i}=e_{0i}-\eta_i p$
$c_{1i}=e_{1i}+\eta_i X$
Where $e_{0i},e_{1i}$ are present and future endownments, $c_{0i}, c_{1i}$ represents present and future consumption, $p$ is the price of the investment technology, and $\eta_i$ is the number of units bought. Finally $X$ is the payoff of the investment technology. 

Assuming investors differ only on their endowments, we can solve for the equilibrium using a representative agent with the average endowment $\bar{e}=\frac{\sum e_i}{N}$. 

Suppose now that the present endowment of each agent depends on how many units he/she decides to buy. 
$c_{0i}=e^i(\eta_i)-\eta_i p$

The function $e^i(\eta_i)$ is not necessarily the same for all investors.

My question is: Can we solve for the equilibrium using a representative agent with endowment 
$\bar{e(\eta)}=\frac{\sum e^i (\eta)}{N}$ ?

Thank you

Reference: Rubinstein, M., 1974. An aggregation theorem for securities markets. Journal of Financial
Economics 1, 225-244.
The answer is it depends on more assumptions on preferences. The short answer is no. To provide as much intuition we will look at the optimal conditions in each of these problems.

First, for the descentralized problem you have that individuals choose $(c_{0i}, c_{1i}, \eta_i)$ to maximize:

$\max \qquad \sum_t \beta^t u(c_{ti}) $

$s.t \qquad c_{0i} = e_{0i}(\eta_i) - \eta_i p$

$ \quad \qquad c_{1i} = e_{1i}(\eta_i) + \eta_i X$

The solution, for each individual $i$ will be optimal if they follow the Euler equation derived from the first order conditions and that markets clear:

$\frac{1}{\beta} \frac{u'(c_{0i}^*)}{u'({c_{i}^*)}} = \frac{p - e_{i}'(\eta_i^*)}{e_{1i}'(\eta_i^*) + X}$

Now look at the representative agent problem for whom you say the endowment is given by $\bar e(\eta) = \frac{1}{N}\sum_{i} e^i(\eta)$. I will drop the $N$ because scaling does not matter (you are assuming the mean endowment, I am using the total endowment so all of my solutions are $N$ times what you want). This agent's problem is to choose $(c_0, c_1, \eta)$ to maximize:

$\max \qquad \sum_t \beta^t u(c_{ti}) $

$s.t \qquad c_{0} = \sum_{i} e_{i}(\eta) - \eta p$

$ \quad \qquad c_{1} = \sum_{i} e_{i}(\eta) + \eta X$

Now the first order condition says:

$\frac{1}{\beta} \frac{u'(c_{0}^*)}{u'({c_{1}^*)}} = \frac{p - \sum_{i}e_{i}'(\eta^*)}{\sum_i e_{i}'(\eta^*) + X}$

These two need not be equal. Do you have more assumption on the preferences/endowment functions?