← 返回 coinbase 的题目列表Crypto Trading System with Pause, Resume, and Cancel
类型:online_judge
Design a crypto trading system that supports pausing, resuming, and canceling orders. Implement a class CryptoTradingSystem with methods:
pause(order_id): Pause the specified order
resume(order_id): Resume the specified order
cancel(order_id): Cancel the specified order
get_status(order_id): Get the current status of the order (active, paused, canceled)
Example
system = CryptoTradingSystem()
order_id = 'order123'
system.pause(order_id)
assert system.get_status(order_id) == 'paused'
system.resume(order_id)
assert system.get_status(order_id) == 'active'
system.cancel(order_id)
assert system.get_status(order_id) == 'canceled'
Assume the total number of orders will not exceed 10,000.