期货AR分钟策略-回测/模拟错误


(angsidongfang1) #1


如图,点击新建-期货策略-期货分钟AR策略,点击运行全部之后会显示:

error_help error:  'NoneType' object has no attribute 'get'
Trade (回测/模拟)(trade)使用错误

错误代码
[2020-01-08 16:22:51.198693] INFO: bigquant: 命中缓存

[2020-01-08 16:22:51.200611] INFO: bigquant: cached.v2 运行完成[0.032426s].

[2020-01-08 16:22:51.283742] INFO: algo: TradingAlgorithm V1.6.3

[2020-01-08 16:22:52.507368] INFO: algo: trading transform...

[2020-01-08 16:22:53.585823] ERROR: bigquant: module name: backtest, module version: v8, trackeback: Traceback (most recent call last): AttributeError: 'Position' object has no attribute 'to_dict'

[2020-01-08 16:22:53.599452] ERROR: bigquant: module name: trade, module version: v4, trackeback: Traceback (most recent call last): AttributeError: 'Position' object has no attribute 'to_dict'

error_help error: 'NoneType' object has no attribute 'get'

Trade (回测/模拟)(trade)使用错误,你可以:

[1.一键查看文档](https://bigquant.com/docs/modules.html#trade)

[2.一键搜索答案](https://bigquant.com/community/search?q=ck:%20Traceback%20(most%20recent%20call%20last):AttributeError:%20%27Position%27%20object%20has%20no%20attribute%20%27to_dict%27)

--------------------------------------------------------------------------- AttributeError Traceback (most recent call last) <ipython-input-1-c9ea940d8135> in <module>() 160 plot_charts=True, 161 backtest_only=False, --> 162 benchmark='' 163 ) AttributeError: 'Position' object has no attribute 'to_dict'

无解,不知道是什么原因
另外,不修改策略,仅修改期货品种以及开始和结束时间,仍然会显示回测使用错误,不知道该如何解决,求助大神


(angsidongfang1) #2


之后用了几个策略,也出现了类似的问题


(iQuant) #3

您好,可以将报错策略分享到社区,我们来帮您看一下:


(达达) #4

期货每个合约是有声明周期的,回测日期不能乱填。如果你填的日期合约都交割了,就没日线行情给你回测了。


(angsidongfang1) #5

不是这个问题,看我第一个帖子
新建的是默认模板,该模板是【期货分钟AR策略】,使用该策略的所有默认参数
所有都是默认参数
【任何指标都没有修改】、【没有修改任何指标!】
接下来第二个步骤,点击【全部运行】开始跑程序
接下来就开始报错


(angsidongfang1) #6
克隆策略

期货AR分钟策略

版本 v1.0

目录

  • ### AR策略的交易规则

  • ### 策略构建步骤

  • ### 策略的实现

正文

一、AR策略的交易规则

  • 当收盘价 ≥ 最近60日收盘价最高值时,平空开多;
  • 当收盘价 ≤ 最近60日收盘价最低值时,平多开空;

二、策略构建步骤

1、确定期货合约和回测时间

  • 通过证券代码列表输入要回测的一个期货合约,以及回测的起止日期,本例合约代码为 RB1901.SHF, 开始时间为2018-04-20 09:01:00,结束时间为2018-05-20 15:15:00

2、确定买卖条件信号

  • 在输入特征列表中通过表达式引擎定义 buy_condition=where(close>=ts_max(close,60),1,0),实现开多信号。
  • 在输入特征列表中通过表达式引擎定义 sell_condition=where(close<=ts_min(close,60),1,0),实现卖空信号。
  • 通过自定义Python模块m4获取期货合约数据
  • 通过衍生特征抽取模块实现买卖条件指标 buy_condition 和 sell_condition 数据的抽取。
  • 通过缺失数据处理模块删去有缺失值的数据。

3、确定买卖原则

  • 每日LOOKBACK_WINDOW根K线后开始操作。

  • 根据开多信号,执行平空开多操作。

  • 根据卖空信号,执行平多开空操作。

  • 每日22点50分平掉所有仓位,保证无隔夜持仓。

4、模拟回测

  • 通过 trade 模块中的初始化函数定义交易手续费、滑点、杠杆比例和是否逐日结算,初始化记录当日Bar数量的变量context.index=1,初始化记录当日交易次数 context.position_counts=0;
  • 通过 trade 模块中的准备函数定义 context.buy_condition 和 context.sell_condition 变量来获取并存放每日交易信号;
  • 通过 trade 模块中的主函数(handle函数)查看每日的交易信号,按照买卖原则执行相应的操作。

三、策略的实现

可视化策略实现如下:

    {"Description":"实验创建于2018/10/16","Summary":"","Graph":{"EdgesInternal":[{"DestinationInputPortId":"-1442:instruments","SourceOutputPortId":"-25:data"},{"DestinationInputPortId":"-1483:input_1","SourceOutputPortId":"-25:data"},{"DestinationInputPortId":"-1473:features","SourceOutputPortId":"-1468:data"},{"DestinationInputPortId":"-1632:input_data","SourceOutputPortId":"-1473:data"},{"DestinationInputPortId":"-1473:input_data","SourceOutputPortId":"-1483:data_1"},{"DestinationInputPortId":"-1442:options_data","SourceOutputPortId":"-1632:data"}],"ModuleNodes":[{"Id":"-25","ModuleId":"BigQuantSpace.instruments.instruments-v2","ModuleParameters":[{"Name":"start_date","Value":"2018-04-20 09:01:00","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"end_date","Value":"2018-05-20 15:15:00","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"market","Value":"CN_FUTURE","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"instrument_list","Value":"RB1901.SHF","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"max_count","Value":0,"ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"rolling_conf","NodeId":"-25"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-25","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":2,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-1442","ModuleId":"BigQuantSpace.trade.trade-v4","ModuleParameters":[{"Name":"start_date","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"end_date","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"initialize","Value":"# 回测引擎:初始化函数,只执行一次\ndef bigquant_run(context):\n # 设置是否是结算模式\n context.set_need_settle(False)\n # 设置最大杠杆\n context.set_max_leverage(1, 'fill_amap')\n \n # 设置手续费\n context.set_commission(futures_commission=PerContract(cost={'RB':(0.000045, 0.000045, 0.000045)}))\n context.set_margin('RB', 0.07)\n \n # 当日分钟K线数量记录变量初始化\n context.index = 1\n # 当日交易次数记录变量初始化\n context.position_counts = 0","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"handle_data","Value":"# 回测引擎:每日数据处理函数,每天执行一次\ndef bigquant_run(context, data):\n # 每次下单手数\n TRADING_UNIT = 5\n # 每日下单次数限制\n DAILY_TRADING_LIMITS = 2\n # 每天LOOKBACK_WINDOW根K线后开始交易\n LOOKBACK_WINDOW = 60\n # 每日平仓时间\n DAY_END_HOUR = 22\n DAY_END_MINUTE = 50\n # 每日隔夜仓保留数量\n EMPTY_POSITION = 0\n \n today = data.current_dt\n instrument_symbol = context.future_symbol(context.instruments[0]) # 交易标的\n curr_position = context.portfolio.positions[instrument_symbol].amount # 持仓数量\n \n\n if context.index < LOOKBACK_WINDOW: # 日内数据超过窗口范围后才开始交易\n context.index += 1\n return\n \n if today.hour >= DAY_END_HOUR and today.minute >= DAY_END_MINUTE:\n context.index = 1 # 下标初始化\n context.position_counts = 0\n # 了结当日仓位\n if curr_position != EMPTY_POSITION:\n context.order_target(instrument_symbol, EMPTY_POSITION)\n return\n \n # 获取当前分钟的买卖信号\n today_date=today.strftime('%Y-%m-%d %H:%M:%S')\n try:\n buy_condition = context.buy_condition[today_date]\n except:\n buy_condition = 0\n \n try: \n sell_condition=context.sell_condition[today_date]\n except:\n sell_condition = 0\n \n price = data.history(instrument_symbol, 'close', LOOKBACK_WINDOW, '1m')\n \n # 如果当前没有仓位,且大于通道价格上限,long开仓\n if curr_position <= 0 and buy_condition>0 and context.position_counts < DAILY_TRADING_LIMITS:\n context.position_counts += 1 \n context.order_target(instrument_symbol, TRADING_UNIT)\n elif curr_position >= 0 and sell_condition>0 and context.position_counts < DAILY_TRADING_LIMITS:\n context.position_counts += 1\n context.order_target(instrument_symbol, -TRADING_UNIT)","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"prepare","Value":"# 回测引擎:准备数据,只执行一次\ndef bigquant_run(context):\n df = context.options['data'].read_df()\n df['date']=df['date'].apply(lambda x:x.strftime('%Y-%m-%d %H:%M:%S'))\n df.set_index('date',inplace=True)\n context.buy_condition=df['buy_condition']\n context.sell_condition=df['sell_condition']\n\n","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"before_trading_start","Value":"# 回测引擎:每个单位时间开始前调用一次,即每日开盘前调用一次。\ndef bigquant_run(context, data):\n pass\n","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"volume_limit","Value":"0","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"order_price_field_buy","Value":"open","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"order_price_field_sell","Value":"open","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"capital_base","Value":"50000","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"auto_cancel_non_tradable_orders","Value":"True","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"data_frequency","Value":"minute","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"price_type","Value":"后复权","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"product_type","Value":"期货","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"plot_charts","Value":"True","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"backtest_only","Value":"False","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"benchmark","Value":"","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"instruments","NodeId":"-1442"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"options_data","NodeId":"-1442"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"history_ds","NodeId":"-1442"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"benchmark_ds","NodeId":"-1442"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"trading_calendar","NodeId":"-1442"}],"OutputPortsInternal":[{"Name":"raw_perf","NodeId":"-1442","OutputType":null}],"UsePreviousResults":false,"moduleIdForCode":3,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-1468","ModuleId":"BigQuantSpace.input_features.input_features-v1","ModuleParameters":[{"Name":"features","Value":"\n# #号开始的表示注释\n# 多个特征,每行一个,可以包含基础特征和衍生特征\nbuy_condition=where(close>=ts_max(close,60),1,0)\nsell_condition=where(close<=ts_min(close,60),1,0)\n","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features_ds","NodeId":"-1468"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-1468","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":5,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-1473","ModuleId":"BigQuantSpace.derived_feature_extractor.derived_feature_extractor-v3","ModuleParameters":[{"Name":"date_col","Value":"date","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"instrument_col","Value":"instrument","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"drop_na","Value":"False","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"remove_extra_columns","Value":"False","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"user_functions","Value":"{}","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_data","NodeId":"-1473"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features","NodeId":"-1473"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-1473","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":6,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-1483","ModuleId":"BigQuantSpace.cached.cached-v3","ModuleParameters":[{"Name":"run","Value":"# Python 代码入口函数,input_1/2/3 对应三个输入端,data_1/2/3 对应三个输出端\ndef bigquant_run(input_1, input_2, input_3,before_days):\n # 示例代码如下。在这里编写您的代码\n #start_date=(pd.to_datetime(input_1.read_pickle()['start_date']) - datetime.timedelta(days=before_days)).strftime('%Y-%m-%d %H:%M:%S')\n start_date=input_1.read_pickle()['start_date']\n end_date=input_1.read_pickle()['end_date']\n ins=input_1.read_pickle()['instruments'][0]\n df = DataSource('bar1m_'+ins).read(start_date=start_date,end_date=end_date,fields=['open','close','high','low'])\n df['adjust_factor']=1.0\n data_1 = DataSource.write_df(df)\n return Outputs(data_1=data_1, data_2=None, data_3=None)\n","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"post_run","Value":"# 后处理函数,可选。输入是主函数的输出,可以在这里对数据做处理,或者返回更友好的outputs数据格式。此函数输出不会被缓存。\ndef bigquant_run(outputs):\n return outputs\n","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"input_ports","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"params","Value":"{'before_days':1}","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"output_ports","Value":"","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_1","NodeId":"-1483"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_2","NodeId":"-1483"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_3","NodeId":"-1483"}],"OutputPortsInternal":[{"Name":"data_1","NodeId":"-1483","OutputType":null},{"Name":"data_2","NodeId":"-1483","OutputType":null},{"Name":"data_3","NodeId":"-1483","OutputType":null}],"UsePreviousResults":false,"moduleIdForCode":4,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-1632","ModuleId":"BigQuantSpace.dropnan.dropnan-v1","ModuleParameters":[],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_data","NodeId":"-1632"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-1632","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":7,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true}],"SerializedClientData":"<?xml version='1.0' encoding='utf-16'?><DataV1 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><Meta /><NodePositions><NodePosition Node='-25' Position='-54,0,200,200'/><NodePosition Node='-1442' Position='-47,444,200,200'/><NodePosition Node='-1468' Position='553,32,200,200'/><NodePosition Node='-1473' Position='362,230,200,200'/><NodePosition Node='-1483' Position='271,124,200,200'/><NodePosition Node='-1632' Position='344,325,200,200'/></NodePositions><NodeGroups /></DataV1>"},"IsDraft":true,"ParentExperimentId":null,"WebService":{"IsWebServiceExperiment":false,"Inputs":[],"Outputs":[],"Parameters":[{"Name":"交易日期","Value":"","ParameterDefinition":{"Name":"交易日期","FriendlyName":"交易日期","DefaultValue":"","ParameterType":"String","HasDefaultValue":true,"IsOptional":true,"ParameterRules":[],"HasRules":false,"MarkupType":0,"CredentialDescriptor":null}}],"WebServiceGroupId":null,"SerializedClientData":"<?xml version='1.0' encoding='utf-16'?><DataV1 xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'><Meta /><NodePositions></NodePositions><NodeGroups /></DataV1>"},"DisableNodesUpdate":false,"Category":"user","Tags":[],"IsPartialRun":true}
    In [1]:
    # 本代码由可视化策略环境自动生成 2020年1月9日 16:45
    # 本代码单元只能在可视化模式下编辑。您也可以拷贝代码,粘贴到新建的代码单元或者策略,然后修改。
    
    
    # Python 代码入口函数,input_1/2/3 对应三个输入端,data_1/2/3 对应三个输出端
    def m4_run_bigquant_run(input_1, input_2, input_3,before_days):
        # 示例代码如下。在这里编写您的代码
        #start_date=(pd.to_datetime(input_1.read_pickle()['start_date']) - datetime.timedelta(days=before_days)).strftime('%Y-%m-%d %H:%M:%S')
        start_date=input_1.read_pickle()['start_date']
        end_date=input_1.read_pickle()['end_date']
        ins=input_1.read_pickle()['instruments'][0]
        df = DataSource('bar1m_'+ins).read(start_date=start_date,end_date=end_date,fields=['open','close','high','low'])
        df['adjust_factor']=1.0
        data_1 = DataSource.write_df(df)
        return Outputs(data_1=data_1, data_2=None, data_3=None)
    
    # 后处理函数,可选。输入是主函数的输出,可以在这里对数据做处理,或者返回更友好的outputs数据格式。此函数输出不会被缓存。
    def m4_post_run_bigquant_run(outputs):
        return outputs
    
    # 回测引擎:初始化函数,只执行一次
    def m3_initialize_bigquant_run(context):
       # 设置是否是结算模式
        context.set_need_settle(False)
        # 设置最大杠杆
        context.set_max_leverage(1, 'fill_amap')
        
        # 设置手续费
        context.set_commission(futures_commission=PerContract(cost={'RB':(0.000045, 0.000045, 0.000045)}))
        context.set_margin('RB', 0.07)
        
        # 当日分钟K线数量记录变量初始化
        context.index = 1
        # 当日交易次数记录变量初始化
        context.position_counts = 0
    # 回测引擎:每日数据处理函数,每天执行一次
    def m3_handle_data_bigquant_run(context, data):
        # 每次下单手数
        TRADING_UNIT = 5
        # 每日下单次数限制
        DAILY_TRADING_LIMITS = 2
        # 每天LOOKBACK_WINDOW根K线后开始交易
        LOOKBACK_WINDOW = 60
        # 每日平仓时间
        DAY_END_HOUR = 22
        DAY_END_MINUTE = 50
        # 每日隔夜仓保留数量
        EMPTY_POSITION = 0
        
        today = data.current_dt
        instrument_symbol = context.future_symbol(context.instruments[0]) # 交易标的
        curr_position = context.portfolio.positions[instrument_symbol].amount # 持仓数量
        
    
        if context.index < LOOKBACK_WINDOW: # 日内数据超过窗口范围后才开始交易
            context.index += 1
            return
        
        if today.hour >= DAY_END_HOUR and today.minute >= DAY_END_MINUTE:
            context.index = 1              # 下标初始化
            context.position_counts = 0
            # 了结当日仓位
            if curr_position != EMPTY_POSITION:
                context.order_target(instrument_symbol, EMPTY_POSITION)
            return
        
        # 获取当前分钟的买卖信号
        today_date=today.strftime('%Y-%m-%d %H:%M:%S')
        try:
            buy_condition = context.buy_condition[today_date]
        except:
            buy_condition = 0
        
        try:    
            sell_condition=context.sell_condition[today_date]
        except:
            sell_condition = 0
            
        price = data.history(instrument_symbol, 'close', LOOKBACK_WINDOW, '1m')
        
        # 如果当前没有仓位,且大于通道价格上限,long开仓
        if curr_position <= 0 and buy_condition>0 and context.position_counts < DAILY_TRADING_LIMITS:
            context.position_counts += 1 
            context.order_target(instrument_symbol, TRADING_UNIT)
        elif curr_position >= 0 and sell_condition>0 and context.position_counts < DAILY_TRADING_LIMITS:
            context.position_counts += 1
            context.order_target(instrument_symbol, -TRADING_UNIT)
    # 回测引擎:准备数据,只执行一次
    def m3_prepare_bigquant_run(context):
        df = context.options['data'].read_df()
        df['date']=df['date'].apply(lambda x:x.strftime('%Y-%m-%d %H:%M:%S'))
        df.set_index('date',inplace=True)
        context.buy_condition=df['buy_condition']
        context.sell_condition=df['sell_condition']
    
    
    # 回测引擎:每个单位时间开始前调用一次,即每日开盘前调用一次。
    def m3_before_trading_start_bigquant_run(context, data):
        pass
    
    
    m2 = M.instruments.v2(
        start_date='2018-04-20 09:01:00',
        end_date='2018-05-20 15:15:00',
        market='CN_FUTURE',
        instrument_list='RB1901.SHF',
        max_count=0
    )
    
    m4 = M.cached.v3(
        input_1=m2.data,
        run=m4_run_bigquant_run,
        post_run=m4_post_run_bigquant_run,
        input_ports='',
        params='{\'before_days\':1}',
        output_ports='',
        m_cached=False
    )
    
    m5 = M.input_features.v1(
        features="""
    # #号开始的表示注释
    # 多个特征,每行一个,可以包含基础特征和衍生特征
    buy_condition=where(close>=ts_max(close,60),1,0)
    sell_condition=where(close<=ts_min(close,60),1,0)
    """
    )
    
    m6 = M.derived_feature_extractor.v3(
        input_data=m4.data_1,
        features=m5.data,
        date_col='date',
        instrument_col='instrument',
        drop_na=False,
        remove_extra_columns=False,
        user_functions={}
    )
    
    m7 = M.dropnan.v1(
        input_data=m6.data
    )
    
    m3 = M.trade.v4(
        instruments=m2.data,
        options_data=m7.data,
        start_date='',
        end_date='',
        initialize=m3_initialize_bigquant_run,
        handle_data=m3_handle_data_bigquant_run,
        prepare=m3_prepare_bigquant_run,
        before_trading_start=m3_before_trading_start_bigquant_run,
        volume_limit=0,
        order_price_field_buy='open',
        order_price_field_sell='open',
        capital_base=50000,
        auto_cancel_non_tradable_orders=True,
        data_frequency='minute',
        price_type='后复权',
        product_type='期货',
        plot_charts=True,
        backtest_only=False,
        benchmark=''
    )
    
    error_help error:  'NoneType' object has no attribute 'get'
    

    Trade (回测/模拟)(trade)使用错误,你可以:

    1.一键查看文档

    2.一键搜索答案

    ---------------------------------------------------------------------------
    AttributeError                            Traceback (most recent call last)
    <ipython-input-1-df542b839312> in <module>()
        160     plot_charts=True,
        161     backtest_only=False,
    --> 162     benchmark=''
        163 )
    
    AttributeError: 'Position' object has no attribute 'to_dict'

    【这个策略不是我编写的!】
    【这个策略是系统自带的默认策略!】
    点击新建-期货AR策略就可以找到,所有指标都没有任何修改
    只要点击运行全部就开始报错
    纳闷

    (达达) #7

    我这边正常出结果。你关闭一下策略开发环境试一下。



    (tinylight) #8

    同样的报错 。是不是系统有什么调整


    (达达) #9

    问题已经找到,等修复完了就可以用了。


    (tinylight) #10

    啥时候好


    (达达) #11

    已经好了吧