 The novel is set in 1830 , at the tail end of the initial campaign to secure Latin America 's independence from Spain . Most of Spanish America had gained independence by this date ; only Cuba and Puerto Rico remained under Spanish rule . 
