We investigate a longitudinal data model with nonparametric regression functions that may vary across the observed individuals. In a variety of applications, it is natural to impose a group structure on the regression curves. Specifically, we may suppose that the observed individuals can be grouped into a number of classes whose members all share the same regression function. We develop a statistical procedure to estimate the unknown group structure from the data. Our estimation approach is illustrated by an application to financial data. In particular, we use it to empirically investigate the effect of trading venue fragmentation on market quality in the European stock market.