Overview of the simulated live trading module

This chapter helps you build a comprehensive overview before entering live trading: what you can do, how it differs from backtesting, the meaning of key terms, and which chapter to read next.

Dear user, if you have completed strategy backtesting and want to observe strategy performance “at real time,” this module is for you. We try to use the same set of strategy code as the backtesting, simulating order placement and logging locally, allowing you to complete the entire process before connecting to a real brokerage firm.

0. 适用场景

  • You have completed the strategy backtesting and are ready to enter the simulated live trading stage (not yet or temporarily connected to a real trading platform).

  • You want to quickly establish a holistic understanding of the process from “configuration → order placement → transaction completion → logs → troubleshooting”.

  • If you plan to expand to include real brokerages (such as QMT) in the future, you will need a stable document entry point.

1. 这个模块解决什么问题

  • A unified explanation of the complete process of “configuration, order placement, execution, logging, and troubleshooting” in simulated live trading.

  • Reduce the cognitive load when switching from backtesting to live testing—avoid the situation where “backtesting parameters work, but you’re completely confused when the live test starts.”

  • This provides a documentation entry point for future expansion to support real-world counters, eliminating the need to start from scratch.

2. 与回测的关系

Qteasy’s design goal is to use the same strategy logic for both backtesting and live trading. The main difference lies in “how time passes” and “who performs the matching”—rather than rewriting the entire strategy code. The table below will help you quickly compare options when making your selection; if you are already familiar with backtesting, you can focus on the entry points and trading methods related to “live trading” in the “live trading” column.

Column Meanings: The Comparison Items represent the dimensions; the Backtesting column describes the historical verification mode; the **Simulated Live Trading (mode=0) column describes the live mode running at a real clock.

How to use: When deciding “which mode to use now”, search by line; when starting live, confirm that the last line entry is mode=0 + qt.run(op).

Comparison item

Backtesting

Simulated live trading (mode=0)

Time

Fast forward on historical intervals

Real time progresses according to the trading calendar.

Strategy Code

Same Operator/Strategy

The same set of logic

Deal

Simulated matching based on historical prices

Typically, transactions are matched by a simulator at the live price.

typical entrance

op.run_backtest() / qt.run(op, mode=1)

qt.run(op) and mode=0

Operator (Trader Container): This is the “trader” object you create and hold for your strategy; it’s used in both backtesting and live trading, just in different modes. You can think of it as the same trader taking the same test in both the “historical exam” and the “simulated live exam.”

A common one-line code to start live:

import qteasy as qt
qt.configure(mode=0, ...)  # 0 表示 live / 模拟实盘
qt.run(op)                 # op 为您的 Operator

3. 您将获得的 capability(能力地图)

The following capabilities have been gradually improved in recent versions, with the aim of making simulated live trading verifiable, interceptable, auditable, and scalable:

  • Configuration Verifiable: Live-related parameters are checked before runtime, so errors are reported earlier when configurations are incorrect, rather than crashing halfway through the process.

  • Possible Risk Control: Orders can be blocked locally according to rules before they are actually handed over to the brokerage firm (like a pre-order review panel).

  • Auditable Rejections: When an order is rejected, it can be retrieved in the log using the rule number and the English reason, making it easy to review “why the order was not closed”.

  • The brokerage interface is scalable: It provides unified interfaces for connect, submit, and poll for transactions, facilitating future integration with real-world trading platforms such as QMT.

  • Clearer Order Status: Statuses such as partially completed and fully completed are more consistent with the cumulative transaction volume, reducing the discrepancy between the interface display and one’s expectations.

4. 术语速查表

The simulated live trading documentation will repeatedly use terms such as Operator, Trader, Broker, risk control, and product path. This section is the module-wide terminology hub: grouped by topic, allowing you to refer back to it after it first appears in the main text of each chapter. You don’t need to read it all at once—use the in-page search when you encounter unfamiliar terms.

Column Meanings: Terms are English names or configuration keys; Descriptions describe the responsibilities in the qteasy live workflow; Analogies use investment/daily scenarios to aid memorization (if there are differences between the analogy and real-world behavior, the description column shall prevail).

How to use: First, determine which category you are stuck in: “Running Entity / Configuration / Order / Maintenance,” and open the corresponding section. Based on the current issue (e.g., “Where to check for rejected orders”), find keywords in the Instructions column, and then jump to sections such as :doc:3-risk-and-order-lifecycle or :doc:5-artifacts-and-troubleshooting.

Example: You see partial-filled in the Shell and don’t understand it → Open §4.3 and find the line → You will learn that it means “partially filled” → Go to :doc:3-risk-and-order-lifecycle to see the status change.

4.1 Operating Entity

During live runtime, the Operator still holds the policy, but it is driven by the Trader according to the real schedule; orders are processed by the Broker. This table covers the main roles from the “policy container” to the “your interface”; it does not include specific configuration keys (see §4.2).

the term

Description

analogy

Operator

The top-level container that holds the policy group and is responsible for scheduling and signal merging.

Portfolio Manager: Deciding When and Which Strategies to Run

Trader

In live mode, the main processes that actually run according to a schedule, including strategy execution, order placement, and log writing, are the core of the operation.

Trader Seat: The person you interact with in your Shell conversation

Broker (Securities Firm)

The target audience for receiving orders, returning processing results, and transaction confirmation.

