Margins are the major safeguards against default risk on a derivatives exchange. When the clearing house sets the margin requirement for a particular clearing firm, it does so by only focusing on that particular clearing firm’s positions (e.g. the SPAN system). We depart from this traditional approach and show how to account for interdepencies across clearing members when setting margins. Our method generalizes the SPAN system by allowing individual margins to increase when clearing firms are more likely to be in financial distress simultaneously.