Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve equity curve readability #391

Merged
merged 1 commit into from May 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion jesse/services/charts.py
Expand Up @@ -47,7 +47,11 @@ def portfolio_vs_asset_returns(study_name: str = None) -> str:
plt.title(f'Portfolio Daily Return - {study_name}')
else:
plt.title('Portfolio Daily Return')
plt.plot(date_list, store.app.daily_balance)

start_balance_arr = np.full(len(store.app.daily_balance), store.app.daily_balance[0])
plt.fill_between(date_list, store.app.daily_balance, start_balance_arr, where=start_balance_arr < store.app.daily_balance, color='green', alpha=0.5)
plt.fill_between(date_list, start_balance_arr, store.app.daily_balance, where=start_balance_arr > store.app.daily_balance, color='red', alpha=0.7)
plt.plot(date_list, store.app.daily_balance, linewidth='4')

# price change%
plt.subplot(2, 1, 2)
Expand Down