大神,我改了下您的代码,能不用tick的。能说说这段买入股票的逻辑吗?
-------------------------------------------------------
if now_peice != limit_high and time_buy < = '13:30:00':
print("3")
sell_5 = tick['a5_p']
sell_4 = tick['a4_p']
sell_3 = tick['a3_p']
sell_2 = tick['a2_p']
sell_1 = tick['a1_p']
if limit_high == sell_3 or limit_high == sell_2 or limit_high == sell_1:
if stock not in context.portfolio.positions:
new_peice = current_data[stock].last_price
if context.portfolio.available_cash > 5000:
if g.cash > new_peice*100:
order_count = (int(g.cash // (new_peice*100))) * 100
log.info('---------买入股票:' + str(stock) +', 股票数量:'+ str(int(order_count)))
order_target(stock, order_count)
#order_target(stock, 100)
----------------------------------------------------------------
2021-12-03