diff --git a/.env.example b/.env.example new file mode 100644 index 00000000..153a7626 --- /dev/null +++ b/.env.example @@ -0,0 +1,3 @@ +OPENAI_API_KEY=sk-123 +FINNHUB_API_KEY= +GOOGLE_API_KEY= \ No newline at end of file diff --git a/README.md b/README.md index cac18691..65f0956d 100644 --- a/README.md +++ b/README.md @@ -124,6 +124,11 @@ You will need the OpenAI API for all the agents. export OPENAI_API_KEY=$YOUR_OPENAI_API_KEY ``` +To help consolidate the variables in an .env file, you can copy the .env.example. The main.py script will pick up from there. +```bash +cp .env.example .env +``` + ### CLI Usage You can also try out the CLI directly by running: diff --git a/main.py b/main.py index 6c8ae3d9..15428c0c 100644 --- a/main.py +++ b/main.py @@ -1,5 +1,8 @@ from tradingagents.graph.trading_graph import TradingAgentsGraph from tradingagents.default_config import DEFAULT_CONFIG +from dotenv import load_dotenv + +load_dotenv() # Create a custom config config = DEFAULT_CONFIG.copy() diff --git a/requirements.txt b/requirements.txt index a6154cd2..d8de9fe8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -24,3 +24,4 @@ rich questionary langchain_anthropic langchain-google-genai +python-dotenv