A generalized approach to optimal hedging with option contracts