The rating is based entirely on the ratio of "Total Value" to "Debt".
D rating is at a ratios worse than 5:1. C rating at 10:1. I dont remember what ratio B rating is at.
The D rating may be faster approached than expected because as debt increases the ratio doesn't just worsen because of that on its own but also because the debt decreases total value as well.
edit: I've looked it up in the files: Dividing debt by total value gives you a percentage by which the game determines your rating. At up to 1%, 2%, 3%, 5%, 6%, 7%, 10% and 20% debt you have anywhere from an AAA to a C rating and D from >20% debt.
ps. when Cook the Books is available you can with one or two purchase stay out of D or C debt respectively for the remainder of the match.