Theoretical foundations for quantitative finance