We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
assert pos.volume_long_his == 0 assert pos.volume_long == amount assert pos.volume_long_today == amount # 此项源码作为结算使用 assert pos.volume_long_frozen_today == 0 # TODO 买入是否需要冻结?
r = acc.send_order(code, amount=amount, price=price, towards=ORDER_DIRECTION.BUY).copy() acc.make_deal(r) r1 = acc.send_order(code, amount=amount, price=price, towards=ORDER_DIRECTION.SELL).copy() assert r1 == False # 此处应为交易前置检查失败 acc.make_deal(r1)
def test_sell(): # 委托状态:委托全部成交 code, price, amount = '000001', 10, 1000 acc: QIFI_Account = QIFI_Account("x4", "x4") acc.initial() r = acc.send_order(code, amount=amount, price=price, towards=ORDER_DIRECTION.BUY).copy() acc.make_deal(r) pos: QA_Position = acc.positions.get(code) volume_his = pos.volume_long_his print("建仓买入", pos.hold_detail) assert pos.volume_long_his == 0 assert pos.volume_long == amount assert pos.volume_long_today == amount assert pos.volume_long_frozen_today == 0 # TODO 买入是否需要冻结? if volume_his == 0: r = acc.send_order(code, amount=amount, price=price, towards=ORDER_DIRECTION.SELL).copy() print("卖出委托", r) assert r == False # 此处应为交易前置检查失败 if r: acc.make_deal(r) # {'volume_long_today': 0, 'volume_long_his': 0, 'volume_long': 1000, 'volume_short_today': 0, 'volume_short_his': 0, 'volume_short': 0, 'volume_long_frozen_today': 1000, 'volume_short_frozen_today': 0} print("卖出委托后", pos.hold_detail) assert pos.volume_long == amount assert pos.volume_long_today == amount assert pos.volume_long_frozen_today == 0 # TODO 买入是否需要冻结? acc.settle() print("结算后", pos.hold_detail) assert pos.volume_long == amount assert pos.volume_long_his == amount assert pos.volume_long_today == 0 assert pos.volume_long_frozen_today == 0
The text was updated successfully, but these errors were encountered:
already fixed
Sorry, something went wrong.
No branches or pull requests
关于当日买入后, volume_frozen_today , volume_today 值问题
The text was updated successfully, but these errors were encountered: