trading_agent.requests.request_expiry_watcher
¶
Notices requests that lapsed without an answer, and tells their desks.
Permission requests lapse after [approvals] expiry_minutes, because an action approved much later could act on stale prices. The watcher runs beside the desks and checks every few seconds.
Typical usage example:
watcher = RequestExpiryWatcher(store, responder) await watcher.run()
RequestExpiryWatcher
¶
Saves lapsed requests as expired and tells each desk once.
Creates the watcher.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
store
|
UserRequestStore
|
Where requests are kept. |
required |
responder
|
UserRequestResponder
|
Tells the desks. |
required |
check_seconds
|
float
|
How long to wait between checks. |
_CHECK_SECONDS
|
Source code in src/trading_agent/requests/request_expiry_watcher.py
check
¶
Expires every lapsed request now and tells its desk.
Returns:
| Type | Description |
|---|---|
int
|
How many requests expired. |
Source code in src/trading_agent/requests/request_expiry_watcher.py
run
async
¶
Checks every few seconds until cancelled.