Essays on financial markets and the macroeconomy