Skip to content

Commit

Permalink
Merge pull request #233 from fasiondog/feature/docs
Browse files Browse the repository at this point in the history
update docs
  • Loading branch information
fasiondog committed Apr 18, 2024
2 parents 1294944 + 71b8f41 commit 389b2da
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 9 deletions.
35 changes: 34 additions & 1 deletion docs/source/stock_manager.rst
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,31 @@ StockManager/Block/Stock
移除增加的临时Stock

:param str code: 创建时自定义的编码


.. py:method:: add_stock(self, stock)
谨慎调用!!!仅供增加某些临时的外部 Stock, 通常配合 Stock.set_krecord_list 方法直接使用外部来源的数据

:param Stock stock: sm 外部自行创建的 Stock

.. py:method:: remove_stock(self, market_code)
从 sm 中移除 market_code 代表的证券,谨慎使用!!!通常用于移除临时增加的外布 Stock

:param str market_code: 证券市场标识

.. py:method:: get_history_finance_all_fields(self)
获取所有历史财务信息字段及其索引

.. py:method:: get_history_finance_field_index(self, name)
根据字段名称,获取历史财务信息相应字段索引

.. py:method:: get_history_finance_field_name(self, index)
根据字段索引,获取历史财务信息相应字段名


.. py:class:: Stock
Expand Down Expand Up @@ -368,6 +392,12 @@ StockManager/Block/Stock
:param Datetime date: 指定日期必须是0331、0630、0930、1231,如 Datetime(201109300000)
:rtype: list

.. py:method:: set_krecord_list(self, krecord_list)
谨慎调用!!!直接设置当前内存 KRecordList, 仅供需临时增加的外部 Stock 设置 K 线数据

:param sequence krecord_list: 一个可迭代变量获取 KRecord 实例的对象,如: list (仅包含 KRecord 实例)

.. py:method:: realtime_update(self, krecord)
(临时函数)只用于更新内存缓存中的日线数据
Expand All @@ -385,6 +415,9 @@ StockManager/Block/Stock
释放指定类别的内存K线数据

:param Query.KType ktype: K线类型





.. py:class:: Block
Expand Down
10 changes: 5 additions & 5 deletions docs/source/trade_sys/multifactor.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
============

内建对因子合成算法
----------------
--------------------------------

.. py:function:: MF_EqualWeight(inds, stks, query, ref_stk[, ic_n=5])
Expand All @@ -19,7 +19,7 @@
:rtype: MultiFactorBase


.. py:function:: MF_EqualWeight(inds, stks, query, ref_stk[, ic_n=5, ic_rolling_n=120])
.. py:function:: MF_ICWeight(inds, stks, query, ref_stk[, ic_n=5, ic_rolling_n=120])
滚动IC权重合成因子

Expand All @@ -32,7 +32,7 @@
:rtype: MultiFactorBase


.. py:function:: MF_EqualWeight(inds, stks, query, ref_stk[, ic_n=5, ic_rolling_n=120])
.. py:function:: MF_ICIRWeight(inds, stks, query, ref_stk[, ic_n=5, ic_rolling_n=120])
滚动ICIR权重合成因子

Expand All @@ -46,15 +46,15 @@


自定义多因子合成算法基类
--------------------
--------------------------------------

自定义多因子合成算法接口:

* :py:meth:`MultiFactorBase._calculate` - 【必须】计算合成因子


多因子合成算法基类
------------------------
---------------------------------------

.. py:class:: MultiFactorBase
Expand Down
2 changes: 1 addition & 1 deletion docs/source/trade_sys/system.rst
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@
复位,但不包括已有的交易对象,以及共享的部件

.. py:methon:: force_reset_all(self)
.. py:method:: force_reset_all(self)
强制复位所有组件以及清空已有的交易对象,忽略组件的共享属性

Expand Down
8 changes: 6 additions & 2 deletions hikyuu_pywrap/_StockManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ void export_StockManager(py::module& m) {
CSV文件第一行为标题,需含有
Datetime(或Date、日期)、OPEN(或开盘价)、HIGH(或最高价)、LOW(或最低价)、CLOSE(或收盘价)、AMOUNT(或成交金额)、VOLUME(或VOL、COUNT、成交量)。
注意:请确保 csv 使用 utf8 格式存储,否则无法识别中文
:param str code: 自行编号的证券代码,不能和已有的Stock相同,否则将返回Null<Stock>
:param str day_filename: 日线CSV文件名
:param str min_filename: 分钟线CSV文件名
Expand Down Expand Up @@ -197,12 +199,14 @@ void export_StockManager(py::module& m) {

.def("add_stock", &StockManager::addStock, R"(add_stock(self, stock)
谨慎调用!!!仅供增加某些临时的外部 Stock)
谨慎调用!!!仅供增加某些临时的外部 Stock
@return True | False)")

.def("remove_stock", &StockManager::removeStock, R"(remove_stock(self, market_code)
从 sm 中移除 market_code 代表的证券,谨慎使用!!!通常用于移除临时增加的外布 Stock)")
从 sm 中移除 market_code 代表的证券,谨慎使用!!!通常用于移除临时增加的外布 Stock
:param str market_code: 证券市场标识)")

.def("__len__", &StockManager::size, "返回证券数量")
.def("__getitem__", &StockManager::getStock, "同 get_stock")
Expand Down

0 comments on commit 389b2da

Please sign in to comment.