This book spans several disciplines, bringing together elements of mathematics, biology, computing, psychology, finance, and artificial intelligence. Using an agent-based approach, I have developed a comprehensive model which is used to model and predict financial contagion. The innovative feature of my approach may be the application of Sigmund Freud's structural model of the psyche. By investigating the neurosis mechanism as it applies to participants in financial markets, I analyzes, in detail, the destructive impact of the herding effect.