Understanding agent-based models of financial markets: a bottom-up approach based on order parameters and phase diagrams