hikyuu 2.6.6__py3-none-win_amd64.whl → 2.6.8__py3-none-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (175) hide show
  1. hikyuu/__init__.py +16 -2
  2. hikyuu/__init__.pyi +658 -627
  3. hikyuu/analysis/__init__.pyi +563 -519
  4. hikyuu/analysis/analysis.pyi +583 -541
  5. hikyuu/core.pyi +565 -521
  6. hikyuu/cpp/__init__.pyi +2 -2
  7. hikyuu/cpp/concrt140.dll +0 -0
  8. hikyuu/cpp/core310.pyd +0 -0
  9. hikyuu/cpp/core310.pyi +1424 -865
  10. hikyuu/cpp/core311.pyd +0 -0
  11. hikyuu/cpp/core311.pyi +1424 -865
  12. hikyuu/cpp/core312.pyd +0 -0
  13. hikyuu/cpp/core312.pyi +1424 -865
  14. hikyuu/cpp/core313.pyd +0 -0
  15. hikyuu/cpp/core313.pyi +1424 -863
  16. hikyuu/cpp/core39.pyd +0 -0
  17. hikyuu/cpp/core39.pyi +1424 -865
  18. hikyuu/cpp/hikyuu.dll +0 -0
  19. hikyuu/cpp/hikyuu.lib +0 -0
  20. hikyuu/cpp/hku_hdf5.dll +0 -0
  21. hikyuu/cpp/hku_hdf5_cpp.dll +0 -0
  22. hikyuu/cpp/hku_hdf5_hl.dll +0 -0
  23. hikyuu/cpp/hku_hdf5_hl_cpp.dll +0 -0
  24. hikyuu/cpp/i18n/zh_CN/__init__.py +0 -0
  25. hikyuu/cpp/i18n/zh_CN/hikyuu.mo +0 -0
  26. hikyuu/cpp/msvcp140.dll +0 -0
  27. hikyuu/cpp/msvcp140_1.dll +0 -0
  28. hikyuu/cpp/msvcp140_2.dll +0 -0
  29. hikyuu/cpp/msvcp140_atomic_wait.dll +0 -0
  30. hikyuu/cpp/msvcp140_codecvt_ids.dll +0 -0
  31. hikyuu/cpp/sqlite3.dll +0 -0
  32. hikyuu/cpp/vcruntime140.dll +0 -0
  33. hikyuu/cpp/vcruntime140_1.dll +0 -0
  34. hikyuu/data/common_clickhouse.py +0 -47
  35. hikyuu/data/tdx_to_h5.py +1 -1
  36. hikyuu/draw/drawplot/__init__.pyi +32 -37
  37. hikyuu/draw/drawplot/bokeh_draw.pyi +651 -632
  38. hikyuu/draw/drawplot/common.pyi +3 -4
  39. hikyuu/draw/drawplot/echarts_draw.py +9 -8
  40. hikyuu/draw/drawplot/echarts_draw.pyi +598 -567
  41. hikyuu/draw/drawplot/matplotlib_draw.py +3 -3
  42. hikyuu/draw/drawplot/matplotlib_draw.pyi +872 -874
  43. hikyuu/draw/elder.pyi +19 -20
  44. hikyuu/draw/kaufman.py +1 -1
  45. hikyuu/draw/kaufman.pyi +18 -18
  46. hikyuu/draw/volume.pyi +10 -10
  47. hikyuu/examples/notebook/000-Index.ipynb +1 -1
  48. hikyuu/examples/notebook/001-overview.ipynb +78 -63
  49. hikyuu/examples/notebook/002-HowToGetStock.ipynb +259 -40
  50. hikyuu/examples/notebook/003-HowToGetKDataAndDraw.ipynb +49 -41
  51. hikyuu/examples/notebook/004-IndicatorOverview.ipynb +29 -29
  52. hikyuu/examples/notebook/005-Drawplot.ipynb +66 -37
  53. hikyuu/examples/notebook/006-TradeManager.ipynb +808 -61
  54. hikyuu/examples/notebook/007-SystemDetails.ipynb +23 -23
  55. hikyuu/examples/notebook/009-RealData.ipynb +3 -3
  56. hikyuu/examples/notebook/010-Portfolio.ipynb +761 -122
  57. hikyuu/extend.py +32 -98
  58. hikyuu/extend.pyi +597 -593
  59. hikyuu/gui/HikyuuTDX.py +2 -4
  60. hikyuu/gui/data/MainWindow.py +185 -174
  61. hikyuu/hub.pyi +69 -67
  62. hikyuu/include/hikyuu/DataType.h +3 -12
  63. hikyuu/include/hikyuu/KData.h +83 -25
  64. hikyuu/include/hikyuu/KDataImp.h +31 -46
  65. hikyuu/include/hikyuu/KDataPrivatedBufferImp.h +73 -0
  66. hikyuu/include/hikyuu/KDataSharedBufferImp.h +69 -0
  67. hikyuu/include/hikyuu/KQuery.h +38 -32
  68. hikyuu/include/hikyuu/KRecord.h +4 -1
  69. hikyuu/include/hikyuu/MarketInfo.h +1 -1
  70. hikyuu/include/hikyuu/Stock.h +24 -6
  71. hikyuu/include/hikyuu/StockManager.h +15 -6
  72. hikyuu/include/hikyuu/StockTypeInfo.h +6 -0
  73. hikyuu/include/hikyuu/TransRecord.h +2 -8
  74. hikyuu/include/hikyuu/data_driver/KDataDriver.h +5 -0
  75. hikyuu/include/hikyuu/doc.h +4 -0
  76. hikyuu/include/hikyuu/global/GlobalSpotAgent.h +8 -0
  77. hikyuu/include/hikyuu/global/agent/SpotAgent.h +12 -7
  78. hikyuu/include/hikyuu/indicator/Indicator.h +48 -0
  79. hikyuu/include/hikyuu/indicator/Indicator2InImp.h +9 -0
  80. hikyuu/include/hikyuu/indicator/IndicatorImp.h +83 -15
  81. hikyuu/include/hikyuu/indicator/build_in.h +1 -0
  82. hikyuu/include/hikyuu/indicator/crt/AMA.h +2 -1
  83. hikyuu/include/hikyuu/indicator/crt/ATR.h +1 -1
  84. hikyuu/include/hikyuu/indicator/crt/CONTEXT.h +2 -0
  85. hikyuu/include/hikyuu/indicator/crt/CYCLE.h +3 -0
  86. hikyuu/include/hikyuu/indicator/crt/DMA.h +1 -1
  87. hikyuu/include/hikyuu/indicator/crt/IC.h +14 -6
  88. hikyuu/include/hikyuu/indicator/crt/ICIR.h +8 -4
  89. hikyuu/include/hikyuu/indicator/crt/INSUM.h +2 -0
  90. hikyuu/include/hikyuu/indicator/crt/PRICELIST.h +2 -0
  91. hikyuu/include/hikyuu/indicator/crt/REFX.h +25 -0
  92. hikyuu/include/hikyuu/indicator/crt/SLICE.h +4 -4
  93. hikyuu/include/hikyuu/indicator/crt/SPEARMAN.h +3 -2
  94. hikyuu/include/hikyuu/indicator/imp/IContext.h +5 -0
  95. hikyuu/include/hikyuu/indicator/imp/ICval.h +6 -0
  96. hikyuu/include/hikyuu/indicator/imp/IDropna.h +9 -0
  97. hikyuu/include/hikyuu/indicator/imp/IIc.h +2 -1
  98. hikyuu/include/hikyuu/indicator/imp/IPriceList.h +1 -0
  99. hikyuu/include/hikyuu/indicator/imp/IRefX.h +23 -0
  100. hikyuu/include/hikyuu/lang.h +27 -0
  101. hikyuu/include/hikyuu/plugin/KDataToHdf5Importer.h +6 -1
  102. hikyuu/include/hikyuu/plugin/backtest.h +2 -0
  103. hikyuu/include/hikyuu/plugin/extind.h +45 -0
  104. hikyuu/include/hikyuu/plugin/hkuextra.h +77 -0
  105. hikyuu/include/hikyuu/plugin/interface/HkuExtraPluginInterface.h +54 -0
  106. hikyuu/include/hikyuu/plugin/interface/ImportKDataToHdf5PluginInterface.h +10 -1
  107. hikyuu/include/hikyuu/plugin/interface/TMReportPluginInterface.h +1 -0
  108. hikyuu/include/hikyuu/plugin/interface/plugins.h +2 -0
  109. hikyuu/include/hikyuu/python/pybind_utils.h +28 -11
  110. hikyuu/include/hikyuu/trade_manage/Performance.h +0 -1
  111. hikyuu/include/hikyuu/trade_manage/TradeCostBase.h +5 -0
  112. hikyuu/include/hikyuu/trade_manage/TradeManager.h +4 -0
  113. hikyuu/include/hikyuu/trade_manage/TradeManagerBase.h +10 -1
  114. hikyuu/include/hikyuu/trade_manage/TradeRecord.h +1 -1
  115. hikyuu/include/hikyuu/trade_sys/allocatefunds/AllocateFundsBase.h +5 -0
  116. hikyuu/include/hikyuu/trade_sys/condition/ConditionBase.h +5 -0
  117. hikyuu/include/hikyuu/trade_sys/environment/EnvironmentBase.h +5 -0
  118. hikyuu/include/hikyuu/trade_sys/moneymanager/MoneyManagerBase.h +5 -0
  119. hikyuu/include/hikyuu/trade_sys/multifactor/MultiFactorBase.h +6 -3
  120. hikyuu/include/hikyuu/trade_sys/portfolio/Portfolio.h +4 -0
  121. hikyuu/include/hikyuu/trade_sys/profitgoal/ProfitGoalBase.h +5 -0
  122. hikyuu/include/hikyuu/trade_sys/selector/SelectorBase.h +5 -2
  123. hikyuu/include/hikyuu/trade_sys/signal/SignalBase.h +5 -0
  124. hikyuu/include/hikyuu/trade_sys/slippage/SlippageBase.h +5 -0
  125. hikyuu/include/hikyuu/trade_sys/stoploss/StoplossBase.h +6 -1
  126. hikyuu/include/hikyuu/trade_sys/system/System.h +5 -0
  127. hikyuu/include/hikyuu/utilities/config.h +0 -2
  128. hikyuu/include/hikyuu/utilities/datetime/Datetime.h +2 -2
  129. hikyuu/include/hikyuu/utilities/os.h +7 -0
  130. hikyuu/include/hikyuu/utilities/plugin/PluginLoader.h +2 -1
  131. hikyuu/include/hikyuu/utilities/thread/GlobalMQStealThreadPool.h +1 -1
  132. hikyuu/include/hikyuu/utilities/thread/GlobalMQThreadPool.h +1 -1
  133. hikyuu/include/hikyuu/utilities/thread/GlobalThreadPool.h +1 -1
  134. hikyuu/include/hikyuu/utilities/thread/MQThreadPool.h +1 -1
  135. hikyuu/include/hikyuu/version.h +4 -4
  136. hikyuu/include/hikyuu/views/arrow_common.h +38 -0
  137. hikyuu/include/hikyuu/views/arrow_views.h +117 -0
  138. hikyuu/indicator/__init__.py +0 -1
  139. hikyuu/indicator/indicator.py +17 -57
  140. hikyuu/plugin/backtest.dll +0 -0
  141. hikyuu/plugin/clickhousedriver.dll +0 -0
  142. hikyuu/plugin/dataserver.dll +0 -0
  143. hikyuu/plugin/device.dll +0 -0
  144. hikyuu/plugin/extind.dll +0 -0
  145. hikyuu/plugin/hkuextra.dll +0 -0
  146. hikyuu/plugin/import2hdf5.dll +0 -0
  147. hikyuu/plugin/tmreport.dll +0 -0
  148. hikyuu/strategy/strategy_demo1.py +1 -1
  149. hikyuu/test/test_init.py +73 -14
  150. hikyuu/test/test_real_tdx_import.py +336 -0
  151. hikyuu/test/test_tdx_import.py +315 -0
  152. hikyuu/test/test_tdx_real_data_import.py +281 -0
  153. hikyuu/trade_manage/__init__.pyi +583 -553
  154. hikyuu/trade_manage/broker.pyi +19 -18
  155. hikyuu/trade_manage/broker_easytrader.pyi +6 -4
  156. hikyuu/trade_manage/broker_mail.pyi +22 -24
  157. hikyuu/trade_manage/trade.py +10 -65
  158. hikyuu/trade_manage/trade.pyi +583 -565
  159. hikyuu/trade_sys/__init__.py +15 -0
  160. hikyuu/util/__init__.pyi +0 -1
  161. hikyuu/util/check.pyi +17 -15
  162. hikyuu/util/mylog.pyi +8 -7
  163. hikyuu/util/notebook.pyi +9 -11
  164. hikyuu/util/singleton.pyi +8 -6
  165. {hikyuu-2.6.6.dist-info → hikyuu-2.6.8.dist-info}/METADATA +8 -4
  166. {hikyuu-2.6.6.dist-info → hikyuu-2.6.8.dist-info}/RECORD +172 -160
  167. {hikyuu-2.6.6.dist-info → hikyuu-2.6.8.dist-info}/top_level.txt +2 -1
  168. hikyuu/cpp/i18n/zh_CN.mo +0 -0
  169. hikyuu/include/hikyuu/utilities/mo/mo.h +0 -64
  170. hikyuu/indicator/talib_wrap.py +0 -1273
  171. /hikyuu/include/hikyuu/utilities/{mo/moFileReader.h → moFileReader.h} +0 -0
  172. /hikyuu/include/hikyuu/{utilities/mo → views}/__init__.py +0 -0
  173. {hikyuu-2.6.6.dist-info → hikyuu-2.6.8.dist-info}/LICENSE +0 -0
  174. {hikyuu-2.6.6.dist-info → hikyuu-2.6.8.dist-info}/WHEEL +0 -0
  175. {hikyuu-2.6.6.dist-info → hikyuu-2.6.8.dist-info}/entry_points.txt +0 -0
