Skip to content

Commit d3edf59

Browse files
authored
Merge pull request #23 from x0range/master
Prepared riskmodel for non-proportional reinsurance
2 parents 2854783 + d3390de commit d3edf59

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

insurancefirm.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def iterate(self, time): # TODO: split function so that only the sequence
7878
print("Something wrong; agent {0:d} receives too few new contracts {1:d} <= {2:d}".format(self.id, contracts_offered, 2*contracts_dissolved))
7979
#print(self.id, " has ", len(self.underwritten_contracts), " & receives ", contracts_offered, " & lost ", contracts_dissolved)
8080

81-
new_nonproportional_risks = [risk for risk in new_risks if risk.get("insurancetype")=='non-proportional']
81+
new_nonproportional_risks = [risk for risk in new_risks if risk.get("insurancetype")=='excess-of-loss']
8282
new_risks = [risk for risk in new_risks if risk.get("insurancetype") in ['proportional', None]]
8383

8484
underwritten_risks = [{"excess": contract.value, "category": contract.category, \
@@ -215,7 +215,7 @@ def ask_reinsurance_non_proportional(self):
215215
avg_risk_factor /= number_risks
216216
risk = {"value": total_value, "category": categ_id, "owner": self,
217217
#"identifier": uuid.uuid1(),
218-
"insurancetype": 'non-proportional',"number_risks": number_risks,
218+
"insurancetype": 'excess-of-loss', "number_risks": number_risks,
219219
"deductible": self.np_reinsurance_deductible, "excess": np_reinsurance_excess,
220220
"periodized_total_premium": periodized_total_premium, "runtime": 12,
221221
"expiration": time + 12, "risk_factor": avg_risk_factor}

metaplotter.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
ax1.plot(range(len(o_two)), o_two,"b")
9595
ax1.fill_between(range(len(o_one)), o_one_lo, o_one_up, facecolor='red', alpha=0.25)
9696
ax1.fill_between(range(len(o_two)), o_two_lo, o_two_up, facecolor='blue', alpha=0.25)
97-
ax1.set_ylabel("Active firms (out of initially 20)")
97+
ax1.set_ylabel("Active firms")
9898
ax1.set_xlabel("Time")
9999
plt.savefig("data/fig_one_and_two_rm_comp.pdf")
100100
plt.show()

riskmodel.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,11 @@ def compute_expectation(self, categ_risks, categ_id): #TODO: more intuitive
7575

7676
return average_risk_factor, average_exposure, incr_expected_profits
7777

78-
def evaluate(self, risks, cash):
78+
def evaluate(self, risks, cash, offered_risk = None):
79+
# sort current contracts
80+
el_risks = [risk for risk in risks if risk["insurancetype"] == 'excess-of-loss']
81+
risks = [risk for risk in risks if risk["insurancetype"] == 'proportional']
82+
7983
acceptable_by_category = []
8084
remaining_acceptable_by_category = []
8185
expected_profits = 0

0 commit comments

Comments
 (0)