Citi interview question

Write an algorithm that will maximize profit over some historic stock data.