Simple EA Funds variant

This commit is contained in:
Ozzie Gooen 2020-02-06 19:44:06 +00:00
parent b5b29e99d6
commit eecfd765f3
2 changed files with 75 additions and 0 deletions

36
src/EAFunds.bs.js Normal file
View File

@ -0,0 +1,36 @@
'use strict';
function yearlyMeanGrowthRateIfNotClosed(group) {
return {
meanDiff: 1.1,
stdDiff: 1.1
};
}
function yearlyChanceOfClosing(group) {
return 0.1;
}
function yearlyStdevGrowthRate(group, year, parameter) {
if (group) {
return /* tuple */[
30,
30
];
} else {
return /* tuple */[
50,
10
];
}
}
var PayoutsIfAround = {
yearlyMeanGrowthRateIfNotClosed: yearlyMeanGrowthRateIfNotClosed,
yearlyChanceOfClosing: yearlyChanceOfClosing,
yearlyStdevGrowthRate: yearlyStdevGrowthRate
};
exports.PayoutsIfAround = PayoutsIfAround;
/* No side effect */

39
src/EAFunds.re Normal file
View File

@ -0,0 +1,39 @@
type fund =
| ANIMAL_WELFARE
| GLOBAL_HEALTH
| LONG_TERM_FUTURE
| META;
type group =
| Fund(fund)
| All;
type parameter =
| CHANCE_CLOSED
| DONATIONS
| PAYOUTS;
type yearlyNumericDiff = {
meanDiff: float,
stdDiff: float,
};
module PayoutsIfAround = {
let yearlyMeanGrowthRateIfNotClosed = (group: group): yearlyNumericDiff => {
{meanDiff: 1.1, stdDiff: 1.1};
};
let yearlyChanceOfClosing = (group: group) => {
0.1;
};
let yearlyStdevGrowthRate = (group: group, year: int, parameter: parameter) => {
switch (group) {
| Fund(ANIMAL_WELFARE) => (30, 30)
| Fund(GLOBAL_HEALTH) => (30, 30)
| Fund(LONG_TERM_FUTURE) => (30, 30)
| Fund(META) => (30, 30)
| All => (50, 10)
};
};
};