I hope this helps.
It really depends on the wording of your contract and at what stage your contract is at. There is usually a loan / finance contingency on the purchase contract and a period before you have to remove the loan contingency. If you have not removed the loan contingency yet and you can not get a loan due to the loss of your job, you should be able to get your deposit back.
However, if you removed the loan contingency already, and then can not get the loan, then the seller is probably entitle to the deposit.. Which is what happened to one of my colleague's client, she lost her job right before closing and lost the house as well as deposit. However, if you can provide the proof, perhaps the seller will allow you to get part of the deposit back? But unfortunately, if you removed the loan contingency and back out because you can not get the loan, you can lose your deposit.
Better go back, review your contract and consulted with your Realtor and/or Attorney about this situation.