mirror of
https://github.com/TauricResearch/TradingAgents.git
synced 2026-05-01 14:33:10 +03:00
Add environment variable configuration support
- Add .env.example file with API key placeholders - Update README.md with .env file setup instructions - Add dotenv loading in main.py for environment variables 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2
.env.example
Normal file
2
.env.example
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
ALPHA_VANTAGE_API_KEY=alpha_vantage_api_key_placeholder
|
||||||
|
OPENAI_API_KEY=openai_api_key_placeholder
|
||||||
@@ -124,6 +124,12 @@ You will need the OpenAI API for all the agents.
|
|||||||
export OPENAI_API_KEY=$YOUR_OPENAI_API_KEY
|
export OPENAI_API_KEY=$YOUR_OPENAI_API_KEY
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Alternatively, you can create a `.env` file in the project root with your API keys (see `.env.example` for reference):
|
||||||
|
```bash
|
||||||
|
cp .env.example .env
|
||||||
|
# Edit .env with your actual API keys
|
||||||
|
```
|
||||||
|
|
||||||
### CLI Usage
|
### CLI Usage
|
||||||
|
|
||||||
You can also try out the CLI directly by running:
|
You can also try out the CLI directly by running:
|
||||||
|
|||||||
5
main.py
5
main.py
@@ -1,6 +1,11 @@
|
|||||||
from tradingagents.graph.trading_graph import TradingAgentsGraph
|
from tradingagents.graph.trading_graph import TradingAgentsGraph
|
||||||
from tradingagents.default_config import DEFAULT_CONFIG
|
from tradingagents.default_config import DEFAULT_CONFIG
|
||||||
|
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
|
||||||
|
# Load environment variables from .env file
|
||||||
|
load_dotenv()
|
||||||
|
|
||||||
# Create a custom config
|
# Create a custom config
|
||||||
config = DEFAULT_CONFIG.copy()
|
config = DEFAULT_CONFIG.copy()
|
||||||
config["llm_provider"] = "google" # Use a different model
|
config["llm_provider"] = "google" # Use a different model
|
||||||
|
|||||||
Reference in New Issue
Block a user