Financial markets are examples of complex systems being driven by both endogenous processes as well as exogenous shocks. One can obtain insight into the dynamics of those systems by assuming market participants (agents) belonging to particular groups and being characterized by a particular demand & supply functions. The agents themselves are likely to switch to a different group under persuasion of their peers (herding behavior). The mathematical description of this phenomenon in terms of a non-trivial Markov model, combined with the clearing of the market by a market maker provides analytical results for the probability distribution of the asset prices and returns. That in turn allows for trading strategies to be designed and implemented in real life. In the course of the talk I will review several agent based models as well as mention the practicalities of quantitative trading.