Text this: Self-organization of the stock exchange to the edge of a phase transition: empirical and theoretical studies