Brokerage counter: simulator means “practice counter”.

mode=0

Configuration item: Indicates live / simulated live trading (relative to backtesting mode=1, etc.)

Switch: 0 = Runs on real time

CLI command

Command-line interactive interface (Trader Shell)

A “trader terminal” for typing commands.

TUI

Graphical terminal interface

A full-screen interface with a panel, or a CLI option.

4.2 Configuration and Data

Before starting LiveTrade, the items you write via qt.configure(...) will be frozen as LiveTradeConfig, determining the asset types, where market data comes from, and how the data is supplemented. This table is a terminology index for the configuration chapter (:doc:2-configuration-and-run).

the term

Description

analogy

LiveTradeConfig

A snapshot of the live configuration is frozen before startup and will not be accidentally modified during runtime.

The pre-flight inspection form, once signed, should not be altered.

The set of names of the historical data to be fetched, if htypes is empty, the system will try to create all possible htypes by basing on the name of the historical data and the freq/asset_type parameter. the input can be str or list: - str: ‘open, high, low, close’ - list: [‘open’, ‘high’, ‘low’, ‘close’] - list: [‘open’, ‘high’, ‘low’, ‘close’] - list: [‘open’, ‘high’, ‘low’, ‘close’] ‘high’, ‘low’, ‘close’]

Asset types, such as E (stocks) and FD (exchange-traded funds/ETFs).

Tell the system “which set of rules applies to the trading of this batch of assets”.

Market conditions and refill

Fill in the missing tables/ranges in the local data source from online channels.

Replenishing the local “data warehouse”

Live Market Frequency

For example, live_price_acquire_freq='15MIN' specifies how often the real-time price is retrieved.

Market monitoring refresh interval

``simulator’’

The default simulated brokerage type uses live pricing to simulate transactions.

paper trading counter

4.3 Orders and Risk Control

From strategy signal to execution, the process involves “local risk control → brokerage processing → asynchronous execution”. This table contains the core vocabulary of :doc:3-risk-and-order-lifecycle; Please be sure to distinguish between the “risk control rejection” and “counter rejection” rows.

the term

Description

analogy

OrderIntent

A planned order: subject matter, direction, quantity, price, etc.

Draft of completed authorization form

Account Snapshot

Cash, open positions, and daily trading volume at the moment of risk assessment

A snapshot of the account at the moment the order was placed.

RiskManager

Execute multiple rules sequentially to determine whether to allow passage.

Review Desk: Orders will be rejected if any rule fails to meet the requirements.

Risk Decision

Release or refusal, and the reason for refusal in English, rule number

Review conclusion slip

Order rejection due to risk control

Local rule interception: Do not enter the order table, record in risk_log.

The form was returned by the review desk before it was even submitted.

Counter service for rejected orders

The brokerage firm rejected the order: the order table contains a rejected row and the broker ID is empty.

The counter will return the receipt.

partial-filled

Partially traded: The number of traded transactions is less than the number of orders placed.

Only part of the order was executed.

filled

Transaction Success

The number of commissions has been reached.

Often rejected

Rejected (often referring to rejection at the counter)

Invalid delegation

broker_order_id

The brokerage firm’s order number will be sent back to the local system upon successful processing.

Counter receipt number

submit_with_ack

Submit an order and synchronously receive the result of whether it has been accepted.

Immediately after submitting the form, the counter staff will say “Accept/Do not accept”.

poll_fills

Polling for asynchronously arriving transaction results

Regularly ask the counter, “Have there been any new transactions?”

4.4 Operation and Observability

During long runs of live testing or troubleshooting, you will encounter log paths, access control, reconciliation, and debugging. This table corresponds to :doc:5-artifacts-and-troubleshooting, :doc:6-trader-snapshot-gate, and :doc:8-cli-trader-capability-matrix.

the term

Description

analogy

Four-bond products

The four fixed paths are sys_log, trade_log, break_point, and risk_log.

Four dedicated folders: System Log, Transaction Details, Breakpoint Archive, and Risk Control Records.

Startup gate

Pre-run checks: Strategy ready, data tables, optional comparison with remote ledger.

Pre-departure safety check

Strategy Snapshot (Roadmap 5-A)

Data is pre-fetched before the strategy runs, and this step reuses the data to reduce redundant I/O.

Prepare today’s materials on your desk in advance.

Reconcile (Reconciliation Snapshot)

Output a summary of the differences between the local and remote ledgers in JSON format at closing time and other points in time.

End-of-day reconciliation statement

DEBUG Mode

Trader debug switch, can be manually set to run --task ...

Repair mode: Tasks can be triggered step by step.

5. 推荐阅读路径

Consistent with the module’s homepage directory:

  1. doc:

    2-configuration-and-run — Complete the minimum runnable configuration

  2. doc:

    ../tutorials/8-live-trade-risk-and-broker-walkthrough — Follow the tutorial

  3. doc:

    5-artifacts-and-troubleshooting — Checking artifacts and scripts when problems arise

  4. doc:

    4-broker-adapter-and-integration — Read this when you need to expand your brokerage portfolio.

  5. doc:

    8-cli-trader-capability-matrix — CLI command comparison; long-distance comparison: 6-trader-snapshot-gate and 7-manual-smoke-live-grid-roadmap

6. 相关索引