Created
March 4, 2020 21:47
-
-
Save Joshuaek/fa5a71dd76b53ff729e3482d39ca9d79 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def add_contract(self, contract): | |
# Adds a new contract to the forecast | |
self.df[contract.contract_name] = np.zeros(self.number_of_months) | |
self.contracts.append(contract) | |
for m in range(contract.start_month, contract.start_month + contract.term, contract.payment_frequency): | |
try: | |
increase = (contract.increase_percentage * int(m / contract.increase_period) / 100) * contract.value | |
self.df.loc[self.months[m]][contract.contract_name] = contract.value + increase | |
self.df.loc[self.months[m]]['live_contracts'] += 1 | |
except IndexError: | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment