trading_agent.requests.question_response
¶
The user's answers to a desk's questions: checked against the options, and written up for the desk.
Typical usage example:
response = QuestionResponse(request, [{'selected': ['Wait'], 'other': ''}]) response.check() text = response.message()
QuestionResponse
¶
One answer per question: the options chosen, and any text typed under "Other".
Creates the response.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
request
|
UserRequest
|
The question request. |
required |
answers
|
Sequence[dict[str, Any]]
|
One {"selected": [labels], "other": text} per question, in order. |
required |
Source code in src/trading_agent/requests/question_response.py
check
¶
Checks that each answer fits its question.
Raises:
| Type | Description |
|---|---|
ValueError
|
The number of answers is wrong, an answer names an option the question does not have, a single-choice question has more or fewer than one answer, or a multiple-choice question has none. |
Source code in src/trading_agent/requests/question_response.py
stored
¶
The response as saved with the request.
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
The answers, cleaned. |
Source code in src/trading_agent/requests/question_response.py
message
¶
The message the desk receives.
Returns:
| Type | Description |
|---|---|
str
|
Each question with the user's answer. |