@@ -1,30 +1,30 @@
1
1
  from __future__ import annotations
2
- import hikyuu.cpp.core312
3
- from hikyuu.cpp.core312 import OrderBrokerBase
2
+ import hikyuu.cpp.core313
3
+ from hikyuu.cpp.core313 import OrderBrokerBase
4
4
  from hikyuu.util.mylog import hku_error
5
5
  import json as json
6
+ import typing
6
7
  __all__ = ['OrderBrokerBase', 'OrderBrokerWrap', 'TestOrderBroker', 'crtOB', 'hku_error', 'json']
7
- class OrderBrokerWrap(hikyuu.cpp.core312.OrderBrokerBase):
8
+ class OrderBrokerWrap(hikyuu.cpp.core313.OrderBrokerBase):
8
9
  """
9
10
  订单代理包装类,用户可以参考自定义自己的订单代理,加入额外的处理
10
- 包装只有买卖操作参数只有(code, price, num)的交易接口类
11
-
11
+ 包装只有买卖操作参数只有(code, price, num)的交易接口类
12
12
  """
13
+ __firstlineno__: typing.ClassVar[int] = 37
14
+ __static_attributes__: typing.ClassVar[tuple] = ('_broker')
13
15
  def __init__(self, broker, name):
14
16
  """
15
17
 
16
- 订单代理包装类,用户可以参考自定义自己的订单代理,加入额外的处理
17
-
18
+ 订单代理包装类,用户可以参考自定义自己的订单代理,加入额外的处理
18
19
  """
