Skip to content

Commit

Permalink
Update README.template
Browse files Browse the repository at this point in the history
  • Loading branch information
manhinhang authored Sep 19, 2024
1 parent 0d243fb commit b42a19c
Showing 1 changed file with 70 additions and 0 deletions.
70 changes: 70 additions & 0 deletions README.template
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,76 @@ ib-gateway-docker
| - | - | - |
| ib_insync | [examples/ib_insync](./examples/ib_insync) | This example demonstrated how to connect `IB Gateway`


## Health check container

### API

Healthcheck via api call `http://localhost:8080/healthcheck`

Config `HEALTHCHECK_API_ENABLE=true` in environment variable to enable API

```bash
curl -f http://localhost:8080/healthcheck
```

- Docker compose example

```yaml
services:
ib-gateway:
image: manhinhang/ib-gateway-docker
ports:
- 4002:4002
environment:
- IB_ACCOUNT=$IB_ACCOUNT
- IB_PASSWORD=$IB_PASSWORD
- TRADING_MODE=$TRADING_MODE
- HEALTHCHECK_API_ENABLE=true
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8080/healthcheck"]
interval: 60s
timeout: 30s
retries: 3
start_period: 60s
```
### CLI
Execute `healthcheck` to detect IB gateway haelth status

```bash
healthcheck
# output: Ping IB Gateway successful
echo $?
# output: 0
```

```bash
healthcheck
# output: Can not connect to IB Gateway
echo $?
# output: 1
```

- Docker compose example

```yaml
services:
ib-gateway:
image: manhinhang/ib-gateway-docker
ports:
- 4002:4002
environment:
- IB_ACCOUNT=$IB_ACCOUNT
- IB_PASSWORD=$IB_PASSWORD
- TRADING_MODE=$TRADING_MODE
healthcheck:
test: /healthcheck/bin/healthcheck
interval: 60s
timeout: 30s
retries: 3
start_period: 60s
```

# Tests

The [test cases](test/test_ib_gateway.py) written with testinfra.
Expand Down

0 comments on commit b42a19c

Please sign in to comment.