Fund managers respond to the payoff gradient by continuously adjusting leverage in our analytic and simulation models. The base model has a stable equilibrium with classic properties. However, bubbles and crashes occur in extended models incorporating an endogenous market risk premium based on investors' historical losses and constantgain learning. When losses have been small for a long time, asset prices inflate as fund managers increase leverage. Then slight losses can trigger a crash, as a widening risk premium accelerates deleveraging and asset price declines.