TWAP
TWAP(Time-Weighted Average Price,时间加权平均价)用于大单拆分交易。开启后,算法会将大额委托自动拆分为多笔子单,并在设置的算法时长内尽量完成指定委托数量,使成交均价接近该时间区间内的市场平均成交水平。
位置:下单板 → Smart Order → TWAP
⚠️ 风险提示:除服务器单之外,无限易的算法皆为本地算法单,依赖行情或成交回报触发。若因网络延迟、断线、软件关闭等原因导致算法无法正常运行,无限易不承担相关责任。
🔔 TWAP 不支持交易所标准套利的 互换 指令。
使用方法
在 下单板 中选择 Smart Order → TWAP。
在弹窗中填写 TWAP 参数,点击 开始使用。
点击 Smart Order 的
可修改参数。点击 开始使用 只表示开启 TWAP 功能,此时不会立即发送算法单。
在 下单板 中设置 委托数量、买卖方向 等下单参数并下单。
下单后,系统会按 TWAP 参数自动拆分并执行委托。
参数说明
| 参数 | 说明 |
|---|---|
| 算法总时长 | TWAP 计划完成全部委托的总时间。 |
| 单笔上限 / 单笔下限 | 算法将总委托量拆分为多笔子单时,每笔子单委托数量的上限 / 下限。上下限可设置为相同数量,此时每笔子单数量固定。 |
| 最小开仓量 | 设置后,开仓时只有当单笔累计数量达到最小开仓量要求时才会发单。 风险:若剩余数量始终无法满足该发单条件,总委托数量可能无法全部完成。 |
| 价格检查间隔 | 算法会根据委托数量和算法总时长自动计算每笔子单的单位时间段。在单位时间段内,先以排队价挂单;每隔一个价格检查间隔,检查排队价是否变化。若排队价变化,则撤单并改用最新排队价挂单;若单位时间段结束仍未成交,则立即改用追单价格追单。 |
| 追单价格 | 可选择使用对手价、市价、涨跌停价作为追单价格。 |
| 追单超价(Tick) | 追单时,系统会将附加超价后的价格与对手价比较,并选择更优价格进行追单。追单次数最多不超过 交易设置 中设置的 追单次数。 |
部分交易所或合约不支持市价指令。若选择市价后触发追单,可能出现错单并导致算法终止。详见 交易术语解释 中的市价说明。
v2026.0526 及之后版本:SHFE / INE 合约的 追单价格 设置为 市价 时,系统默认使用 对手价超价 10 Tick 作为保护价。
v2026.0526 及之后版本支持 最小开仓量。
案例说明
示例参数:
| 参数 | 设置 |
|---|---|
| 算法总时长 | 300s |
| 单笔上限 / 单笔下限 | 20 / 10 |
| 价格检查间隔 | 5s |
| 追单价格 | 对手价 |
| 追单超价(Tick) | 1 |
| 最小开仓量 | 8 |
| 委托数量 | 100 |
| 买卖方向 | 买 |
按照以上设置,TWAP 会将 100 手委托拆分为 7 笔子单。每笔子单数量在 10 至 20 手之间,且开仓时单笔累计数量需不低于 8 手 才会发单。系统会自动生成每笔子单的单位时间 t,确保 t1 + t2 + ... + t7 ≤ 300s。
第一笔子单在 t1(09:00:00 ~ 09:00:42) 内执行,系统先以 买价 挂出 12 手买单。在该时间段内,系统每隔 5s 检查一次买价:
若买价发生变化,则撤单并改用新的买价重新挂单。
若到 09:00:42 仍未成交,则立即按 对手价 + 1 Tick 追单,即按当前 卖价 + 1 Tick 追单;系统会将该价格与当前 对手价 择优确定实际追单价格。
随后算法进入 t2,继续按同样逻辑执行,直到 t7 完成或算法结束。
算法列表
下单后,可在 算法列表 窗口中查看并管理 TWAP 算法单。
位置:交易 → 算法列表 → Smart Order
TWAP 算法运行规则:
网络断线后,算法无法正常运行。
算法单委托在本地运行。软件关闭后,算法不会继续执行,也不会自动保存;下次打开软件时不会显示历史记录。
执行中、已暂停的算法可手动保存:右键算法单,选择 储存为任务下单。
执行过程中手动撤单,算法会自动终止。
执行过程中遇到错单或手动撤单,算法会自动暂停(v2025.0925b 之前的版本会终止)。
注意事项
请合理设置 算法总时长、委托数量、单笔上限 和 单笔下限。若时间参数与拆分数量无法匹配,算法触发后可能无法按预期完成。
例如:委托数量为 100 手,算法总时长设置为 5 秒,但单笔数量只设置为 1~2 手,此时算法总时长可能会被自动延长。
TWAP 执行过程中,如果某笔子单出现部分成交,系统会针对该笔子单的 未成交数量 继续补单。
TWAP
TWAP (Time-Weighted Average Price) is used for large-order splitting. Once enabled, it automatically breaks a large order into multiple child orders and tries to complete the specified quantity within the configured duration, so the average execution price is close to the market average during that time period.
Path: Trade Board → Smart Order → TWAP
⚠️ Risk Warning: Except for server-side orders, all InfiniTrader Algos run locally and are triggered by market quotes or fill reports. InfiniTrader assumes no liability if an Algo fails to run properly due to network latency, disconnection, software shutdown, or similar reasons.
🔔 TWAP does not support Swap orders for exchange-standard spreads.
Usage
In the Trade Board, select Smart Order → TWAP.
In the pop-up window, configure the TWAP parameters and click Start Using.
Click
in Smart Order to modify the parameters.Clicking Start Using only enables TWAP. It does not send any Algo orders immediately.
Set the Order Qty, Buy/Sell direction, and other order parameters on the Trade Board, then place the order.
After the order is placed, TWAP automatically splits and executes it based on the configured parameters.
Parameter Description
| Parameter | Description |
|---|---|
| Total Time | The total time TWAP is intended to use to complete the full order. |
| Upper Limit / Lower Limit per Order | The upper and lower quantity limit for each child order when TWAP splits the total order into multiple child orders. If both values are the same, each child order uses a fixed quantity. |
| Min Open Volume | After this is set, open orders are sent only when the accumulated quantity of a single slice reaches the minimum open volume requirement. Risk: if the remaining quantity never meets this threshold, the total order may not be fully completed. |
| Price Check Interval | TWAP automatically calculates the time slice for each child order based on the order quantity and total duration. Within each time slice, the order is first placed at the Passive price. At each Price Check Interval, TWAP checks whether the passive price has changed. If it has changed, the order is canceled and replaced at the latest passive price. If the order is still unfilled when the time slice ends, TWAP immediately chases it using the selected Chase Price. |
| Chase Price | You can choose Aggressive, Market, or Limit Up / Limit Down as the chase price. |
| Pay up(Tick) | When chasing an order, TWAP compares the price after applying the pay-up ticks with the Aggressive price and uses the better price. The number of chase attempts cannot exceed the Chase setting in Settings. |
Some exchanges or contracts do not support market orders. If Market is selected and a chase is triggered, the Algo may enter Fail status and terminate. See the market order section in Trading Terminology for details.
v2026.0526 and later: For SHFE / INE contracts, when Chase Price is set to Market, TWAP uses the Aggressive price with a 10-tick pay-up as the default protection price.
Min Open Volume is supported in
v2026.0526and later.
Example
Example settings:
| Parameter | Setting |
|---|---|
| Total Time | 300s |
| Upper Limit / Lower Limit per Order | 20 / 10 |
| Price Check Interval | 5s |
| Chase Price | Aggressive |
| Pay up(Tick) | 1 |
| Min Open Volume | 8 |
| Order Qty | 100 |
| Buy/Sell | Buy |
TWAP splits the 100-lot order into 7 child orders. Each child order has a quantity between 10 and 20 lots. For opening orders, a child order is sent only when the accumulated quantity reaches at least 8 lots. TWAP automatically assigns a time slice t to each child order so that t1 + t2 + ... + t7 ≤ 300s.
During t1 (09:00:00 ~ 09:00:42), TWAP first places a 12-lot buy order at the Bid price. During this time slice, TWAP checks the bid price every 5s:
If the Bid price changes, the order is canceled and replaced at the new Bid price.
If the order is still unfilled at 09:00:42, TWAP immediately chases it at Aggressive + 1 Tick, which means Ask + 1 Tick for a buy order. TWAP compares this price with the current Aggressive price and uses the better price as the actual chase price.
TWAP then moves to t2 and continues with the same logic until t7 is completed or the Algo ends.
Algos
After placing the order, you can view and manage the TWAP Algo in the Algos window.
Path: Trade → Algos → Smart Order
TWAP runtime rules:
Algos do not run properly after a network disconnection.
Algos run locally. If the software is closed, they stop running and are not saved automatically. No historical records will be shown the next time the software is opened.
Running and paused Algos can be saved manually: right-click the Algo and select Save As Designated Order.
You can also configure automatic saving in Time Master. Import the saved file next time to continue execution. For details, see Designated Trader.
If you manually cancel an order during execution, the algorithm stops automatically.
If an erroneous order occurs or an order is manually canceled during execution, the algorithm pauses automatically. Versions earlier than v2025.0925b stop instead.
Tips
Make sure Total Time, Order Qty, Upper Limit, and Lower Limit are configured reasonably. If the duration and split quantities do not match, TWAP may not complete as expected after it is triggered.
For example, if Order Qty is 100, Total Time is 5s, and each child order is limited to only 1-2 lots, the actual execution time may be extended automatically.
During TWAP execution, if a child order is only partially filled, TWAP continues to submit orders for the remaining unfilled quantity of that child order.