模拟实盘报错

模拟实盘错误
标签: #<Tag:0x00007fa196501830>

(ohmyskyhigh) #1

回测没有问题,但是发送至模拟交易时会在m3处报告AttributeError,咋整?


AttributeError Traceback (most recent call last)
in ()
313 features=m2.data,
314 start_date=’’,
–> 315 end_date=’’
316 )
317

/var/app/enabled/biglearning/module2/common/modulemanagerv2.cpython-36m-x86_64-linux-gnu.so in biglearning.module2.common.modulemanagerv2.BigQuantModuleVersion.call()

/var/app/enabled/biglearning/module2/common/moduleinvoker.cpython-36m-x86_64-linux-gnu.so in biglearning.module2.common.moduleinvoker.module_invoke()

/var/app/enabled/biglearning/module2/modules/general_feature_extractor/v7/init.cpython-36m-x86_64-linux-gnu.so in biglearning.module2.modules.general_feature_extractor.v7.init.bigquant_cache_key()

/var/app/enabled/bigexpr/impl/expression.cpython-36m-x86_64-linux-gnu.so in bigexpr.impl.expression.extract_variables()

/var/app/enabled/bigexpr/impl/expression.cpython-36m-x86_64-linux-gnu.so in bigexpr.impl.expression.__evaluate_ast()

AttributeError: ‘Attribute’ object has no attribute ‘id’

m1 = M.instruments.v2(
    start_date=T.live_run_param('trading_date', '2019-01-01'),
    end_date=T.live_run_param('trading_date', '2020-07-31'),
    market='CN_STOCK_A',
    instrument_list='',
    max_count=0
)

m2 = M.input_features.v1(
    features="""# #号开始的表示注释,注释需单独一行
# 多个特征,每行一个,可以包含基础特征和衍生特征,特征须为本平台特征
rsi_14 = ta_rsi_14_0
rsi_14_r2 = rsi_14-shift(ta_rsi_14_0, 2)
roe = fs_roe_0
roe_ttm = fs_roe_ttm_0
R_120 = return_120
eps = fs_eps_0
close_0
open_0
date_bt = (shift(date, -1)).dt.strftime('%Y-%m-%d')

pe = pe_ttm_0
volatility = volatility_30_0
industry_sw_level1 = industry_sw_level1_0
pe_mean = group_mean(industry_sw_level1_0, pe_ttm_0)
roe_mean = group_mean(industry_sw_level1_0, roe)
status = st_status_0
eps_yoy = fs_eps_yoy_0


receivable = fs_account_receivable_0
current_assets = fs_current_assets_0
fs_publish_date = fs_publish_date_0
fs_quarter_index = fs_quarter_index_0
fs_quarter_year = fs_quarter_year_0

list_board_0"""
)

m3 = M.general_feature_extractor.v7(
    instruments=m1.data,
    features=m2.data,
    start_date='',
    end_date=''
)

m4 = M.derived_feature_extractor.v3(
    input_data=m3.data,
    features=m2.data,
    date_col='date',
    instrument_col='instrument',
    drop_na=True,
    remove_extra_columns=True,
    user_functions=m4_user_functions_bigquant_run
)


(adhaha111) #2

您可以发下完整的策略吗,我这边运行是没有问题的


(adhaha111) #3

您可以仔细分析下自己的因子部分,出现这个错误很大可能都是因子的提取问题


(ohmyskyhigh) #4

我这边在回测模式下完美通过,只要上交易就报错。我不是特别好排查问题。如果我们这边能把模拟交易机制给写一下就好了


(ohmyskyhigh) #8

更新过后的因子跟上面不一样但又同样的问题,排查过后是以下因子好像有问题,是因为在模拟盘中因子列表中不支持pandas series function吗?

if_roe_good = roe.between(0, roe_mean)

(adhaha111) #9

您好,您重跑一下看下呢,我这边模拟交易也是没问题的