Do I need a contract to lock in a rate?
I am reading your question in two different ways...
Some lenders, at their option, will allow you to lock in mortgage money well in advance of needing it - up to 2 years beforehand. They will almost certainly charge you an upfront, nonrefundable fee to do this, as the chance that your plans may change is higher the longer out you lock, and they want some confirmation of your intent to follow through. That said, however, it may be impractical for you to lock in money before you know exactly what and where you will be buying, when you will close, and exactly how much you will need.
Other lenders may not have any lock options longer than 90 days, for which you would generally already have signed an offer and contract to purchase a specific property. Locks of this nature are generally available in 15, 30, 45, 60, 75, and 90 day increments, all at slightly different costs. Traditional locks require the following information:
The address of the property
The exact amount of money you need (the mortgage dollar amount) and the terms at which it will be borrowed (fixed rate, adjustable rate, etc)
The anticipated timeline of closing (which is generally defined in the purchase contract)
When a lender locks without the above information, they incur substantially higher risks, as they have set money aside that may or may not be used. When the market changes and that money is committed at a rate that is no longer competitive, they may lose revenue or pay penalties of various kinds. Some lenders willingly accept that risk (at a price), and others do not.
As a borrower, you should never consider your rate locked unless you receive confirmation of your loan terms and rate in writing from your lender.
This all depends on the lender you are going to use. Some lenders who are having capacity issues are requiring a full application with sales contract and appraisal to allow a rate to be locked. The reason they do this is to avoid loans taking up a reservation for funds and then dropping out and not closing.
Other lenders allow what I call "speculative" locks. This will allow you to lock a rate and then find a property. This can be a daunting task if you are wanting to buy a short sale or REO property; mainly due to the extended time it takes for the banks to respond to your offer. Keep in mind that it is taking 30 and in some cases 45+ days to get a transaction closed right now; so lock accordingly and consult your mortgage professional for advice.