Nasdaq quarterly profit beats on record trading volumes