Added marketState functionality and test