Skip to content

Commit 7cb1478

Browse files
Guillaume De Saint MartinGuillaumeDSM
authored andcommitted
[Portfolio] fix get_coefficient_of_determination error
1 parent d6146fc commit 7cb1478

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

octobot_trading/personal_data/portfolios/portfolio_util.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,9 @@ async def get_coefficient_of_determination(exchange_manager, use_high_instead_of
172172
:param use_high_instead_of_end_balance: best case exponential growth based on end balance or highest balance
173173
"""
174174
coefficient_of_determination = 0
175+
if exchange_manager.exchange_personal_data.portfolio_manager is None or \
176+
exchange_manager.exchange_personal_data.portfolio_manager.portfolio_value_holder.origin_portfolio is None:
177+
return 0
175178
# get data the data necessary to compute the coefficient_of_determination
176179
origin_portfolio = portfolio_to_float(
177180
exchange_manager.exchange_personal_data.portfolio_manager.portfolio_value_holder.origin_portfolio.portfolio

0 commit comments

Comments
 (0)