19
20
  def _buy(self, datetime, market, code, price, num, stoploss, goal_price, part_from, remark = ''):
20
21
  """
21
22
 
22
- 实现 OrderBrokerBase 的 _buy 接口
23
- :param str market: 证券市场
24
- :param str code: 证券代码
25
- :param float price: 买入价格
26
- :param int num: 买入数量
27
-
23
+ 实现 OrderBrokerBase 的 _buy 接口
24
+ :param str market: 证券市场
25
+ :param str code: 证券代码
26
+ :param float price: 买入价格
27
+ :param int num: 买入数量
28
28
  """
29
29
  def _get_asset_info(self):
30
30
  ...
@@ -36,6 +36,8 @@ class TestOrderBroker:
36
36
  """
37
37
  用于测试的订单代理,仅在执行买入/卖出时打印信息
38
38
  """
39
+ __firstlineno__: typing.ClassVar[int] = 74
40
+ __static_attributes__: typing.ClassVar[tuple] = tuple()
39
41
  def __init__(self):
40
42
  ...
41
43
  def buy(self, market, code, price, num, stoploss, goal_price, part_from, remark = ''):
@@ -45,10 +47,9 @@ class TestOrderBroker:
45
47
  def crtOB(broker, name = 'NO_NAME'):
46
48
  """
47
49
 
48
- 快速生成订单代理包装对象
50
+ 快速生成订单代理包装对象
49
51
 
50
- :param broker: 订单代理示例,必须拥有buy和sell方法,并且参数为 code, price, num
51
- :param float slip: 如果当前的卖一价格和指示买入的价格绝对差值不超过slip则下单,
52
- 否则忽略; 对卖出操作无效,立即以当前价卖出
53
-
52
+ :param broker: 订单代理示例,必须拥有buy和sell方法,并且参数为 code, price, num
53
+ :param float slip: 如果当前的卖一价格和指示买入的价格绝对差值不超过slip则下单,
54
+ 否则忽略; 对卖出操作无效,立即以当前价卖出
54
55
  """
