trading_agent.client.pairing_commands
¶
The trading-agent pairing commands: list, approve and revoke Telegram chats.
They work on the pairing file directly, so they work whether or not the gateway is running, and the running gateway sees the change at the chat's next message.
Typical usage example:
exit_code = PairingCommands(store, 'main').approve('ABCD2345')
PairingCommands
¶
Manages Telegram pairings for the user.
Creates the commands.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
store
|
PairingStore
|
The pairing file. |
required |
default_desk
|
str
|
The desk a newly paired chat talks to. |
required |
output
|
TextIO
|
Where to print. |
stdout
|
Source code in src/trading_agent/client/pairing_commands.py
list
¶
Prints the paired chats and the codes waiting for approval.
Returns:
| Type | Description |
|---|---|
int
|
Always 0. |
Source code in src/trading_agent/client/pairing_commands.py
approve
¶
Pairs the chat that was given a code.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
code
|
str
|
The code the bot sent. |
required |
Returns:
| Type | Description |
|---|---|
int
|
0 when paired, 1 when no valid code matches. |
Source code in src/trading_agent/client/pairing_commands.py
revoke
¶
Unpairs a chat.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
chat_id
|
str
|
The chat's id, as |
required |
Returns:
| Type | Description |
|---|---|
int
|
0 when removed, 1 when the chat was not paired or the id is not a number. |