updated cost-of-carry function