trading_agent.configuration.secrets
¶
Secrets read from TRADING_AGENT_* environment variables and the .env file.
Secrets are kept apart from trading_agent.toml so that the TOML file can be committed to git while .env never is. bin/trading-agent changes into the project folder first, so .env is found there.
Typical usage example:
secrets = Secrets() token = secrets.gateway_access_token
Secrets
¶
Bases: BaseSettings
The secret values the agent needs.
Attributes:
| Name | Type | Description |
|---|---|---|
gateway_access_token |
str
|
The token every web interface and API request must present. |
claude_code_oauth_token |
str
|
The Max subscription token made by |
openai_api_key |
str
|
The key for OpenAI-compatible backends, or empty for local servers that need none. |
webhook_token |
str
|
The token incoming webhooks must present, kept apart from the gateway token so it can be pasted into services such as TradingView; empty switches webhooks off. |
telegram_bot_token |
str
|
The token BotFather gave for the trading-agent bot, or empty when Telegram is not set up. |
firebase_service_account_file |
str
|
The path of the Firebase service-account key JSON that lets the gateway send push notifications, or empty when push is not set up. |
named
¶
Reads a secret by its own name, such as DEEPSEEK_API_KEY, from the environment or the .env file.
It serves backends whose key is named in trading_agent.toml with api_key_variable.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
variable
|
str
|
The variable's full name. |
required |
Returns:
| Type | Description |
|---|---|
str
|
The value, or an empty string when it is not set. |