回测没有问题,但点击开始交易后没有任何结果

新手专区
标签: #<Tag:0x00007fcf788ebe40>

(richewan) #1

写了一个策略,在我的策略中运行时,都可以看到回测的结果

,但点击开始交易后,在我的交易中,看到的结果如下,累计收益等指标都是0

策略代码如下:是从社区中拷贝的

instruments = [‘600519.SHA’] # 选择的投资标的
start_date = ‘2014-07-17’ # 回测开始日期
end_date = ‘2018-06-07’ # 回测结束日期
def initialize(context):
context.set_commission(PerDollar(0.0015)) # 手续费设置

def handle_data(context, data):

if context.trading_day_index < 20: # 在20个交易日以后才开始真正运行
    return

sid = context.symbol(instruments[0])
price = data.current(sid, 'price') # 当前价格

high_point = data.history(sid, 'price', 20, '1d').max() # 20日高点 
low_point = data.history(sid, 'price', 10, '1d').min() # 10日低点    
    
# 持仓
cur_position = context.portfolio.positions[sid].amount  
           
# 交易逻辑
# 最新价大于20日高点,并且处于空仓状态,并且该股票当日可以交易
if price >= high_point  and cur_position == 0 and data.can_trade(sid):  
    context.order_target_percent(sid, 1) 
# 最新价小鱼等于10日低点,并且持有股票,并且该股票当日可以交易    
elif price <= low_point  and cur_position > 0 and data.can_trade(sid): 
    context.order_target_percent(sid, 0) 

m=M.trade.v3(
instruments=instruments,
start_date=start_date,
end_date=end_date,
initialize=initialize,
handle_data=handle_data,
order_price_field_buy=‘open’,# 买入股票订单成交价为收盘价
order_price_field_sell=‘open’,# 卖出股票订单成交价为收盘价
capital_base=float(“1.0e6”),# 初始资金为100万
benchmark=‘000300.INDX’,# 比较基准为沪深300指数
)


(richewan) #2

这个问题提交4天时间了,平台一直都还没有答复啊


(iQuant) #3

您好,这个要看是否有开仓,另外可用金额可能有点问题,能具体看一下您的代码么


(richewan) #4

下面的是我编写的策略,模拟运行没有任何结果,但回测有结果. 您可以复制过去运行一下.

按照学院文档介绍的,只要模拟运行之后,应该是可以直接看到回侧记录的.

另外,请教一下,在仓位控制上,我要实现 如果当前持仓股票为0,则买入全部持有资金的一半, 如果当前持有股票,还需要买入3只股票,则按剩下的资金分3等分买入,代码如何写啊, 这个我还没研究明白.

1. 策略基本参数

证券池:这里使用所有股票

instruments = D.instruments()

起始日期

start_date = ‘2018-06-01’

结束日期

end_date = ‘2018-06-12’

初始资金

capital_base = 100000

策略比较参考标准,以沪深300为例

benchmark = ‘000300.INDX’

调仓周期(多少个交易日调仓)

rebalance_period = 0

每轮调仓买入的股票数量

stock_num = 3

import numpy as np
import pandas as pd

instrument1 = D.instruments(start_date=start_date, end_date=start_date)
instrument2 = D.features(instruments=instrument1,start_date=start_date, end_date=start_date, fields=[‘list_days_0’])
instrument=instrument2[instrument2[‘list_days_0’]>10][‘instrument’].values

features = [
‘high’,‘amount’,‘turn’,‘low’,‘open’,‘close’,‘high’
]

m1 = M.user_feature_extractor.v1(
instruments=instrument, start_date=start_date, end_date=end_date,
history_data_fields=features, look_back_days=10,
features_by_instrument={

    'u_close_00':lambda x:x.open-x.close,
    'u_return_1':lambda x:(x.shift(1).close-x.shift(2).close)/x.shift(2).close,
    'u_return_2':lambda x:(x.shift(2).close-x.shift(3).close)/x.shift(3).close,
    'u_range':lambda x:(x.high-x.low)/(x.high),
}

)

df=m1.data.read_df()
s=df.copy()

s=s.sort_values(by=[‘date’])

s=s[ (s[‘u_close_00’]>=0) ]

selected_data=s[ ( (s[‘u_return_1’]>0.06)&(s[‘u_return_1’]+s[‘u_return_2’]>0.05) ) ] [[ ‘instrument’,‘date’]]

selected_data=selected_data.reset_index()

2. 选择股票:为了得到更好的性能,在这里做批量计算

selected_data = selected_data.groupby(‘date’).apply(lambda df: df[:stock_num])

def initialize(context):
# 设置手续费,买入时万3,卖出是千分之1.3,不足5元以5元计
context.set_commission(PerOrder(buy_cost=0.0003, sell_cost=0.0013, min_cost=5))
context.max_cash_per_instrument = 0.2

策略交易逻辑,每个交易日运行一次

def handle_data(context,data):
today_buy = data.current_dt.strftime(’%Y-%m-%d’) # 交易日期
# 调仓:卖出所有持有股票
for equity in context.portfolio.positions:
#--------------根据持仓天数决定卖出------------------
today = data.current_dt
pos = context.portfolio.positions
if data.can_trade(equity) and today - context.portfolio.positions[equity].last_sale_date >=datetime.timedelta(context.options[‘rebalance_period’]) :
context.order_target_percent(equity, 0)
#---------------end---------------------------------

# 调仓:买入新的股票
try:
    instruments_to_buy = context.options['selected_data'].ix[today_buy].instrument
except:
    instruments_to_buy=[]
    
if len(instruments_to_buy) == 0:
    return
# 等量分配资金买入股票
weight = 1.0 / len(instruments_to_buy)
for instrument in instruments_to_buy:
    if data.can_trade(context.symbol(instrument)):
        context.order_target_percent(context.symbol(instrument), weight)

策略回测:

m = M.trade.v3(
instruments=D.instruments(),
start_date=start_date, #selected_data.date[0].strftime(’%Y-%m-%d’),
end_date = end_date, #selected_data.date[-1].strftime(’%Y-%m-%d’),
#start_date=‘2016-02-24’,
#end_date=‘2017-02-22’,
initialize=initialize,
handle_data=handle_data,
# 买入订单以开盘价成交
order_price_field_buy=‘open’,
# 卖出订单以开盘价成交
order_price_field_sell=‘close’,
capital_base=1000000,
benchmark=‘000300.INDX’,
# 传入数据给回测模块,所有回测函数里用到的数据都要从这里传入,并通过 context.options 使用,否则可能会遇到缓存问题
options={‘selected_data’: selected_data, ‘rebalance_period’: 0},
)


(zhw_henry) #5

我发现这问题了,不过是在新地址上运行不行,在老地址之前上的策略运行没问题


(达达) #6

我试着猜测您的想法改成了可视化策略,您看一下,每天的选股条件可能您要自己处理一下,感觉始终买入那几只

克隆策略

    {"Description":"实验创建于2017/8/26","Summary":"","Graph":{"EdgesInternal":[{"DestinationInputPortId":"287d2cb0-f53c-4101-bdf8-104b137c8601-76:features","SourceOutputPortId":"287d2cb0-f53c-4101-bdf8-104b137c8601-24:data"},{"DestinationInputPortId":"287d2cb0-f53c-4101-bdf8-104b137c8601-70:features","SourceOutputPortId":"287d2cb0-f53c-4101-bdf8-104b137c8601-24:data"},{"DestinationInputPortId":"287d2cb0-f53c-4101-bdf8-104b137c8601-70:instruments","SourceOutputPortId":"287d2cb0-f53c-4101-bdf8-104b137c8601-62:data"},{"DestinationInputPortId":"287d2cb0-f53c-4101-bdf8-104b137c8601-81:instruments","SourceOutputPortId":"287d2cb0-f53c-4101-bdf8-104b137c8601-62:data"},{"DestinationInputPortId":"287d2cb0-f53c-4101-bdf8-104b137c8601-76:input_data","SourceOutputPortId":"287d2cb0-f53c-4101-bdf8-104b137c8601-70:data"},{"DestinationInputPortId":"-86:input_data","SourceOutputPortId":"287d2cb0-f53c-4101-bdf8-104b137c8601-76:data"},{"DestinationInputPortId":"287d2cb0-f53c-4101-bdf8-104b137c8601-81:options_data","SourceOutputPortId":"-86:data"}],"ModuleNodes":[{"Id":"287d2cb0-f53c-4101-bdf8-104b137c8601-24","ModuleId":"BigQuantSpace.input_features.input_features-v1","ModuleParameters":[{"Name":"features","Value":"# #号开始的表示注释\n# 多个特征,每行一个,可以包含基础特征和衍生特征\nhigh_0\namount_0\nturn_0\nlow_0\nopen_0\nclose_0\nopen_0-close_0\nreturn_1\nreturn_2\n(high_0-low_0)/high_0\nlist_days_0","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features_ds","NodeId":"287d2cb0-f53c-4101-bdf8-104b137c8601-24"}],"OutputPortsInternal":[{"Name":"data","NodeId":"287d2cb0-f53c-4101-bdf8-104b137c8601-24","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":1,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"287d2cb0-f53c-4101-bdf8-104b137c8601-62","ModuleId":"BigQuantSpace.instruments.instruments-v2","ModuleParameters":[{"Name":"start_date","Value":"2018-03-01","ValueType":"Literal","LinkedGlobalParameter":"交易日期"},{"Name":"end_date","Value":"2018-06-12","ValueType":"Literal","LinkedGlobalParameter":"交易日期"},{"Name":"market","Value":"CN_STOCK_A","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"instrument_list","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"max_count","Value":"0","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"rolling_conf","NodeId":"287d2cb0-f53c-4101-bdf8-104b137c8601-62"}],"OutputPortsInternal":[{"Name":"data","NodeId":"287d2cb0-f53c-4101-bdf8-104b137c8601-62","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":2,"IsPartOfPartialRun":null,"Comment":"预测数据,用于回测和模拟","CommentCollapsed":false},{"Id":"287d2cb0-f53c-4101-bdf8-104b137c8601-70","ModuleId":"BigQuantSpace.general_feature_extractor.general_feature_extractor-v6","ModuleParameters":[{"Name":"start_date","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"end_date","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"before_start_days","Value":"10","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"instruments","NodeId":"287d2cb0-f53c-4101-bdf8-104b137c8601-70"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features","NodeId":"287d2cb0-f53c-4101-bdf8-104b137c8601-70"}],"OutputPortsInternal":[{"Name":"data","NodeId":"287d2cb0-f53c-4101-bdf8-104b137c8601-70","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":3,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"287d2cb0-f53c-4101-bdf8-104b137c8601-76","ModuleId":"BigQuantSpace.derived_feature_extractor.derived_feature_extractor-v2","ModuleParameters":[{"Name":"date_col","Value":"date","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"instrument_col","Value":"instrument","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"user_functions","Value":"","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_data","NodeId":"287d2cb0-f53c-4101-bdf8-104b137c8601-76"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"features","NodeId":"287d2cb0-f53c-4101-bdf8-104b137c8601-76"}],"OutputPortsInternal":[{"Name":"data","NodeId":"287d2cb0-f53c-4101-bdf8-104b137c8601-76","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":4,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"287d2cb0-f53c-4101-bdf8-104b137c8601-81","ModuleId":"BigQuantSpace.trade.trade-v3","ModuleParameters":[{"Name":"start_date","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"end_date","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"handle_data","Value":"# 回测引擎:每日数据处理函数,每天执行一次\ndef bigquant_run(context, data):\n today_date = data.current_dt.strftime('%Y-%m-%d') # 交易日期\n stock_sell=[]\n # 调仓:卖出所有持有股票\n for equity in context.portfolio.positions:\n #--------------根据持仓天数决定卖出------------------\n today = data.current_dt\n pos = context.portfolio.positions\n if data.can_trade(equity) and today - context.portfolio.positions[equity].last_sale_date >=datetime.timedelta(context.rebalance_period) :\n context.order_target_percent(equity, 0)\n stock_sell.append(equity)\n print(today_date,'卖出',stock_sell)\n #---------------end---------------------------------\n \n # 调仓:买入新的股票\n try:\n instruments_to_buy = context.selected_data.ix[today_date].instrument.values.tolist()[0:context.stock_num]\n\n except:\n instruments_to_buy=[]\n\n if len(instruments_to_buy) == 0:\n return\n # 等量分配资金买入股票\n weight = 1.0 / len(instruments_to_buy)\n for instrument in instruments_to_buy:\n if data.can_trade(context.symbol(instrument)):\n context.order_target_percent(context.symbol(instrument), weight)\n print(today_date,'买入',instruments_to_buy)","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"prepare","Value":"# 回测引擎:准备数据,只执行一次\ndef bigquant_run(context):\n # 加载预测数据\n df = context.options['data'].read_df()\n s=df[df['(high_0-low_0)/high_0']>=0]\n selected=s[(s['return_1']>0.06) & (s['return_1']+s['return_2']>0.05) & (s['list_days_0']>10)]\n selected_data = selected[['date','instrument']]\n selected_data['date']=selected_data['date'].apply(lambda x:x.strftime('%Y-%m-%d'))\n context.selected_data=selected_data.set_index('date')\n","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"initialize","Value":"# 回测引擎:初始化函数,只执行一次\ndef bigquant_run(context):\n\n # 系统已经设置了默认的交易手续费和滑点,要修改手续费可使用如下函数\n context.set_commission(PerOrder(buy_cost=0.0003, sell_cost=0.0013, min_cost=5))\n context.max_cash_per_instrument = 0.2\n context.rebalance_period = 0\n context.stock_num=3","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"before_trading_start","Value":"","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"volume_limit","Value":0.025,"ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"order_price_field_buy","Value":"open","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"order_price_field_sell","Value":"close","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"capital_base","Value":1000000,"ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"benchmark","Value":"000300.SHA","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"auto_cancel_non_tradable_orders","Value":"True","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"data_frequency","Value":"daily","ValueType":"Literal","LinkedGlobalParameter":null},{"Name":"price_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":"amount_integer","Value":"False","ValueType":"Literal","LinkedGlobalParameter":null}],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"instruments","NodeId":"287d2cb0-f53c-4101-bdf8-104b137c8601-81"},{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"options_data","NodeId":"287d2cb0-f53c-4101-bdf8-104b137c8601-81"}],"OutputPortsInternal":[{"Name":"raw_perf","NodeId":"287d2cb0-f53c-4101-bdf8-104b137c8601-81","OutputType":null}],"UsePreviousResults":false,"moduleIdForCode":5,"IsPartOfPartialRun":null,"Comment":"","CommentCollapsed":true},{"Id":"-86","ModuleId":"BigQuantSpace.dropnan.dropnan-v1","ModuleParameters":[],"InputPortsInternal":[{"DataSourceId":null,"TrainedModelId":null,"TransformModuleId":null,"Name":"input_data","NodeId":"-86"}],"OutputPortsInternal":[{"Name":"data","NodeId":"-86","OutputType":null}],"UsePreviousResults":true,"moduleIdForCode":6,"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='287d2cb0-f53c-4101-bdf8-104b137c8601-24' Position='765,23.081432342529297,200,200'/><NodePosition Node='287d2cb0-f53c-4101-bdf8-104b137c8601-62' Position='1074,121,200,200'/><NodePosition Node='287d2cb0-f53c-4101-bdf8-104b137c8601-70' Position='1078,234,200,200'/><NodePosition Node='287d2cb0-f53c-4101-bdf8-104b137c8601-76' Position='1076,327,200,200'/><NodePosition Node='287d2cb0-f53c-4101-bdf8-104b137c8601-81' Position='1067.302978515625,636.5015869140625,200,200'/><NodePosition Node='-86' Position='1063.4300537109375,511.6644592285156,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 [41]:
    # 本代码由可视化策略环境自动生成 2018年6月15日 14:47
    # 本代码单元只能在可视化模式下编辑。您也可以拷贝代码,粘贴到新建的代码单元或者策略,然后修改。
    
    
    m1 = M.input_features.v1(
        features="""# #号开始的表示注释
    # 多个特征,每行一个,可以包含基础特征和衍生特征
    high_0
    amount_0
    turn_0
    low_0
    open_0
    close_0
    open_0-close_0
    return_1
    return_2
    (high_0-low_0)/high_0
    list_days_0"""
    )
    
    m2 = M.instruments.v2(
        start_date=T.live_run_param('trading_date', '2018-03-01'),
        end_date=T.live_run_param('trading_date', '2018-06-12'),
        market='CN_STOCK_A',
        instrument_list='',
        max_count=0
    )
    
    m3 = M.general_feature_extractor.v6(
        instruments=m2.data,
        features=m1.data,
        start_date='',
        end_date='',
        before_start_days=10
    )
    
    m4 = M.derived_feature_extractor.v2(
        input_data=m3.data,
        features=m1.data,
        date_col='date',
        instrument_col='instrument'
    )
    
    m6 = M.dropnan.v1(
        input_data=m4.data
    )
    
    # 回测引擎:每日数据处理函数,每天执行一次
    def m5_handle_data_bigquant_run(context, data):
        today_date = data.current_dt.strftime('%Y-%m-%d') # 交易日期
        stock_sell=[]
        # 调仓:卖出所有持有股票
        for equity in context.portfolio.positions:
            #--------------根据持仓天数决定卖出------------------
            today = data.current_dt
            pos = context.portfolio.positions
            if data.can_trade(equity) and today - context.portfolio.positions[equity].last_sale_date >=datetime.timedelta(context.rebalance_period) :
                context.order_target_percent(equity, 0)
                stock_sell.append(equity)
        print(today_date,'卖出',stock_sell)
            #---------------end---------------------------------
        
        # 调仓:买入新的股票
        try:
            instruments_to_buy = context.selected_data.ix[today_date].instrument.values.tolist()[0:context.stock_num]
    
        except:
            instruments_to_buy=[]
    
        if len(instruments_to_buy) == 0:
            return
        # 等量分配资金买入股票
        weight = 1.0 / len(instruments_to_buy)
        for instrument in instruments_to_buy:
            if data.can_trade(context.symbol(instrument)):
                context.order_target_percent(context.symbol(instrument), weight)
        print(today_date,'买入',instruments_to_buy)
    # 回测引擎:准备数据,只执行一次
    def m5_prepare_bigquant_run(context):
        # 加载预测数据
        df = context.options['data'].read_df()
        s=df[df['(high_0-low_0)/high_0']>=0]
        selected=s[(s['return_1']>0.06) & (s['return_1']+s['return_2']>0.05) & (s['list_days_0']>10)]
        selected_data = selected[['date','instrument']]
        selected_data['date']=selected_data['date'].apply(lambda x:x.strftime('%Y-%m-%d'))
        context.selected_data=selected_data.set_index('date')
    
    # 回测引擎:初始化函数,只执行一次
    def m5_initialize_bigquant_run(context):
    
        # 系统已经设置了默认的交易手续费和滑点,要修改手续费可使用如下函数
        context.set_commission(PerOrder(buy_cost=0.0003, sell_cost=0.0013, min_cost=5))
        context.max_cash_per_instrument = 0.2
        context.rebalance_period = 0
        context.stock_num=3
    m5 = M.trade.v3(
        instruments=m2.data,
        options_data=m6.data,
        start_date='',
        end_date='',
        handle_data=m5_handle_data_bigquant_run,
        prepare=m5_prepare_bigquant_run,
        initialize=m5_initialize_bigquant_run,
        volume_limit=0.025,
        order_price_field_buy='open',
        order_price_field_sell='close',
        capital_base=1000000,
        benchmark='000300.SHA',
        auto_cancel_non_tradable_orders=True,
        data_frequency='daily',
        price_type='后复权',
        plot_charts=True,
        backtest_only=False,
        amount_integer=False
    )
    
    [2018-06-15 14:47:49.038910] INFO: bigquant: input_features.v1 开始运行..
    [2018-06-15 14:47:49.042202] INFO: bigquant: 命中缓存
    [2018-06-15 14:47:49.043423] INFO: bigquant: input_features.v1 运行完成[0.004565s].
    [2018-06-15 14:47:49.049357] INFO: bigquant: instruments.v2 开始运行..
    [2018-06-15 14:47:49.052098] INFO: bigquant: 命中缓存
    [2018-06-15 14:47:49.053188] INFO: bigquant: instruments.v2 运行完成[0.003805s].
    [2018-06-15 14:47:49.062857] INFO: bigquant: general_feature_extractor.v6 开始运行..
    [2018-06-15 14:47:49.065081] INFO: bigquant: 命中缓存
    [2018-06-15 14:47:49.065984] INFO: bigquant: general_feature_extractor.v6 运行完成[0.003118s].
    [2018-06-15 14:47:49.072385] INFO: bigquant: derived_feature_extractor.v2 开始运行..
    [2018-06-15 14:47:49.074673] INFO: bigquant: 命中缓存
    [2018-06-15 14:47:49.075521] INFO: bigquant: derived_feature_extractor.v2 运行完成[0.003138s].
    [2018-06-15 14:47:49.082840] INFO: bigquant: dropnan.v1 开始运行..
    [2018-06-15 14:47:49.085724] INFO: bigquant: 命中缓存
    [2018-06-15 14:47:49.086823] INFO: bigquant: dropnan.v1 运行完成[0.003962s].
    [2018-06-15 14:47:49.112071] INFO: bigquant: backtest.v7 开始运行..
    [2018-06-15 14:47:51.813030] INFO: algo: set price type:backward_adjusted
    2018-03-01 卖出 []
    2018-03-01 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-03-02 卖出 [Equity(1563 [000004.SZA]), Equity(1915 [000001.SZA]), Equity(2253 [000002.SZA])]
    2018-03-02 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-03-05 卖出 [Equity(1915 [000001.SZA]), Equity(1563 [000004.SZA]), Equity(2253 [000002.SZA])]
    2018-03-05 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-03-06 卖出 [Equity(1563 [000004.SZA]), Equity(1915 [000001.SZA]), Equity(2253 [000002.SZA])]
    2018-03-06 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-03-07 卖出 [Equity(1915 [000001.SZA]), Equity(1563 [000004.SZA]), Equity(2253 [000002.SZA])]
    2018-03-07 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-03-08 卖出 [Equity(1563 [000004.SZA]), Equity(1915 [000001.SZA]), Equity(2253 [000002.SZA])]
    2018-03-08 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-03-09 卖出 [Equity(1915 [000001.SZA]), Equity(1563 [000004.SZA]), Equity(2253 [000002.SZA])]
    2018-03-09 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-03-12 卖出 [Equity(1563 [000004.SZA]), Equity(1915 [000001.SZA]), Equity(2253 [000002.SZA])]
    2018-03-12 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-03-13 卖出 [Equity(1915 [000001.SZA]), Equity(1563 [000004.SZA]), Equity(2253 [000002.SZA])]
    2018-03-13 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-03-14 卖出 [Equity(1563 [000004.SZA]), Equity(1915 [000001.SZA]), Equity(2253 [000002.SZA])]
    2018-03-14 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-03-15 卖出 [Equity(1915 [000001.SZA]), Equity(1563 [000004.SZA]), Equity(2253 [000002.SZA])]
    2018-03-15 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-03-16 卖出 [Equity(1563 [000004.SZA]), Equity(1915 [000001.SZA]), Equity(2253 [000002.SZA])]
    2018-03-16 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-03-19 卖出 [Equity(1915 [000001.SZA]), Equity(1563 [000004.SZA]), Equity(2253 [000002.SZA])]
    2018-03-19 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-03-20 卖出 [Equity(1563 [000004.SZA]), Equity(1915 [000001.SZA]), Equity(2253 [000002.SZA])]
    2018-03-20 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-03-21 卖出 [Equity(1915 [000001.SZA]), Equity(1563 [000004.SZA]), Equity(2253 [000002.SZA])]
    2018-03-21 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-03-22 卖出 [Equity(1563 [000004.SZA]), Equity(1915 [000001.SZA]), Equity(2253 [000002.SZA])]
    2018-03-22 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-03-23 卖出 [Equity(1915 [000001.SZA]), Equity(1563 [000004.SZA]), Equity(2253 [000002.SZA])]
    2018-03-23 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-03-26 卖出 [Equity(1563 [000004.SZA]), Equity(1915 [000001.SZA]), Equity(2253 [000002.SZA])]
    2018-03-26 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-03-27 卖出 [Equity(1915 [000001.SZA]), Equity(1563 [000004.SZA]), Equity(2253 [000002.SZA])]
    2018-03-27 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-03-28 卖出 [Equity(1563 [000004.SZA]), Equity(1915 [000001.SZA]), Equity(2253 [000002.SZA])]
    2018-03-28 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-03-29 卖出 [Equity(1915 [000001.SZA]), Equity(1563 [000004.SZA]), Equity(2253 [000002.SZA])]
    2018-03-29 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-03-30 卖出 [Equity(1563 [000004.SZA]), Equity(1915 [000001.SZA]), Equity(2253 [000002.SZA])]
    2018-03-30 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-04-02 卖出 [Equity(1915 [000001.SZA]), Equity(1563 [000004.SZA]), Equity(2253 [000002.SZA])]
    2018-04-02 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-04-03 卖出 [Equity(1563 [000004.SZA]), Equity(1915 [000001.SZA]), Equity(2253 [000002.SZA])]
    2018-04-03 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-04-04 卖出 [Equity(1915 [000001.SZA]), Equity(1563 [000004.SZA]), Equity(2253 [000002.SZA])]
    2018-04-04 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-04-09 卖出 [Equity(1563 [000004.SZA]), Equity(1915 [000001.SZA]), Equity(2253 [000002.SZA])]
    2018-04-09 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-04-10 卖出 [Equity(1915 [000001.SZA]), Equity(1563 [000004.SZA]), Equity(2253 [000002.SZA])]
    2018-04-10 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-04-11 卖出 [Equity(1563 [000004.SZA]), Equity(1915 [000001.SZA]), Equity(2253 [000002.SZA])]
    2018-04-11 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-04-12 卖出 [Equity(1915 [000001.SZA]), Equity(1563 [000004.SZA]), Equity(2253 [000002.SZA])]
    2018-04-12 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-04-13 卖出 [Equity(1563 [000004.SZA]), Equity(1915 [000001.SZA]), Equity(2253 [000002.SZA])]
    2018-04-13 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-04-16 卖出 [Equity(1915 [000001.SZA]), Equity(1563 [000004.SZA]), Equity(2253 [000002.SZA])]
    2018-04-16 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-04-17 卖出 [Equity(1563 [000004.SZA]), Equity(1915 [000001.SZA]), Equity(2253 [000002.SZA])]
    2018-04-17 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-04-18 卖出 [Equity(1915 [000001.SZA]), Equity(1563 [000004.SZA]), Equity(2253 [000002.SZA])]
    2018-04-18 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-04-19 卖出 [Equity(1563 [000004.SZA]), Equity(1915 [000001.SZA]), Equity(2253 [000002.SZA])]
    2018-04-19 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-04-20 卖出 [Equity(1915 [000001.SZA]), Equity(1563 [000004.SZA]), Equity(2253 [000002.SZA])]
    2018-04-20 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-04-23 卖出 [Equity(1563 [000004.SZA]), Equity(1915 [000001.SZA]), Equity(2253 [000002.SZA])]
    2018-04-23 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-04-24 卖出 [Equity(1915 [000001.SZA]), Equity(1563 [000004.SZA]), Equity(2253 [000002.SZA])]
    2018-04-24 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-04-25 卖出 [Equity(1563 [000004.SZA]), Equity(1915 [000001.SZA]), Equity(2253 [000002.SZA])]
    2018-04-25 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-04-26 卖出 [Equity(1915 [000001.SZA]), Equity(1563 [000004.SZA]), Equity(2253 [000002.SZA])]
    2018-04-26 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-04-27 卖出 [Equity(1563 [000004.SZA]), Equity(1915 [000001.SZA]), Equity(2253 [000002.SZA])]
    2018-04-27 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-05-02 卖出 [Equity(1915 [000001.SZA]), Equity(1563 [000004.SZA]), Equity(2253 [000002.SZA])]
    2018-05-02 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-05-03 卖出 [Equity(1563 [000004.SZA]), Equity(1915 [000001.SZA]), Equity(2253 [000002.SZA])]
    2018-05-03 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-05-04 卖出 [Equity(1915 [000001.SZA]), Equity(1563 [000004.SZA]), Equity(2253 [000002.SZA])]
    2018-05-04 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-05-07 卖出 [Equity(1563 [000004.SZA]), Equity(1915 [000001.SZA]), Equity(2253 [000002.SZA])]
    2018-05-07 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-05-08 卖出 [Equity(1915 [000001.SZA]), Equity(1563 [000004.SZA]), Equity(2253 [000002.SZA])]
    2018-05-08 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-05-09 卖出 [Equity(1563 [000004.SZA]), Equity(1915 [000001.SZA]), Equity(2253 [000002.SZA])]
    2018-05-09 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-05-10 卖出 [Equity(1915 [000001.SZA]), Equity(1563 [000004.SZA]), Equity(2253 [000002.SZA])]
    2018-05-10 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-05-11 卖出 [Equity(1563 [000004.SZA]), Equity(1915 [000001.SZA]), Equity(2253 [000002.SZA])]
    2018-05-11 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-05-14 卖出 [Equity(1915 [000001.SZA]), Equity(1563 [000004.SZA]), Equity(2253 [000002.SZA])]
    2018-05-14 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-05-15 卖出 [Equity(1563 [000004.SZA]), Equity(1915 [000001.SZA]), Equity(2253 [000002.SZA])]
    2018-05-15 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-05-16 卖出 [Equity(1915 [000001.SZA]), Equity(1563 [000004.SZA]), Equity(2253 [000002.SZA])]
    2018-05-16 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-05-17 卖出 [Equity(1563 [000004.SZA]), Equity(1915 [000001.SZA]), Equity(2253 [000002.SZA])]
    2018-05-17 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-05-18 卖出 [Equity(1915 [000001.SZA]), Equity(1563 [000004.SZA]), Equity(2253 [000002.SZA])]
    2018-05-18 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-05-21 卖出 [Equity(1563 [000004.SZA]), Equity(1915 [000001.SZA]), Equity(2253 [000002.SZA])]
    2018-05-21 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-05-22 卖出 [Equity(1915 [000001.SZA]), Equity(1563 [000004.SZA]), Equity(2253 [000002.SZA])]
    2018-05-22 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-05-23 卖出 [Equity(1563 [000004.SZA]), Equity(1915 [000001.SZA]), Equity(2253 [000002.SZA])]
    2018-05-23 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-05-24 卖出 [Equity(1915 [000001.SZA]), Equity(1563 [000004.SZA]), Equity(2253 [000002.SZA])]
    2018-05-24 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-05-25 卖出 [Equity(1563 [000004.SZA]), Equity(1915 [000001.SZA]), Equity(2253 [000002.SZA])]
    2018-05-25 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-05-28 卖出 [Equity(1915 [000001.SZA]), Equity(1563 [000004.SZA]), Equity(2253 [000002.SZA])]
    2018-05-28 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-05-29 卖出 [Equity(1563 [000004.SZA]), Equity(1915 [000001.SZA]), Equity(2253 [000002.SZA])]
    2018-05-29 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-05-30 卖出 [Equity(1915 [000001.SZA]), Equity(1563 [000004.SZA]), Equity(2253 [000002.SZA])]
    2018-05-30 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-05-31 卖出 [Equity(1563 [000004.SZA]), Equity(1915 [000001.SZA]), Equity(2253 [000002.SZA])]
    2018-05-31 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-06-01 卖出 [Equity(1915 [000001.SZA]), Equity(1563 [000004.SZA]), Equity(2253 [000002.SZA])]
    2018-06-01 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-06-04 卖出 [Equity(1563 [000004.SZA]), Equity(1915 [000001.SZA]), Equity(2253 [000002.SZA])]
    2018-06-04 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-06-05 卖出 [Equity(1915 [000001.SZA]), Equity(1563 [000004.SZA]), Equity(2253 [000002.SZA])]
    2018-06-05 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-06-06 卖出 [Equity(1563 [000004.SZA]), Equity(1915 [000001.SZA]), Equity(2253 [000002.SZA])]
    2018-06-06 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-06-07 卖出 [Equity(1915 [000001.SZA]), Equity(1563 [000004.SZA]), Equity(2253 [000002.SZA])]
    2018-06-07 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-06-08 卖出 [Equity(1563 [000004.SZA]), Equity(1915 [000001.SZA]), Equity(2253 [000002.SZA])]
    2018-06-08 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-06-11 卖出 [Equity(1915 [000001.SZA]), Equity(1563 [000004.SZA]), Equity(2253 [000002.SZA])]
    2018-06-11 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    2018-06-12 卖出 [Equity(1563 [000004.SZA]), Equity(1915 [000001.SZA]), Equity(2253 [000002.SZA])]
    2018-06-12 买入 ['000001.SZA', '000002.SZA', '000004.SZA']
    [2018-06-15 14:48:14.552487] INFO: Performance: Simulated 70 trading days out of 70.
    [2018-06-15 14:48:14.554175] INFO: Performance: first open: 2018-03-01 01:30:00+00:00
    [2018-06-15 14:48:14.555251] INFO: Performance: last close: 2018-06-12 07:00:00+00:00
    
    • 收益率-6.21%
    • 年化收益率-20.62%
    • 基准收益率-4.91%
    • 阿尔法-0.11
    • 贝塔0.68
    • 夏普比率-1.29
    • 胜率0.48
    • 盈亏比1.16
    • 收益波动率19.37%
    • 信息比率-0.24
    • 最大回撤13.97%
    [2018-06-15 14:48:15.570700] INFO: bigquant: backtest.v7 运行完成[26.458612s].
    


    (richewan) #7

    好的,谢谢! 我再研究下看看