A parametric approach to counterparty and credit risk