Since the 2007/2008 financial crisis stability of the banking system has become a major topic attracting a lot of attention from experts in finance, economics and politics. In view of promoting resilience of the overall economy, the consensual approach is to pursue a macroprudential banking regulation with the objective to mitigate the risk involved in the financial system as a whole. In order to assess the consequences of the different measures and policies (e.g., capital requirements or countercyclical capital buffers) on the economic stability and in particular on social welfare, appropriate stochastic models capable of describing realistically the interplay between the financial sector and the real economy are of vital necessity. Developing the mathematical framework and machinery to respond to these macroeconomic questions is the major objective of the current project. Its main challenges and tasks are threefold and consist in (i) designing a macroeconomic and stochastic continuous-time general equilibrium model featuring both idiosyncratic and aggregate risk, which contrasts with the usual representative agent approaches; (ii) developing the mathematical tools to solve for (approximate) equilibria by relying on PDE, martingale, duality and mean field game techniques; (iii) applying and adapting numerical methods as well as robust calibration and estimation algorithms to test and assess existing and new macroprudential policies on real data.