Input to the function will be amount and portfolio object. return an object with the amount being equally distributed based on the portfolio given.
- stocks: AAPL, EA, ATVI, OKTA, TEAM
- portfolios: p1, …, p4
portfolios are defined as
- p1: 0.4 p2, 0.2 AAPL, 0.4 EA
- p2: 0.4 p3, 0.4 p4, 0.2 AAPL
- p3: 0.2 EA, 0.8 ATVI
- p4: 0.6 OKTA, 0.4 TEAM
Portfolio can be nested : p1: 0.4 p2, 0.2 AAPL, 0.4 EA
Given the amount 1000$ and portfolio p4 as the input return as below
/**
* e.g. Input given is p4, $1000 -> {"OKTA": $600, "TEAM": $400, ......}
* p1 -> ??
* p2 -> ??
* p3 -> ??
*/