hikyuu 2.6.2__py3-none-win_amd64.whl → 2.6.3__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 +1 -1
- hikyuu/__init__.pyi +25 -9
- hikyuu/analysis/__init__.pyi +16 -0
- hikyuu/analysis/analysis.pyi +17 -1
- hikyuu/core.pyi +18 -2
- hikyuu/cpp/core310.pyd +0 -0
- hikyuu/cpp/core310.pyi +369 -41
- hikyuu/cpp/core311.pyd +0 -0
- hikyuu/cpp/core311.pyi +369 -41
- hikyuu/cpp/core312.pyd +0 -0
- hikyuu/cpp/core312.pyi +369 -41
- hikyuu/cpp/core313.pyd +0 -0
- hikyuu/cpp/core313.pyi +369 -41
- hikyuu/cpp/core39.pyd +0 -0
- hikyuu/cpp/core39.pyi +369 -41
- hikyuu/cpp/hikyuu.dll +0 -0
- hikyuu/cpp/hikyuu.lib +0 -0
- hikyuu/cpp/sqlite3.dll +0 -0
- hikyuu/draw/drawplot/bokeh_draw.pyi +21 -5
- hikyuu/draw/drawplot/echarts_draw.pyi +21 -5
- hikyuu/draw/drawplot/matplotlib_draw.py +22 -0
- hikyuu/draw/drawplot/matplotlib_draw.pyi +21 -5
- hikyuu/draw/kaufman.py +2 -2
- hikyuu/draw/kaufman.pyi +2 -2
- hikyuu/extend.pyi +21 -5
- hikyuu/hub.pyi +6 -6
- hikyuu/include/hikyuu/Block.h +20 -0
- hikyuu/include/hikyuu/KQuery.h +8 -0
- hikyuu/include/hikyuu/Stock.h +1 -1
- hikyuu/include/hikyuu/StockManager.h +6 -0
- hikyuu/include/hikyuu/indicator/Indicator.h +5 -0
- hikyuu/include/hikyuu/indicator/IndicatorImp.h +8 -3
- hikyuu/include/hikyuu/indicator/crt/INSUM.h +5 -10
- hikyuu/include/hikyuu/indicator/crt/RSI.h +2 -18
- hikyuu/include/hikyuu/plugin/backtest.h +3 -2
- hikyuu/include/hikyuu/plugin/extind.h +150 -0
- hikyuu/include/hikyuu/plugin/interface/BackTestPluginInterface.h +2 -1
- hikyuu/include/hikyuu/plugin/interface/ExtendIndicatorsPluginInterface.h +26 -0
- hikyuu/include/hikyuu/plugin/interface/plugins.h +2 -0
- hikyuu/include/hikyuu/strategy/BrokerTradeManager.h +7 -5
- hikyuu/include/hikyuu/strategy/Strategy.h +22 -9
- hikyuu/include/hikyuu/trade_manage/OrderBrokerBase.h +11 -4
- hikyuu/include/hikyuu/trade_manage/TradeManager.h +8 -5
- hikyuu/include/hikyuu/trade_manage/TradeManagerBase.h +6 -4
- hikyuu/include/hikyuu/trade_manage/TradeRecord.h +9 -1
- hikyuu/include/hikyuu/trade_sys/multifactor/MultiFactorBase.h +8 -5
- hikyuu/include/hikyuu/trade_sys/multifactor/crt/MF_EqualWeight.h +4 -1
- hikyuu/include/hikyuu/trade_sys/multifactor/crt/MF_ICIRWeight.h +4 -1
- hikyuu/include/hikyuu/trade_sys/multifactor/crt/MF_ICWeight.h +4 -1
- hikyuu/include/hikyuu/trade_sys/multifactor/crt/MF_Weight.h +4 -1
- hikyuu/include/hikyuu/trade_sys/multifactor/imp/EqualWeightMultiFactor.h +2 -1
- hikyuu/include/hikyuu/trade_sys/multifactor/imp/ICIRMultiFactor.h +2 -1
- hikyuu/include/hikyuu/trade_sys/multifactor/imp/ICMultiFactor.h +2 -1
- hikyuu/include/hikyuu/trade_sys/multifactor/imp/WeightMultiFactor.h +1 -1
- hikyuu/include/hikyuu/trade_sys/system/TradeRequest.h +7 -4
- hikyuu/include/hikyuu/trade_sys/system/imp/WalkForwardTradeManager.h +17 -13
- hikyuu/include/hikyuu/utilities/thread/{MQStealThreadPool.h → GlobalMQStealThreadPool.h} +12 -12
- hikyuu/include/hikyuu/utilities/thread/GlobalMQThreadPool.h +271 -0
- hikyuu/include/hikyuu/utilities/thread/{StealThreadPool.h → GlobalStealThreadPool.h} +11 -10
- hikyuu/include/hikyuu/utilities/thread/GlobalThreadPool.h +224 -0
- hikyuu/include/hikyuu/utilities/thread/InterruptFlag.h +16 -0
- hikyuu/include/hikyuu/utilities/thread/MQThreadPool.h +27 -70
- hikyuu/include/hikyuu/utilities/thread/ThreadPool.h +18 -53
- hikyuu/include/hikyuu/utilities/thread/ThreadSafeQueue.h +4 -0
- hikyuu/include/hikyuu/utilities/thread/algorithm.h +9 -9
- hikyuu/include/hikyuu/utilities/thread/thread.h +4 -0
- hikyuu/include/hikyuu/version.h +4 -4
- hikyuu/plugin/backtest.dll +0 -0
- hikyuu/plugin/dataserver.dll +0 -0
- hikyuu/plugin/device.dll +0 -0
- hikyuu/plugin/extind.dll +0 -0
- hikyuu/plugin/import2hdf5.dll +0 -0
- hikyuu/trade_manage/__init__.pyi +21 -5
- hikyuu/trade_manage/broker.py +8 -8
- hikyuu/trade_manage/broker.pyi +4 -4
- hikyuu/trade_manage/broker_easytrader.py +3 -3
- hikyuu/trade_manage/broker_easytrader.pyi +2 -2
- hikyuu/trade_manage/broker_mail.py +2 -2
- hikyuu/trade_manage/broker_mail.pyi +2 -2
- hikyuu/trade_manage/trade.pyi +21 -5
- hikyuu/util/singleton.pyi +1 -1
- {hikyuu-2.6.2.dist-info → hikyuu-2.6.3.dist-info}/METADATA +1 -1
- {hikyuu-2.6.2.dist-info → hikyuu-2.6.3.dist-info}/RECORD +87 -82
- {hikyuu-2.6.2.dist-info → hikyuu-2.6.3.dist-info}/LICENSE +0 -0
- {hikyuu-2.6.2.dist-info → hikyuu-2.6.3.dist-info}/WHEEL +0 -0
- {hikyuu-2.6.2.dist-info → hikyuu-2.6.3.dist-info}/entry_points.txt +0 -0
- {hikyuu-2.6.2.dist-info → hikyuu-2.6.3.dist-info}/top_level.txt +0 -0
hikyuu/extend.pyi
CHANGED
|
@@ -173,6 +173,7 @@ from hikyuu.cpp.core39 import PositionRecord
|
|
|
173
173
|
from hikyuu.cpp.core39 import PositionRecordList
|
|
174
174
|
from hikyuu.cpp.core39 import ProfitGoalBase
|
|
175
175
|
from hikyuu.cpp.core39 import Query
|
|
176
|
+
from hikyuu.cpp.core39 import RANK
|
|
176
177
|
from hikyuu.cpp.core39 import RECOVER_BACKWARD
|
|
177
178
|
from hikyuu.cpp.core39 import RECOVER_EQUAL_BACKWARD
|
|
178
179
|
from hikyuu.cpp.core39 import RECOVER_EQUAL_FORWARD
|
|
@@ -439,18 +440,33 @@ from hikyuu.cpp.core39 import VIGOR
|
|
|
439
440
|
from hikyuu.cpp.core39 import WEAVE
|
|
440
441
|
from hikyuu.cpp.core39 import WEEK
|
|
441
442
|
from hikyuu.cpp.core39 import WINNER
|
|
443
|
+
from hikyuu.cpp.core39 import WITHDAY
|
|
444
|
+
from hikyuu.cpp.core39 import WITHHALFYEAR
|
|
445
|
+
from hikyuu.cpp.core39 import WITHHOUR
|
|
446
|
+
from hikyuu.cpp.core39 import WITHHOUR2
|
|
447
|
+
from hikyuu.cpp.core39 import WITHHOUR4
|
|
448
|
+
from hikyuu.cpp.core39 import WITHKTYPE
|
|
449
|
+
from hikyuu.cpp.core39 import WITHMIN
|
|
450
|
+
from hikyuu.cpp.core39 import WITHMIN15
|
|
451
|
+
from hikyuu.cpp.core39 import WITHMIN30
|
|
452
|
+
from hikyuu.cpp.core39 import WITHMIN5
|
|
453
|
+
from hikyuu.cpp.core39 import WITHMIN60
|
|
454
|
+
from hikyuu.cpp.core39 import WITHMONTH
|
|
455
|
+
from hikyuu.cpp.core39 import WITHQUARTER
|
|
456
|
+
from hikyuu.cpp.core39 import WITHWEEK
|
|
457
|
+
from hikyuu.cpp.core39 import WITHYEAR
|
|
442
458
|
from hikyuu.cpp.core39 import WMA
|
|
443
459
|
from hikyuu.cpp.core39 import YEAR
|
|
444
460
|
from hikyuu.cpp.core39 import ZHBOND10
|
|
445
461
|
from hikyuu.cpp.core39 import ZONGGUBEN
|
|
446
462
|
from hikyuu.cpp.core39 import ZSCORE
|
|
447
|
-
from hikyuu.cpp.core39 import __add__ as __old_TimeDelta_add__
|
|
448
463
|
from hikyuu.cpp.core39 import __add__ as __old_Datetime_add__
|
|
449
|
-
from hikyuu.cpp.core39 import
|
|
450
|
-
from hikyuu.cpp.core39 import __init__ as __old_TimeDelta_init__
|
|
464
|
+
from hikyuu.cpp.core39 import __add__ as __old_TimeDelta_add__
|
|
451
465
|
from hikyuu.cpp.core39 import __init__ as old_Query_init
|
|
452
|
-
from hikyuu.cpp.core39 import
|
|
466
|
+
from hikyuu.cpp.core39 import __init__ as __old_TimeDelta_init__
|
|
467
|
+
from hikyuu.cpp.core39 import __init__ as __old_Datetime_init__
|
|
453
468
|
from hikyuu.cpp.core39 import __sub__ as __old_Datetime_sub__
|
|
469
|
+
from hikyuu.cpp.core39 import __sub__ as __old_TimeDelta_sub__
|
|
454
470
|
from hikyuu.cpp.core39 import active_device
|
|
455
471
|
from hikyuu.cpp.core39 import backtest
|
|
456
472
|
from hikyuu.cpp.core39 import batch_calculate_inds
|
|
@@ -506,7 +522,7 @@ import numpy as np
|
|
|
506
522
|
import os as os
|
|
507
523
|
import pandas as pd
|
|
508
524
|
import sys as sys
|
|
509
|
-
__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', 'DatetimeList_to_df', 'DatetimeList_to_np', 'Datetime_date', 'Datetime_datetime', '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', 'KDataToHdf5Importer', 'KData_getitem', 'KData_iter', 'KData_to_df', 'KData_to_np', 'KRecord', 'KRecordList', 'LAST', 'LASTVALUE', 'LIUTONGPAN', 'LLV', 'LLVBARS', 'LN', 'LOG', 'LOG_LEVEL', 'LONGCROSS', 'LoanRecord', 'MA', 'MACD', 'MAX', 'MAXYEAR', 'MDD', 'MF_EqualWeight', 'MF_ICIRWeight', 'MF_ICWeight', 'MF_Weight', 'MIN', 'MINUTE', 'MINYEAR', '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', 'Parameter_items', 'Parameter_iter', 'Parameter_keys', 'Parameter_to_dict', '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', 'TimeDelta_timedelta', 'TimeLineList', 'TimeLineRecord', 'TimeLine_to_df', 'TimeLine_to_np', 'TradeCostBase', 'TradeManager', 'TradeRecord', 'TradeRecordList', 'TradeRequest', 'TransList', 'TransList_to_df', 'TransList_to_np', 'TransRecord', 'UPNDAY', 'VAR', 'VARP', 'VIGOR', 'WARN', 'WEAVE', 'WEEK', 'WINNER', 'WMA', 'YEAR', 'ZHBOND10', 'ZONGGUBEN', 'ZSCORE', 'active_device', 'backtest', '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', 'date', 'datetime', 'fetch_trial_license', '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', 'new_Query_init', 'np', 'old_Query_init', 'open_ostream_to_python', 'open_spend_time', 'os', 'pd', 'remove_license', 'roundDown', 'roundEx', 'roundUp', 'run_in_strategy', 'set_log_level', 'set_python_in_interactive', 'set_python_in_jupyter', 'start_data_server', 'start_spot_agent', 'stop_data_server', 'stop_spot_agent', 'sys', 'time', 'timedelta', 'timezone', 'toPriceList', 'tzinfo', 'view_license']
|
|
525
|
+
__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', 'DatetimeList_to_df', 'DatetimeList_to_np', 'Datetime_date', 'Datetime_datetime', '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', 'KDataToHdf5Importer', 'KData_getitem', 'KData_iter', 'KData_to_df', 'KData_to_np', 'KRecord', 'KRecordList', 'LAST', 'LASTVALUE', 'LIUTONGPAN', 'LLV', 'LLVBARS', 'LN', 'LOG', 'LOG_LEVEL', 'LONGCROSS', 'LoanRecord', 'MA', 'MACD', 'MAX', 'MAXYEAR', 'MDD', 'MF_EqualWeight', 'MF_ICIRWeight', 'MF_ICWeight', 'MF_Weight', 'MIN', 'MINUTE', 'MINYEAR', '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', 'Parameter_items', 'Parameter_iter', 'Parameter_keys', 'Parameter_to_dict', 'Performance', 'Portfolio', 'PositionRecord', 'PositionRecordList', 'ProfitGoalBase', 'Query', 'RANK', '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', 'TimeDelta_timedelta', 'TimeLineList', 'TimeLineRecord', 'TimeLine_to_df', 'TimeLine_to_np', 'TradeCostBase', 'TradeManager', 'TradeRecord', 'TradeRecordList', 'TradeRequest', 'TransList', 'TransList_to_df', 'TransList_to_np', 'TransRecord', 'UPNDAY', 'VAR', 'VARP', 'VIGOR', 'WARN', 'WEAVE', 'WEEK', 'WINNER', 'WITHDAY', 'WITHHALFYEAR', 'WITHHOUR', 'WITHHOUR2', 'WITHHOUR4', 'WITHKTYPE', 'WITHMIN', 'WITHMIN15', 'WITHMIN30', 'WITHMIN5', 'WITHMIN60', 'WITHMONTH', 'WITHQUARTER', 'WITHWEEK', 'WITHYEAR', 'WMA', 'YEAR', 'ZHBOND10', 'ZONGGUBEN', 'ZSCORE', 'active_device', 'backtest', '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', 'date', 'datetime', 'fetch_trial_license', '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', 'new_Query_init', 'np', 'old_Query_init', 'open_ostream_to_python', 'open_spend_time', 'os', 'pd', 'remove_license', 'roundDown', 'roundEx', 'roundUp', 'run_in_strategy', 'set_log_level', 'set_python_in_interactive', 'set_python_in_jupyter', 'start_data_server', 'start_spot_agent', 'stop_data_server', 'stop_spot_agent', 'sys', 'time', 'timedelta', 'timezone', 'toPriceList', 'tzinfo', 'view_license']
|
|
510
526
|
def DatetimeList_to_df(data):
|
|
511
527
|
"""
|
|
512
528
|
仅在安装了pandas模块时生效,转换为pandas.DataFrame
|
hikyuu/hub.pyi
CHANGED
|
@@ -28,11 +28,11 @@ import sys as sys
|
|
|
28
28
|
import typing
|
|
29
29
|
__all__: list = ['add_remote_hub', 'add_local_hub', 'update_hub', 'remove_hub', 'build_hub', 'help_part', 'get_part', 'get_part_list', 'get_hub_path', 'get_part_info', 'get_part_module', 'print_part_info', 'get_hub_name_list', 'get_part_name_list', 'get_current_hub', 'search_part']
|
|
30
30
|
class ConfigModel(sqlalchemy.orm.decl_api.Base):
|
|
31
|
-
__mapper__: typing.ClassVar[sqlalchemy.orm.mapper.Mapper] # value = <Mapper at
|
|
31
|
+
__mapper__: typing.ClassVar[sqlalchemy.orm.mapper.Mapper] # value = <Mapper at 0x193fcffdd30; ConfigModel>
|
|
32
32
|
__table__: typing.ClassVar[sqlalchemy.sql.schema.Table] # value = Table('hub_config', MetaData(), Column('id', Integer(), table=<hub_config>, primary_key=True, nullable=False, default=Sequence('config_id_seq', metadata=MetaData())), Column('key', String(), table=<hub_config>), Column('value', String(), table=<hub_config>), schema=None)
|
|
33
33
|
__table_args__: typing.ClassVar[tuple] # value = (UniqueConstraint(Column('key', String(), table=<hub_config>)))
|
|
34
34
|
__tablename__: typing.ClassVar[str] = 'hub_config'
|
|
35
|
-
_sa_class_manager: typing.ClassVar[sqlalchemy.orm.instrumentation.ClassManager] # value = <ClassManager of <class 'hikyuu.hub.ConfigModel'> at
|
|
35
|
+
_sa_class_manager: typing.ClassVar[sqlalchemy.orm.instrumentation.ClassManager] # value = <ClassManager of <class 'hikyuu.hub.ConfigModel'> at 193fd0017c0>
|
|
36
36
|
def __init__(self, **kwargs):
|
|
37
37
|
"""
|
|
38
38
|
A simple constructor that allows initialization from kwargs.
|
|
@@ -109,11 +109,11 @@ class HubManager:
|
|
|
109
109
|
def print_part_info(self, name):
|
|
110
110
|
...
|
|
111
111
|
class HubModel(sqlalchemy.orm.decl_api.Base):
|
|
112
|
-
__mapper__: typing.ClassVar[sqlalchemy.orm.mapper.Mapper] # value = <Mapper at
|
|
112
|
+
__mapper__: typing.ClassVar[sqlalchemy.orm.mapper.Mapper] # value = <Mapper at 0x193fd03a130; HubModel>
|
|
113
113
|
__table__: typing.ClassVar[sqlalchemy.sql.schema.Table] # value = Table('hub_repo', MetaData(), Column('id', Integer(), table=<hub_repo>, primary_key=True, nullable=False, default=Sequence('remote_id_seq', metadata=MetaData())), Column('name', String(), table=<hub_repo>), Column('hub_type', String(), table=<hub_repo>), Column('local_base', String(), table=<hub_repo>), Column('local', String(), table=<hub_repo>), Column('url', String(), table=<hub_repo>), Column('branch', String(), table=<hub_repo>), schema=None)
|
|
114
114
|
__table_args__: typing.ClassVar[tuple] # value = (UniqueConstraint(Column('name', String(), table=<hub_repo>)))
|
|
115
115
|
__tablename__: typing.ClassVar[str] = 'hub_repo'
|
|
116
|
-
_sa_class_manager: typing.ClassVar[sqlalchemy.orm.instrumentation.ClassManager] # value = <ClassManager of <class 'hikyuu.hub.HubModel'> at
|
|
116
|
+
_sa_class_manager: typing.ClassVar[sqlalchemy.orm.instrumentation.ClassManager] # value = <ClassManager of <class 'hikyuu.hub.HubModel'> at 193fd034220>
|
|
117
117
|
def __init__(self, **kwargs):
|
|
118
118
|
"""
|
|
119
119
|
A simple constructor that allows initialization from kwargs.
|
|
@@ -146,11 +146,11 @@ class ModuleConflictError(Exception):
|
|
|
146
146
|
def __str__(self):
|
|
147
147
|
...
|
|
148
148
|
class PartModel(sqlalchemy.orm.decl_api.Base):
|
|
149
|
-
__mapper__: typing.ClassVar[sqlalchemy.orm.mapper.Mapper] # value = <Mapper at
|
|
149
|
+
__mapper__: typing.ClassVar[sqlalchemy.orm.mapper.Mapper] # value = <Mapper at 0x193fd03a760; PartModel>
|
|
150
150
|
__table__: typing.ClassVar[sqlalchemy.sql.schema.Table] # value = Table('hub_part', MetaData(), Column('id', Integer(), table=<hub_part>, primary_key=True, nullable=False, default=Sequence('part_id_seq', metadata=MetaData())), Column('hub_name', String(), table=<hub_part>), Column('part', String(), table=<hub_part>), Column('name', String(), table=<hub_part>), Column('author', String(), table=<hub_part>), Column('version', String(), table=<hub_part>), Column('doc', String(), table=<hub_part>), Column('module_name', String(), table=<hub_part>), Column('label', String(), table=<hub_part>), schema=None)
|
|
151
151
|
__table_args__: typing.ClassVar[tuple] # value = (UniqueConstraint(Column('name', String(), table=<hub_part>)))
|
|
152
152
|
__tablename__: typing.ClassVar[str] = 'hub_part'
|
|
153
|
-
_sa_class_manager: typing.ClassVar[sqlalchemy.orm.instrumentation.ClassManager] # value = <ClassManager of <class 'hikyuu.hub.PartModel'> at
|
|
153
|
+
_sa_class_manager: typing.ClassVar[sqlalchemy.orm.instrumentation.ClassManager] # value = <ClassManager of <class 'hikyuu.hub.PartModel'> at 193fd034c70>
|
|
154
154
|
def __init__(self, **kwargs):
|
|
155
155
|
"""
|
|
156
156
|
A simple constructor that allows initialization from kwargs.
|
hikyuu/include/hikyuu/Block.h
CHANGED
|
@@ -43,6 +43,14 @@ public:
|
|
|
43
43
|
return iter;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
+
bool isNull() const {
|
|
47
|
+
return !m_data;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
uint64_t id() const {
|
|
51
|
+
return m_data ? (uint64_t)m_data.get() : 0;
|
|
52
|
+
}
|
|
53
|
+
|
|
46
54
|
bool operator==(const Block& blk) const {
|
|
47
55
|
return m_data == blk.m_data;
|
|
48
56
|
}
|
|
@@ -145,6 +153,8 @@ public:
|
|
|
145
153
|
/** 设置对应的指数 */
|
|
146
154
|
void setIndexStock(const Stock& stk);
|
|
147
155
|
|
|
156
|
+
uint64_t strongHash() const;
|
|
157
|
+
|
|
148
158
|
private:
|
|
149
159
|
struct HKU_API Data {
|
|
150
160
|
string m_category;
|
|
@@ -170,4 +180,14 @@ HKU_API Block getBlock(const string& category, const string& name);
|
|
|
170
180
|
|
|
171
181
|
} /* namespace hku */
|
|
172
182
|
|
|
183
|
+
namespace std {
|
|
184
|
+
template <>
|
|
185
|
+
class hash<hku::Block> {
|
|
186
|
+
public:
|
|
187
|
+
size_t operator()(hku::Block const& blk) const noexcept {
|
|
188
|
+
return blk.id();
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
} // namespace std
|
|
192
|
+
|
|
173
193
|
#endif /* BLOCK_H_ */
|
hikyuu/include/hikyuu/KQuery.h
CHANGED
|
@@ -173,6 +173,14 @@ public:
|
|
|
173
173
|
m_recoverType = recoverType;
|
|
174
174
|
}
|
|
175
175
|
|
|
176
|
+
/**
|
|
177
|
+
* @brief 哈希值(谨慎)
|
|
178
|
+
* @note 由于 end 为 null 时,获取
|
|
179
|
+
* K线数据行为不一致,所以除非知道自己的使用场景,否则勿使用此方法
|
|
180
|
+
* @return size_t
|
|
181
|
+
*/
|
|
182
|
+
uint64_t hash() const;
|
|
183
|
+
|
|
176
184
|
/** 获取queryType名称,用于显示输出 */
|
|
177
185
|
static string getQueryTypeName(QueryType);
|
|
178
186
|
|
hikyuu/include/hikyuu/Stock.h
CHANGED
|
@@ -113,6 +113,12 @@ public:
|
|
|
113
113
|
*/
|
|
114
114
|
MarketInfo getMarketInfo(const string& market) const;
|
|
115
115
|
|
|
116
|
+
/**
|
|
117
|
+
* 获取指定市场代表指数证券
|
|
118
|
+
* @param market 指定的市场标识
|
|
119
|
+
*/
|
|
120
|
+
Stock getMarketStock(const string& market) const;
|
|
121
|
+
|
|
116
122
|
/**
|
|
117
123
|
* 获取相应的证券类型详细信息
|
|
118
124
|
* @param type 证券类型
|
|
@@ -198,6 +198,11 @@ public:
|
|
|
198
198
|
return !m_imp && m_imp == other.m_imp;
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
+
/** 判断指标公式中是否包含指定名称的指标(特殊用途) */
|
|
202
|
+
bool contains(const string& name) const {
|
|
203
|
+
return m_imp ? m_imp->contains(name) : false;
|
|
204
|
+
}
|
|
205
|
+
|
|
201
206
|
string str() const;
|
|
202
207
|
|
|
203
208
|
protected:
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
#include "../config.h"
|
|
13
13
|
#include "../KData.h"
|
|
14
14
|
#include "../utilities/Parameter.h"
|
|
15
|
-
#include "../utilities/thread/
|
|
15
|
+
#include "../utilities/thread/thread.h"
|
|
16
16
|
|
|
17
17
|
namespace hku {
|
|
18
18
|
|
|
@@ -95,6 +95,9 @@ public:
|
|
|
95
95
|
/** 判断是否和另一个指标等效,即计算效果相同 */
|
|
96
96
|
bool alike(const IndicatorImp& other) const;
|
|
97
97
|
|
|
98
|
+
/** 判断指标公式中是否包含指定名称的指标(特殊用途) */
|
|
99
|
+
bool contains(const string& name) const;
|
|
100
|
+
|
|
98
101
|
/**
|
|
99
102
|
* 使用IndicatorImp(const Indicator&...)构造函数后,计算结果使用该函数,
|
|
100
103
|
* 未做越界保护
|
|
@@ -195,9 +198,11 @@ private:
|
|
|
195
198
|
void execute_weave();
|
|
196
199
|
void execute_if();
|
|
197
200
|
|
|
198
|
-
std::vector<IndicatorImpPtr> getAllSubNodes();
|
|
201
|
+
std::vector<IndicatorImpPtr> getAllSubNodes() const;
|
|
199
202
|
void repeatALikeNodes();
|
|
200
203
|
|
|
204
|
+
void _clearBuffer();
|
|
205
|
+
|
|
201
206
|
protected:
|
|
202
207
|
static size_t _get_step_start(size_t pos, size_t step, size_t discard);
|
|
203
208
|
|
|
@@ -224,7 +229,7 @@ public:
|
|
|
224
229
|
static void releaseDynEngine();
|
|
225
230
|
|
|
226
231
|
protected:
|
|
227
|
-
static
|
|
232
|
+
static ThreadPool* ms_tg;
|
|
228
233
|
|
|
229
234
|
#if HKU_SUPPORT_SERIALIZATION
|
|
230
235
|
private:
|
|
@@ -12,25 +12,20 @@
|
|
|
12
12
|
namespace hku {
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
15
|
+
* 返回板块各成分该指标相应输出按计算类型得到的计算值.
|
|
16
|
+
* @note 注意: INSUM使用模式4/5时相当于RANK功能, 但不适合在MF中使用, 在 MF 中使用时计算量为 N x N
|
|
17
|
+
* 级别, 计算缓慢。如果希望在 MF 中使用,建议直接使用 RANK[VIP] 指标。
|
|
16
18
|
* @param block 指定板块
|
|
17
19
|
* @param query 指定范围
|
|
18
20
|
* @param ind 指定指标
|
|
19
|
-
* @param mode 计算类型:0-累加,1-平均数,2-最大值,3
|
|
21
|
+
* @param mode 计算类型:0-累加,1-平均数,2-最大值,3-最小值,4-降序排名(指标值最高的排名值为1)
|
|
22
|
+
* 5-升序排名(指标值最低的排名值为1),
|
|
20
23
|
* @param fill_null 日期对齐时缺失数据填充 nan 值。
|
|
21
24
|
* @return Indicator
|
|
22
25
|
*/
|
|
23
26
|
Indicator HKU_API INSUM(const Block& block, const KQuery& query, const Indicator& ind, int mode,
|
|
24
27
|
bool fill_null = true);
|
|
25
28
|
|
|
26
|
-
/**
|
|
27
|
-
* 返回板块各成分该指标相应输出按计算类型得到的计算值.计算类型:0-累加,1-平均数,2-最大值,3-最小值.
|
|
28
|
-
* @param block 指定板块
|
|
29
|
-
* @param ind 指定指标
|
|
30
|
-
* @param mode 计算类型:0-累加,1-平均数,2-最大值,3-最小值.
|
|
31
|
-
* @param fill_null 日期对齐时缺失数据填充 nan 值。
|
|
32
|
-
* @return Indicator
|
|
33
|
-
*/
|
|
34
29
|
Indicator HKU_API INSUM(const Block& block, const Indicator& ind, int mode, bool fill_null = true);
|
|
35
30
|
|
|
36
31
|
} // namespace hku
|
|
@@ -19,24 +19,8 @@ namespace hku {
|
|
|
19
19
|
* 相对强弱指数
|
|
20
20
|
* @ingroup Indicator
|
|
21
21
|
*/
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
Indicator u = IF(diff > 0, diff, 0);
|
|
25
|
-
Indicator d = IF(diff < 0, (-1) * diff, 0);
|
|
26
|
-
Indicator ema_u = EMA(u, n);
|
|
27
|
-
Indicator ema_d = EMA(d, n);
|
|
28
|
-
ema_d = IF(ema_d == 0.0, 1, ema_d);
|
|
29
|
-
Indicator rs = ema_u / ema_d;
|
|
30
|
-
Indicator _1 = CVAL(1);
|
|
31
|
-
Indicator rsi = (_1 - _1 / (_1 + rs)) * CVAL(100);
|
|
32
|
-
rsi.name("RSI");
|
|
33
|
-
rsi.setParam<int>("n", n);
|
|
34
|
-
return rsi;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
inline Indicator RSI(const Indicator& data, int n) {
|
|
38
|
-
return RSI(n)(data);
|
|
39
|
-
}
|
|
22
|
+
Indicator HKU_API RSI(int n = 14);
|
|
23
|
+
Indicator HKU_API RSI(const Indicator& data, int n = 14);
|
|
40
24
|
|
|
41
25
|
} // namespace hku
|
|
42
26
|
|
|
@@ -21,17 +21,18 @@ namespace hku {
|
|
|
21
21
|
* @param ktype K线类型
|
|
22
22
|
* @param ref_market 所属市场
|
|
23
23
|
* @param mode 模式 0: 当前bar收盘价执行买卖操作;1: 下一bar开盘价执行买卖操作;
|
|
24
|
+
* @param support_short 是否支持做空
|
|
24
25
|
*/
|
|
25
26
|
void HKU_API backtest(const StrategyContext& context, const std::function<void(Strategy*)>& on_bar,
|
|
26
27
|
const TradeManagerPtr& tm, const Datetime& start_date,
|
|
27
28
|
const Datetime& end_date = Null<Datetime>(),
|
|
28
29
|
const KQuery::KType& ktype = KQuery::DAY, const string& ref_market = "SH",
|
|
29
|
-
int mode = 0);
|
|
30
|
+
int mode = 0, bool support_short = false);
|
|
30
31
|
|
|
31
32
|
// 仅在 sm.init 之后使用
|
|
32
33
|
void HKU_API backtest(const std::function<void(Strategy*)>& on_bar, const TradeManagerPtr& tm,
|
|
33
34
|
const Datetime& start_date, const Datetime& end_date = Null<Datetime>(),
|
|
34
35
|
const KQuery::KType& ktype = KQuery::DAY, const string& ref_market = "SH",
|
|
35
|
-
int mode = 0);
|
|
36
|
+
int mode = 0, bool support_short = false);
|
|
36
37
|
|
|
37
38
|
} // namespace hku
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025 hikyuu.org
|
|
3
|
+
*
|
|
4
|
+
* Created on: 2025-05-19
|
|
5
|
+
* Author: fasiondog
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include "hikyuu/indicator/Indicator.h"
|
|
11
|
+
|
|
12
|
+
namespace hku {
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @brief 将指标数据转换到指定周期
|
|
16
|
+
* @param ktype 指定周期
|
|
17
|
+
* @param fill_null 扩展时填充null数据,否则为使用最近值填充
|
|
18
|
+
* @return Indicator
|
|
19
|
+
*/
|
|
20
|
+
Indicator HKU_API WITHKTYPE(const KQuery::KType& ktype, bool fill_null = false);
|
|
21
|
+
|
|
22
|
+
Indicator HKU_API WITHKTYPE(const Indicator& ind, const KQuery::KType& ktype,
|
|
23
|
+
bool fill_null = false);
|
|
24
|
+
|
|
25
|
+
inline Indicator WITHDAY(bool fill_null = false) {
|
|
26
|
+
return WITHKTYPE(KQuery::DAY, fill_null);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
inline Indicator WITHDAY(const Indicator& ind, bool fill_null = false) {
|
|
30
|
+
return WITHKTYPE(ind, KQuery::DAY, fill_null);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
inline Indicator WITHWEEK(bool fill_null = false) {
|
|
34
|
+
return WITHKTYPE(KQuery::WEEK, fill_null);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
inline Indicator WITHWEEK(const Indicator& ind, bool fill_null = false) {
|
|
38
|
+
return WITHKTYPE(ind, KQuery::WEEK, fill_null);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
inline Indicator WITHMONTH(bool fill_null = false) {
|
|
42
|
+
return WITHKTYPE(KQuery::MONTH, fill_null);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
inline Indicator WITHMONTH(const Indicator& ind, bool fill_null = false) {
|
|
46
|
+
return WITHKTYPE(ind, KQuery::MONTH, fill_null);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
inline Indicator WITHQUARTER(bool fill_null = false) {
|
|
50
|
+
return WITHKTYPE(KQuery::QUARTER, fill_null);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
inline Indicator WITHQUARTER(const Indicator& ind, bool fill_null = false) {
|
|
54
|
+
return WITHKTYPE(ind, KQuery::QUARTER, fill_null);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
inline Indicator WITHHALFYEAR(bool fill_null = false) {
|
|
58
|
+
return WITHKTYPE(KQuery::HALFYEAR, fill_null);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
inline Indicator WITHHALFYEAR(const Indicator& ind, bool fill_null = false) {
|
|
62
|
+
return WITHKTYPE(ind, KQuery::HALFYEAR, fill_null);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
inline Indicator WITHYEAR(bool fill_null = false) {
|
|
66
|
+
return WITHKTYPE(KQuery::YEAR, fill_null);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
inline Indicator WITHYEAR(const Indicator& ind, bool fill_null = false) {
|
|
70
|
+
return WITHKTYPE(ind, KQuery::YEAR, fill_null);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
inline Indicator WITHMIN(bool fill_null = false) {
|
|
74
|
+
return WITHKTYPE(KQuery::MIN, fill_null);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
inline Indicator WITHMIN(const Indicator& ind, bool fill_null = false) {
|
|
78
|
+
return WITHKTYPE(ind, KQuery::MIN, fill_null);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
inline Indicator WITHMIN5(bool fill_null = false) {
|
|
82
|
+
return WITHKTYPE(KQuery::MIN5, fill_null);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
inline Indicator WITHMIN5(const Indicator& ind, bool fill_null = false) {
|
|
86
|
+
return WITHKTYPE(ind, KQuery::MIN5, fill_null);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
inline Indicator WITHMIN15(bool fill_null = false) {
|
|
90
|
+
return WITHKTYPE(KQuery::MIN15, fill_null);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
inline Indicator WITHMIN15(const Indicator& ind, bool fill_null = false) {
|
|
94
|
+
return WITHKTYPE(ind, KQuery::MIN15, fill_null);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
inline Indicator WITHMIN30(bool fill_null = false) {
|
|
98
|
+
return WITHKTYPE(KQuery::MIN30, fill_null);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
inline Indicator WITHMIN30(const Indicator& ind, bool fill_null = false) {
|
|
102
|
+
return WITHKTYPE(ind, KQuery::MIN30, fill_null);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
inline Indicator WITHMIN60(bool fill_null = false) {
|
|
106
|
+
return WITHKTYPE(KQuery::MIN60, fill_null);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
inline Indicator WITHMIN60(const Indicator& ind, bool fill_null = false) {
|
|
110
|
+
return WITHKTYPE(ind, KQuery::MIN60, fill_null);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
inline Indicator WITHHOUR(bool fill_null = false) {
|
|
114
|
+
return WITHKTYPE(KQuery::MIN60, fill_null);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
inline Indicator WITHHOUR(const Indicator& ind, bool fill_null = false) {
|
|
118
|
+
return WITHKTYPE(ind, KQuery::MIN60, fill_null);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
inline Indicator WITHHOUR2(bool fill_null = false) {
|
|
122
|
+
return WITHKTYPE(KQuery::HOUR2, fill_null);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
inline Indicator WITHHOUR2(const Indicator& ind, bool fill_null = false) {
|
|
126
|
+
return WITHKTYPE(ind, KQuery::HOUR2, fill_null);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
inline Indicator WITHHOUR4(bool fill_null = false) {
|
|
130
|
+
return WITHKTYPE(KQuery::HOUR4, fill_null);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
inline Indicator WITHHOUR4(const Indicator& ind, bool fill_null = false) {
|
|
134
|
+
return WITHKTYPE(ind, KQuery::HOUR4, fill_null);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* @brief 计算指标值在指定板块中的排名
|
|
139
|
+
* @param block 指定板块
|
|
140
|
+
* @param ref_ind 指标
|
|
141
|
+
* @param mode 排名模式,0-降序排名(指标值最高值排名为1), 1-升序排名(指标值越大排名值越大),
|
|
142
|
+
* 2-降序排名百分比, 3-升序排名百分比
|
|
143
|
+
* @param fill_null 是否填充null数据
|
|
144
|
+
* @param market 指定市场(对齐日期)
|
|
145
|
+
* @return Indicator
|
|
146
|
+
*/
|
|
147
|
+
Indicator HKU_API RANK(const Block& block, const Indicator& ref_ind, int mode = 0,
|
|
148
|
+
bool fill_null = true, const string& market = "SH");
|
|
149
|
+
|
|
150
|
+
} // namespace hku
|
|
@@ -20,7 +20,8 @@ public:
|
|
|
20
20
|
virtual void backtest(const StrategyContext& context,
|
|
21
21
|
const std::function<void(Strategy*)>& on_bar, const TradeManagerPtr& tm,
|
|
22
22
|
const Datetime& start_date, const Datetime& end_date,
|
|
23
|
-
const KQuery::KType& ktype, const string& ref_market, int mode
|
|
23
|
+
const KQuery::KType& ktype, const string& ref_market, int mode,
|
|
24
|
+
bool support_short) = 0;
|
|
24
25
|
};
|
|
25
26
|
|
|
26
27
|
} // namespace hku
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025 hikyuu.org
|
|
3
|
+
*
|
|
4
|
+
* Created on: 2025-05-19
|
|
5
|
+
* Author: fasiondog
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include "hikyuu/indicator/Indicator.h"
|
|
11
|
+
#include "hikyuu/utilities/plugin/PluginBase.h"
|
|
12
|
+
|
|
13
|
+
namespace hku {
|
|
14
|
+
|
|
15
|
+
class ExtendIndicatorsPluginInterface : public PluginBase {
|
|
16
|
+
public:
|
|
17
|
+
ExtendIndicatorsPluginInterface() = default;
|
|
18
|
+
virtual ~ExtendIndicatorsPluginInterface() = default;
|
|
19
|
+
|
|
20
|
+
virtual Indicator getIndicator(const std::string& name, const Parameter& params) const = 0;
|
|
21
|
+
|
|
22
|
+
virtual Indicator getIndicator(const std::string& name, const Indicator& ref_ind,
|
|
23
|
+
const Parameter& params) const = 0;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
} // namespace hku
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
#include "DevicePluginInterface.h"
|
|
12
12
|
#include "DataServerPluginInterface.h"
|
|
13
13
|
#include "ImportKDataToHdf5PluginInterface.h"
|
|
14
|
+
#include "ExtendIndicatorsPluginInterface.h"
|
|
14
15
|
|
|
15
16
|
namespace hku {
|
|
16
17
|
|
|
@@ -18,5 +19,6 @@ namespace hku {
|
|
|
18
19
|
#define HKU_PLUGIN_DEVICE "device"
|
|
19
20
|
#define HKU_PLUGIN_DATASERVER "dataserver"
|
|
20
21
|
#define HKU_PLUGIN_IMPORTKDATATOHDF5 "import2hdf5"
|
|
22
|
+
#define HKU_PLUGIN_EXTEND_INDICATOR "extind"
|
|
21
23
|
|
|
22
24
|
}
|
|
@@ -258,7 +258,8 @@ public:
|
|
|
258
258
|
*/
|
|
259
259
|
virtual TradeRecord buy(const Datetime& datetime, const Stock& stock, price_t realPrice,
|
|
260
260
|
double number, price_t stoploss = 0.0, price_t goalPrice = 0.0,
|
|
261
|
-
price_t planPrice = 0.0, SystemPart from = PART_INVALID
|
|
261
|
+
price_t planPrice = 0.0, SystemPart from = PART_INVALID,
|
|
262
|
+
const string& remark = "") override;
|
|
262
263
|
|
|
263
264
|
/**
|
|
264
265
|
* 卖出操作
|
|
@@ -275,7 +276,7 @@ public:
|
|
|
275
276
|
virtual TradeRecord sell(const Datetime& datetime, const Stock& stock, price_t realPrice,
|
|
276
277
|
double number = MAX_DOUBLE, price_t stoploss = 0.0,
|
|
277
278
|
price_t goalPrice = 0.0, price_t planPrice = 0.0,
|
|
278
|
-
SystemPart from = PART_INVALID) override;
|
|
279
|
+
SystemPart from = PART_INVALID, const string& remark = "") override;
|
|
279
280
|
|
|
280
281
|
/**
|
|
281
282
|
* 卖空
|
|
@@ -291,8 +292,8 @@ public:
|
|
|
291
292
|
*/
|
|
292
293
|
virtual TradeRecord sellShort(const Datetime& datetime, const Stock& stock, price_t realPrice,
|
|
293
294
|
double number, price_t stoploss = 0.0, price_t goalPrice = 0.0,
|
|
294
|
-
price_t planPrice = 0.0,
|
|
295
|
-
|
|
295
|
+
price_t planPrice = 0.0, SystemPart from = PART_INVALID,
|
|
296
|
+
const string& remark = "") override {
|
|
296
297
|
HKU_WARN("The subclass does not implement this method");
|
|
297
298
|
return TradeRecord();
|
|
298
299
|
}
|
|
@@ -312,7 +313,8 @@ public:
|
|
|
312
313
|
virtual TradeRecord buyShort(const Datetime& datetime, const Stock& stock, price_t realPrice,
|
|
313
314
|
double number = MAX_DOUBLE, price_t stoploss = 0.0,
|
|
314
315
|
price_t goalPrice = 0.0, price_t planPrice = 0.0,
|
|
315
|
-
SystemPart from = PART_INVALID
|
|
316
|
+
SystemPart from = PART_INVALID,
|
|
317
|
+
const string& remark = "") override {
|
|
316
318
|
HKU_WARN("The subclass does not implement this method");
|
|
317
319
|
return TradeRecord();
|
|
318
320
|
}
|