Endogenous trade policy and the gains from international financial markets