hikyuu 2.5.2__py3-none-win_amd64.whl → 2.5.5__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.
- hikyuu/__init__.py +5 -1
- hikyuu/__init__.pyi +522 -511
- hikyuu/analysis/__init__.pyi +490 -485
- hikyuu/analysis/analysis.pyi +491 -486
- hikyuu/core.pyi +492 -487
- hikyuu/cpp/__init__.pyi +2 -2
- hikyuu/cpp/core310.pyd +0 -0
- hikyuu/cpp/core310.pyi +249 -26
- hikyuu/cpp/core311.pyd +0 -0
- hikyuu/cpp/core311.pyi +249 -26
- hikyuu/cpp/core312.pyd +0 -0
- hikyuu/cpp/core312.pyi +249 -26
- hikyuu/cpp/core313.pyd +0 -0
- hikyuu/cpp/core313.pyi +243 -26
- hikyuu/cpp/core38.pyd +0 -0
- hikyuu/cpp/core38.pyi +249 -26
- hikyuu/cpp/core39.pyd +0 -0
- hikyuu/cpp/core39.pyi +249 -26
- hikyuu/cpp/hikyuu.dll +0 -0
- hikyuu/cpp/hikyuu.lib +0 -0
- hikyuu/data/mysql_upgrade/0027.sql +6 -0
- hikyuu/data/pytdx_to_h5.py +7 -4
- hikyuu/data/pytdx_to_mysql.py +7 -4
- hikyuu/data/sqlite_upgrade/0027.sql +8 -0
- hikyuu/draw/drawplot/__init__.py +8 -1
- hikyuu/draw/drawplot/__init__.pyi +11 -7
- hikyuu/draw/drawplot/bokeh_draw.pyi +509 -500
- hikyuu/draw/drawplot/common.pyi +1 -1
- hikyuu/draw/drawplot/echarts_draw.pyi +511 -502
- hikyuu/draw/drawplot/matplotlib_draw.py +129 -8
- hikyuu/draw/drawplot/matplotlib_draw.pyi +571 -515
- hikyuu/draw/elder.pyi +11 -11
- hikyuu/draw/kaufman.pyi +18 -18
- hikyuu/draw/volume.pyi +10 -10
- hikyuu/extend.pyi +501 -495
- hikyuu/fetcher/stock/zh_block_em.py +18 -7
- hikyuu/hub.py +112 -6
- hikyuu/hub.pyi +39 -13
- hikyuu/include/hikyuu/DataType.h +1 -2
- hikyuu/include/hikyuu/StockManager.h +2 -1
- hikyuu/include/hikyuu/StrategyContext.h +12 -3
- hikyuu/include/hikyuu/indicator/Indicator.h +24 -0
- hikyuu/include/hikyuu/indicator/Indicator2InImp.h +1 -0
- hikyuu/include/hikyuu/indicator/build_in.h +2 -0
- hikyuu/include/hikyuu/indicator/crt/ATR.h +2 -13
- hikyuu/include/hikyuu/indicator/crt/BARSSINCE.h +14 -2
- hikyuu/include/hikyuu/indicator/crt/KALMAN.h +30 -0
- hikyuu/include/hikyuu/indicator/crt/TR.h +32 -0
- hikyuu/include/hikyuu/indicator/imp/IAtr.h +3 -1
- hikyuu/include/hikyuu/indicator/imp/IBarsSince.h +6 -0
- hikyuu/include/hikyuu/indicator/imp/IKalman.h +27 -0
- hikyuu/include/hikyuu/indicator/imp/ITr.h +35 -0
- hikyuu/include/hikyuu/python/convert_any.h +299 -0
- hikyuu/include/hikyuu/trade_manage/PositionRecord.h +5 -4
- hikyuu/include/hikyuu/trade_sys/allocatefunds/crt/AF_MultiFactor.h +1 -1
- hikyuu/include/hikyuu/trade_sys/allocatefunds/imp/MultiFactorAllocaterFunds.h +3 -0
- hikyuu/include/hikyuu/trade_sys/condition/ConditionBase.h +4 -1
- hikyuu/include/hikyuu/trade_sys/condition/imp/{SubCondition.h → logic/SubCondition.h} +1 -1
- hikyuu/include/hikyuu/trade_sys/environment/EnvironmentBase.h +20 -6
- hikyuu/include/hikyuu/trade_sys/environment/build_in.h +1 -0
- hikyuu/include/hikyuu/trade_sys/environment/crt/EV_Logic.h +35 -0
- hikyuu/include/hikyuu/trade_sys/environment/imp/logic/AddEnvironment.h +42 -0
- hikyuu/include/hikyuu/trade_sys/environment/imp/logic/AndEnvironment.h +42 -0
- hikyuu/include/hikyuu/trade_sys/environment/imp/logic/DivEnvironment.h +42 -0
- hikyuu/include/hikyuu/trade_sys/environment/imp/logic/MultiEnvironment.h +42 -0
- hikyuu/include/hikyuu/trade_sys/environment/imp/logic/OrEnvironment.h +42 -0
- hikyuu/include/hikyuu/trade_sys/environment/imp/logic/SubEnvironment.h +42 -0
- hikyuu/include/hikyuu/trade_sys/environment/imp/logic/__init__.py +1 -0
- hikyuu/include/hikyuu/trade_sys/portfolio/Portfolio.h +0 -4
- hikyuu/include/hikyuu/trade_sys/signal/crt/SG_Logic.h +68 -7
- hikyuu/include/hikyuu/trade_sys/signal/imp/logic/AndSignal.h +19 -0
- hikyuu/include/hikyuu/trade_sys/signal/imp/logic/OperatorSignal.h +1 -0
- hikyuu/include/hikyuu/trade_sys/signal/imp/logic/OperatorValueSignal.h +1 -0
- hikyuu/include/hikyuu/trade_sys/signal/imp/logic/OrSignal.h +19 -0
- hikyuu/include/hikyuu/utilities/datetime/Datetime.h +2 -1
- hikyuu/include/hikyuu/version.h +4 -4
- hikyuu/indicator/indicator.py +1 -0
- hikyuu/trade_manage/__init__.pyi +506 -499
- hikyuu/trade_manage/broker.pyi +3 -3
- hikyuu/trade_manage/broker_easytrader.pyi +1 -1
- hikyuu/trade_manage/trade.pyi +506 -499
- hikyuu/trade_sys/trade_sys.py +4 -3
- hikyuu/util/__init__.pyi +1 -1
- hikyuu/util/singleton.pyi +1 -1
- {hikyuu-2.5.2.dist-info → hikyuu-2.5.5.dist-info}/METADATA +3 -2
- {hikyuu-2.5.2.dist-info → hikyuu-2.5.5.dist-info}/RECORD +90 -73
- {hikyuu-2.5.2.dist-info → hikyuu-2.5.5.dist-info}/top_level.txt +1 -0
- {hikyuu-2.5.2.dist-info → hikyuu-2.5.5.dist-info}/LICENSE +0 -0
- {hikyuu-2.5.2.dist-info → hikyuu-2.5.5.dist-info}/WHEEL +0 -0
- {hikyuu-2.5.2.dist-info → hikyuu-2.5.5.dist-info}/entry_points.txt +0 -0
hikyuu/cpp/core39.pyi
CHANGED
|
@@ -1,11 +1,36 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
import numpy
|
|
3
3
|
import typing
|
|
4
|
-
__all__ = ['ABS', 'ACOS', 'AD', 'ADVANCE', 'AF_EqualWeight', 'AF_FixedWeight', 'AF_FixedWeightList', 'AF_MultiFactor', 'ALIGN', 'AMA', 'ASIN', 'ATAN', 'ATR', 'AVEDEV', 'AllocateFundsBase', 'BACKSET', 'BARSCOUNT', 'BARSLAST', 'BARSSINCE', 'BETWEEN', 'BLOCKSETNUM', 'BUSINESS', 'Block', 'BlockInfoDriver', 'BorrowRecord', 'BrokerPositionRecord', 'CEILING', 'CN_Bool', 'CN_OPLine', 'CONTEXT', 'CONTEXT_K', 'CORR', 'COS', 'COST', 'COUNT', 'CROSS', 'CVAL', 'CYCLE', 'C_AMO', 'C_CLOSE', 'C_HIGH', 'C_KDATA', 'C_LOW', 'C_OPEN', 'C_VOL', 'ConditionBase', 'Constant', 'CostRecord', 'DATE', 'DAY', 'DEBUG', 'DECLINE', 'DEVSQ', 'DIFF', 'DIRECT', 'DISCARD', 'DMA', 'DOWNNDAY', 'DROPNA', 'DataDriverFactory', 'Datetime', 'DatetimeList', 'Days', 'EMA', 'ERROR', 'EVERY', 'EV_Bool', 'EV_TwoLine', 'EXIST', 'EXP', 'EnvironmentBase', 'FATAL', 'FILTER', 'FINANCE', 'FLOOR', 'FundsRecord', 'HHV', 'HHVBARS', 'HKUException', 'HOUR', 'HSL', 'Hours', 'IC', 'ICIR', 'IF', 'INBLOCK', 'INDEXA', 'INDEXADV', 'INDEXC', 'INDEXDEC', 'INDEXH', 'INDEXL', 'INDEXO', 'INDEXV', 'INFO', 'INSUM', 'INTPART', 'IR', 'ISINF', 'ISINFA', 'ISLASTBAR', 'ISNA', 'IndParam', 'Indicator', 'IndicatorImp', 'JUMPDOWN', 'JUMPUP', 'KDATA_PART', 'KData', 'KDataDriver', 'KRecord', 'KRecordList', 'LAST', 'LASTVALUE', 'LIUTONGPAN', 'LLV', 'LLVBARS', 'LN', 'LOG', 'LOG_LEVEL', 'LONGCROSS', 'LoanRecord', 'MA', 'MACD', 'MAX', 'MDD', 'MF_EqualWeight', 'MF_ICIRWeight', 'MF_ICWeight', 'MF_Weight', 'MIN', 'MINUTE', 'MM_FixedCapital', 'MM_FixedCapitalFunds', 'MM_FixedCount', 'MM_FixedCountTps', 'MM_FixedPercent', 'MM_FixedRisk', 'MM_FixedUnits', 'MM_Nothing', 'MM_WilliamsFixedRisk', 'MOD', 'MONTH', 'MRR', 'MarketInfo', 'Microseconds', 'Milliseconds', 'Minutes', 'MoneyManagerBase', 'MultiFactorBase', 'NDAY', 'NOT', 'OFF', 'OrderBrokerBase', 'PF_Simple', 'PF_WithoutAF', 'PG_FixedHoldDays', 'PG_FixedPercent', 'PG_NoGoal', 'POS', 'POW', 'PRICELIST', 'Parameter', 'Performance', 'Portfolio', 'PositionRecord', 'PositionRecordList', 'ProfitGoalBase', 'Query', 'RECOVER_BACKWARD', 'RECOVER_EQUAL_BACKWARD', 'RECOVER_EQUAL_FORWARD', 'RECOVER_FORWARD', 'REF', 'REPLACE', 'RESULT', 'REVERSE', 'ROC', 'ROCP', 'ROCR', 'ROCR100', 'ROUND', 'ROUNDDOWN', 'ROUNDUP', 'RSI', 'SAFTYLOSS', 'SE_Fixed', 'SE_MaxFundsOptimal', 'SE_MultiFactor', 'SE_PerformanceOptimal', 'SE_Signal', 'SGN', 'SG_Add', 'SG_AllwaysBuy', 'SG_Band', 'SG_Bool', 'SG_Buy', 'SG_Cross', 'SG_CrossGold', 'SG_Cycle', 'SG_Div', 'SG_Flex', 'SG_Mul', 'SG_OneSide', 'SG_Sell', 'SG_Single', 'SG_Single2', 'SG_Sub', 'SIN', 'SLICE', 'SLOPE', 'SMA', 'SPEARMAN', 'SP_FixedPercent', 'SP_FixedValue', 'SQRT', 'STDEV', 'STDP', 'ST_FixedPercent', 'ST_Indicator', 'ST_Saftyloss', 'SUM', 'SUMBARS', 'SYS_Simple', 'SYS_WalkForward', 'ScoreRecord', 'ScoreRecordList', 'Seconds', 'SelectorBase', 'SignalBase', 'SlippageBase', 'SpotRecord', 'Stock', 'StockManager', 'StockTypeInfo', 'StockWeight', 'StockWeightList', 'StoplossBase', 'Strategy', 'StrategyContext', 'System', 'SystemPart', 'SystemWeight', 'SystemWeightList', 'TAN', 'TA_ACCBANDS', 'TA_ACOS', 'TA_AD', 'TA_ADD', 'TA_ADOSC', 'TA_ADX', 'TA_ADXR', 'TA_APO', 'TA_AROON', 'TA_AROONOSC', 'TA_ASIN', 'TA_ATAN', 'TA_ATR', 'TA_AVGDEV', 'TA_AVGPRICE', 'TA_BBANDS', 'TA_BETA', 'TA_BOP', 'TA_CCI', 'TA_CDL2CROWS', 'TA_CDL3BLACKCROWS', 'TA_CDL3INSIDE', 'TA_CDL3LINESTRIKE', 'TA_CDL3OUTSIDE', 'TA_CDL3STARSINSOUTH', 'TA_CDL3WHITESOLDIERS', 'TA_CDLABANDONEDBABY', 'TA_CDLADVANCEBLOCK', 'TA_CDLBELTHOLD', 'TA_CDLBREAKAWAY', 'TA_CDLCLOSINGMARUBOZU', 'TA_CDLCONCEALBABYSWALL', 'TA_CDLCOUNTERATTACK', 'TA_CDLDARKCLOUDCOVER', 'TA_CDLDOJI', 'TA_CDLDOJISTAR', 'TA_CDLDRAGONFLYDOJI', 'TA_CDLENGULFING', 'TA_CDLEVENINGDOJISTAR', 'TA_CDLEVENINGSTAR', 'TA_CDLGAPSIDESIDEWHITE', 'TA_CDLGRAVESTONEDOJI', 'TA_CDLHAMMER', 'TA_CDLHANGINGMAN', 'TA_CDLHARAMI', 'TA_CDLHARAMICROSS', 'TA_CDLHIGHWAVE', 'TA_CDLHIKKAKE', 'TA_CDLHIKKAKEMOD', 'TA_CDLHOMINGPIGEON', 'TA_CDLIDENTICAL3CROWS', 'TA_CDLINNECK', 'TA_CDLINVERTEDHAMMER', 'TA_CDLKICKING', 'TA_CDLKICKINGBYLENGTH', 'TA_CDLLADDERBOTTOM', 'TA_CDLLONGLEGGEDDOJI', 'TA_CDLLONGLINE', 'TA_CDLMARUBOZU', 'TA_CDLMATCHINGLOW', 'TA_CDLMATHOLD', 'TA_CDLMORNINGDOJISTAR', 'TA_CDLMORNINGSTAR', 'TA_CDLONNECK', 'TA_CDLPIERCING', 'TA_CDLRICKSHAWMAN', 'TA_CDLRISEFALL3METHODS', 'TA_CDLSEPARATINGLINES', 'TA_CDLSHOOTINGSTAR', 'TA_CDLSHORTLINE', 'TA_CDLSPINNINGTOP', 'TA_CDLSTALLEDPATTERN', 'TA_CDLSTICKSANDWICH', 'TA_CDLTAKURI', 'TA_CDLTASUKIGAP', 'TA_CDLTHRUSTING', 'TA_CDLTRISTAR', 'TA_CDLUNIQUE3RIVER', 'TA_CDLUPSIDEGAP2CROWS', 'TA_CDLXSIDEGAP3METHODS', 'TA_CEIL', 'TA_CMO', 'TA_CORREL', 'TA_COS', 'TA_COSH', 'TA_DEMA', 'TA_DIV', 'TA_DX', 'TA_EMA', 'TA_EXP', 'TA_FLOOR', 'TA_HT_DCPERIOD', 'TA_HT_DCPHASE', 'TA_HT_PHASOR', 'TA_HT_SINE', 'TA_HT_TRENDLINE', 'TA_HT_TRENDMODE', 'TA_IMI', 'TA_KAMA', 'TA_LINEARREG', 'TA_LINEARREG_ANGLE', 'TA_LINEARREG_INTERCEPT', 'TA_LINEARREG_SLOPE', 'TA_LN', 'TA_LOG10', 'TA_MA', 'TA_MACD', 'TA_MACDEXT', 'TA_MACDFIX', 'TA_MAMA', 'TA_MAVP', 'TA_MAX', 'TA_MAXINDEX', 'TA_MEDPRICE', 'TA_MFI', 'TA_MIDPOINT', 'TA_MIDPRICE', 'TA_MIN', 'TA_MININDEX', 'TA_MINMAX', 'TA_MINMAXINDEX', 'TA_MINUS_DI', 'TA_MINUS_DM', 'TA_MOM', 'TA_MULT', 'TA_NATR', 'TA_OBV', 'TA_PLUS_DI', 'TA_PLUS_DM', 'TA_PPO', 'TA_ROC', 'TA_ROCP', 'TA_ROCR', 'TA_ROCR100', 'TA_RSI', 'TA_SAR', 'TA_SAREXT', 'TA_SIN', 'TA_SINH', 'TA_SMA', 'TA_SQRT', 'TA_STDDEV', 'TA_STOCH', 'TA_STOCHF', 'TA_STOCHRSI', 'TA_SUB', 'TA_SUM', 'TA_T3', 'TA_TAN', 'TA_TANH', 'TA_TEMA', 'TA_TRANGE', 'TA_TRIMA', 'TA_TRIX', 'TA_TSF', 'TA_TYPPRICE', 'TA_ULTOSC', 'TA_VAR', 'TA_WCLPRICE', 'TA_WILLR', 'TA_WMA', 'TC_FixedA', 'TC_FixedA2015', 'TC_FixedA2017', 'TC_TestStub', 'TC_Zero', 'TIME', 'TIMELINE', 'TIMELINEVOL', 'TRACE', 'TURNOVER', 'TimeDelta', 'TimeLineList', 'TimeLineRecord', 'TradeCostBase', 'TradeManager', 'TradeRecord', 'TradeRecordList', 'TradeRequest', 'TransList', 'TransRecord', 'UPNDAY', 'VAR', 'VARP', 'VIGOR', 'WARN', 'WEAVE', 'WEEK', 'WINNER', 'WMA', 'YEAR', 'ZHBOND10', 'ZONGGUBEN', 'ZSCORE', 'batch_calculate_inds', 'can_upgrade', 'close_ostream_to_python', 'close_spend_time', 'combinate_ind', 'combinate_index', 'constant', 'crtBrokerTM', 'crtSEOptimal', 'crtTM', 'crt_pf_strategy', 'crt_sys_strategy', 'find_optimal_system', 'find_optimal_system_multi', 'get_block', 'get_business_name', 'get_data_from_buffer_server', 'get_date_range', 'get_kdata', 'get_last_version', 'get_log_level', 'get_stock', 'get_system_part_enum', 'get_system_part_name', 'get_version', 'get_version_git', 'get_version_with_build', 'hikyuu_init', 'inner_analysis_sys_list', 'inner_combinate_ind_analysis', 'inner_combinate_ind_analysis_with_block', 'isinf', 'isnan', 'open_ostream_to_python', 'open_spend_time', 'roundDown', 'roundEx', 'roundUp', 'run_in_strategy', 'set_log_level', 'set_python_in_interactive', 'set_python_in_jupyter', 'start_spot_agent', 'stop_spot_agent', 'toPriceList']
|
|
4
|
+
__all__ = ['ABS', 'ACOS', 'AD', 'ADVANCE', 'AF_EqualWeight', 'AF_FixedWeight', 'AF_FixedWeightList', 'AF_MultiFactor', 'ALIGN', 'AMA', 'ASIN', 'ATAN', 'ATR', 'AVEDEV', 'AllocateFundsBase', 'BACKSET', 'BARSCOUNT', 'BARSLAST', 'BARSSINCE', 'BARSSINCEN', 'BETWEEN', 'BLOCKSETNUM', 'BUSINESS', 'Block', 'BlockInfoDriver', 'BorrowRecord', 'BrokerPositionRecord', 'CEILING', 'CN_Bool', 'CN_OPLine', 'CONTEXT', 'CONTEXT_K', 'CORR', 'COS', 'COST', 'COUNT', 'CROSS', 'CVAL', 'CYCLE', 'C_AMO', 'C_CLOSE', 'C_HIGH', 'C_KDATA', 'C_LOW', 'C_OPEN', 'C_VOL', 'ConditionBase', 'Constant', 'CostRecord', 'DATE', 'DAY', 'DEBUG', 'DECLINE', 'DEVSQ', 'DIFF', 'DIRECT', 'DISCARD', 'DMA', 'DOWNNDAY', 'DROPNA', 'DataDriverFactory', 'Datetime', 'DatetimeList', 'Days', 'EMA', 'ERROR', 'EVERY', 'EV_Bool', 'EV_TwoLine', 'EXIST', 'EXP', 'EnvironmentBase', 'FATAL', 'FILTER', 'FINANCE', 'FLOOR', 'FundsRecord', 'HHV', 'HHVBARS', 'HKUException', 'HOUR', 'HSL', 'Hours', 'IC', 'ICIR', 'IF', 'INBLOCK', 'INDEXA', 'INDEXADV', 'INDEXC', 'INDEXDEC', 'INDEXH', 'INDEXL', 'INDEXO', 'INDEXV', 'INFO', 'INSUM', 'INTPART', 'IR', 'ISINF', 'ISINFA', 'ISLASTBAR', 'ISNA', 'IndParam', 'Indicator', 'IndicatorImp', 'JUMPDOWN', 'JUMPUP', 'KALMAN', 'KDATA_PART', 'KData', 'KDataDriver', 'KRecord', 'KRecordList', 'LAST', 'LASTVALUE', 'LIUTONGPAN', 'LLV', 'LLVBARS', 'LN', 'LOG', 'LOG_LEVEL', 'LONGCROSS', 'LoanRecord', 'MA', 'MACD', 'MAX', 'MDD', 'MF_EqualWeight', 'MF_ICIRWeight', 'MF_ICWeight', 'MF_Weight', 'MIN', 'MINUTE', 'MM_FixedCapital', 'MM_FixedCapitalFunds', 'MM_FixedCount', 'MM_FixedCountTps', 'MM_FixedPercent', 'MM_FixedRisk', 'MM_FixedUnits', 'MM_Nothing', 'MM_WilliamsFixedRisk', 'MOD', 'MONTH', 'MRR', 'MarketInfo', 'Microseconds', 'Milliseconds', 'Minutes', 'MoneyManagerBase', 'MultiFactorBase', 'NDAY', 'NOT', 'OFF', 'OrderBrokerBase', 'PF_Simple', 'PF_WithoutAF', 'PG_FixedHoldDays', 'PG_FixedPercent', 'PG_NoGoal', 'POS', 'POW', 'PRICELIST', 'Parameter', 'Performance', 'Portfolio', 'PositionRecord', 'PositionRecordList', 'ProfitGoalBase', 'Query', 'RECOVER_BACKWARD', 'RECOVER_EQUAL_BACKWARD', 'RECOVER_EQUAL_FORWARD', 'RECOVER_FORWARD', 'REF', 'REPLACE', 'RESULT', 'REVERSE', 'ROC', 'ROCP', 'ROCR', 'ROCR100', 'ROUND', 'ROUNDDOWN', 'ROUNDUP', 'RSI', 'SAFTYLOSS', 'SE_Fixed', 'SE_MaxFundsOptimal', 'SE_MultiFactor', 'SE_PerformanceOptimal', 'SE_Signal', 'SGN', 'SG_Add', 'SG_AllwaysBuy', 'SG_And', 'SG_Band', 'SG_Bool', 'SG_Buy', 'SG_Cross', 'SG_CrossGold', 'SG_Cycle', 'SG_Div', 'SG_Flex', 'SG_Mul', 'SG_OneSide', 'SG_Or', 'SG_Sell', 'SG_Single', 'SG_Single2', 'SG_Sub', 'SIN', 'SLICE', 'SLOPE', 'SMA', 'SPEARMAN', 'SP_FixedPercent', 'SP_FixedValue', 'SQRT', 'STDEV', 'STDP', 'ST_FixedPercent', 'ST_Indicator', 'ST_Saftyloss', 'SUM', 'SUMBARS', 'SYS_Simple', 'SYS_WalkForward', 'ScoreRecord', 'ScoreRecordList', 'Seconds', 'SelectorBase', 'SignalBase', 'SlippageBase', 'SpotRecord', 'Stock', 'StockManager', 'StockTypeInfo', 'StockWeight', 'StockWeightList', 'StoplossBase', 'Strategy', 'StrategyContext', 'System', 'SystemPart', 'SystemWeight', 'SystemWeightList', 'TAN', 'TA_ACCBANDS', 'TA_ACOS', 'TA_AD', 'TA_ADD', 'TA_ADOSC', 'TA_ADX', 'TA_ADXR', 'TA_APO', 'TA_AROON', 'TA_AROONOSC', 'TA_ASIN', 'TA_ATAN', 'TA_ATR', 'TA_AVGDEV', 'TA_AVGPRICE', 'TA_BBANDS', 'TA_BETA', 'TA_BOP', 'TA_CCI', 'TA_CDL2CROWS', 'TA_CDL3BLACKCROWS', 'TA_CDL3INSIDE', 'TA_CDL3LINESTRIKE', 'TA_CDL3OUTSIDE', 'TA_CDL3STARSINSOUTH', 'TA_CDL3WHITESOLDIERS', 'TA_CDLABANDONEDBABY', 'TA_CDLADVANCEBLOCK', 'TA_CDLBELTHOLD', 'TA_CDLBREAKAWAY', 'TA_CDLCLOSINGMARUBOZU', 'TA_CDLCONCEALBABYSWALL', 'TA_CDLCOUNTERATTACK', 'TA_CDLDARKCLOUDCOVER', 'TA_CDLDOJI', 'TA_CDLDOJISTAR', 'TA_CDLDRAGONFLYDOJI', 'TA_CDLENGULFING', 'TA_CDLEVENINGDOJISTAR', 'TA_CDLEVENINGSTAR', 'TA_CDLGAPSIDESIDEWHITE', 'TA_CDLGRAVESTONEDOJI', 'TA_CDLHAMMER', 'TA_CDLHANGINGMAN', 'TA_CDLHARAMI', 'TA_CDLHARAMICROSS', 'TA_CDLHIGHWAVE', 'TA_CDLHIKKAKE', 'TA_CDLHIKKAKEMOD', 'TA_CDLHOMINGPIGEON', 'TA_CDLIDENTICAL3CROWS', 'TA_CDLINNECK', 'TA_CDLINVERTEDHAMMER', 'TA_CDLKICKING', 'TA_CDLKICKINGBYLENGTH', 'TA_CDLLADDERBOTTOM', 'TA_CDLLONGLEGGEDDOJI', 'TA_CDLLONGLINE', 'TA_CDLMARUBOZU', 'TA_CDLMATCHINGLOW', 'TA_CDLMATHOLD', 'TA_CDLMORNINGDOJISTAR', 'TA_CDLMORNINGSTAR', 'TA_CDLONNECK', 'TA_CDLPIERCING', 'TA_CDLRICKSHAWMAN', 'TA_CDLRISEFALL3METHODS', 'TA_CDLSEPARATINGLINES', 'TA_CDLSHOOTINGSTAR', 'TA_CDLSHORTLINE', 'TA_CDLSPINNINGTOP', 'TA_CDLSTALLEDPATTERN', 'TA_CDLSTICKSANDWICH', 'TA_CDLTAKURI', 'TA_CDLTASUKIGAP', 'TA_CDLTHRUSTING', 'TA_CDLTRISTAR', 'TA_CDLUNIQUE3RIVER', 'TA_CDLUPSIDEGAP2CROWS', 'TA_CDLXSIDEGAP3METHODS', 'TA_CEIL', 'TA_CMO', 'TA_CORREL', 'TA_COS', 'TA_COSH', 'TA_DEMA', 'TA_DIV', 'TA_DX', 'TA_EMA', 'TA_EXP', 'TA_FLOOR', 'TA_HT_DCPERIOD', 'TA_HT_DCPHASE', 'TA_HT_PHASOR', 'TA_HT_SINE', 'TA_HT_TRENDLINE', 'TA_HT_TRENDMODE', 'TA_IMI', 'TA_KAMA', 'TA_LINEARREG', 'TA_LINEARREG_ANGLE', 'TA_LINEARREG_INTERCEPT', 'TA_LINEARREG_SLOPE', 'TA_LN', 'TA_LOG10', 'TA_MA', 'TA_MACD', 'TA_MACDEXT', 'TA_MACDFIX', 'TA_MAMA', 'TA_MAVP', 'TA_MAX', 'TA_MAXINDEX', 'TA_MEDPRICE', 'TA_MFI', 'TA_MIDPOINT', 'TA_MIDPRICE', 'TA_MIN', 'TA_MININDEX', 'TA_MINMAX', 'TA_MINMAXINDEX', 'TA_MINUS_DI', 'TA_MINUS_DM', 'TA_MOM', 'TA_MULT', 'TA_NATR', 'TA_OBV', 'TA_PLUS_DI', 'TA_PLUS_DM', 'TA_PPO', 'TA_ROC', 'TA_ROCP', 'TA_ROCR', 'TA_ROCR100', 'TA_RSI', 'TA_SAR', 'TA_SAREXT', 'TA_SIN', 'TA_SINH', 'TA_SMA', 'TA_SQRT', 'TA_STDDEV', 'TA_STOCH', 'TA_STOCHF', 'TA_STOCHRSI', 'TA_SUB', 'TA_SUM', 'TA_T3', 'TA_TAN', 'TA_TANH', 'TA_TEMA', 'TA_TRANGE', 'TA_TRIMA', 'TA_TRIX', 'TA_TSF', 'TA_TYPPRICE', 'TA_ULTOSC', 'TA_VAR', 'TA_WCLPRICE', 'TA_WILLR', 'TA_WMA', 'TC_FixedA', 'TC_FixedA2015', 'TC_FixedA2017', 'TC_TestStub', 'TC_Zero', 'TIME', 'TIMELINE', 'TIMELINEVOL', 'TR', 'TRACE', 'TURNOVER', 'TimeDelta', 'TimeLineList', 'TimeLineRecord', 'TradeCostBase', 'TradeManager', 'TradeRecord', 'TradeRecordList', 'TradeRequest', 'TransList', 'TransRecord', 'UPNDAY', 'VAR', 'VARP', 'VIGOR', 'WARN', 'WEAVE', 'WEEK', 'WINNER', 'WMA', 'YEAR', 'ZHBOND10', 'ZONGGUBEN', 'ZSCORE', 'batch_calculate_inds', 'can_upgrade', 'close_ostream_to_python', 'close_spend_time', 'combinate_ind', 'combinate_index', 'constant', 'crtBrokerTM', 'crtSEOptimal', 'crtTM', 'crt_pf_strategy', 'crt_sys_strategy', 'find_optimal_system', 'find_optimal_system_multi', 'get_block', 'get_business_name', 'get_data_from_buffer_server', 'get_date_range', 'get_kdata', 'get_last_version', 'get_log_level', 'get_stock', 'get_system_part_enum', 'get_system_part_name', 'get_version', 'get_version_git', 'get_version_with_build', 'hikyuu_init', 'inner_analysis_sys_list', 'inner_combinate_ind_analysis', 'inner_combinate_ind_analysis_with_block', 'isinf', 'isnan', 'open_ostream_to_python', 'open_spend_time', 'roundDown', 'roundEx', 'roundUp', 'run_in_strategy', 'set_log_level', 'set_python_in_interactive', 'set_python_in_jupyter', 'start_spot_agent', 'stop_spot_agent', 'toPriceList']
|
|
5
5
|
class AllocateFundsBase:
|
|
6
6
|
"""
|
|
7
7
|
资产分配算法基类, 子类接口:
|
|
8
8
|
|
|
9
|
+
公共参数:
|
|
10
|
+
|
|
11
|
+
- adjust_running_sys (bool|True): 是否调整之前已经持仓策略的持仓。不调整时,仅使用总账户当前剩余资金进行分配,否则将使用总市值进行分配
|
|
12
|
+
注意: 无论是否调整已持仓策略,权重比例都是相对于总资产,不是针对剩余现金余额
|
|
13
|
+
仅针对剩余现金比例调整没有意义,即使分配由于交易成本原因可能也无法完成实际交易
|
|
14
|
+
adjust_running_sys: True - 主动根据资产分配对已持仓策略进行增减仓
|
|
15
|
+
adjust_running_sys: False - 不会根据当前分配权重对已持仓策略进行强制加减仓
|
|
16
|
+
|
|
17
|
+
- auto_adjust_weight (bool|True): 自动调整权重,此时认为传入的权重为各证券的相互比例(详见ignore_zero_weight说明)。否则,以传入的权重为指定权重不做调整(此时传入的各个权重需要小于1)。
|
|
18
|
+
|
|
19
|
+
- ignore_zero_weight (bool|False): 该参数在 auto_adjust_weight 时生效。是否过滤子类返回的比例权重列表中的 0 值(包含小于0)和 nan 值。
|
|
20
|
+
|
|
21
|
+
如:子类返回权重比例列表 [6, 2, 0, 0, 0], 则
|
|
22
|
+
- 过滤 0 值,则实际调整后的权重为 Xi / sum(Xi):[6/8, 2/8]
|
|
23
|
+
- 不过滤,m 设为非零元素个数,n为总元素个数,(Xi / Sum(Xi)) * (m / n):
|
|
24
|
+
[(6/8)*(2/5), (2/8)*(2/5), 0, 0, 0]
|
|
25
|
+
即,保留分为5份后,仅在2份中保持相对比例
|
|
26
|
+
|
|
27
|
+
- ignore_se_score_is_null (bool|False): 忽略选中系统列表中的系统得分为 null 的系统. 注意:某些SE(如SE_MultiFactor)本身可能也存在类似控制
|
|
28
|
+
- ignore_se_score_lt_zero (bool|False): 忽略选中系统列表中的系统得分小于等于 0 的系统
|
|
29
|
+
- reserve_percent (float|0.0): 保留不参与重分配的资产比例
|
|
30
|
+
- trace (bool|False): 打印跟踪信息
|
|
31
|
+
|
|
32
|
+
子类接口:
|
|
33
|
+
|
|
9
34
|
- _allocateWeight : 【必须】子类资产分配调整实现
|
|
10
35
|
- _clone : 【必须】克隆接口
|
|
11
36
|
- _reset : 【可选】重载私有变量
|
|
@@ -457,7 +482,7 @@ class ConditionBase:
|
|
|
457
482
|
def _pybind11_conduit_v1_(*args, **kwargs):
|
|
458
483
|
...
|
|
459
484
|
@staticmethod
|
|
460
|
-
def plot(cn, new = True, axes = None, kdata = None):
|
|
485
|
+
def plot(cn, new = True, axes = None, kdata = None, upcolor = 'red', downcolor = 'blue', alpha = 0.2):
|
|
461
486
|
"""
|
|
462
487
|
绘制系统有效条件
|
|
463
488
|
|
|
@@ -466,6 +491,9 @@ class ConditionBase:
|
|
|
466
491
|
:param axes: 指定在那个轴对象中进行绘制
|
|
467
492
|
:param KData kdata: 指定的KData,如该值为None,则认为该系统有效条件已经
|
|
468
493
|
指定了交易对象,否则,使用该参数作为交易对象
|
|
494
|
+
:param upcolor: 有效数时的颜色
|
|
495
|
+
:param downcolor: 无效时的颜色
|
|
496
|
+
:param alpha: 透明度
|
|
469
497
|
|
|
470
498
|
"""
|
|
471
499
|
def __add__(self, arg0: ConditionBase) -> ConditionBase:
|
|
@@ -1303,7 +1331,7 @@ class EnvironmentBase:
|
|
|
1303
1331
|
def _pybind11_conduit_v1_(*args, **kwargs):
|
|
1304
1332
|
...
|
|
1305
1333
|
@staticmethod
|
|
1306
|
-
def plot(ev, ref_kdata, new = True, axes = None):
|
|
1334
|
+
def plot(ev, ref_kdata, new = True, axes = None, upcolor = 'red', downcolor = 'blue', alpha = 0.2):
|
|
1307
1335
|
"""
|
|
1308
1336
|
绘制市场有效判断
|
|
1309
1337
|
|
|
@@ -1311,8 +1339,15 @@ class EnvironmentBase:
|
|
|
1311
1339
|
:param KData ref_kdata: 用于日期参考
|
|
1312
1340
|
:param new: 仅在未指定axes的情况下生效,当为True时,创建新的窗口对象并在其中进行绘制
|
|
1313
1341
|
:param axes: 指定在那个轴对象中进行绘制
|
|
1342
|
+
:param upcolor: 有效时的颜色
|
|
1343
|
+
:param downcolor: 无效时的颜色
|
|
1344
|
+
:param alpha: 透明度
|
|
1314
1345
|
|
|
1315
1346
|
"""
|
|
1347
|
+
def __add__(self, arg0: EnvironmentBase) -> EnvironmentBase:
|
|
1348
|
+
...
|
|
1349
|
+
def __and__(self, arg0: EnvironmentBase) -> EnvironmentBase:
|
|
1350
|
+
...
|
|
1316
1351
|
def __getstate__(self) -> tuple:
|
|
1317
1352
|
...
|
|
1318
1353
|
@typing.overload
|
|
@@ -1324,13 +1359,21 @@ class EnvironmentBase:
|
|
|
1324
1359
|
@typing.overload
|
|
1325
1360
|
def __init__(self, arg0: str) -> None:
|
|
1326
1361
|
...
|
|
1362
|
+
def __mul__(self, arg0: EnvironmentBase) -> EnvironmentBase:
|
|
1363
|
+
...
|
|
1364
|
+
def __or__(self, arg0: EnvironmentBase) -> EnvironmentBase:
|
|
1365
|
+
...
|
|
1327
1366
|
def __repr__(self) -> str:
|
|
1328
1367
|
...
|
|
1329
1368
|
def __setstate__(self, arg0: tuple) -> None:
|
|
1330
1369
|
...
|
|
1331
1370
|
def __str__(self) -> str:
|
|
1332
1371
|
...
|
|
1333
|
-
def
|
|
1372
|
+
def __sub__(self, arg0: EnvironmentBase) -> EnvironmentBase:
|
|
1373
|
+
...
|
|
1374
|
+
def __truediv__(self, arg0: EnvironmentBase) -> EnvironmentBase:
|
|
1375
|
+
...
|
|
1376
|
+
def _add_valid(self, arg0: Datetime, arg1: float) -> None:
|
|
1334
1377
|
"""
|
|
1335
1378
|
_add_valid(self, datetime)
|
|
1336
1379
|
|
|
@@ -1535,7 +1578,6 @@ class Indicator:
|
|
|
1535
1578
|
"""
|
|
1536
1579
|
技术指标
|
|
1537
1580
|
"""
|
|
1538
|
-
__hash__: typing.ClassVar[None] = None
|
|
1539
1581
|
@staticmethod
|
|
1540
1582
|
def __getitem__(data, i):
|
|
1541
1583
|
"""
|
|
@@ -1581,6 +1623,21 @@ class Indicator:
|
|
|
1581
1623
|
:rtype: bool
|
|
1582
1624
|
"""
|
|
1583
1625
|
@staticmethod
|
|
1626
|
+
def heatmap(ind, axes = None):
|
|
1627
|
+
"""
|
|
1628
|
+
|
|
1629
|
+
绘制指标收益年-月收益热力图
|
|
1630
|
+
|
|
1631
|
+
指标收益率 = (当前月末值 - 上月末值) / 上月末值 * 100
|
|
1632
|
+
|
|
1633
|
+
指标应已计算(即有值),且为时间序列
|
|
1634
|
+
|
|
1635
|
+
:param ind: 指定指标
|
|
1636
|
+
:param axes: 绘制的轴对象,默认为None,表示创建新的轴对象
|
|
1637
|
+
:return: None
|
|
1638
|
+
|
|
1639
|
+
"""
|
|
1640
|
+
@staticmethod
|
|
1584
1641
|
def plot(indicator, new = True, axes = None, kref = None, legend_on = False, text_on = False, text_color = 'k', zero_on = False, label = None, linestyle = '-', *args, **kwargs):
|
|
1585
1642
|
"""
|
|
1586
1643
|
绘制indicator曲线
|
|
@@ -1655,6 +1712,8 @@ class Indicator:
|
|
|
1655
1712
|
@typing.overload
|
|
1656
1713
|
def __gt__(self, arg0: float) -> Indicator:
|
|
1657
1714
|
...
|
|
1715
|
+
def __hash__(self) -> int:
|
|
1716
|
+
...
|
|
1658
1717
|
@typing.overload
|
|
1659
1718
|
def __init__(self) -> None:
|
|
1660
1719
|
...
|
|
@@ -3250,8 +3309,23 @@ class Portfolio:
|
|
|
3250
3309
|
def _pybind11_conduit_v1_(*args, **kwargs):
|
|
3251
3310
|
...
|
|
3252
3311
|
@staticmethod
|
|
3312
|
+
def heatmap(sys, axes = None):
|
|
3313
|
+
"""
|
|
3314
|
+
|
|
3315
|
+
绘制系统收益年-月收益热力图
|
|
3316
|
+
|
|
3317
|
+
"""
|
|
3318
|
+
@staticmethod
|
|
3253
3319
|
def performance(sys, ref_stk = None):
|
|
3254
|
-
|
|
3320
|
+
"""
|
|
3321
|
+
|
|
3322
|
+
绘制系统绩效,即账户累积收益率曲线
|
|
3323
|
+
|
|
3324
|
+
:param SystemBase | PortfolioBase sys: SYS或PF实例
|
|
3325
|
+
:param Stock ref_stk: 参考股票, 默认为沪深300: sh000300, 绘制参考标的的收益曲线
|
|
3326
|
+
:return: None
|
|
3327
|
+
|
|
3328
|
+
"""
|
|
3255
3329
|
def __getstate__(self) -> tuple:
|
|
3256
3330
|
...
|
|
3257
3331
|
@typing.overload
|
|
@@ -3470,7 +3544,10 @@ class PositionRecord:
|
|
|
3470
3544
|
@property
|
|
3471
3545
|
def total_profit(self) -> float:
|
|
3472
3546
|
"""
|
|
3473
|
-
|
|
3547
|
+
total_profit(self):
|
|
3548
|
+
|
|
3549
|
+
累计盈利 = 累计卖出资金 - 累计买入资金 - 累计交易成本
|
|
3550
|
+
注意: 只对已清仓的记录有效, 未清仓的记录返回0
|
|
3474
3551
|
"""
|
|
3475
3552
|
@property
|
|
3476
3553
|
def total_risk(self) -> float:
|
|
@@ -5617,6 +5694,14 @@ class StrategyContext:
|
|
|
5617
5694
|
def ktype_list(self, arg1: list[str]) -> None:
|
|
5618
5695
|
...
|
|
5619
5696
|
@property
|
|
5697
|
+
def preload_num(self) -> dict[str, int]:
|
|
5698
|
+
"""
|
|
5699
|
+
预加载数量
|
|
5700
|
+
"""
|
|
5701
|
+
@preload_num.setter
|
|
5702
|
+
def preload_num(self, arg1: dict[str, int]) -> None:
|
|
5703
|
+
...
|
|
5704
|
+
@property
|
|
5620
5705
|
def start_datetime(self) -> Datetime:
|
|
5621
5706
|
"""
|
|
5622
5707
|
起始日期
|
|
@@ -5660,8 +5745,23 @@ class System:
|
|
|
5660
5745
|
def _pybind11_conduit_v1_(*args, **kwargs):
|
|
5661
5746
|
...
|
|
5662
5747
|
@staticmethod
|
|
5748
|
+
def heatmap(sys, axes = None):
|
|
5749
|
+
"""
|
|
5750
|
+
|
|
5751
|
+
绘制系统收益年-月收益热力图
|
|
5752
|
+
|
|
5753
|
+
"""
|
|
5754
|
+
@staticmethod
|
|
5663
5755
|
def performance(sys, ref_stk = None):
|
|
5664
|
-
|
|
5756
|
+
"""
|
|
5757
|
+
|
|
5758
|
+
绘制系统绩效,即账户累积收益率曲线
|
|
5759
|
+
|
|
5760
|
+
:param SystemBase | PortfolioBase sys: SYS或PF实例
|
|
5761
|
+
:param Stock ref_stk: 参考股票, 默认为沪深300: sh000300, 绘制参考标的的收益曲线
|
|
5762
|
+
:return: None
|
|
5763
|
+
|
|
5764
|
+
"""
|
|
5665
5765
|
@staticmethod
|
|
5666
5766
|
def plot(sys, new = True, axes = None, style = 1, only_draw_close = False):
|
|
5667
5767
|
"""
|
|
@@ -6593,6 +6693,19 @@ class TradeManager:
|
|
|
6593
6693
|
@staticmethod
|
|
6594
6694
|
def _pybind11_conduit_v1_(*args, **kwargs):
|
|
6595
6695
|
...
|
|
6696
|
+
@staticmethod
|
|
6697
|
+
def heatmap(tm, start_date, end_date = None, axes = None):
|
|
6698
|
+
"""
|
|
6699
|
+
|
|
6700
|
+
绘制账户收益年-月收益热力图
|
|
6701
|
+
|
|
6702
|
+
:param tm: 交易账户
|
|
6703
|
+
:param start_date: 开始日期
|
|
6704
|
+
:param end_date: 结束日期,默认为今天
|
|
6705
|
+
:param axes: 绘制的轴对象,默认为None,表示创建新的轴对象
|
|
6706
|
+
:return: None
|
|
6707
|
+
|
|
6708
|
+
"""
|
|
6596
6709
|
def __getstate__(self) -> tuple:
|
|
6597
6710
|
...
|
|
6598
6711
|
@typing.overload
|
|
@@ -7528,7 +7641,7 @@ def AF_FixedWeightList(weights: list[float]) -> AllocateFundsBase:
|
|
|
7528
7641
|
"""
|
|
7529
7642
|
AF_FixedWeightList(weights)
|
|
7530
7643
|
|
|
7531
|
-
|
|
7644
|
+
固定比例资产分配列表.
|
|
7532
7645
|
|
|
7533
7646
|
:param float weights: 指定的资产比例列表
|
|
7534
7647
|
"""
|
|
@@ -7536,7 +7649,7 @@ def AF_MultiFactor() -> AllocateFundsBase:
|
|
|
7536
7649
|
"""
|
|
7537
7650
|
AF_MultiFactor()
|
|
7538
7651
|
|
|
7539
|
-
创建 MultiFactor
|
|
7652
|
+
创建 MultiFactor 评分权重的资产分配算法实例, 即直接以SE返回的评分作为权重。
|
|
7540
7653
|
"""
|
|
7541
7654
|
@typing.overload
|
|
7542
7655
|
def ALIGN(ref: DatetimeList, fill_null: bool = True) -> Indicator:
|
|
@@ -7623,23 +7736,14 @@ def ATAN(arg0: float) -> Indicator:
|
|
|
7623
7736
|
def ATR(n: int = 14) -> Indicator:
|
|
7624
7737
|
...
|
|
7625
7738
|
@typing.overload
|
|
7626
|
-
def ATR(n:
|
|
7627
|
-
...
|
|
7628
|
-
@typing.overload
|
|
7629
|
-
def ATR(data: Indicator, n: IndParam) -> Indicator:
|
|
7630
|
-
...
|
|
7631
|
-
@typing.overload
|
|
7632
|
-
def ATR(data: Indicator, n: Indicator) -> Indicator:
|
|
7633
|
-
...
|
|
7634
|
-
@typing.overload
|
|
7635
|
-
def ATR(data: Indicator, n: int = 14) -> Indicator:
|
|
7739
|
+
def ATR(kdata: KData, n: int = 14) -> Indicator:
|
|
7636
7740
|
"""
|
|
7637
|
-
ATR([
|
|
7741
|
+
ATR([kdata, n=14])
|
|
7638
7742
|
|
|
7639
|
-
平均真实波幅(Average True Range)
|
|
7743
|
+
平均真实波幅(Average True Range), 真实波动幅度 TR 的简单移动均值
|
|
7640
7744
|
|
|
7641
|
-
:param
|
|
7642
|
-
:param int
|
|
7745
|
+
:param KData kdata 待计算的源数据
|
|
7746
|
+
:param int n: 计算均值的周期窗口,必须为大于1的整数
|
|
7643
7747
|
:rtype: Indicator
|
|
7644
7748
|
"""
|
|
7645
7749
|
@typing.overload
|
|
@@ -7744,6 +7848,23 @@ def BARSSINCE(arg0: float) -> Indicator:
|
|
|
7744
7848
|
:rtype: Indicator
|
|
7745
7849
|
"""
|
|
7746
7850
|
@typing.overload
|
|
7851
|
+
def BARSSINCEN(n: int) -> Indicator:
|
|
7852
|
+
...
|
|
7853
|
+
@typing.overload
|
|
7854
|
+
def BARSSINCEN(cond: Indicator, n: int) -> Indicator:
|
|
7855
|
+
"""
|
|
7856
|
+
BARSSINCEN(cond, n)
|
|
7857
|
+
|
|
7858
|
+
N周期内第一个条件成立到当前的周期数
|
|
7859
|
+
|
|
7860
|
+
用法:BARSSINCEN(X,N):N周期内第一次X不为0到现在的周期数,N为常量BARSSINCEN(X,N)
|
|
7861
|
+
例如:BARSSINCEN(HIGH>10,10)表示10个周期内股价超过10元时到当前的周期数
|
|
7862
|
+
|
|
7863
|
+
:param Indicator cond: 条件
|
|
7864
|
+
:param int|Indicator n: 时间窗口
|
|
7865
|
+
:rtype: Indicator
|
|
7866
|
+
"""
|
|
7867
|
+
@typing.overload
|
|
7747
7868
|
def BETWEEN(arg0: Indicator, arg1: Indicator, arg2: Indicator) -> Indicator:
|
|
7748
7869
|
...
|
|
7749
7870
|
@typing.overload
|
|
@@ -8794,6 +8915,21 @@ def JUMPUP(arg0: Indicator) -> Indicator:
|
|
|
8794
8915
|
:rtype: Indicator
|
|
8795
8916
|
"""
|
|
8796
8917
|
@typing.overload
|
|
8918
|
+
def KALMAN(q: float = 0.01, r: float = 0.1) -> Indicator:
|
|
8919
|
+
...
|
|
8920
|
+
@typing.overload
|
|
8921
|
+
def KALMAN(ind: Indicator, q: float = 0.01, r: float = 0.1) -> Indicator:
|
|
8922
|
+
"""
|
|
8923
|
+
KALMAN(ind, [q=0.01], [r=0.1])
|
|
8924
|
+
|
|
8925
|
+
Kalman滤波器, 用于平滑指标, 可设置平滑系数q和r, 默认q=0.01, r=0.1
|
|
8926
|
+
|
|
8927
|
+
:param Indicator ind: 指标
|
|
8928
|
+
:param float q: 平滑系数
|
|
8929
|
+
:param float r: 噪声系数
|
|
8930
|
+
:rtype: Indicator
|
|
8931
|
+
"""
|
|
8932
|
+
@typing.overload
|
|
8797
8933
|
def KDATA_PART(data: KData, kpart: str) -> Indicator:
|
|
8798
8934
|
...
|
|
8799
8935
|
@typing.overload
|
|
@@ -9884,6 +10020,10 @@ def SGN(arg0: Indicator) -> Indicator:
|
|
|
9884
10020
|
:param Indicator data: 输入数据
|
|
9885
10021
|
:rtype: Indicator
|
|
9886
10022
|
"""
|
|
10023
|
+
@typing.overload
|
|
10024
|
+
def SG_Add(sg_list: typing.Sequence, alternate: bool) -> SignalBase:
|
|
10025
|
+
...
|
|
10026
|
+
@typing.overload
|
|
9887
10027
|
def SG_Add(sg1: SignalBase, sg2: SignalBase, alternate: bool) -> SignalBase:
|
|
9888
10028
|
"""
|
|
9889
10029
|
SG_Add(sg1, sg2, alternate)
|
|
@@ -9905,6 +10045,23 @@ def SG_AllwaysBuy() -> SignalBase:
|
|
|
9905
10045
|
一个特殊的SG,持续每天发出买入信号,通常配合 PF 使用
|
|
9906
10046
|
"""
|
|
9907
10047
|
@typing.overload
|
|
10048
|
+
def SG_And(sg_list: typing.Sequence, alternate: bool) -> SignalBase:
|
|
10049
|
+
...
|
|
10050
|
+
@typing.overload
|
|
10051
|
+
def SG_And(sg1: SignalBase, sg2: SignalBase, alternate: bool) -> SignalBase:
|
|
10052
|
+
"""
|
|
10053
|
+
SG_And(sg1, sg2, alternate)
|
|
10054
|
+
|
|
10055
|
+
生成两个指标与的信号
|
|
10056
|
+
|
|
10057
|
+
由于 SG 的 alternate 默认为 True, 在使用如 "sg1 + sg2 + sg3" 的形式时,容易忽略 sg1 + sg2 的 alternate 属性
|
|
10058
|
+
建议使用: SG_Add(sg1, sg2, False) + sg3 来避免 alternate 的问题
|
|
10059
|
+
|
|
10060
|
+
:param SignalBase sg1: 输入信号1
|
|
10061
|
+
:param SignalBase sg2: 输入信号2
|
|
10062
|
+
:param bool alternate: 是否交替买入卖出,默认为True
|
|
10063
|
+
"""
|
|
10064
|
+
@typing.overload
|
|
9908
10065
|
def SG_Band(ind: Indicator, lower: Indicator, upper: Indicator) -> SignalBase:
|
|
9909
10066
|
...
|
|
9910
10067
|
@typing.overload
|
|
@@ -9969,6 +10126,10 @@ def SG_Cycle() -> SignalBase:
|
|
|
9969
10126
|
|
|
9970
10127
|
一个特殊的SG,配合PF使用,以 PF 调仓周期为买入信号
|
|
9971
10128
|
"""
|
|
10129
|
+
@typing.overload
|
|
10130
|
+
def SG_Div(sg_list: typing.Sequence, alternate: bool) -> SignalBase:
|
|
10131
|
+
...
|
|
10132
|
+
@typing.overload
|
|
9972
10133
|
def SG_Div(sg1: SignalBase, sg2: SignalBase, alternate: bool) -> SignalBase:
|
|
9973
10134
|
"""
|
|
9974
10135
|
SG_Div(sg1, sg2, alternate)
|
|
@@ -9992,6 +10153,10 @@ def SG_Flex(op: Indicator, slow_n: int) -> SignalBase:
|
|
|
9992
10153
|
:param int slow_n: 慢线EMA周期
|
|
9993
10154
|
:return: 信号指示器
|
|
9994
10155
|
"""
|
|
10156
|
+
@typing.overload
|
|
10157
|
+
def SG_Mul(sg_list: typing.Sequence, alternate: bool) -> SignalBase:
|
|
10158
|
+
...
|
|
10159
|
+
@typing.overload
|
|
9995
10160
|
def SG_Mul(sg1: SignalBase, sg2: SignalBase, alternate: bool) -> SignalBase:
|
|
9996
10161
|
"""
|
|
9997
10162
|
SG_Mul(sg1, sg2, alternate)
|
|
@@ -10015,6 +10180,23 @@ def SG_OneSide(ind: Indicator, is_buy: bool) -> SignalBase:
|
|
|
10015
10180
|
:param bool is_buy: 构建的是买入信号,否则为卖出信号
|
|
10016
10181
|
:return: 信号指示器
|
|
10017
10182
|
"""
|
|
10183
|
+
@typing.overload
|
|
10184
|
+
def SG_Or(sg_list: typing.Sequence, alternate: bool) -> SignalBase:
|
|
10185
|
+
...
|
|
10186
|
+
@typing.overload
|
|
10187
|
+
def SG_Or(sg1: SignalBase, sg2: SignalBase, alternate: bool) -> SignalBase:
|
|
10188
|
+
"""
|
|
10189
|
+
SG_Or(sg1, sg2, alternate)
|
|
10190
|
+
|
|
10191
|
+
生成两个指标与的信号
|
|
10192
|
+
|
|
10193
|
+
由于 SG 的 alternate 默认为 True, 在使用如 "sg1 + sg2 + sg3" 的形式时,容易忽略 sg1 + sg2 的 alternate 属性
|
|
10194
|
+
建议使用: SG_Add(sg1, sg2, False) + sg3 来避免 alternate 的问题
|
|
10195
|
+
|
|
10196
|
+
:param SignalBase sg1: 输入信号1
|
|
10197
|
+
:param SignalBase sg2: 输入信号2
|
|
10198
|
+
:param bool alternate: 是否交替买入卖出,默认为True
|
|
10199
|
+
"""
|
|
10018
10200
|
def SG_Sell(ind: Indicator) -> SignalBase:
|
|
10019
10201
|
"""
|
|
10020
10202
|
SG_Sell(ind)
|
|
@@ -10057,6 +10239,10 @@ def SG_Single2(ind: Indicator, filter_n: int = 10, filter_p: float = 0.1) -> Sig
|
|
|
10057
10239
|
:param float filter_p: 过滤器百分比
|
|
10058
10240
|
:return: 信号指示器
|
|
10059
10241
|
"""
|
|
10242
|
+
@typing.overload
|
|
10243
|
+
def SG_Sub(sg_list: typing.Sequence, alternate: bool) -> SignalBase:
|
|
10244
|
+
...
|
|
10245
|
+
@typing.overload
|
|
10060
10246
|
def SG_Sub(sg1: SignalBase, sg2: SignalBase, alternate: bool) -> SignalBase:
|
|
10061
10247
|
"""
|
|
10062
10248
|
SG_Sub(sg1, sg2, alternate)
|
|
@@ -12435,6 +12621,22 @@ def TIMELINEVOL(arg0: KData) -> Indicator:
|
|
|
12435
12621
|
:rtype: Indicator
|
|
12436
12622
|
"""
|
|
12437
12623
|
@typing.overload
|
|
12624
|
+
def TR() -> Indicator:
|
|
12625
|
+
...
|
|
12626
|
+
@typing.overload
|
|
12627
|
+
def TR(kdata: KData) -> Indicator:
|
|
12628
|
+
"""
|
|
12629
|
+
TR([kdata])
|
|
12630
|
+
|
|
12631
|
+
真实波动幅度(TR)是以下三个值中的最大值:
|
|
12632
|
+
1. 当前周期最高价与最低价之差
|
|
12633
|
+
2. 当前周期最高价与前一周期收盘价之差的绝对值
|
|
12634
|
+
3. 当前周期最低价与前一周期收盘价之差的绝对值
|
|
12635
|
+
|
|
12636
|
+
:param KData kdata: K线数据
|
|
12637
|
+
:rtype: Indicator
|
|
12638
|
+
"""
|
|
12639
|
+
@typing.overload
|
|
12438
12640
|
def TURNOVER(n: int = 1) -> Indicator:
|
|
12439
12641
|
...
|
|
12440
12642
|
@typing.overload
|
|
@@ -12524,14 +12726,34 @@ def VIGOR(n: int = 2) -> Indicator:
|
|
|
12524
12726
|
:param int n: EMA平滑窗口
|
|
12525
12727
|
:rtype: Indicator
|
|
12526
12728
|
"""
|
|
12729
|
+
@typing.overload
|
|
12730
|
+
def WEAVE(arg0: typing.Sequence) -> Indicator:
|
|
12731
|
+
...
|
|
12732
|
+
@typing.overload
|
|
12527
12733
|
def WEAVE(arg0: Indicator, arg1: Indicator) -> Indicator:
|
|
12734
|
+
...
|
|
12735
|
+
@typing.overload
|
|
12736
|
+
def WEAVE(arg0: Indicator, arg1: Indicator, arg2: Indicator) -> Indicator:
|
|
12737
|
+
...
|
|
12738
|
+
@typing.overload
|
|
12739
|
+
def WEAVE(arg0: Indicator, arg1: Indicator, arg2: Indicator, arg3: Indicator) -> Indicator:
|
|
12740
|
+
...
|
|
12741
|
+
@typing.overload
|
|
12742
|
+
def WEAVE(arg0: Indicator, arg1: Indicator, arg2: Indicator, arg3: Indicator, arg4: Indicator) -> Indicator:
|
|
12743
|
+
...
|
|
12744
|
+
@typing.overload
|
|
12745
|
+
def WEAVE(arg0: Indicator, arg1: Indicator, arg2: Indicator, arg3: Indicator, arg4: Indicator, arg5: Indicator) -> Indicator:
|
|
12528
12746
|
"""
|
|
12529
|
-
WEAVE(ind1, ind2)
|
|
12747
|
+
WEAVE(ind1, ind2[, ind3, ind4, ind5, ind6])
|
|
12530
12748
|
|
|
12531
|
-
|
|
12749
|
+
将最多6个Indicator的结果组合在一起放在一个Indicator中。如ind = WEAVE(ind1, ind2), 则此时ind包含多个结果,按ind1、ind2的顺序存放。
|
|
12532
12750
|
|
|
12533
12751
|
:param Indicator ind1: 指标1
|
|
12534
12752
|
:param Indicator ind2: 指标2
|
|
12753
|
+
:param Indicator ind3: 指标3, 可省略
|
|
12754
|
+
:param Indicator ind4: 指标4, 可省略
|
|
12755
|
+
:param Indicator ind5: 指标5, 可省略
|
|
12756
|
+
:param Indicator ind6: 指标6, 可省略
|
|
12535
12757
|
:rtype: Indicator
|
|
12536
12758
|
"""
|
|
12537
12759
|
@typing.overload
|
|
@@ -12745,6 +12967,7 @@ def get_date_range(start: Datetime, end: Datetime) -> DatetimeList:
|
|
|
12745
12967
|
get_date_range(start, end)
|
|
12746
12968
|
|
|
12747
12969
|
获取指定 [start, end) 日期时间范围的自然日日历日期列表,仅支持到日
|
|
12970
|
+
为防止内存占用过大,end如果超出系统明日日期,则强制为系统明日日期。
|
|
12748
12971
|
|
|
12749
12972
|
:param Datetime start: 起始日期
|
|
12750
12973
|
:param Datetime end: 结束日期
|
hikyuu/cpp/hikyuu.dll
CHANGED
|
Binary file
|
hikyuu/cpp/hikyuu.lib
CHANGED
|
Binary file
|
hikyuu/data/pytdx_to_h5.py
CHANGED
|
@@ -282,10 +282,13 @@ def import_one_stock_data(connect, api, h5file, market, ktype, stock_record, sta
|
|
|
282
282
|
|
|
283
283
|
for bar in bar_list:
|
|
284
284
|
try:
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
285
|
+
if ktype == "DAY":
|
|
286
|
+
tmp = datetime.date(bar["year"], bar["month"], bar["day"])
|
|
287
|
+
bar_datetime = (tmp.year * 10000 + tmp.month * 100 + tmp.day) * 10000
|
|
288
|
+
else:
|
|
289
|
+
tmp = datetime.datetime(bar["year"], bar["month"], bar["day"], bar['hour'], bar['minute'])
|
|
290
|
+
bar_datetime = (tmp.year * 10000 + tmp.month * 100 + tmp.day) * \
|
|
291
|
+
10000 + bar["hour"] * 100 + bar["minute"]
|
|
289
292
|
except Exception as e:
|
|
290
293
|
hku_error("Failed translate datetime: {}, from {}! {}".format(bar, api.ip, e))
|
|
291
294
|
continue
|
hikyuu/data/pytdx_to_mysql.py
CHANGED
|
@@ -331,10 +331,13 @@ def import_one_stock_data(
|
|
|
331
331
|
|
|
332
332
|
for bar in bar_list:
|
|
333
333
|
try:
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
334
|
+
if ktype == "DAY":
|
|
335
|
+
tmp = datetime.date(bar["year"], bar["month"], bar["day"])
|
|
336
|
+
bar_datetime = (tmp.year * 10000 + tmp.month * 100 + tmp.day) * 10000
|
|
337
|
+
else:
|
|
338
|
+
tmp = datetime.datetime(bar["year"], bar["month"], bar["day"], bar['hour'], bar['minute'])
|
|
339
|
+
bar_datetime = (tmp.year * 10000 + tmp.month * 100 + tmp.day) * \
|
|
340
|
+
10000 + bar["hour"] * 100 + bar["minute"]
|
|
338
341
|
except Exception as e:
|
|
339
342
|
hku_error("Failed translate datetime: {}, from {}! {}".format(bar, api.ip, e))
|
|
340
343
|
continue
|
hikyuu/draw/drawplot/__init__.py
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
# 1. 20171122, Added by fasiondog
|
|
30
30
|
# ===============================================================================
|
|
31
31
|
|
|
32
|
-
from hikyuu.core import KData, Indicator, SignalBase, ConditionBase, EnvironmentBase, System, Portfolio
|
|
32
|
+
from hikyuu.core import KData, Indicator, SignalBase, ConditionBase, EnvironmentBase, System, Portfolio, TradeManager
|
|
33
33
|
|
|
34
34
|
import matplotlib
|
|
35
35
|
from matplotlib.pylab import gca as mpl_gca
|
|
@@ -49,6 +49,9 @@ from .matplotlib_draw import ax_draw_macd2 as mpl_ax_draw_macd2
|
|
|
49
49
|
from .matplotlib_draw import ax_set_locator_formatter as mpl_ax_set_locator_formatter
|
|
50
50
|
from .matplotlib_draw import adjust_axes_show as mpl_adjust_axes_show
|
|
51
51
|
from .matplotlib_draw import sys_performance as mpl_sys_performance
|
|
52
|
+
from .matplotlib_draw import tm_heatmap as mpl_tm_heatmap
|
|
53
|
+
from .matplotlib_draw import sys_heatmap as mpl_sys_heatmap
|
|
54
|
+
from .matplotlib_draw import iheatmap as mpl_iheatmap
|
|
52
55
|
from .matplotlib_draw import (DRAWNULL, STICKLINE, DRAWBAND, RGB, PLOYLINE,
|
|
53
56
|
DRAWLINE, DRAWTEXT, DRAWNUMBER, DRAWTEXT_FIX, DRAWNUMBER_FIX, DRAWSL,
|
|
54
57
|
DRAWIMG, DRAWICON, DRAWBMP, SHOWICONS, DRAWRECTREL)
|
|
@@ -119,6 +122,7 @@ def use_draw_with_matplotlib():
|
|
|
119
122
|
|
|
120
123
|
Indicator.plot = mpl_iplot
|
|
121
124
|
Indicator.bar = mpl_ibar
|
|
125
|
+
Indicator.heatmap = mpl_iheatmap
|
|
122
126
|
|
|
123
127
|
SignalBase.plot = mpl_sgplot
|
|
124
128
|
|
|
@@ -128,6 +132,9 @@ def use_draw_with_matplotlib():
|
|
|
128
132
|
System.plot = mpl_sysplot
|
|
129
133
|
System.performance = mpl_sys_performance
|
|
130
134
|
Portfolio.performance = mpl_sys_performance
|
|
135
|
+
TradeManager.heatmap = mpl_tm_heatmap
|
|
136
|
+
System.heatmap = mpl_sys_heatmap
|
|
137
|
+
Portfolio.heatmap = mpl_sys_heatmap
|
|
131
138
|
|
|
132
139
|
|
|
133
140
|
def use_draw_with_echarts():
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
|
-
from hikyuu.cpp.
|
|
3
|
-
from hikyuu.cpp.
|
|
4
|
-
from hikyuu.cpp.
|
|
5
|
-
from hikyuu.cpp.
|
|
6
|
-
from hikyuu.cpp.
|
|
7
|
-
from hikyuu.cpp.
|
|
8
|
-
from hikyuu.cpp.
|
|
2
|
+
from hikyuu.cpp.core38 import ConditionBase
|
|
3
|
+
from hikyuu.cpp.core38 import EnvironmentBase
|
|
4
|
+
from hikyuu.cpp.core38 import Indicator
|
|
5
|
+
from hikyuu.cpp.core38 import KData
|
|
6
|
+
from hikyuu.cpp.core38 import Portfolio
|
|
7
|
+
from hikyuu.cpp.core38 import SignalBase
|
|
8
|
+
from hikyuu.cpp.core38 import System
|
|
9
|
+
from hikyuu.cpp.core38 import TradeManager
|
|
9
10
|
from hikyuu.draw.drawplot.bokeh_draw import ax_draw_macd as bk_ax_draw_macd
|
|
10
11
|
from hikyuu.draw.drawplot.bokeh_draw import ax_draw_macd2 as bk_ax_draw_macd2
|
|
11
12
|
from hikyuu.draw.drawplot.bokeh_draw import create_figure as bk_create_figure
|
|
@@ -45,13 +46,16 @@ from hikyuu.draw.drawplot.matplotlib_draw import cnplot as mpl_cnplot
|
|
|
45
46
|
from hikyuu.draw.drawplot.matplotlib_draw import create_figure as mpl_create_figure
|
|
46
47
|
from hikyuu.draw.drawplot.matplotlib_draw import evplot as mpl_evplot
|
|
47
48
|
from hikyuu.draw.drawplot.matplotlib_draw import ibar as mpl_ibar
|
|
49
|
+
from hikyuu.draw.drawplot.matplotlib_draw import iheatmap as mpl_iheatmap
|
|
48
50
|
from hikyuu.draw.drawplot.matplotlib_draw import iplot as mpl_iplot
|
|
49
51
|
from hikyuu.draw.drawplot.matplotlib_draw import kplot as mpl_kplot
|
|
50
52
|
from hikyuu.draw.drawplot.matplotlib_draw import mkplot as mpl_mkplot
|
|
51
53
|
from hikyuu.draw.drawplot.matplotlib_draw import set_mpl_params
|
|
52
54
|
from hikyuu.draw.drawplot.matplotlib_draw import sgplot as mpl_sgplot
|
|
55
|
+
from hikyuu.draw.drawplot.matplotlib_draw import sys_heatmap as mpl_sys_heatmap
|
|
53
56
|
from hikyuu.draw.drawplot.matplotlib_draw import sys_performance as mpl_sys_performance
|
|
54
57
|
from hikyuu.draw.drawplot.matplotlib_draw import sysplot as mpl_sysplot
|
|
58
|
+
from hikyuu.draw.drawplot.matplotlib_draw import tm_heatmap as mpl_tm_heatmap
|
|
55
59
|
import matplotlib as matplotlib
|
|
56
60
|
from matplotlib.pyplot import gca as mpl_gca
|
|
57
61
|
from matplotlib.pyplot import gcf as mpl_gcf
|