Cocoa prices rally in commodity markets after sharp declines