Skip to content

Instantly share code, notes, and snippets.

@ShaneLee
Last active January 2, 2020 09:34
Show Gist options
  • Save ShaneLee/56b914f002ec8bf336142f842cae6c53 to your computer and use it in GitHub Desktop.
Save ShaneLee/56b914f002ec8bf336142f842cae6c53 to your computer and use it in GitHub Desktop.
def get_expected_portfolio_return(porfolio):
return np.sum(portfolio['weight'] * porfolio['returns'])
expected_portfolio_return = get_expected_portfolio_return(portfolio)
final_value = expected_portfolio_return * PORTFOLIO_VALUE
print('Estimated value of Portfolio in {} : £{:,.2f} \nExpected Portfolio Return: {:,.2f}%').format(datetime.now().year + YEARS, final_value, expected_portfolio_return)
print('Estimated Income £{:,.2f}').format(final_value * 0.04)
@DBremen
Copy link

DBremen commented Jan 2, 2020

Hi Shane,
thanks a lot for sharing. I found two small typos:

  • Line 7 should read: print('Estimated value of Portfolio in {} : £{:,.2f} \nExpected Portfolio Return: {:,.2f}%'.format(datetime.now().year + YEARS, final_value, expected_portfolio_return))
    Line 8 should read: print('Estimated Income £{:,.2f}'.format(final_value * 0.04))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment