Pathwise functional calculus and applications to continuous-time finance