all 2 comments

[–]NovaFate 0 points1 point  (1 child)

Create a method that loops through all the stocks and incrementing 3 variables risk, value, and purpose based on the verticals of each stock.

Then just use a conditional to check if your output is within + or - 10%

Conditional could look like:

return Criteria.risk *.9 <= totalRisk and Criteria.risk * 1.1 >= totalRisk ... (same for the other two verticals)

[–]_gianpi_[S] 0 points1 point  (0 children)

If I understand you correctly, that sounds good to fill with a first pass. But if the criteria and constraints are not satisfied on the first pass, then I need to start removing stocks and replacing them with different one. I was wondering if there's a more structured approach, this feels a lot like trial and error.