hikyuu 2.6.8.3__py3-none-manylinux2014_aarch64.whl → 2.7.3__py3-none-manylinux2014_aarch64.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.
- hikyuu/__init__.py +55 -23
- hikyuu/__init__.pyi +626 -595
- hikyuu/analysis/__init__.pyi +589 -563
- hikyuu/analysis/analysis.pyi +590 -564
- hikyuu/core.py +2 -0
- hikyuu/core.pyi +591 -565
- hikyuu/cpp/__init__.pyi +2 -2
- hikyuu/cpp/core310.pyi +587 -130
- hikyuu/cpp/core310.so +0 -0
- hikyuu/cpp/core311.pyi +587 -130
- hikyuu/cpp/core311.so +0 -0
- hikyuu/cpp/core312.pyi +587 -130
- hikyuu/cpp/core312.so +0 -0
- hikyuu/cpp/core313.pyi +587 -130
- hikyuu/cpp/core313.so +0 -0
- hikyuu/cpp/i18n/zh_CN/hikyuu.mo +0 -0
- hikyuu/cpp/i18n/zh_CN/hikyuu_plugin.mo +0 -0
- hikyuu/cpp/libboost_atomic.so +0 -0
- hikyuu/cpp/libboost_atomic.so.1.90.0 +0 -0
- hikyuu/cpp/libboost_charconv.so +0 -0
- hikyuu/cpp/libboost_charconv.so.1.90.0 +0 -0
- hikyuu/cpp/libboost_chrono.so +0 -0
- hikyuu/cpp/libboost_chrono.so.1.90.0 +0 -0
- hikyuu/cpp/libboost_container.so +0 -0
- hikyuu/cpp/libboost_container.so.1.90.0 +0 -0
- hikyuu/cpp/libboost_date_time.so +0 -0
- hikyuu/cpp/libboost_date_time.so.1.90.0 +0 -0
- hikyuu/cpp/libboost_locale.so +0 -0
- hikyuu/cpp/libboost_locale.so.1.90.0 +0 -0
- hikyuu/cpp/libboost_random.so +0 -0
- hikyuu/cpp/libboost_random.so.1.90.0 +0 -0
- hikyuu/cpp/libboost_serialization.so +0 -0
- hikyuu/cpp/libboost_serialization.so.1.90.0 +0 -0
- hikyuu/cpp/libboost_thread.so +0 -0
- hikyuu/cpp/libboost_thread.so.1.90.0 +0 -0
- hikyuu/cpp/libboost_wserialization.so +0 -0
- hikyuu/cpp/libboost_wserialization.so.1.90.0 +0 -0
- hikyuu/cpp/libhikyuu.so +0 -0
- hikyuu/cpp/libhku_hdf5.so +0 -0
- hikyuu/cpp/libhku_hdf5.so.200 +0 -0
- hikyuu/cpp/libhku_hdf5.so.200.2.0 +0 -0
- hikyuu/cpp/libhku_hdf5_cpp.so +0 -0
- hikyuu/cpp/libhku_hdf5_cpp.so.200 +0 -0
- hikyuu/cpp/libhku_hdf5_cpp.so.200.2.0 +0 -0
- hikyuu/cpp/libhku_hdf5_hl.so +0 -0
- hikyuu/cpp/libhku_hdf5_hl.so.200 +0 -0
- hikyuu/cpp/libhku_hdf5_hl.so.200.1.0 +0 -0
- hikyuu/cpp/libhku_hdf5_hl_cpp.so +0 -0
- hikyuu/cpp/libhku_hdf5_hl_cpp.so.200 +0 -0
- hikyuu/cpp/libhku_hdf5_hl_cpp.so.200.1.0 +0 -0
- hikyuu/cpp/libhku_hdf5_tools.so +0 -0
- hikyuu/cpp/libhku_hdf5_tools.so.200 +0 -0
- hikyuu/cpp/libhku_hdf5_tools.so.200.1.1 +0 -0
- hikyuu/cpp/libsqlite3.so +0 -0
- hikyuu/data/clickhouse_upgrade/0001.sql +2 -0
- hikyuu/data/clickhouse_upgrade/createdb.sql +105 -105
- hikyuu/data/common.py +3 -3
- hikyuu/data/common_clickhouse.py +1 -3
- hikyuu/data/download_block.py +351 -0
- hikyuu/data/em_block_to_clickhouse.py +26 -74
- hikyuu/data/em_block_to_mysql.py +25 -75
- hikyuu/data/em_block_to_sqlite.py +26 -78
- hikyuu/data/hku_config_template.py +33 -6
- hikyuu/data/mysql_upgrade/0029.sql +2 -0
- hikyuu/data/pytdx_to_clickhouse.py +96 -38
- hikyuu/data/pytdx_to_h5.py +78 -29
- hikyuu/data/pytdx_to_mysql.py +69 -21
- hikyuu/data/pytdx_weight_to_clickhouse.py +3 -1
- hikyuu/data/pytdx_weight_to_mysql.py +3 -1
- hikyuu/data/pytdx_weight_to_sqlite.py +3 -1
- hikyuu/data/sqlite_upgrade/0029.sql +4 -0
- hikyuu/data/tdx_to_clickhouse.py +2 -2
- hikyuu/data/tdx_to_h5.py +11 -11
- hikyuu/data/tdx_to_mysql.py +2 -2
- hikyuu/data/zh_bond10_to_clickhouse.py +1 -1
- hikyuu/draw/__init__.pyi +1 -1
- hikyuu/draw/drawplot/__init__.pyi +8 -8
- hikyuu/draw/drawplot/bokeh_draw.pyi +610 -583
- hikyuu/draw/drawplot/common.pyi +1 -1
- hikyuu/draw/drawplot/echarts_draw.pyi +612 -585
- hikyuu/draw/drawplot/matplotlib_draw.py +12 -76
- hikyuu/draw/drawplot/matplotlib_draw.pyi +623 -596
- hikyuu/draw/elder.pyi +11 -11
- hikyuu/draw/kaufman.pyi +18 -18
- hikyuu/draw/volume.pyi +10 -10
- hikyuu/examples/notebook/Demo/Demo1.ipynb +48 -33
- hikyuu/extend.py +0 -7
- hikyuu/extend.pyi +599 -573
- hikyuu/fetcher/stock/zh_block_em.py +12 -40
- hikyuu/gui/HikyuuTDX.py +140 -33
- hikyuu/gui/data/CollectSpotThread.py +1 -1
- hikyuu/gui/data/EscapetimeThread.py +8 -14
- hikyuu/gui/data/ImportBlockInfoTask.py +3 -10
- hikyuu/gui/data/MainWindow.py +1300 -761
- hikyuu/gui/data/SchedImportThread.py +2 -2
- hikyuu/gui/data/UsePytdxImportToH5Thread.py +3 -3
- hikyuu/gui/data/UseQmtImportToH5Thread.py +2 -2
- hikyuu/gui/data/UseTdxImportToH5Thread.py +3 -3
- hikyuu/gui/data/tool.py +32 -25
- hikyuu/gui/dataserver.py +5 -3
- hikyuu/gui/images/liandongxiaopu.png +0 -0
- hikyuu/gui/importdata.py +4 -0
- hikyuu/hub.pyi +6 -6
- hikyuu/include/hikyuu/DataType.h +4 -16
- hikyuu/include/hikyuu/KData.h +6 -3
- hikyuu/include/hikyuu/KDataPrivatedBufferImp.h +1 -1
- hikyuu/include/hikyuu/KDataSharedBufferImp.h +1 -1
- hikyuu/include/hikyuu/KQuery.h +2 -2
- hikyuu/include/hikyuu/Stock.h +4 -1
- hikyuu/include/hikyuu/StockManager.h +29 -4
- hikyuu/include/hikyuu/StrategyContext.h +4 -4
- hikyuu/include/hikyuu/data_driver/BaseInfoDriver.h +9 -0
- hikyuu/include/hikyuu/data_driver/BlockInfoDriver.h +6 -0
- hikyuu/include/hikyuu/data_driver/KDataDriver.h +24 -1
- hikyuu/include/hikyuu/data_driver/base_info/mysql/MySQLBaseInfoDriver.h +1 -1
- hikyuu/include/hikyuu/data_driver/base_info/sqlite/SQLiteBaseInfoDriver.h +1 -1
- hikyuu/include/hikyuu/data_driver/block_info/mysql/MySQLBlockInfoDriver.h +2 -1
- hikyuu/include/hikyuu/data_driver/block_info/qianlong/QLBlockInfoDriver.h +2 -1
- hikyuu/include/hikyuu/data_driver/block_info/sqlite/SQLiteBlockInfoDriver.h +2 -1
- hikyuu/include/hikyuu/data_driver/kdata/DoNothingKDataDriver.h +1 -1
- hikyuu/include/hikyuu/data_driver/kdata/cvs/KDataTempCsvDriver.h +1 -1
- hikyuu/include/hikyuu/data_driver/kdata/hdf5/H5KDataDriver.h +1 -1
- hikyuu/include/hikyuu/data_driver/kdata/mysql/MySQLKDataDriver.h +6 -2
- hikyuu/include/hikyuu/data_driver/kdata/sqlite/SQLiteKDataDriver.h +2 -2
- hikyuu/include/hikyuu/data_driver/kdata/tdx/TdxKDataDriver.h +1 -1
- hikyuu/include/hikyuu/global/sysinfo.h +24 -5
- hikyuu/include/hikyuu/hikyuu.h +1 -1
- hikyuu/include/hikyuu/indicator/IndicatorImp.h +1 -1
- hikyuu/include/hikyuu/indicator/build_in.h +1 -0
- hikyuu/include/hikyuu/indicator/crt/CYCLE.h +4 -4
- hikyuu/include/hikyuu/indicator/crt/HSL.h +2 -2
- hikyuu/include/hikyuu/indicator/crt/QUANTILE_TRUNC.h +30 -0
- hikyuu/include/hikyuu/indicator/crt/TURNOVER.h +1 -0
- hikyuu/include/hikyuu/indicator/crt/ZSCORE.h +2 -2
- hikyuu/include/hikyuu/indicator/imp/IQuantileTrunc.h +25 -0
- hikyuu/include/hikyuu/lang.h +15 -2
- hikyuu/include/hikyuu/misc.h +38 -0
- hikyuu/include/hikyuu/plugin/KDataToClickHouseImporter.h +40 -0
- hikyuu/include/hikyuu/plugin/KDataToMySQLImporter.h +40 -0
- hikyuu/include/hikyuu/plugin/checkdata.h +20 -0
- hikyuu/include/hikyuu/plugin/dataserver.h +2 -1
- hikyuu/include/hikyuu/plugin/device.h +10 -0
- hikyuu/include/hikyuu/plugin/extind.h +40 -0
- hikyuu/include/hikyuu/plugin/hkuextra.h +1 -17
- hikyuu/include/hikyuu/plugin/interface/CheckDataPluginInterface.h +25 -0
- hikyuu/include/hikyuu/plugin/interface/DataServerPluginInterface.h +2 -2
- hikyuu/include/hikyuu/plugin/interface/DevicePluginInterface.h +2 -0
- hikyuu/include/hikyuu/plugin/interface/ExtendIndicatorsPluginInterface.h +12 -0
- hikyuu/include/hikyuu/plugin/interface/HkuExtraPluginInterface.h +1 -13
- hikyuu/include/hikyuu/plugin/interface/ImportKDataToClickHousePluginInterface.h +44 -0
- hikyuu/include/hikyuu/plugin/interface/ImportKDataToMySQLPluginInterface.h +42 -0
- hikyuu/include/hikyuu/plugin/interface/plugins.h +9 -1
- hikyuu/include/hikyuu/python/convert_any.h +9 -6
- hikyuu/include/hikyuu/python/pybind_utils.h +4 -11
- hikyuu/include/hikyuu/strategy/RunSystemInStrategy.h +3 -0
- hikyuu/include/hikyuu/strategy/Strategy.h +1 -1
- hikyuu/include/hikyuu/trade_manage/Performance.h +4 -4
- hikyuu/include/hikyuu/trade_manage/TradeManagerBase.h +10 -2
- hikyuu/include/hikyuu/trade_manage/TradeRecord.h +2 -1
- hikyuu/include/hikyuu/trade_sys/allocatefunds/AllocateFundsBase.h +0 -1
- hikyuu/include/hikyuu/trade_sys/allocatefunds/build_in.h +1 -0
- hikyuu/include/hikyuu/trade_sys/allocatefunds/crt/AF_FixedAmount.h +26 -0
- hikyuu/include/hikyuu/trade_sys/allocatefunds/imp/FixAmountFunds.h +18 -0
- hikyuu/include/hikyuu/trade_sys/condition/ConditionBase.h +0 -1
- hikyuu/include/hikyuu/trade_sys/environment/EnvironmentBase.h +0 -1
- hikyuu/include/hikyuu/trade_sys/moneymanager/MoneyManagerBase.h +0 -1
- hikyuu/include/hikyuu/trade_sys/moneymanager/imp/FixedCapitalFundsMM.h +0 -4
- hikyuu/include/hikyuu/trade_sys/multifactor/MultiFactorBase.h +36 -4
- hikyuu/include/hikyuu/trade_sys/multifactor/NormalizeBase.h +124 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/ScoresFilterBase.h +124 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/build_in.h +3 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/buildin_norm.h +36 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/buildin_scfilter.h +51 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/filter/GroupSCFilter.h +24 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/filter/IgnoreLessOrEqualValueSCFilter.h +24 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/filter/IgnoreNanSCFilter.h +24 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/filter/MinAmountPercentSCFilter.h +25 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/filter/PriceSCFilter.h +24 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/filter/TopNSCFilter.h +24 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/imp/EqualWeightMultiFactor.h +1 -1
- hikyuu/include/hikyuu/trade_sys/multifactor/imp/ICIRMultiFactor.h +1 -1
- hikyuu/include/hikyuu/trade_sys/multifactor/imp/ICMultiFactor.h +1 -1
- hikyuu/include/hikyuu/trade_sys/multifactor/imp/WeightMultiFactor.h +1 -1
- hikyuu/include/hikyuu/trade_sys/multifactor/normalize/NormMinMax.h +23 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/normalize/NormQuantile.h +28 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/normalize/NormQuantileUniform.h +28 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/normalize/NormZScore.h +25 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/normalize/__init__.py +1 -0
- hikyuu/include/hikyuu/trade_sys/multifactor/normalize/quantile_trunc.h +16 -0
- hikyuu/include/hikyuu/trade_sys/portfolio/Portfolio.h +20 -13
- hikyuu/include/hikyuu/trade_sys/portfolio/imp/SimplePortfolio.h +7 -0
- hikyuu/include/hikyuu/trade_sys/portfolio/imp/WithoutAFPortfolio.h +7 -0
- hikyuu/include/hikyuu/trade_sys/profitgoal/ProfitGoalBase.h +9 -11
- hikyuu/include/hikyuu/trade_sys/selector/SelectorBase.h +49 -1
- hikyuu/include/hikyuu/trade_sys/selector/build_in.h +1 -0
- hikyuu/include/hikyuu/trade_sys/selector/crt/SE_MultiFactor2.h +40 -0
- hikyuu/include/hikyuu/trade_sys/selector/imp/MultiFactorSelector.h +0 -3
- hikyuu/include/hikyuu/trade_sys/selector/imp/MultiFactorSelector2.h +49 -0
- hikyuu/include/hikyuu/trade_sys/selector/imp/logic/OperatorSelector.h +1 -1
- hikyuu/include/hikyuu/trade_sys/selector/imp/logic/OperatorValueSelector.h +1 -1
- hikyuu/include/hikyuu/trade_sys/signal/SignalBase.h +0 -1
- hikyuu/include/hikyuu/trade_sys/signal/imp/BandSignal2.h +0 -4
- hikyuu/include/hikyuu/trade_sys/signal/imp/logic/AddValueSignal.h +2 -2
- hikyuu/include/hikyuu/trade_sys/signal/imp/logic/DivValueSignal.h +2 -2
- hikyuu/include/hikyuu/trade_sys/signal/imp/logic/MulValueSignal.h +2 -2
- hikyuu/include/hikyuu/trade_sys/signal/imp/logic/OperatorSignal.h +1 -1
- hikyuu/include/hikyuu/trade_sys/signal/imp/logic/OperatorValueSignal.h +4 -4
- hikyuu/include/hikyuu/trade_sys/signal/imp/logic/SubValueSignal.h +2 -2
- hikyuu/include/hikyuu/trade_sys/slippage/SlippageBase.h +0 -1
- hikyuu/include/hikyuu/trade_sys/slippage/build_in.h +5 -1
- hikyuu/include/hikyuu/trade_sys/slippage/crt/SP_LogNormal.h +22 -0
- hikyuu/include/hikyuu/trade_sys/slippage/crt/SP_Normal.h +22 -0
- hikyuu/include/hikyuu/trade_sys/slippage/crt/SP_TruncNormal.h +25 -0
- hikyuu/include/hikyuu/trade_sys/slippage/crt/SP_Uniform.h +23 -0
- hikyuu/include/hikyuu/trade_sys/slippage/imp/LogNormalSlippage.h +28 -0
- hikyuu/include/hikyuu/trade_sys/slippage/imp/NormalSlippage.h +28 -0
- hikyuu/include/hikyuu/trade_sys/slippage/imp/TruncNormalSlippage.h +28 -0
- hikyuu/include/hikyuu/trade_sys/slippage/imp/UniformSlippage.h +24 -0
- hikyuu/include/hikyuu/trade_sys/stoploss/StoplossBase.h +0 -1
- hikyuu/include/hikyuu/trade_sys/system/System.h +15 -3
- hikyuu/include/hikyuu/utilities/Log.h +6 -7
- hikyuu/include/hikyuu/utilities/Parameter.h +17 -0
- hikyuu/include/hikyuu/utilities/SpendTimer.h +17 -7
- hikyuu/include/hikyuu/utilities/arithmetic.h +55 -0
- hikyuu/include/hikyuu/utilities/config.h +28 -0
- hikyuu/include/hikyuu/utilities/db_connect/mysql/MySQLConnect.h +1 -1
- hikyuu/include/hikyuu/utilities/db_connect/mysql/MySQLStatement.h +1 -1
- hikyuu/include/hikyuu/utilities/db_connect/sqlite/SQLiteConnect.h +1 -1
- hikyuu/include/hikyuu/utilities/db_connect/sqlite/SQLiteStatement.h +1 -1
- hikyuu/include/hikyuu/utilities/plugin/PluginBase.h +17 -2
- hikyuu/include/hikyuu/utilities/plugin/PluginLoader.h +4 -1
- hikyuu/include/hikyuu/utilities/plugin/PluginManager.h +41 -22
- hikyuu/include/hikyuu/utilities/thread/GlobalStealThreadPool.h +1 -2
- hikyuu/include/hikyuu/utilities/thread/GlobalThreadPool.h +1 -1
- hikyuu/include/hikyuu/utilities/thread/MQStealThreadPool.h +286 -0
- hikyuu/include/hikyuu/utilities/thread/MQThreadPool.h +1 -0
- hikyuu/include/hikyuu/utilities/thread/StealThreadPool.h +297 -0
- hikyuu/include/hikyuu/utilities/thread/ThreadPool.h +1 -0
- hikyuu/include/hikyuu/utilities/thread/WorkStealQueue.h +9 -8
- hikyuu/include/hikyuu/utilities/thread/algorithm.h +64 -14
- hikyuu/include/hikyuu/version.h +5 -5
- hikyuu/plugin/libbacktest.so +0 -0
- hikyuu/plugin/libcheckdata.so +0 -0
- hikyuu/plugin/libclickhousedriver.so +0 -0
- hikyuu/plugin/libdataserver.so +0 -0
- hikyuu/{cpp/core39.so → plugin/libdataserver_parquet.so} +0 -0
- hikyuu/plugin/libdevice.so +0 -0
- hikyuu/plugin/libextind.so +0 -0
- hikyuu/plugin/libhkuextra.so +0 -0
- hikyuu/plugin/libimport2ch.so +0 -0
- hikyuu/plugin/libimport2hdf5.so +0 -0
- hikyuu/plugin/libimport2mysql.so +0 -0
- hikyuu/plugin/libtmreport.so +0 -0
- hikyuu/trade_manage/__init__.pyi +607 -582
- hikyuu/trade_manage/broker.pyi +3 -3
- hikyuu/trade_manage/broker_easytrader.pyi +1 -1
- hikyuu/trade_manage/trade.py +0 -2
- hikyuu/trade_manage/trade.pyi +607 -582
- hikyuu/trade_sys/trade_sys.py +54 -5
- hikyuu/util/__init__.pyi +2 -2
- hikyuu/util/singleton.pyi +1 -1
- {hikyuu-2.6.8.3.dist-info → hikyuu-2.7.3.dist-info}/METADATA +42 -32
- {hikyuu-2.6.8.3.dist-info → hikyuu-2.7.3.dist-info}/RECORD +267 -212
- {hikyuu-2.6.8.3.dist-info → hikyuu-2.7.3.dist-info}/top_level.txt +2 -2
- hikyuu/cpp/core39.pyi +0 -14190
- hikyuu/data/pytdx_to_taos.py +0 -736
- hikyuu/data_driver/__init__.py +0 -49
- hikyuu/data_driver/jqdata_data_driver.py +0 -277
- hikyuu/data_driver/pytdx_data_driver.py +0 -292
- hikyuu/fetcher/stock/zh_stock_a_huatai.py +0 -51
- hikyuu/fetcher/stock/zh_stock_a_pytdx.py +0 -129
- hikyuu/gui/data/CollectToMemThread.py +0 -123
- hikyuu/gui/data/CollectToMySQLThread.py +0 -178
- hikyuu/gui/start_huatai_insight.py +0 -510
- hikyuu/include/hikyuu/views/arrow_common.h +0 -38
- hikyuu/include/hikyuu/views/arrow_views.h +0 -117
- hikyuu/tools/update_block_info.py +0 -168
- /hikyuu/include/hikyuu/{views → trade_sys/multifactor/filter}/__init__.py +0 -0
- {hikyuu-2.6.8.3.dist-info → hikyuu-2.7.3.dist-info}/WHEEL +0 -0
- {hikyuu-2.6.8.3.dist-info → hikyuu-2.7.3.dist-info}/entry_points.txt +0 -0
|
@@ -377,8 +377,14 @@ def iplot(
|
|
|
377
377
|
if not label:
|
|
378
378
|
label = "%s %.2f" % (indicator.long_name, indicator[-1])
|
|
379
379
|
|
|
380
|
-
|
|
381
|
-
|
|
380
|
+
#解决缺值时无法绘图的问题 by stone 20251217
|
|
381
|
+
#py_indicatr = [None if x == constant.null_price else x for x in indicator]
|
|
382
|
+
#axes.plot(py_indicatr, linestyle=linestyle, label=label, *args, **kwargs)
|
|
383
|
+
|
|
384
|
+
py_indicatr = np.array([None if x == constant.null_price else x for x in indicator])
|
|
385
|
+
py_x = np.arange(len(py_indicatr))
|
|
386
|
+
imask = np.isfinite(py_indicatr)
|
|
387
|
+
axes.plot(py_x[imask], py_indicatr[imask], linestyle=linestyle, label=label, *args, **kwargs)
|
|
382
388
|
|
|
383
389
|
if legend_on:
|
|
384
390
|
leg = axes.legend(loc='upper left')
|
|
@@ -866,7 +872,6 @@ def tm_performance(tm: TradeManager, query: Query, ref_stk: Stock = None):
|
|
|
866
872
|
funds = VALUE(funds)
|
|
867
873
|
funds_return = [f.total_assets / f.total_base if f.total_base != 0.0 else constant.null_price for f in funds_list]
|
|
868
874
|
funds_return = VALUE(funds_return, align_dates=ref_dates)
|
|
869
|
-
funds_return.name = "系统累积收益率"
|
|
870
875
|
ref_return = ALIGN(ROCR(ref_k.close, 0), ref_dates)
|
|
871
876
|
ref_return.name = f"{ref_stk.name}({ref_stk.market_code})"
|
|
872
877
|
|
|
@@ -897,8 +902,8 @@ def tm_performance(tm: TradeManager, query: Query, ref_stk: Stock = None):
|
|
|
897
902
|
ax1 = fg.add_subplot(gs[:4, :3])
|
|
898
903
|
ax2 = fg.add_subplot(gs[:, 3:])
|
|
899
904
|
ax3 = fg.add_subplot(gs[4:, :3])
|
|
900
|
-
ref_return.plot(axes=ax1, legend_on=True)
|
|
901
|
-
funds_return.plot(axes=ax1, legend_on=True)
|
|
905
|
+
ref_return.plot(axes=ax1, legend_on=True, label=f'{ref_stk.name}({ref_stk.market_code}) 收益曲线')
|
|
906
|
+
funds_return.plot(axes=ax1, legend_on=True, label=f'{tm.name} 累积收益率 {funds_return[-1]*100.:<.2f}%')
|
|
902
907
|
ax1.set_title(f"账户({tm.name}) 累积收益率")
|
|
903
908
|
label = t1 + '\n\n' + t2 + '\n\n' + t3
|
|
904
909
|
ax2.text(0,
|
|
@@ -923,6 +928,7 @@ def tm_performance(tm: TradeManager, query: Query, ref_stk: Stock = None):
|
|
|
923
928
|
ax3.xaxis.set_visible(False)
|
|
924
929
|
ax3.yaxis.set_visible(False)
|
|
925
930
|
ax3.set_frame_on(False)
|
|
931
|
+
return ax1 # 返回主图axis
|
|
926
932
|
|
|
927
933
|
|
|
928
934
|
def sys_performance(sys, ref_stk=None):
|
|
@@ -937,77 +943,7 @@ def sys_performance(sys, ref_stk=None):
|
|
|
937
943
|
ref_stk = get_stock('sh000300')
|
|
938
944
|
|
|
939
945
|
query = sys.query
|
|
940
|
-
|
|
941
|
-
ref_dates = sh000001_k.get_datetime_list()
|
|
942
|
-
|
|
943
|
-
ref_k = ref_stk.get_kdata(query)
|
|
944
|
-
|
|
945
|
-
funds_list = sys.tm.get_funds_list(ref_dates)
|
|
946
|
-
funds = [f.total_assets for f in funds_list]
|
|
947
|
-
funds = VALUE(funds)
|
|
948
|
-
funds_return = [f.total_assets / f.total_base if f.total_base != 0.0 else constant.null_price for f in funds_list]
|
|
949
|
-
funds_return = VALUE(funds_return, align_dates=ref_dates)
|
|
950
|
-
funds_return.name = "系统累积收益率"
|
|
951
|
-
ref_return = ALIGN(ROCR(ref_k.close, 0), ref_dates)
|
|
952
|
-
ref_return.name = f"{ref_stk.name}({ref_stk.market_code})"
|
|
953
|
-
|
|
954
|
-
per = sys.tm.get_performance(sh000001_k[-1].datetime)
|
|
955
|
-
text = per.report()
|
|
956
|
-
|
|
957
|
-
# 计算最大回撤
|
|
958
|
-
max_pullback = min(MDD(funds))
|
|
959
|
-
|
|
960
|
-
# 计算 sharp
|
|
961
|
-
bond = ZHBOND10(ref_dates)
|
|
962
|
-
sigma = STDEV(ROCP(funds), len(ref_dates))
|
|
963
|
-
sigma = 15.874507866387544 * sigma[-1] # 15.874 = sqrt(252)
|
|
964
|
-
sharp = (per['帐户平均年收益率%'] - bond[-1]) * 0.01 / sigma if sigma != 0.0 else 0.0
|
|
965
|
-
|
|
966
|
-
invest_total = per['累计投入本金'] + per['累计投入资产']
|
|
967
|
-
cur_fund = per['当前总资产']
|
|
968
|
-
t1 = '投入总资产: {:<.2f} 当前总资产: {:<.2f} 当前盈利: {:<.2f}'.format(
|
|
969
|
-
invest_total, cur_fund, cur_fund - invest_total)
|
|
970
|
-
t2 = '当前策略收益: {:<.2f}% 年化收益率: {:<.2f}% 最大回撤: {:<.2f}%'.format(
|
|
971
|
-
funds_return[-1]*100 - 100, per["帐户平均年收益率%"], max_pullback)
|
|
972
|
-
t3 = '系统胜率: {:<.2f}% 盈/亏比: 1 : {:<.2f} 夏普比率: {:<.2f}'.format(
|
|
973
|
-
per['赢利交易比例%'], per['净赢利/亏损比例'], sharp)
|
|
974
|
-
|
|
975
|
-
import matplotlib.pyplot as plt
|
|
976
|
-
fg = plt.figure(figsize=(15, 10))
|
|
977
|
-
gs = fg.add_gridspec(5, 4)
|
|
978
|
-
ax1 = fg.add_subplot(gs[:4, :3])
|
|
979
|
-
ax2 = fg.add_subplot(gs[:, 3:])
|
|
980
|
-
ax3 = fg.add_subplot(gs[4:, :3])
|
|
981
|
-
ref_return.plot(axes=ax1, legend_on=True)
|
|
982
|
-
funds_return.plot(axes=ax1, legend_on=True)
|
|
983
|
-
if isinstance(sys, System):
|
|
984
|
-
stk = sys.get_stock()
|
|
985
|
-
ax1.set_title(f"{sys.name} {stk.name}({stk.market_code}) 累积收益率")
|
|
986
|
-
else:
|
|
987
|
-
ax1.set_title(f"{sys.name} 累积收益率")
|
|
988
|
-
label = t1 + '\n\n' + t2 + '\n\n' + t3
|
|
989
|
-
ax2.text(0,
|
|
990
|
-
1,
|
|
991
|
-
text,
|
|
992
|
-
horizontalalignment='left',
|
|
993
|
-
verticalalignment='top',
|
|
994
|
-
transform=ax2.transAxes,
|
|
995
|
-
# color='r'
|
|
996
|
-
)
|
|
997
|
-
ax3.text(0.02,
|
|
998
|
-
0.9,
|
|
999
|
-
label,
|
|
1000
|
-
horizontalalignment='left',
|
|
1001
|
-
verticalalignment='top',
|
|
1002
|
-
transform=ax3.transAxes,
|
|
1003
|
-
# color='r'
|
|
1004
|
-
)
|
|
1005
|
-
ax2.xaxis.set_visible(False)
|
|
1006
|
-
ax2.yaxis.set_visible(False)
|
|
1007
|
-
ax2.set_frame_on(False)
|
|
1008
|
-
ax3.xaxis.set_visible(False)
|
|
1009
|
-
ax3.yaxis.set_visible(False)
|
|
1010
|
-
ax3.set_frame_on(False)
|
|
946
|
+
return tm_performance(sys.tm, query, ref_stk)
|
|
1011
947
|
|
|
1012
948
|
|
|
1013
949
|
def tm_heatmap(tm, start_date, end_date=None, axes=None):
|