def _extract_data(prices, n_markets):
    """ Extract the open, close, high and low prices from the price matrix. """
    os = prices[:, :, :n_markets]
    cs = prices[:, :, n_markets:2*n_markets]
    hs = prices[:, :, 2*n_markets:3*n_markets]
    ls = prices[:, :, 3*n_markets:4*n_markets]
    return os, cs, hs, ls