Complexity approach to the dynamics of financial systems