A dynamic programing approach is applied to address speed optimization problem in liner shipping. Stochastic port times and time windows are considered in the optimization. A lower and upper bound of the model is derived from real world problem structure. Detoured bunkering decision is considered for speed decision. Computational results provide practical insights for liner shipping managers.