Skip to content

"Vibe-Trading: Your Personal Trading Agent"

fix(br-data): align zimaos compose with the system job path

shadowinlifea11cb97173b7
diff --git a/agent/src/config/env_schema.py b/agent/src/config/env_schema.py
index 9b9c8463c..97be98e18 100644
--- a/agent/src/config/env_schema.py
+++ b/agent/src/config/env_schema.py
@@ -248,14 +248,17 @@ class DataConfig(_EnvBase):
vibe_trading_openalex_mailto: str = Field(alias="VIBE_TRADING_OPENALEX_MAILTO", default="")
vibe_tw_stock_db: str = Field(alias="VIBE_TW_STOCK_DB", default="")
# Brazilian official data (B3 COTAHIST, CVM, BCB, Tesouro Direto), synced
- # by ``vibe-trading br-data sync`` into one SQLite file. Empty = default
+ # by the one-off CLI ``python -m src.br_data sync`` or by the daily
+ # ``system:br-data-sync`` job (gated by ``vibe_br_sync_enabled`` below)
+ # into one SQLite file. Empty = default
# ``~/.vibe-trading/br-data/br_data.db``.
vibe_br_data_db: str = Field(alias="VIBE_BR_DATA_DB", default="")
# First COTAHIST year a sync downloads (B3 publishes from 1986).
vibe_br_cotahist_start_year: int = Field(alias="VIBE_BR_COTAHIST_START_YEAR", default=2015)
# First year of CVM fund daily reports / company filings a sync downloads.
vibe_br_cvm_start_year: int = Field(alias="VIBE_BR_CVM_START_YEAR", default=2022)
- # Local time (HH:MM, America/Sao_Paulo) of the daily sync in daemon mode.
+ # Local time (HH:MM, America/Sao_Paulo) used as the cron slot for the
+ # FIRST seed of the daily sync system job (see ``vibe_br_sync_enabled``).
vibe_br_sync_time: str = Field(alias="VIBE_BR_SYNC_TIME", default="21:30")
# Opt-in gate for the protected daily-sync system job
# (``system:br-data-sync``, scheduler-unification T9), read via
diff --git a/zimaos/README.md b/zimaos/README.md
index 0c9797694..0989eb7a8 100644
--- a/zimaos/README.md
+++ b/zimaos/README.md
@@ -42,9 +42,16 @@ python -m src.br_data sync --only bcb tesouro
python -m src.br_data sync --only cotahist --cotahist-from 2025
```
-The initial full download can be several GB. The daily sync service is off by
-default; enable it explicitly with `--profile br-data-sync` when starting
-Compose. Its schedule is controlled by `VIBE_BR_SYNC_TIME` in São Paulo time.
+The initial full download can be several GB. The daily sync no longer runs as a
+separate sidecar container or Compose profile: it now runs inside the main
+application container as the protected system job `system:br-data-sync`, which
+is seeded and fires only while the main service sets **both**
+`VIBE_TRADING_ENABLE_SCHEDULER=1` and `VIBE_BR_SYNC_ENABLED=1`. This compose
+template sets both; set either to `0` to keep the daily network sync off. The
+first sync is no longer launched at container start but at the next
+`VIBE_BR_SYNC_TIME` slot (São Paulo wall clock, default 21:30), after B3 and
+CVM publish the day's files. `VIBE_BR_SYNC_TIME` drives the **first seed** only
+— changing it later needs a PATCH of the stored job row, not a compose edit.
Historical coverage starts at `VIBE_BR_COTAHIST_START_YEAR` (default 2015) and
`VIBE_BR_CVM_START_YEAR` (default 2022). No sync is launched by opening the UI.
@@ -66,6 +73,13 @@ roll back, select a previous immutable `sha-<commit>` tag and restart Compose.
Configure a imagem, a pasta persistente e as chaves antes de importar o Compose.
O aplicativo não inicia com chaves de exemplo. A sincronização diária dos dados
-brasileiros e as atualizações automáticas ficam desativadas por padrão. Ative o
-perfil `br-data-sync` somente se quiser baixar a base oficial e mantê-la atualizada.
-O workflow é um modelo inativo para seu próprio fork; não publica no upstream.
+brasileiros não usa mais contêiner separado nem perfil do Compose: ela roda no
+contêiner principal como tarefa de sistema protegida (`system:br-data-sync`),
+ativada neste modelo por `VIBE_TRADING_ENABLE_SCHEDULER=1` e
+`VIBE_BR_SYNC_ENABLED=1` (defina qualquer um dos dois como `0` para mantê-la
+desativada). A primeira sincronização não ocorre ao iniciar o contêiner, mas no
+próximo horário `VIBE_BR_SYNC_TIME` (fuso de São Paulo, padrão 21:30); esse
+valor vale apenas para a primeira criação da tarefa — mudanças posteriores
+exigem um PATCH na linha da tarefa armazenada. As atualizações automáticas
+ficam desativadas por padrão. O workflow é um modelo inativo para seu próprio
+fork; não publica no upstream.
diff --git a/zimaos/docker-compose.yml b/zimaos/docker-compose.yml
index b0bb736b9..f0de67fdd 100644
--- a/zimaos/docker-compose.yml
+++ b/zimaos/docker-compose.yml
@@ -1,5 +1,6 @@
# ZimaOS custom-app template. Configure required variables before importing.
-# Daily data sync and Watchtower updates are opt-in; see README.md.
+# Daily data sync runs as a system job inside the main app (see the flags in
+# that service); Watchtower updates are opt-in; see README.md.
name: vibe-trading
services:
@@ -64,6 +65,21 @@ services:
LANGCHAIN_MODEL_NAME: "${LANGCHAIN_MODEL_NAME:-deepseek/deepseek-v3.2}"
OPENROUTER_API_KEY: "${OPENROUTER_API_KEY:?Set OPENROUTER_API_KEY}"
OPENROUTER_BASE_URL: https://openrouter.ai/api/v1
+ # Daily sync of the official Brazilian datasets (B3 COTAHIST, CVM,
+ # Banco Central, Tesouro Direto) into the br-data/ volume, where the
+ # get_br_market_data tool and the B3 loader read them. The standalone
+ # sync sidecar container is gone: the sync now runs inside this
+ # service as the protected system job `system:br-data-sync`, which is
+ # seeded and fires only while BOTH flags below are set. The first sync
+ # is no longer launched at container start but at the next 21:30
+ # America/Sao_Paulo wall time; the initial download can be several GB
+ # and later runs only fetch what changed. VIBE_BR_SYNC_TIME drives the
+ # FIRST seed only — changing it later needs a PATCH of the stored job
+ # row, not an edit here. Set either flag to "0" to keep the daily
+ # network sync off.
+ VIBE_TRADING_ENABLE_SCHEDULER: "1"
+ VIBE_BR_SYNC_ENABLED: "1"
+ VIBE_BR_SYNC_TIME: "21:30"
# Do NOT set VIBE_TRADING_TRUST_DOCKER_LOOPBACK here: with a LAN-published
# port it would treat LAN clients as local.
volumes:
@@ -121,46 +137,6 @@ services:
en_us: Brazilian official datasets (SQLite)
pt_br: Base oficial de dados brasileiros (SQLite)
- # Daily sync of the official Brazilian datasets (B3 COTAHIST, CVM funds and
- # companies, Banco Central, Tesouro Direto) into br-data/, where the app's
- # get_br_market_data tool and the B3 loader read them. The first run
- # downloads several GB and can take hours; later runs only fetch what changed.
- vibe-trading-br-data:
- profiles: ["br-data-sync"]
- image: ${VIBE_TRADING_IMAGE:?Set VIBE_TRADING_IMAGE to a reviewed image tag}
- container_name: vibe-trading-br-data
- pull_policy: always
- restart: unless-stopped
- depends_on:
- vibe-trading-init:
- condition: service_completed_successfully
- command: ["python", "-m", "src.br_data", "daemon"]
- environment:
- TZ: America/Sao_Paulo
- # First years to download (B3 publishes from 1986; each year of
- # COTAHIST is a few hundred MB in SQLite, options included).
- VIBE_BR_COTAHIST_START_YEAR: "2015"
- VIBE_BR_CVM_START_YEAR: "2022"
- # Daily run time (Sao Paulo), after B3 and CVM publish the day's files.
- VIBE_BR_SYNC_TIME: "21:30"
- volumes:
- - ${VIBE_TRADING_APPDATA:-/DATA/AppData/vibe-trading}/home:/home/vibe/.vibe-trading
- - ${VIBE_TRADING_APPDATA:-/DATA/AppData/vibe-trading}/br-data:/home/vibe/.vibe-trading/br-data
- # The image's healthcheck probes the web server, which this service does
- # not run.
- healthcheck:
- disable: true
- cap_drop:
- - ALL
- security_opt:
- - "no-new-privileges:true"
- read_only: true
- tmpfs:
- - /tmp
- mem_limit: 2g
- labels:
- com.centurylinklabs.watchtower.enable: "false"
-
x-casaos:
architectures:
- amd64