To capture wrong/right way risk, we need to determine the dependency between counterparties and to correlate the credit spreads or hazard rates with the other market risk factors, e.g. equities, commodities, etc., in the scenario generation.
We use an equity swap as an example. Assume the correlation between the underlying equity price and the credit quality (hazard rate) of party B is