Late sell-off caps monthly gains, data shows