@@ -1,14 +1,16 @@
1
1
  from __future__ import annotations
2
- from hikyuu.cpp.core312 import Datetime
2
+ from hikyuu.cpp.core313 import Datetime
3
3
  from hikyuu.util.mylog import hku_info
4
+ import typing
4
5
  __all__ = ['Datetime', 'EasyTraderOrderBroker', 'hku_info']
5
6
  class EasyTraderOrderBroker:
6
7
  """
7
8
 
8
- 使用华泰客户端实例
9
- 注意:buy|sell 中已屏蔽实际通过easytrade下单,防止调试误操作,请自行根据需要打开
10
-
9
+ 使用华泰客户端实例
10
+ 注意:buy|sell 中已屏蔽实际通过easytrade下单,防止调试误操作,请自行根据需要打开
11
11
  """
12
+ __firstlineno__: typing.ClassVar[int] = 10
13
+ __static_attributes__: typing.ClassVar[tuple] = ('buffer', 'user')
12
14
  def __init__(self, user):
13
15
  ...
14
16
  def buy(self, market, code, price, num, stoploss, goal_price, part_from, remark = ''):
@@ -2,54 +2,52 @@ from __future__ import annotations
2
2
  from email.header import Header
3
3
  from email.mime.text import MIMEText
4
4
  import smtplib as smtplib
5
+ import typing
5
6
  __all__ = ['Header', 'MIMEText', 'MailOrderBroker', 'smtplib']
6
7
  class MailOrderBroker:
7
8
  """
8
9
 
9
- 邮件订单代理
10
-
10
+ 邮件订单代理
11
11
  """
12
+ __firstlineno__: typing.ClassVar[int] = 37
13
+ __static_attributes__: typing.ClassVar[tuple] = ('_host', '_pwd', '_receivers', '_sender')
12
14
  def __init__(self, host, sender, pwd, receivers):
13
15
  """
14
16
 
15
- 邮件订单代理,执行买入/卖出操作时发送 Email
17
+ 邮件订单代理,执行买入/卖出操作时发送 Email
16
18
 
17
- :param str host: smtp服务器地址
18
- :param int port: smtp服务器端口
19
- :param str sender: 发件邮箱(既用户名)
20
- :param str pwd: 密码
21
- :param list receivers: 接受者邮箱列表
22
-
19
+ :param str host: smtp服务器地址
20
+ :param int port: smtp服务器端口
21
+ :param str sender: 发件邮箱(既用户名)
22
+ :param str pwd: 密码
23
+ :param list receivers: 接受者邮箱列表
23
24
  """
24
25
  def _sendmail(self, title, msg):
25
26
  """
26
27
  发送邮件
27
28
 
28
- :param str title: 邮件标题
29
- :param str msg: 邮件内容
30
-
29
+ :param str title: 邮件标题
30
+ :param str msg: 邮件内容
31
31
  """
32
32
  def buy(self, market, code, price, num, stoploss, goal_price, part_from, remark = ''):
33
33
  """
34
34
  执行买入操作,向指定的邮箱发送邮件,格式如下::
35
35
 
36
- 邮件标题:【Hkyuu提醒】买入 证券代码
37
- 邮件内容:买入:证券代码,价格:买入的价格,数量:买入数量
36
+ 邮件标题:【Hkyuu提醒】买入 证券代码
37
+ 邮件内容:买入:证券代码,价格:买入的价格,数量:买入数量
38
38
 
39
- :param str code: 证券代码
40
- :param float price: 买入价格
41
- :param int num: 买入数量
42
-
39
+ :param str code: 证券代码
40
+ :param float price: 买入价格
41
+ :param int num: 买入数量
43
42
  """
44
43
  def sell(self, market, code, price, num, stoploss, goal_price, part_from, remark = ''):
45
44
  """
46
45
  执行卖出操作,向指定的邮箱发送邮件,格式如下::
47
46
 
48
- 邮件标题:【Hkyuu提醒】卖出 证券代码
49
- 邮件内容:卖出:证券代码,价格:卖出的价格,数量:卖出数量
47
+ 邮件标题:【Hkyuu提醒】卖出 证券代码
48
+ 邮件内容:卖出:证券代码,价格:卖出的价格,数量:卖出数量
50
49
 
51
- :param str code: 证券代码
52
- :param float price: 卖出价格
53
- :param int num: 卖出数量
54
-
50
+ :param str code: 证券代码
51
+ :param float price: 卖出价格
52
+ :param int num: 卖出数量
55
53
  """
