know something inside out

[know something inside out] {v. phr.} To be extremely wellconversant with something; be an expert in; have thorough knowledgeof.

Tom knows the stock market inside out.