Functional equations and the foundations of financial mathematics