买入 浦发银行 最新价 两万元
stock = '600000.SH'
target_amount = 20000
full_tick = xtdata.get_full_tick([stock])
print(f"{stock} 全推行情: {full_tick}")
current_price = full_tick[stock]['lastPrice']
买入金额 取目标金额 与 可用金额中较小的
buy_amount = min(target_amount, available_cash)
买入数量 取整为100的整数倍
buy_vol = int(buy_amount / current_price / 100) * 100
print(f"当前可用资金 {available_cash} 目标买入金额 {target_amount} 买入股数 {buy_vol}股")
async_seq = xt_trader.order_stock_async(acc, stock, xtconstant.STOCK_BUY, buy_vol, xtconstant.FIX_PRICE,10.08, current_price,
'strategy_name', stock)
这个指定价格10.08为什么报错 |