Here is the unsupported article from wiki regarding the term "Yankee". It appears the first usage of the term is 1713. My history of the use of the term is from England where we don't recognise the significance of the North & South division. In Britain Americans were also called "Rebels" regardless of where they were because of some 1776 thing. My father used to tell me the tongue in cheek phrase popular during the war;
There are only three things wrong with the Yanks-
Over-sexed,
Over-paid
& Over here!

There have always been nicknames for other countries and I don't think that they are necessarily derisive. Yank, Limey, Pommie, Aussie, Kiwi & Canuck to name but a few. I think they are generally used as good natured terms. No offence intended.