2. Simulate Live Trading in CLI

This page describes simulated live trading in the CLI from a command and capability-list perspective. For step-by-step operation, read tutorials/8-live-trade-risk-and-broker-walkthrough.md.

2.1. 0. 文档边界

  • This page is a command capability index, not a step-by-step tutorial

  • Focus: which commands exist, what feedback to read, and where to troubleshoot

2.2. 1. 命令能力分组

  • Run control: start, pause, resume, stop

  • Trading: buy, sell, cancel

  • Status queries: orders, fills, positions, account

  • Diagnostics and logs: system messages, errors, task status

2.3. 2. 核心反馈语义

  • Rejections show an English summary (with rule_id / reason)

  • Partial-fill status is easier to spot in query results

  • After-close handling is coordinated via the unified Broker API

2.4. 2.1 Manual Order Types (buy/sell)

  • buy/sell ... -p <positive>: submit a limit order (order_type='limit')

  • buy/sell ... without -p, or with -p 0: submit a market order (order_type='market'); CLI fills price from the latest live quote before submit

In SimulatorBroker, key matching differences are:

Order type

Main fill condition (simplified)

limit (limit order)

Sell: live price >= limit sell (with tolerance); buy: live price <= limit buy (with tolerance)

market (market order)

Prefer market fill when price is not near limit up/down; fill probability drops near limits

Example (user-visible feedback):

Order rejected by risk rule [MAX_ORDER_QTY]: order quantity exceeds limit

2.5. 3. 快速问题分流(CLI 视角)

  • No order after submit: check risk rejection messages first

  • Order but no fill: check broker reports and market conditions

  • Status stuck: check whether fill reports keep arriving

2.6. 4. 命令-文档映射

Concern

Check First

Run configuration correct

live_trading/2-configuration-and-run.md

Why order rejected or unfilled

live_trading/3-risk-and-order-lifecycle.md

How to investigate logs

live_trading/5-artifacts-and-troubleshooting.md

Full hands-on path

tutorials/8-live-trade-risk-and-broker-walkthrough.md

2.7. 5. 跳转导航

  • Mechanism: live_trading/3-risk-and-order-lifecycle.md

  • Troubleshooting: live_trading/5-artifacts-and-troubleshooting.md

  • API 参考:api/api_reference.rst