Skip to content

Commit

Permalink
sync with the latest (#1)
Browse files Browse the repository at this point in the history
* release 2.0.0-beta

* update README

* disable register event for offline scripts

* add repr

* persist broker if need

* fix portfolio set_state

* update i18n

* add is_st_stock && is_suspended

* update i18n

* release 2.0.0

* fix broker persist

* remove duplicate option in .gitignore

* update setup.py

* add LIVE_TRADING

* do not copy; add LIVE_TRADING

* fix RunInfo

* fix dt

* 修改配置的读取方式,不再从~/.rqalpha/config.yml读取用户配置信息,而是默认从当前命令行读取config.yml,如果没有找到,则会读取系统默认配置信息。

* 1.	config 现在不再进行版本检查
2.	generate_config 现在会生成默认系统配置信息的config.yml文件
3.	不再使用config_template.yml模板

* release 2.0.1

* fix typo

* little refactory

* little fixes

* remove run_id

* use integer value for ACCOUNT_TYPE

* support context_vars with dict input

* remove debug print

* release 2.0.2

* fix mavg and vwap

* include requirements-py2.txt

* bug fixed

* release 2.0.5

* Bug Fixed: ricequant#76

* 解决 get_mod_config_path  返回值不正确的问题

* analyser benchmark bug fixed

* release 0.2.6

* fix typo

* fix de_listed

* fix AnalyserMod

* add tick event source

* implement get_ticks for test

* fix concatenate bug

* use merge sort to merge ticks

* fill open price from snapshot

* add tick price board

* get tick from event

* rename matcher & simulation broker

* remove internal limit up & limit down from bar.py

* let matcher use price board

* enable volume_limit only when frequency is 1d/1m

* update tick model

* filter past time when universe is change

* refactor

* fix limit up / limit down

* fix limit up / limit down typo

* fix typo

* fix bug when missing market data

* fix doc typo

* add match order_book_id filter

* fix before_trading

* python2 unicode compatible

* make better_exceptions unicode str compatible with python 2.7

* print time spend when performance regress

* arg_checker: fix check_are_valid_fields, is_valid_date

* fix for python2

* add count for is_suspended and is_st_stock

* fix

* fix

* fix order_percent; clear comment

* update docs

* release 2.0.7

* update version

* fix before_trading time bug

* update FAQ doc

* remove useless code

* performance tune

* add matching type check

* publish EVENT.POST_UNIVERSE_CHANGED only when universe changes really

* cache get_account_type because it is god damn slow

* update repr of snapshot

* fix before_trading time bug

* auto set default encoding with utf8

* format code

* update sys_stock_realtime readme

* add limit up & limit down

* implement a1 b1

* add data_board

* use order_book_id to be index

* fix realtime stock cause by mod conflict

* refactor event source

* remove StockRealtimePriceBoard

* add intro/optimizing_parameters

* add batch run test code

* add batch run by main.run

* add analyser batch run performance

* fix docs

* use `from rqalpha import run` to run batch

* refactor ptimizing_parameterso

* fix subscribe bug & refactor event source

* bug fixed

* release 2.0.8

* add missing logger in api

* add missing logger in api

* add  mod_sys_analyser README.rst

* update sys_analyser README

* Update README.rst

* 增加 sys_progress Mod 对应的 README.rst 文档

* 增加 sys_risk_mod 对应的README.rst

* add sys_simulation mod README.rst

* update sys_stock_realtime mod README.rst

* update docs

* update

* seems better

* preload carray

* data type matters

* update sys_funcat docs

* add more examples into sys_funcat doc

* add mod requirement

* fix format style

* update rqalpha_mod_sys_analyser docs

* update docs

* update docs

* add optimizing parameters examples in docs

* unify is_suspended/is_st_stock

* add set_pending_cancel

* fix logic bug in order.is_final

* refactor deal_price_decider create

* format test code

* format example code

* fix test_api_base

* refactor test_api

* remove test code

* show progress bar for test_api

* fix typo

* fix test_api_future/test_api_stock

* fix doc

* fix test code

* update simulation broker

* use env.get_instrument instead of data_proxy

* update signal broker

* bug fixed

* update sys analyser mod

* format code

* update history_bars api

* add signal test algo

* disable test_api temporarily

* fix rqalpha cmd error

* format code

* update i18n

* release 2.0.9

* add error message, fix bug in test cases

* fix only export custom user mod config issue

* Update signal_broker.py

81行修改了一处BUG

* format code

* update docs

* Develop (ricequant#89)

* test

* test

* merge 2.0.6

* commit

* commit

* fix no settlement

* delete tags

* add extend_api example

* update docs

* update docs

* release 2.1.0

* release 2.1.0

* update docs

* 提供 `from rqalpha import cli` 方便第三方 Mod 扩展 `rqalpha` command

* add include_now

* fix data_proxy

* Fix ricequant#90

* fix concept testcase

* do not create position until first trade

* add quarter arg checker

* fix include_now in BEFORE_TRADING

* refactor

refactor rqalpha_mod_sys_funcat

* fix bar_count

* refactor get_price

remove useless code

* refactor sys_funcat

* Fix bug issue#94

* release 2.1.2

* add bar count scale

* don't create position

* add stock & future test case

* refactor test.py

* fix travis in 2.7 because ipython==6.0+ is not support python 2

* fix bug when running future

* fix alpha calculate error

* update test pkl

* update i18n

* require six

* only futures has settle price

* use int32/int64

* fix transaction_cost

* fix typo

* add pnl/starting_cash/fronzen_cash

* fix frozen_cash

* add requests lib requirement

* update translation

* fix tiny bug for rqalpha mod install cmd

* fix history_bars

* make price_limit as a warning switcher option for signal model

* fix history_bars when include_now=True

* remove force include_now=False

* fix history_bars

* fix regression

* support config.json as user config file

* bug fixed

* add issue template

* Update issue_template.md

* add comment

* bug fixed

* fix future calc

* fix ricequant#101

* release 2.1.3

* update version

* update pkl

* remove unused typing lib

* add deprecated property for making old version RQA compatible

* fix plot when only backtest with one day

* fix settlement price

* fix history_bars because we misuse ExecutionContext.phase()

* 增加期货账户级别仓位强平 ricequant#108

* pass test case

* update i18n

* release 2.1.4

* bug fixed

* fix frozen_cash cal

* fix clear position
  • Loading branch information
shij10 authored Apr 29, 2017
1 parent 9094bc8 commit d8210b7
Show file tree
Hide file tree
Showing 194 changed files with 10,000 additions and 7,421 deletions.
17 changes: 17 additions & 0 deletions .github/issue_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# 提 ISSUE 须知

请先阅读文档 [rqalpha文档](http://rqalpha.readthedocs.io/)

如果仍有问题的话请在 [issue列表](https://github.com/ricequant/rqalpha/issues) 中寻找是否有相关问题的解决方案

如果没有的话 麻烦开一个issue 描述以下问题:

## 1. RQAlpha的版本

## 2. Python的版本

## 3. 是Windows/Linux/MacOS or others?

## 4. 您出现问题对应的源码/或者能复现问题的简易代码 以及对应的配置

## 5. 您出现的错误堆栈日志信息
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ rqalpha.system.log
*.pk
*.h5
.vscode
.idea
*.c
*.so
*.pyc
Expand All @@ -20,4 +19,4 @@ persist/
.coverage
.tox
rqalpha_test_coverage_report/
.tmp.pkl
.tmp.pkl
9 changes: 5 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,24 +24,25 @@ install:
# Install bcolz
- pip install Cython
- pip install bcolz
- pip install -r requirements.txt

# Install Test Deps
- pip install TA-Lib
- pip install coveralls
- pip install -U setuptools
- pip install funcat
- pip install ipython==5.3.0
- pip install .
script:
- ls $HOME/.rqalpha/bundle/
- ls -al $HOME/.rqalpha/
- ls -al $HOME/.rqalpha/bundle/
- |
if [ ! -d $HOME/.rqalpha/config.yml ]; then
if [ ! -f $HOME/.rqalpha/bundle/instruments.pk ]; then
rqalpha update_bundle
fi
- coverage run --source=rqalpha test.py
cache:
directories:
- $HOME/.cache/pip
- $HOME/.rqalpha
- $HOME/.rqalpha/bundle
after_success:
coveralls
191 changes: 191 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,194 @@
==================
CHANGELOG
==================

2.1.4
==================

- 解决 history_bars 在 before_trading 获取的是未来数据的问题
- 解决 before_trading 获取结算价是当前交易日结算价的问题
- 增加 RQAlpha 向前兼容(0.3.x) `Issue 100 <https://github.com/ricequant/rqalpha/issues/100>`_
- 期货增加强平机制: 及当前账户权益<=0时,清空仓位,资金置0 `Issue 108 <https://github.com/ricequant/rqalpha/issues/108>`_
- 解决回测时只有一个交易日时,只有回测数据显示的问题

2.1.3
==================

- Fix `Issue 101 <https://github.com/ricequant/rqalpha/issues/101>`_
- Fix `Issue 105 <https://github.com/ricequant/rqalpha/issues/105>`_
- 解决运行 RQAlpha 时缺少 `six` | `requests` 库依赖的问题
- 解决安装RQAlpha时在某些情况下报错的问题
- 解决第三方 Mod 安装后配置文件路径有误的问题
- 现在可以通过 `rqalpha mod install -e .` 的方式来安装依赖 Mod 了
- 现在运行策略时会检测当前目录是否存在 `config.yml` 或者 `config.json` 来作为配置文件
- 解决股票下单就存在 `position` 的问题,现在只有成交后才会产生 `position` 了。
- 修复 `portfolio` 和 `future_account` 计算逻辑的一些问题
- 修复 `transaction_cost` 在某个 position 清空以后计算不准确的问题
- 在信号模式下 `price_limit` 表示是否输出涨跌停买入/卖出的报警信息,但不会阻止其买入/卖出

2.1.2
==================

- 提供 :code:`from rqalpha import cli` 方便第三方 Mod 扩展 `rqalpha` command
- :code:`history_bars` 增加 :code:`include_now` option
- Fix `Issue 90 <https://github.com/ricequant/rqalpha/issues/90>`_
- Fix `Issue 94 <https://github.com/ricequant/rqalpha/issues/94>`_

2.1.0
==================

- Fix `Issue 87 <https://github.com/ricequant/rqalpha/issues/87>`_
- Fix `Issue 89 <https://github.com/ricequant/rqalpha/pull/89>`_
- Fix 无法通过 :code:`env.config.mod` 获取全部 `mod` 的配置信息
- 增加 :code:`context.config` 来获取配置信息
- 提供 :code:`from rqalpha import export_as_api` 接口,方便扩展自定义 API

2.0.9
==================

- Fix `Issue 79 <https://github.com/ricequant/rqalpha/issues/79>`_
- Fix `Issue 82 <https://github.com/ricequant/rqalpha/issues/82>`_
- Fix :code:`rqalpha cmd` 失效

2.0.8
==================

- Fix `Issue 81 <https://github.com/ricequant/rqalpha/issues/81>`_
- 解决 `mod_config.yml` 文件解析出错以后,所有的命令报错的问题
- 默认在 Python 2.x 下 `sys.setdefaultencoding("utf-8")`
- 优化 `UNIVERSE_CHANGED` 事件,现在只有在universe真正变化时才触发

2.0.7
==================

- Fix `Issue 78 <https://github.com/ricequant/rqalpha/issues/78>`_
- `is_st_stock` | `is_suspended` 支持 `count` 参数
- 解决大量 Python 2.x 下中文乱码问题

2.0.6
==================

- 解决在 Python 2.x 下安装 RQAlpha 提示 `requirements-py2.txt Not Found` 的问题
- 解决 `Benchmark` 无法显示的问题
- 解决 `rqalpha mod list` 显示不正确的问题
- 现在可以通过配置 `base.extra_vars` 向策略中预定义变量了。用法如下:

.. code-block:: python3
from rqalpha import run
config = {
"base": {
"strategy_file": "strategy.py",
"start_date": "2016-06-01",
"end_date": "2016-07-01",
"stock_starting_cash":100000,
"benchmark": '000300.XSHG'
},
"extra":{
"context_vars":{
"short":5,
"middle":10,
"long":21
}
}
}
result_dict = run(config)
# 以下是策略代码:
def handle_bar(context):
print(context.short) # 5
print(context.middle) # 10
print(context.long) # 21
2.0.1
==================

- 修改配置的读取方式,不再从 `~/.rqalpha/config.yml` 读取自定义配置信息,而是默认从当前路径读取 `config.yml`,如果没找到,则会读取系统默认配置信息
- 现在不再对自定义信息进行版本检查
- :code:`rqalpha generate_config` 现在会生成包含所有默认系统配置信息的 `config.yml` 文件。
- :code:`RUN_TYPE` 增加 :code:`LIVE_TRADING`
- 修复 :code:`history_bars` 获取日期错误产生的问题
- 修复执行 :code:`context.run_info` 会报错的问题
- 修复持久化报错的问题
- 增加 Order Persist 相关内容


2.0.0
==================

2.0.0 详细修改内容请访问:`RQAlpha 2.0.0 <https://github.com/ricequant/rqalpha/issues/65>`_

**Portfolio/Account/Position 相关**

- 重新定义了 :code:`Portfolio`, :code:`Account` 和 :code:`Position` 的角色和关系
- 删除大部分累计计算的属性,重新实现股票和期货的计算逻辑
- 现在只有在 :code:`Portfolio` 层级进行净值/份额的计算,Account级别不再进行净值/份额/收益/相关的计算
- 账户的恢复和初始化现在只需要 :code:`total_cash`, :code:`positions` 和 :code:`backward_trade_set` 即可完成
- 精简 :code:`Position` 的初始化,可以从 :code:`real_broker` 直接进行恢复
- :code:`Account` 提供 :code:`fast_forward` 函数,账户现在可以从任意时刻通过 :code:`orders` 和 :code:`trades` 快速前进至最新状态
- 如果存在 Benchmark, 则创建一个 :code:`benchmark_portfolio`, 其包含一个 :code:`benchmark_account`
- 策略在调用 :code:`context.portfolio.positions[some_security]` 时候,如果 position 不存在,不再每次都创建临时仓位,而是会缓存,从而提高回测速度和性能
- 不再使用 :code:`clone` 方法
- 不再使用 :code:`PortfolioProxy` 和 :code:`PositionProxy`

**Event 相关**

- 规范 Event 的生成和相应逻辑, 使用 Event object 来替换原来的 Enum
- 抽离事件执行相关逻辑为 :code:`Executor` 模块

**Mod 相关**

- 规范化 Mod 命名规则,需要以 `rqalpha_mod_xxx` 作为 Mod 依赖库命名
- 抽离 :code:`slippage` 相关业务逻辑至 :code:`simulation mod`
- 抽离 :code:`commission` 相关业务逻辑至 :code:`simulation mod`
- 抽离 :code:`tax` 相关业务逻辑至 :code:`simulation mod`
- `rqalpha mod list` 命令现在可以格式化显示 Mod 当前的状态了

**Environment 和 ExecutionContext 相关**

- 现在 :code:`ExecutionContext` 只负责上下文相关的内容,不再可以通过 :code:`ExecutionContext` 访问其他成员变量。
- 扩展了 :code:`Environment` 的功能,RQAlpha 及 Mod 均可以直接通过 :code:`Environment.get_instance()` 来获取到环境中核心模块的引用
- :code:`Environment` 还提供了很多常用的方法,具体请直接参考代码

**配置及参数相关**

- 重构了配置相关的内容,`~/.rqalpha/config.yml` 现在类似于 Sublime/Atom 的用户配置文件,用于覆盖默认配置信息,因此只需要增加自定义配置项即可,不需要全部的配置内容都存在
- 将Mod自己的默认配置从配置文件中删除,放在Mod中自行管理和维护
- 独立存在 `~/.rqalpha/.mod_conifg.yml`, 提供 `rqalpha mod install/uninstall/enable/disable/list` 命令,RQAlpha 会通过该配置文件来对Mod进行管理。
- 抽离 :code:`rqalpha run` 的参数,将其中属于 `Mod` 的参数全部删除,取代之为Mod提供了参数注入机制,所以现在 `Mod` 可以自行决定是否要注入参数或者命令来扩展 RQAlpha 的功能
- 提供了 :code:`rqalpha-cmd` 命令,`Mod` 推荐在该命令下注入自己的命令来实现功能扩展
- 不再使用 `--strategy-type`, 改为使用 `--security` 选项
- `--output-file` | `--report` | `--plot` | `--plot-save`参数 转移至 `sys_analyser` Mod 中
- `plot` | `report` 命令,转移至 `sys_analyser` Mod 中
- `--signal` | `--slippage` | `--commission-multiplier` | `--matching-type` | `--rid` 转移至 `sys_simulation` Mod 中

**Risk 计算**

- 修复 `tracking error <https://www.ricequant.com/api/python/chn#backtest-results-factors>`_ 计算错误
- 修改 `sharpe <https://www.ricequant.com/api/python/chn#backtest-results-risk-adjusted-returns>`_ , `sortino <https://www.ricequant.com/api/python/chn#backtest-results-risk-adjusted-returns>`_ , `information ratio <https://www.ricequant.com/api/python/chn#backtest-results-risk-adjusted-returns>`_ , `alpha <https://www.ricequant.com/api/python/chn#backtest-results-returns>`_ 计算逻辑。参考 `晨星 <https://gladmainnew.morningstar.com/directhelp/Methodology_StDev_Sharpe.pdf>`_ 的方法, 先计算单日级别指标, 再进行年化。与原本直接基于年化值计算相比, 在分析时间较短的情况下, 新的指标计算结果会系统性低于原指标结果。
- 引入单日无风险利率作为中间变量计算上述指标。单日无风险利率为通过 `中国债券信息网 <http://yield.chinabond.com.cn/cbweb-mn/yield_main>`_ 获取得到对应期限的年化国债到期收益率除以244得到
- 修改指标说明若干

**其他**

- 修改了 :code:`Order` 和 :code:`Trade` 的字段和函数,使其更通用
- 为 :code:`RqAttrDict` 类增加 :code:`update` 方法,现在支持动态更新了
- :code:`arg_checker` 增加 :code:`is_greater_or_equal_than` 和 :code:`is_less_or_equal_than` 函数
- 删除 :code:`DEFAULT_FUTURE_INFO` 变量,现在可以直接通过 :code:`data_proxy` 获取相关数据
- 通过 `better_exceptions <https://github.com/Qix-/better-exceptions>`_ 提供更好的错误堆栈提示体验
- 对字符串的处理进行了优化,现在可以正确在 Python2.x/3.x 下显示中文了
- 修复 :code:`update_bundle` 直接在代码中调用会报错的问题
- 增加对于下单量为0的订单过滤,不再会创建订单,也不再会输出警报日志
- 增加 :code:`is_suspended` 和 :code:`is_st_stock` API 的支持

0.3.14
==================

- Hotfix :code:`UnboundLocalError: local variable 'signature' referenced before assignment`

0.3.13
==================

Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
include requirements.txt
include requirements-py2.txt
include rqalpha/VERSION.txt
recursive-include rqalpha/resource *.png
Loading

0 comments on commit d8210b7

Please sign in to comment.