I accepted a job that I'm not really qualified for from a repeat client who I've enjoyed working with in the past. When they offered me the job, I told them that I wasn't qualified and offered to help them find someone who is. They encouraged me to learn on the job and said they would be patient, and encouraged me to accept, so I accepted reluctantly.
After me not being qualified, the second problem is that the job is probably impossible. The goal is to improve the profitability of the client's automated stock trading algorithm to a degree that I believe is not realistic. Before starting billing, I wrote a proposal for the client that clearly outlined the possibility that we would not achieve the goal. (But I don't think the client really accepted this, although they said they did, and due to my unqualified-ness, any statement I make asserting or rejecting the general feasibility of the project could be dismissed as not authoritative).
So I went in thinking I had my bases covered, but now I'm seeing that this was a mistake. Even with all my disclaimers, I should not have accepted a job I thought was highly likely to fail. Now I am continuing to do trial and error with no end in sight, and I am convinced that I am wasting my time and the client's time and money. I have not said as much to the client yet, that's what I need help with. How do I gracefully part with this job?
During planning, I broke the project up into four phases. The first two phases had deliverables that I achieved, however these deliverables alone are useless to the client. Now I am in the third phase, the deliverable for which is to continuing iterating until the client is either happy with the improvements or decides to stop the job for other reasons. I would be willing to refund the client for the time I've billed while in this phase. Should I offer? The contract itself specifies an hourly rate, but no provision for what happens if the goal can't be achieved. It also specifies no specific term of service.