PIT(point in time)
TTM:过去12个月单季度财务数据的加总,净利润:Q3,Q2
mrq:
lf:
ly:
_n:np_ly_0/np_ly_1 -1
ROIC 衡量的是股东和债权人投入的本钱,到底获取了多少回报? 假如企业赚到的钱是一个蛋糕,它最后会被三个人分走,支付的利息费用被债主拿走了,缴的税被国家拿走了,剩下的利润被股东拿走了。
ROE = 净利润/净资产:1.净利润容易被操控;2.净资产没有考虑债权人的利润 ROA衡量所有资产
【ROIC】投入资本回报率 |释义|:ROIC是生产经营活动中所有投入资本赚取的收益率,而不论这些投入资本是被称为债务还是权益。分子是指公司如果完全按权益筹资所应报告的税后利润,分母是指公司所有要求回报的现金来源的总和。。相对而言ROIC是比ROA和ROE更全面、更好的度量盈利能力的工具,是衡量一家公司真实经营业绩最好的度量指标,与ROE相比,ROIC去除了公司不同的融资结构对盈利能力造成的影响,使用ROIC将有助于投资者将关注的核心聚焦在核心业务的盈利能力上。 |公式|:EBIT反推法(1-有效税率)2/(期初全部投入资本+期末全部投入资本)
【有效税率】 |公式|:有效税率:当所得税>0时,为所得税/利润总额,否则为0
【EBIT正推法】 (营业总收入-营业税金及附加)-(营业成本+利息支出+手续费及佣金支出+销售费用+管理费用+研发费用+存货跌价损失+信用减值损失)+其他收益
【EBIT反推法】 |公式|:利润总额+利息费用(不含资本化利息支出) 如果财务报告中公布了财务费用明细,则“利息费用=(利息支出-财务费用明细.利息资本化金额)-利息收入”;如果财务报告中未公布财务费用明细,则以“利润表.利息费用 -利润表.利息收入 ”替代。一般而言,中期报告和年度报告中会公布财务费用明细。
【投入资本】 |释义|:投入资本指所有投资者(股权人、债权人)投入的资金总和,这些资金都是意图分享企业经营回报的。投入资本与总资产的核心差别在于投资资本中不包括无息负债。 股东权益(含少数股东权益)+负债合计-无息流动负债-无息长期负债
【无息流动负债】 |释义|:无息流动负债在资产负债表中主要表现为应付账款、应付工资、其他应付等。无息流动负债也是企业对其他方资金的一种占用,但这部分资金并不来自于投资人,这种资金占用只是企业正常经营活动中的一个必要环节,一种循环占用。 |公式|:应付帐款及应付票据+预收款项+应付职工薪酬+应交税费+其他应付款合计+预提费用+递延收益.流动负债+合同负债+其他流动负债-短期融资债(其他流动负债)+衍生金融负债
【无息非流动负债】 |释义|:无息非流动负债在资产负债表中主要体现为预计负债、长期应付款等。为了谨慎起见,我们采用间接法计算无息非流动负债。 |公式|:非流动负债合计-长期借款-应付债券
df = m5.data_1.read()[['date','instrument','roic_ttm_0']]
df[df.instrument=='000063.SZA']
# 本代码由可视化策略环境自动生成 2022年11月21日 13:45
# 本代码单元只能在可视化模式下编辑。您也可以拷贝代码,粘贴到新建的代码单元或者策略,然后修改。
# Python 代码入口函数,input_1/2/3 对应三个输入端,data_1/2/3 对应三个输出端
def m5_run_bigquant_run(input_1, input_2, input_3):
df = input_1.read()
df.replace(np.nan, round(0, 1), inplace=True)
# 无息流动负债
df['noninterest_current_liab_lf_0'] = df['bill_and_account_payable_lf_0'] + df['advance_payment_lf_0'] + df['payroll_payable_lf_0'] + df['tax_payable_lf_0'] + df['other_payables_sum_lf_0'] + df['differed_income_current_liab_lf_0'] + df['contract_liab_lf_0'] + df['other_current_liab_lf_0'] + df['derivative_fnncl_liab_lf_0']
df['noninterest_current_liab_lf_4'] = df['bill_and_account_payable_lf_4'] + df['advance_payment_lf_4'] + df['payroll_payable_lf_4'] + df['tax_payable_lf_4'] + df['other_payables_sum_lf_4'] + df['differed_income_current_liab_lf_4'] + df['contract_liab_lf_4'] + df['other_current_liab_lf_4'] + df['derivative_fnncl_liab_lf_4']
# 无息非流动负债
df['noninterest_noncurrent_liab_lf_0'] = df['total_noncurrent_liab_lf_0'] - df['lt_loan_lf_0'] - df['bond_payable_lf_0']
df['noninterest_noncurrent_liab_lf_4'] = df['total_noncurrent_liab_lf_4'] - df['lt_loan_lf_4'] - df['bond_payable_lf_4']
# 全部投入资本
df['total_paidin_capital_lf_0'] = df['total_owner_equity_lf_0'] + (df['total_liab_lf_0'] - df['noninterest_current_liab_lf_0'] - df['noninterest_noncurrent_liab_lf_0'])
df['total_paidin_capital_lf_4'] = df['total_owner_equity_lf_4'] + (df['total_liab_lf_4'] - df['noninterest_current_liab_lf_4'] - df['noninterest_noncurrent_liab_lf_4'])
# 平均全部投入资本
df['total_paidin_capital_ttm_mean'] = (df['total_paidin_capital_lf_0'] + df['total_paidin_capital_lf_4']) / 2
# 是否有财务费用明细的数据打标签
df['nan_tag_fs_interest_income_ttm_0'] = 0 # 财务费用明细有数据则为0,则不用财务费用科目的数据
df.loc[(df['interest_fee_ttm_0']==0)&(df['fc_interest_income_ttm_0']==0), 'nan_tag_fs_interest_income_ttm_0'] = 1
df['EBIT_ttm_0'] = df['total_profit_ttm_0'] + (df['interest_fee_ttm_0'] - df['fc_interest_income_ttm_0']) + df['financing_expenses_ttm_0'] * df['nan_tag_fs_interest_income_ttm_0']
# 给利润总额为负的数据打标签
df['neg_tag_total_profit'] = 1
df.loc[df['total_profit_ttm_0']<0, 'neg_tag_total_profit'] = 0
df['effective_tax_rate_ttm_0'] = (df['income_tax_cost_ttm_0'] * df['neg_tag_total_profit']) / df['total_profit_ttm_0']
# 计算ROIC
df['roic_ttm_0'] = (df['EBIT_ttm_0'] * (1 - df['effective_tax_rate_ttm_0'])) / df['total_paidin_capital_ttm_mean']
data_1 = DataSource.write_df(df)
return Outputs(data_1=data_1, data_2=None, data_3=None)
# 后处理函数,可选。输入是主函数的输出,可以在这里对数据做处理,或者返回更友好的outputs数据格式。此函数输出不会被缓存。
def m5_post_run_bigquant_run(outputs):
return outputs
# 回测引擎:初始化函数,只执行一次
def m7_initialize_bigquant_run(context):
# 加载预测数据
context.ranker_prediction = context.options['data'].read_df()
# 系统已经设置了默认的交易手续费和滑点,要修改手续费可使用如下函数
context.set_commission(PerOrder(buy_cost=0.0003, sell_cost=0.0013, min_cost=5))
# 预测数据,通过options传入进来,使用 read_df 函数,加载到内存 (DataFrame)
# 设置买入的股票数量,这里买入预测股票列表排名靠前的5只
stock_count = 50
# 每只的股票的权重,如下的权重分配会使得靠前的股票分配多一点的资金,[0.339160, 0.213986, 0.169580, ..]
context.stock_weights = T.norm([1 / math.log(i + 2) for i in range(0, stock_count)])
# 设置每只股票占用的最大资金比例
context.max_cash_per_instrument = 0.2
context.options['hold_days'] = 5
# 回测引擎:每日数据处理函数,每天执行一次
def m7_handle_data_bigquant_run(context, data):
# 按日期过滤得到今日的预测数据
ranker_prediction = context.ranker_prediction[
context.ranker_prediction.date == data.current_dt.strftime('%Y-%m-%d')]
ranker_prediction = ranker_prediction.sort_values('roic_ttm_0',ascending=False)
# 1. 资金分配
# 平均持仓时间是hold_days,每日都将买入股票,每日预期使用 1/hold_days 的资金
# 实际操作中,会存在一定的买入误差,所以在前hold_days天,等量使用资金;之后,尽量使用剩余资金(这里设置最多用等量的1.5倍)
is_staging = context.trading_day_index < context.options['hold_days'] # 是否在建仓期间(前 hold_days 天)
cash_avg = context.portfolio.portfolio_value / context.options['hold_days']
cash_for_buy = min(context.portfolio.cash, (1 if is_staging else 1.5) * cash_avg)
cash_for_sell = cash_avg - (context.portfolio.cash - cash_for_buy)
positions = {e.symbol: p.amount * p.last_sale_price
for e, p in context.perf_tracker.position_tracker.positions.items()}
# 2. 生成卖出订单:hold_days天之后才开始卖出;对持仓的股票,按机器学习算法预测的排序末位淘汰
if not is_staging and cash_for_sell > 0:
equities = {e.symbol: e for e, p in context.perf_tracker.position_tracker.positions.items()}
instruments = list(reversed(list(ranker_prediction.instrument[ranker_prediction.instrument.apply(
lambda x: x in equities and not context.has_unfinished_sell_order(equities[x]))])))
# print('rank order for sell %s' % instruments)
for instrument in instruments:
context.order_target(context.symbol(instrument), 0)
cash_for_sell -= positions[instrument]
if cash_for_sell <= 0:
break
# 3. 生成买入订单:按机器学习算法预测的排序,买入前面的stock_count只股票
buy_cash_weights = context.stock_weights
buy_instruments = list(ranker_prediction.instrument[:len(buy_cash_weights)])
max_cash_per_instrument = context.portfolio.portfolio_value * context.max_cash_per_instrument
for i, instrument in enumerate(buy_instruments):
cash = cash_for_buy * buy_cash_weights[i]
if cash > max_cash_per_instrument - positions.get(instrument, 0):
# 确保股票持仓量不会超过每次股票最大的占用资金量
cash = max_cash_per_instrument - positions.get(instrument, 0)
if cash > 0:
context.order_value(context.symbol(instrument), cash)
# 回测引擎:准备数据,只执行一次
def m7_prepare_bigquant_run(context):
pass
# 回测引擎:每个单位时间开始前调用一次,即每日开盘前调用一次。
def m7_before_trading_start_bigquant_run(context, data):
pass
m1 = M.input_features.v1(
features="""# 所得税费用
income_tax_cost_ttm_0
income_tax_cost_ttm_4
# 利润总额
total_profit_ttm_0
total_profit_ttm_4
# 财务费用:利息费用
interest_fee_ttm_0
interest_fee_ttm_4
# 财务费用:利息收入
fc_interest_income_ttm_0
fc_interest_income_ttm_4
# 财务费用
financing_expenses_ttm_0
financing_expenses_ttm_4
# 所有者权益
total_owner_equity_lf_0
total_owner_equity_lf_4
# 负债合计
total_liab_lf_0
total_liab_lf_4
# 应收账款及应付票据
bill_and_account_payable_lf_0
bill_and_account_payable_lf_4
# 预收款项
advance_payment_lf_0
advance_payment_lf_4
# 应付职工薪酬
payroll_payable_lf_0
payroll_payable_lf_4
# 应交税费
tax_payable_lf_0
tax_payable_lf_4
# 其他应付款合计
other_payables_sum_lf_0
other_payables_sum_lf_4
# 递延收益.流动负债
differed_income_current_liab_lf_0
differed_income_current_liab_lf_4
# 合同负债
contract_liab_lf_0
contract_liab_lf_4
# 其他流动负债
other_current_liab_lf_0
other_current_liab_lf_4
# 衍生金融负债
derivative_fnncl_liab_lf_0
derivative_fnncl_liab_lf_4
# 非流动负债合计
total_noncurrent_liab_lf_0
total_noncurrent_liab_lf_4
# 长期借款
lt_loan_lf_0
lt_loan_lf_4
# 应付债券
bond_payable_lf_0
bond_payable_lf_4"""
)
m2 = M.instruments.v2(
start_date='2020-01-01',
end_date='2021-01-01',
market='CN_STOCK_A',
instrument_list='',
max_count=0
)
m3 = M.general_feature_extractor.v7(
instruments=m2.data,
features=m1.data,
start_date='',
end_date='',
before_start_days=90
)
m4 = M.derived_feature_extractor.v3(
input_data=m3.data,
features=m1.data,
date_col='date',
instrument_col='instrument',
drop_na=False,
remove_extra_columns=False,
user_functions={}
)
m5 = M.cached.v3(
input_1=m4.data,
run=m5_run_bigquant_run,
post_run=m5_post_run_bigquant_run,
input_ports='',
params='{}',
output_ports=''
)
m6 = M.sort.v5(
input_ds=m5.data_1,
sort_by='roic_ttm_0',
group_by='date',
keep_columns='--',
ascending=False
)
m9 = M.dropnan.v2(
input_data=m5.data_1
)
m7 = M.trade.v4(
instruments=m2.data,
options_data=m6.sorted_data,
start_date='',
end_date='',
initialize=m7_initialize_bigquant_run,
handle_data=m7_handle_data_bigquant_run,
prepare=m7_prepare_bigquant_run,
before_trading_start=m7_before_trading_start_bigquant_run,
volume_limit=0.025,
order_price_field_buy='open',
order_price_field_sell='close',
capital_base=1000000,
auto_cancel_non_tradable_orders=True,
data_frequency='daily',
price_type='真实价格',
product_type='股票',
plot_charts=True,
backtest_only=False,
benchmark='000300.HIX'
)
m10 = M.input_features.v1(
features='roic_ttm_0'
)
m8 = M.factorlens.v2(
features=m10.data,
user_factor_data=m9.data,
title='因子分析: {factor_name}',
start_date='2019-01-01',
end_date='2021-10-01',
rebalance_period=22,
delay_rebalance_days=0,
rebalance_price='close_0',
stock_pool='全市场',
quantile_count=5,
commission_rate=0.0016,
returns_calculation_method='累乘',
benchmark='无',
drop_new_stocks=60,
drop_price_limit_stocks=True,
drop_st_stocks=True,
drop_suspended_stocks=True,
cutoutliers=True,
normalization=True,
neutralization=[],
metrics=['因子表现概览', '因子分布', '因子行业分布', '因子市值分布', 'IC分析', '买入信号重合分析', '因子估值分析', '因子拥挤度分析', '因子值最大/最小股票', '表达式因子值', '多因子相关性分析'],
factor_coverage=0.5,
user_data_merge='left'
)
[2022-11-19 14:58:12.754302] INFO: moduleinvoker: input_features.v1 开始运行..
[2022-11-19 14:58:12.762328] INFO: moduleinvoker: 命中缓存
[2022-11-19 14:58:12.766848] INFO: moduleinvoker: input_features.v1 运行完成[0.01254s].
[2022-11-19 14:58:12.781633] INFO: moduleinvoker: instruments.v2 开始运行..
[2022-11-19 14:58:12.789509] INFO: moduleinvoker: 命中缓存
[2022-11-19 14:58:12.792047] INFO: moduleinvoker: instruments.v2 运行完成[0.010426s].
[2022-11-19 14:58:12.815289] INFO: moduleinvoker: general_feature_extractor.v7 开始运行..
[2022-11-19 14:58:12.829407] INFO: moduleinvoker: 命中缓存
[2022-11-19 14:58:12.832463] INFO: moduleinvoker: general_feature_extractor.v7 运行完成[0.017222s].
[2022-11-19 14:58:12.846791] INFO: moduleinvoker: derived_feature_extractor.v3 开始运行..
[2022-11-19 14:58:12.857261] INFO: moduleinvoker: 命中缓存
[2022-11-19 14:58:12.859965] INFO: moduleinvoker: derived_feature_extractor.v3 运行完成[0.013201s].
[2022-11-19 14:58:12.888500] INFO: moduleinvoker: cached.v3 开始运行..
[2022-11-19 14:58:12.902332] INFO: moduleinvoker: 命中缓存
[2022-11-19 14:58:12.905556] INFO: moduleinvoker: cached.v3 运行完成[0.017072s].
[2022-11-19 14:58:12.926025] INFO: moduleinvoker: sort.v5 开始运行..
[2022-11-19 14:58:12.940212] INFO: moduleinvoker: 命中缓存
[2022-11-19 14:58:12.944862] INFO: moduleinvoker: sort.v5 运行完成[0.018843s].
[2022-11-19 14:58:19.996367] INFO: moduleinvoker: backtest.v8 开始运行..
[2022-11-19 14:58:20.010123] INFO: backtest: biglearning backtest:V8.6.3
[2022-11-19 14:58:20.012108] INFO: backtest: product_type:stock by specified
[2022-11-19 14:58:20.271827] INFO: moduleinvoker: cached.v2 开始运行..
[2022-11-19 14:58:20.284086] INFO: moduleinvoker: 命中缓存
[2022-11-19 14:58:20.286705] INFO: moduleinvoker: cached.v2 运行完成[0.014904s].
[2022-11-19 14:58:33.017985] INFO: backtest: algo history_data=DataSource(8f8166930df248cd94f3bb1ea7cf7beeT)
[2022-11-19 14:58:33.020297] INFO: algo: TradingAlgorithm V1.8.8
[2022-11-19 14:58:42.231725] INFO: algo: trading transform...
[2022-11-19 14:58:44.130029] INFO: algo: handle_splits get splits [dt:2020-01-20 00:00:00+00:00] [asset:Equity(4920 [002299.SZA]), ratio:0.9405704140663147]
[2022-11-19 14:58:44.134807] INFO: Position: position stock handle split[sid:4920, orig_amount:100, new_amount:106.0, orig_cost:25.49999809273436, new_cost:23.9845, ratio:0.9405704140663147, last_sale_price:23.7399959564209]
[2022-11-19 14:58:44.137095] INFO: Position: after split: PositionStock(asset:Equity(4920 [002299.SZA]), amount:106.0, cost_basis:23.9845, last_sale_price:25.23999786376953)
[2022-11-19 14:58:44.139699] INFO: Position: returning cash: 7.5603
[2022-11-19 14:58:44.294605] INFO: algo: handle_splits get splits [dt:2020-01-21 00:00:00+00:00] [asset:Equity(328 [600186.SHA]), ratio:0.9224806427955627]
[2022-11-19 14:58:44.297176] INFO: Position: position stock handle split[sid:328, orig_amount:2400, new_amount:2601.0, orig_cost:2.4500000520141545, new_cost:2.2601, ratio:0.9224806427955627, last_sale_price:2.379999876022339]
[2022-11-19 14:58:44.299356] INFO: Position: after split: PositionStock(asset:Equity(328 [600186.SHA]), amount:2601.0, cost_basis:2.2601, last_sale_price:2.5799999237060547)
[2022-11-19 14:58:44.301461] INFO: Position: returning cash: 1.6198
[2022-11-19 14:58:48.738183] INFO: algo: handle_splits get splits [dt:2020-03-19 00:00:00+00:00] [asset:Equity(72 [002458.SZA]), ratio:0.5697818994522095]
[2022-11-19 14:58:48.740680] INFO: Position: position stock handle split[sid:72, orig_amount:800, new_amount:1404.0, orig_cost:31.904999733080814, new_cost:18.1789, ratio:0.5697818994522095, last_sale_price:18.28999900817871]
[2022-11-19 14:58:48.742976] INFO: Position: after split: PositionStock(asset:Equity(72 [002458.SZA]), amount:1404.0, cost_basis:18.1789, last_sale_price:32.099998474121094)
[2022-11-19 14:58:48.745136] INFO: Position: returning cash: 0.8414
[2022-11-19 14:58:51.986683] INFO: algo: handle_splits get splits [dt:2020-04-24 00:00:00+00:00] [asset:Equity(943 [002746.SZA]), ratio:0.9734218716621399]
[2022-11-19 14:58:51.989678] INFO: Position: position stock handle split[sid:943, orig_amount:200, new_amount:205.0, orig_cost:14.789999962018017, new_cost:14.3969, ratio:0.9734218716621399, last_sale_price:14.649999618530273]
[2022-11-19 14:58:51.992507] INFO: Position: after split: PositionStock(asset:Equity(943 [002746.SZA]), amount:205.0, cost_basis:14.3969, last_sale_price:15.050000190734863)
[2022-11-19 14:58:51.994935] INFO: Position: returning cash: 6.7502
[2022-11-19 14:58:52.248405] INFO: algo: handle_splits get splits [dt:2020-04-28 00:00:00+00:00] [asset:Equity(1782 [603360.SHA]), ratio:0.6991899609565735]
[2022-11-19 14:58:52.250567] INFO: Position: position stock handle split[sid:1782, orig_amount:100, new_amount:143.0, orig_cost:28.549999239231692, new_cost:19.9619, ratio:0.6991899609565735, last_sale_price:19.850004196166992]
[2022-11-19 14:58:52.252338] INFO: Position: after split: PositionStock(asset:Equity(1782 [603360.SHA]), amount:143.0, cost_basis:19.9619, last_sale_price:28.39000129699707)
[2022-11-19 14:58:52.254046] INFO: Position: returning cash: 0.4496
[2022-11-19 14:58:53.172879] INFO: algo: handle_splits get splits [dt:2020-05-08 00:00:00+00:00] [asset:Equity(2452 [300682.SZA]), ratio:0.6643429398536682]
[2022-11-19 14:58:53.175357] INFO: Position: position stock handle split[sid:2452, orig_amount:100, new_amount:150.0, orig_cost:28.90000152700163, new_cost:19.1995, ratio:0.6643429398536682, last_sale_price:19.059999465942383]
[2022-11-19 14:58:53.177461] INFO: Position: after split: PositionStock(asset:Equity(2452 [300682.SZA]), amount:150.0, cost_basis:19.1995, last_sale_price:28.690000534057617)
[2022-11-19 14:58:53.179192] INFO: Position: returning cash: 10.0002
[2022-11-19 14:58:53.304254] INFO: algo: handle_splits get splits [dt:2020-05-11 00:00:00+00:00] [asset:Equity(5154 [002555.SZA]), ratio:0.9920969605445862]
[2022-11-19 14:58:53.307107] INFO: Position: position stock handle split[sid:5154, orig_amount:100, new_amount:100.0, orig_cost:38.22999954231322, new_cost:37.9279, ratio:0.9920969605445862, last_sale_price:37.65999984741211]
[2022-11-19 14:58:53.309639] INFO: Position: after split: PositionStock(asset:Equity(5154 [002555.SZA]), amount:100.0, cost_basis:37.9279, last_sale_price:37.959999084472656)
[2022-11-19 14:58:53.311866] INFO: Position: returning cash: 29.9999
[2022-11-19 14:58:53.881573] INFO: algo: handle_splits get splits [dt:2020-05-18 00:00:00+00:00] [asset:Equity(3923 [000672.SZA]), ratio:0.9675537943840027]
[2022-11-19 14:58:53.884211] INFO: Position: position stock handle split[sid:3923, orig_amount:100, new_amount:103.0, orig_cost:27.61999893197195, new_cost:26.7238, ratio:0.9675537943840027, last_sale_price:26.540000915527344]
[2022-11-19 14:58:53.887487] INFO: Position: after split: PositionStock(asset:Equity(3923 [000672.SZA]), amount:103.0, cost_basis:26.7238, last_sale_price:27.43000030517578)
[2022-11-19 14:58:53.890046] INFO: Position: returning cash: 9.3799
[2022-11-19 14:58:54.168219] INFO: algo: handle_splits get splits [dt:2020-05-20 00:00:00+00:00] [asset:Equity(3783 [002607.SZA]), ratio:0.9916289448738098]
[2022-11-19 14:58:54.170685] INFO: Position: position stock handle split[sid:3783, orig_amount:100, new_amount:100.0, orig_cost:28.29999923757006, new_cost:28.0631, ratio:0.9916289448738098, last_sale_price:28.430002212524414]
[2022-11-19 14:58:54.173159] INFO: Position: after split: PositionStock(asset:Equity(3783 [002607.SZA]), amount:100.0, cost_basis:28.0631, last_sale_price:28.670000076293945)
[2022-11-19 14:58:54.175563] INFO: Position: returning cash: 23.9998
[2022-11-19 14:58:54.887439] INFO: algo: handle_splits get splits [dt:2020-05-29 00:00:00+00:00] [asset:Equity(2163 [002234.SZA]), ratio:0.9733926057815552]
[2022-11-19 14:58:54.889565] INFO: Position: position stock handle split[sid:2163, orig_amount:200, new_amount:205.0, orig_cost:22.750001912820977, new_cost:22.1447, ratio:0.9733926057815552, last_sale_price:21.95000457763672]
[2022-11-19 14:58:54.891793] INFO: Position: after split: PositionStock(asset:Equity(2163 [002234.SZA]), amount:205.0, cost_basis:22.1447, last_sale_price:22.55000114440918)
[2022-11-19 14:58:54.894653] INFO: Position: returning cash: 10.2493
[2022-11-19 14:58:55.527716] INFO: algo: handle_splits get splits [dt:2020-06-04 00:00:00+00:00] [asset:Equity(1941 [300417.SZA]), ratio:0.581839919090271]
[2022-11-19 14:58:55.532336] INFO: Position: position stock handle split[sid:1941, orig_amount:100, new_amount:171.0, orig_cost:33.959999094600946, new_cost:19.7593, ratio:0.581839919090271, last_sale_price:19.479999542236328]
[2022-11-19 14:58:55.535436] INFO: Position: after split: PositionStock(asset:Equity(1941 [300417.SZA]), amount:171.0, cost_basis:19.7593, last_sale_price:33.47999954223633)
[2022-11-19 14:58:55.538059] INFO: Position: returning cash: 16.9199
[2022-11-19 14:58:56.178206] INFO: algo: handle_splits get splits [dt:2020-06-11 00:00:00+00:00] [asset:Equity(766 [300498.SZA]), ratio:0.8027135133743286]
[2022-11-19 14:58:56.180064] INFO: Position: position stock handle split[sid:766, orig_amount:100, new_amount:124.0, orig_cost:27.500000000033538, new_cost:22.0746, ratio:0.8027135133743286, last_sale_price:21.889997482299805]
[2022-11-19 14:58:56.181750] INFO: Position: after split: PositionStock(asset:Equity(766 [300498.SZA]), amount:124.0, cost_basis:22.0746, last_sale_price:27.270000457763672)
[2022-11-19 14:58:56.183401] INFO: Position: returning cash: 12.6403
[2022-11-19 14:58:56.895866] INFO: algo: handle_splits get splits [dt:2020-06-18 00:00:00+00:00] [asset:Equity(4738 [002605.SZA]), ratio:0.9887735843658447]
[2022-11-19 14:58:56.899451] INFO: Position: position stock handle split[sid:4738, orig_amount:100, new_amount:101.0, orig_cost:36.39999771128623, new_cost:35.9914, ratio:0.9887735843658447, last_sale_price:35.230003356933594]
[2022-11-19 14:58:56.901538] INFO: Position: after split: PositionStock(asset:Equity(4738 [002605.SZA]), amount:101.0, cost_basis:35.9914, last_sale_price:35.630001068115234)
[2022-11-19 14:58:56.903919] INFO: Position: returning cash: 4.7697
[2022-11-19 14:58:58.703562] INFO: algo: handle_splits get splits [dt:2020-07-09 00:00:00+00:00] [asset:Equity(1125 [600556.SHA]), ratio:0.9990323781967163]
[2022-11-19 14:58:58.705752] INFO: Position: position stock handle split[sid:1125, orig_amount:200, new_amount:200.0, orig_cost:18.649997711243287, new_cost:18.632, ratio:0.9990323781967163, last_sale_price:20.64999771118164]
[2022-11-19 14:58:58.707865] INFO: Position: after split: PositionStock(asset:Equity(1125 [600556.SHA]), amount:200.0, cost_basis:18.632, last_sale_price:20.669998168945312)
[2022-11-19 14:58:58.709637] INFO: Position: returning cash: 4.0001
[2022-11-19 14:58:59.398834] WARNING: Performance: maybe_close_position no price for asset:Equity(2156 [002604.SZA]), field:price, dt:2020-07-15 15:00:00+00:00
[2022-11-19 14:58:59.674313] INFO: algo: handle_splits get splits [dt:2020-07-20 00:00:00+00:00] [asset:Equity(4486 [000048.SZA]), ratio:0.9712644219398499]
[2022-11-19 14:58:59.676318] INFO: Position: position stock handle split[sid:4486, orig_amount:200, new_amount:205.0, orig_cost:25.489997897492866, new_cost:24.7575, ratio:0.9712644219398499, last_sale_price:25.35000228881836]
[2022-11-19 14:58:59.678011] INFO: Position: after split: PositionStock(asset:Equity(4486 [000048.SZA]), amount:205.0, cost_basis:24.7575, last_sale_price:26.100000381469727)
[2022-11-19 14:58:59.679657] INFO: Position: returning cash: 23.2497
[2022-11-19 14:58:59.908536] WARNING: Performance: maybe_close_position no price for asset:Equity(153 [300104.SZA]), field:price, dt:2020-07-21 15:00:00+00:00
[2022-11-19 14:59:03.159513] INFO: algo: handle_splits get splits [dt:2020-08-24 00:00:00+00:00] [asset:Equity(1502 [603988.SHA]), ratio:0.9882484674453735]
[2022-11-19 14:59:03.162020] INFO: Position: position stock handle split[sid:1502, orig_amount:200, new_amount:202.0, orig_cost:18.29999924261452, new_cost:18.0849, ratio:0.9882484674453735, last_sale_price:17.660001754760742]
[2022-11-19 14:59:03.164353] INFO: Position: after split: PositionStock(asset:Equity(1502 [603988.SHA]), amount:202.0, cost_basis:18.0849, last_sale_price:17.8700008392334)
[2022-11-19 14:59:03.168558] INFO: Position: returning cash: 6.68
[2022-11-19 14:59:06.279744] INFO: algo: handle_splits get splits [dt:2020-09-23 00:00:00+00:00] [asset:Equity(72 [002458.SZA]), ratio:0.9923076629638672]
[2022-11-19 14:59:06.281816] INFO: Position: position stock handle split[sid:72, orig_amount:300, new_amount:302.0, orig_cost:13.049999239428479, new_cost:12.9496, ratio:0.9923076629638672, last_sale_price:12.899999618530273]
[2022-11-19 14:59:06.283835] INFO: Position: after split: PositionStock(asset:Equity(72 [002458.SZA]), amount:302.0, cost_basis:12.9496, last_sale_price:13.0)
[2022-11-19 14:59:06.285465] INFO: Position: returning cash: 4.2001
[2022-11-19 14:59:06.402641] INFO: algo: handle_splits get splits [dt:2020-09-24 00:00:00+00:00] [asset:Equity(425 [002838.SZA]), ratio:0.9916915893554688]
[2022-11-19 14:59:06.404533] INFO: Position: position stock handle split[sid:425, orig_amount:100, new_amount:100.0, orig_cost:30.36999893234706, new_cost:30.1177, ratio:0.9916915893554688, last_sale_price:29.84000015258789]
[2022-11-19 14:59:06.406304] INFO: Position: after split: PositionStock(asset:Equity(425 [002838.SZA]), amount:100.0, cost_basis:30.1177, last_sale_price:30.09000015258789)
[2022-11-19 14:59:06.408384] INFO: Position: returning cash: 25.0
[2022-11-19 14:59:14.259895] INFO: Performance: Simulated 243 trading days out of 243.
[2022-11-19 14:59:14.263412] INFO: Performance: first open: 2020-01-02 09:30:00+00:00
[2022-11-19 14:59:14.265259] INFO: Performance: last close: 2020-12-31 15:00:00+00:00
[2022-11-19 14:59:24.489361] INFO: moduleinvoker: backtest.v8 运行完成[64.493029s].
[2022-11-19 14:59:24.494372] INFO: moduleinvoker: trade.v4 运行完成[71.519969s].