Skip to content

Commit

Permalink
make legend transclucent
Browse files Browse the repository at this point in the history
  • Loading branch information
cedricporter committed Jul 26, 2016
1 parent 74ed3b2 commit 2c86733
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 11 deletions.
17 changes: 10 additions & 7 deletions README.md
Expand Up @@ -68,13 +68,7 @@ rqalpha generate_examples -d ./
```

### 运行回测
运行以下命令,将开始回测

```
rqalpha run -f examples/simple_macd.py -s 2014-01-04 -e 2015-01-05 -i 100000 -o /tmp/result.pkl
```

其运行的参数如下:
回测脚本参数如下:

```
Usage: rqalpha run [OPTIONS]
Expand All @@ -93,6 +87,15 @@ Options:
--help Show this message and exit.
```

运行以下命令,将开始回测

```
rqalpha run -f examples/multi_rsi.py -s 2014-01-01 -e 2016-01-01 -o /tmp/result.pkl --draw-result
```

等待回测结束后,将显示您的收益率和Risk。

![backtest](https://raw.githubusercontent.com/ricequant/rqalpha/master/docs/multi_rsi.png)

### 分析结果
RQAlpha可以输出一个DataFrame,其中包含了每天的Portfolio信息、Risk信息、Trades和Positions。
Expand Down
Binary file added docs/multi_rsi.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion rqalpha/__main__.py
Expand Up @@ -213,7 +213,9 @@ def show_draw_result(title, results_df):
vals = ax.get_yticks()
ax.set_yticklabels(['{:3.2f}%'.format(x*100) for x in vals])

plt.legend()
leg = plt.legend(loc="upper left")
leg.get_frame().set_alpha(0.5)

plt.show()


Expand Down
2 changes: 0 additions & 2 deletions rqalpha/analyser/risk_cal.py
Expand Up @@ -143,7 +143,6 @@ def cal_sharpe(self):

def cal_sortino(self):
strategy_rets = self.strategy_current_daily_returns.sum() / len(self.strategy_current_daily_returns) * const.DAYS_CNT.TRADING_DAYS_A_YEAR
# strategy_rets = self.strategy_current_annualized_returns[-1]
downside_risk = self.risk.downside_risk

sortino = (strategy_rets - self.riskfree_total_returns) / downside_risk
Expand All @@ -156,7 +155,6 @@ def cal_downside_risk(self):
return 0.

return ((diff * diff).sum() / len(diff)) ** 0.5 * const.DAYS_CNT.TRADING_DAYS_A_YEAR ** 0.5
# return const.DAYS_CNT.TRADING_DAYS_A_YEAR ** 0.5 * np.std(diff, ddof=1)

def __repr__(self):
return "RiskCal({0})".format(self.__dict__)
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -7,7 +7,7 @@

setup(
name='rqalpha',
version='0.0.53',
version='0.0.54',
description='Ricequant Backtest Engine',
packages=find_packages(exclude=[]),
author='ricequant',
Expand Down

0 comments on commit 2c86733

Please sign in to comment.