@@ -29,78 +29,23 @@
29
29
  # 1. 20130213, Added by fasiondog
30
30
  # ===============================================================================
31
31
 
32
- from hikyuu.util.slice import list_getitem
33
32
  from hikyuu import *
34
33
  import numpy as np
35
34
  import pandas as pd
36
35
 
37
36
 
38
- def TradeList_to_np(t_list):
39
- """转化为numpy结构数组"""
40
- t_type = np.dtype(
41
- {
42
- 'names': [
43
- '交易日期', '证券代码', '证券名称', '业务名称', '计划交易价格', '实际成交价格', '目标价格', '成交数量', '佣金', '印花税', '过户费', '其它成本',
44
- '交易总成本', '止损价', '现金余额', '信号来源'
45
- ],
46
- 'formats':
47
- ['datetime64[D]', 'U10', 'U20', 'U10', 'd', 'd', 'd', 'i', 'd', 'd', 'd', 'd', 'd', 'd', 'd', 'U5']
48
- }
49
- )
50
- return np.array(
51
- [
52
- (
53
- t.datetime, t.stock.market_code, t.stock.name, get_business_name(t.business), t.plan_price,
54
- t.real_price, t.goal_price, t.number, t.cost.commission, t.cost.stamptax, t.cost.transferfee,
55
- t.cost.others, t.cost.total, t.stoploss, t.cash, get_system_part_name(t.part)
56
- ) for t in t_list
57
- ],
58
- dtype=t_type
59
- )
37
+ TradeRecordList.to_np = lambda self: trades_to_np(self)
38
+ TradeRecordList.to_df = lambda self: trades_to_df(self)
39
+ TradeRecordList.to_numpy = TradeRecordList.to_np
40
+ TradeRecordList.to_pandas = TradeRecordList.to_df
41
+ TradeRecordList.to_pyarrow = lambda self: trades_to_pa(self)
60
42
 
61
43
 
62
- def TradeList_to_df(t):
63
- """转化为pandas的DataFrame"""
64
- return pd.DataFrame.from_records(TradeList_to_np(t), index='交易日期')
65
-
66
-
67
- TradeRecordList.to_np = TradeList_to_np
68
- TradeRecordList.to_df = TradeList_to_df
69
-
70
-
71
- def PositionList_to_np(pos_list):
72
- """转化为numpy结构数组"""
73
- t_type = np.dtype(
74
- {
75
- 'names': ['证券代码', '证券名称', '买入日期', '已持仓天数', '持仓数量', '投入金额', '当前市值', '盈亏金额', '盈亏比例'],
76
- 'formats': ['U10', 'U20', 'datetime64[D]', 'i', 'i', 'd', 'd', 'd', 'd']
77
- }
78
- )
79
- sm = StockManager.instance()
80
- query = Query(-1)
81
- data = []
82
- for pos in pos_list:
83
- invest = pos.buy_money - pos.sell_money + pos.total_cost
84
- k = pos.stock.get_kdata(query)
85
- cur_val = k[0].close * pos.number
86
- bonus = cur_val - invest
87
- date_list = sm.get_trading_calendar(Query(Datetime(pos.take_datetime.date())))
88
- data.append(
89
- (
90
- pos.stock.market_code, pos.stock.name, pos.take_datetime, len(date_list), pos.number, invest,
91
- cur_val, bonus, 100 * bonus / invest
92
- )
93
- )
94
- return np.array(data, dtype=t_type)
95
-
96
-
97
- def PositionList_to_df(pos_list):
98
- """转化为pandas的DataFrame"""
99
- return pd.DataFrame.from_records(PositionList_to_np(pos_list), index='证券代码')
100
-
101
-
102
- PositionRecordList.to_np = PositionList_to_np
103
- PositionRecordList.to_df = PositionList_to_df
44
+ PositionRecordList.to_np = lambda self: positions_to_np(self)
45
+ PositionRecordList.to_df = lambda self: positions_to_df(self)
46
+ PositionRecordList.to_numpy = PositionRecordList.to_np
47
+ PositionRecordList.to_pandas = PositionRecordList.to_df
48
+ PositionRecordList.to_pyarrow = lambda self: positions_to_pa(self)
104
49
 
105
50
 
106
51
  def Performance_to_df(per):