Created
September 21, 2011 21:03
-
-
Save jaredonline/1233309 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def percent_asset_split | |
plan.best_investment(risk_index).map do |symbol, percentage| | |
::Position.new(:symbol => symbol.to_s, :amount => percentage.to_f, :account => self.account).asset_allocation | |
end.sum.compress.to_percent | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Due to the issue with empty arrays I pointed out yesterday, you should use AllocationHash::sum rather than #sum: