@JoinQuant-TWist
@小兵哥
```
def __fun_tradeStock(context, stock, ratio):
total_value = context.portfolio.portfolio_value
if stock in moneyfund:
self.fun_tradeBond(context, stock, total_value * ratio)
else:
curPrice = history(1,'1d', 'close', security_list=stock, df=False)[stock][-1]
curValue = context.portfolio.positions[stock].total_amount * curPrice
Quota = total_value * ratio
if Quota:
if abs(Quota - curValue) / Quota >= 0.25:
if Quota > curValue:
cash = context.portfolio.cash
if cash >= Quota * 0.25:
self.fun_trade(context, stock, Quota)
else:
self.fun_trade(context, stock, Quota)
else:
self.fun_trade(context, stock, Quota)
```
```
WARNING - /tmp/codejail/70/5971670/tmp010diW/user_code.py:543: UserWarning: 002001.XSHE 在 positions 中不存在, 为了保持兼容, 我们返回空的 Position 对象, amount/price/avg_cost 都是 0
curValue = context.portfolio.positions[stock].total_amount * curPrice
```
策略在这里会出warning,会有什么影响吗
2017-10-02