International gross capital flows: New uses of balance of payments data and application to financial crises