Skip to content

Commit

Permalink
update annualized returns
Browse files Browse the repository at this point in the history
  • Loading branch information
Cuizi7 committed Nov 9, 2018
1 parent 4ee2e23 commit 85813dc
Show file tree
Hide file tree
Showing 15 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion rqalpha/model/portfolio.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def annualized_returns(self):
return -1
current_date = Environment.get_instance().trading_dt.date()
natural_start_date = Environment.get_instance().config.base.natural_start_date
return self.unit_net_value ** (DAYS_CNT.DAYS_A_YEAR / float((current_date - natural_start_date).days + 1)) - 1
return self.unit_net_value ** (DAYS_CNT.TRADING_DAYS_A_YEAR / float((current_date - natural_start_date).days + 1)) - 1

@property
def total_value(self):
Expand Down
4 changes: 2 additions & 2 deletions rqalpha/utils/risk.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import numpy as np

APPROX_BDAYS_PER_MONTH = 21
APPROX_BDAYS_PER_YEAR = 244
APPROX_BDAYS_PER_YEAR = 252

MONTHS_PER_YEAR = 12
WEEKS_PER_YEAR = 52
Expand Down Expand Up @@ -58,7 +58,7 @@ def __init__(self, daily_returns, benchmark_daily_returns, risk_free_rate, days,
self._beta = None
self._sharpe = None
self._return = np.expm1(np.log1p(self._portfolio).sum())
self._annual_return = (1 + self._return) ** (365 / days) - 1
self._annual_return = (1 + self._return) ** (252 / days) - 1
self._benchmark_return = np.expm1(np.log1p(self._benchmark).sum())
self._benchmark_annual_return = (1 + self._benchmark_return) ** (365 / days) - 1
self._max_drawdown = None
Expand Down
Binary file modified tests/outs/test_f_buy_and_hold.pkl
Binary file not shown.
Binary file modified tests/outs/test_f_macd.pkl
Binary file not shown.
Binary file modified tests/outs/test_f_macd_signal.pkl
Binary file not shown.
Binary file modified tests/outs/test_f_mean_reverting.pkl
Binary file not shown.
Binary file modified tests/outs/test_s_buy_and_hold.pkl
Binary file not shown.
Binary file modified tests/outs/test_s_dma.pkl
Binary file not shown.
Binary file modified tests/outs/test_s_dual_thrust.pkl
Binary file not shown.
Binary file modified tests/outs/test_s_golden_cross.pkl
Binary file not shown.
Binary file modified tests/outs/test_s_scheduler.pkl
Binary file not shown.
Binary file modified tests/outs/test_s_tick_size.pkl
Binary file not shown.
Binary file modified tests/outs/test_s_turtle.pkl
Binary file not shown.
Binary file modified tests/outs/test_s_turtle_signal.pkl
Binary file not shown.
Binary file modified tests/outs/test_sf_buy_and_hold.pkl
Binary file not shown.

0 comments on commit 85813dc

Please sign in to comment.