Skip to content

Commit

Permalink
Update Docker setup to use Docker Compose for easier command execution
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesvien committed Dec 23, 2024
1 parent b2e91de commit d14772c
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 18 deletions.
28 changes: 10 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,31 +111,23 @@ poetry run python src/backtester.py --ticker AAPL --start-date 2024-01-01 --end-

## Docker

You can also build and run the project using Docker.
You can run the project easily using Docker Compose.

1. Build the Docker image:
1. Run the agent with custom parameters:
```bash
docker build -t ai-hedge-fund .
docker compose run agent --ticker AAPL
```

2. Run the Hedge Fund system:
2. Run the backtester with custom parameters:
```bash
docker run -it --env-file .env ai-hedge-fund python src/agents.py --ticker AAPL
docker compose run backtester --ticker AAPL
```

3. Run the Backtester:
```bash
docker run -it --env-file .env ai-hedge-fund python src/backtester.py --ticker AAPL
```

4. Run with additional options (e.g., reasoning and date range):
```bash
docker run -it --env-file .env ai-hedge-fund python src/agents.py \
--ticker AAPL \
--start-date 2024-01-01 \
--end-date 2024-03-01 \
--show-reasoning
```
Note:
- The `.env` file will be automatically loaded by Docker Compose
- Use `docker-compose up` to run with default parameters defined in docker-compose.yml
- Use `docker-compose run` to pass custom parameters - no need to specify the python command
- All arguments after the service name are passed directly to the script

## Project Structure
```
Expand Down
30 changes: 30 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
version: '3.8'

services:
agent:
build:
context: .
dockerfile: Dockerfile
env_file: .env
volumes:
- .:/app
entrypoint: python src/agents.py
command: --ticker AAPL
networks:
- ai-hedge-fund

backtester:
build:
context: .
dockerfile: Dockerfile
env_file: .env
volumes:
- .:/app
entrypoint: python src/backtester.py
command: --ticker AAPL
networks:
- ai-hedge-fund

networks:
ai-hedge-fund:
driver: bridge

0 comments on commit d14772c

Please sign in to comment.