Input (stdin)
An order message is a request to trade shares:
order <timestamp> <security> <client> <goal> <participation rate>
New fields:
- client: alphabetical string
- goal: total number of shares to trade
- participation rate: positive integer; the maximum percentage of the security’s trailing-minute traded volume (excluding this order) that this order may constitute
Order rules
- An order is filled when the goal quantity has been traded.
- An order expires after 1 minute.
- An order is active until filled or expired.
- A client can have at most one active order per security.
✅ Output (stdout)
After receiving an order at time T, emit prints:
print T' S <quantity> <price>
Following constraints:
- Timestamps must be non-decreasing, and T’ ≥ T
- Orders expire: T’ < T + 60
- For the trailing minute ending at T’:
emitted_volume / external_volume <= participation_rate - Quantity must be positive integer
- Total emitted quantity ≤ goal
- Price = most recently observed market print price for S
✅ Example
print 5 SILVER 100 8
order 11 SILVER ALICE 100 10
print 12 SILVER 200 9
print 90 SILVER 200 10
Output
print 11 SILVER 10 8
print 12 SILVER 20 9
Explanation:
- At time 11: trailing volume = 100 → can emit 10 shares
- At time 12: trailing volume = 300 → can emit 20 shares
- After time 12, no more prints; order eventually expires at 71
总结(面试官考点)
题 6 是 Voleon 高频交易方向的核心:
✅ 实现简单撮合引擎(Matching Engine)
✅ 处理外部市场成交 → 计算 trailing-minute volume
✅ 根据参与率(participation rate)动态计算可交易数量
✅ 订单有有效期(60 秒)
✅ 订单可多次分批成交(partial fills)
难点:
- 外部市场 prints 会改变 trailing volume
- 每次 print 都可能触发新的可交易量
- 每个 order 需要维护:
- goal 剩余量
- expire time
- 已经交易的 emitted volume
- 考察 模拟复杂系统的能力,类似真实 HFT execution algo(VWAP/TWAP participation algo)。
VOprep 团队长期陪同学员实战各类大厂 OA 与 VO,包括 Voleon、Google、Amazon、Citadel、SIG 等,提供实时答案助攻、远程陪练与面试节奏提醒,帮助大家在关键时刻不卡壳。
如果你也在准备 Tiktok 或类似工程向公司,可以了解一下我们的定制助攻方案——从编程面到系统设计,全程护航上岸。