If you are calculating your capital gains, keep in mind that the US and Spain have different wash sale rules (in Spanish it's called antiaplicación). A wash sale is when you sell a stock or mutual fund and buy back a substantially similar one within some period of time.
In the US, if you sell a stock at a loss and buy back a substantially similar stock (or a contract to do so), you don't count this is a sale, but add this to the cost basis of the new shares instead. The rule doesn't apply for gains.
In Spain, the rule applies for two months, but you need to declare the loss in a special box that can be used later on when you sell the shares.
So in theory something could be a wash sale in the US, but not in Spain, either because of timing or because of currency movement.
Oh what fun.
I'm writing a program to do this calculation... perhaps I'll post it on github when it's done.