How CDS(Credit Default Swap) works?

I have some questions that make me very confused…

Please help me to answer the question

According CDS(Credit Default Swap),

-Investors should buy or sell CDS if they speculate the credit rating of CDS underlying issue to upgraded?

Thanks!

The gist of it: there is a protection seller (insurer), a protection buyer (lender) and a referenc entity (borrower). As a protection buyer, you are short on the reference entity’s credit quality (you’re expecting it’ll worsen), and as a protection seller, you are long the reference entity’s credit quality (you’re expecting it’ll improve). Depending on your expections of the reference entity’s financial/economic situation, you can enter strategies as to whether you should buy or sell CDS, and at which horizon.

Thank for your help! :))