This paper specializes a number of earlier contributions to the theory of valuation of financial products in presence of credit risk, repurchase agreements and funding costs. Earlier works, including our own, pointed to the need of tools such as Backward Stochastic Differential Equations (BSDEs)...