Solution (source code)

= Solution
{c}

Let $\Delta_t$ be the number of stock units and $\beta_t$ the number of bank-account units, with predictable holdings satisfying the integrability conditions for the price integrals. The portfolio value is $V_t=\Delta_tS_t+\beta_tB_t$. It is <self-financing> if
$$
\boxed{V_t=V_0+\int_0^t\Delta_u\,dS_u+
\int_0^t\beta_u\,dB_u.}
$$
Thus changes in value come only from gains on the assets held. Rebalancing transfers money between the stock and <bank account>; it does not inject or withdraw cash. The definition is an identity of <stochastic integrals> and automatically includes the bookkeeping needed when holdings themselves vary randomly.