Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save rodoabad/4b975d269ee291db3b8dd03fc85b6899 to your computer and use it in GitHub Desktop.

Select an option

Save rodoabad/4b975d269ee291db3b8dd03fc85b6899 to your computer and use it in GitHub Desktop.
export const findApplicableSplitsAgainstDividendYear = (dividendYear, splits) => {
const formattedDividendYear = Number(moment(dividendYear).format('X'));
return splits.reduce((acc, split) => {
const formattedExDate = Number(moment(split.exDate).format('X'));
return formattedExDate > formattedDividendYear ?
[
...acc,
split.ratio
] :
acc;
}, []);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment