# Budget Transfer Bot Argentina

Twitter/X bot MVP for posting one relevant daily budget-transfer fact from Argentina's Presupuesto Abierto API.

## What it does

- Queries official Presupuesto Abierto API (`POST /api/v1/credito?format=json`).
- Focuses on paid budget transfers (`inciso_id = 5`, `credito_pagado > 0`).
- Chooses a topic preset for the day (`universidades`, `atn`, or `auto`).
- Generates a <=280 char tweet.
- Dry-run by default. Posting uses `xurl` only when explicitly enabled.
- Stores seen/generated tweets in SQLite to avoid duplicates.

## Required env

```bash
export PRESUPUESTO_ABIERTO_TOKEN='...'
```

For posting:

```bash
export ENABLE_POSTING=1
# xurl must be installed and authenticated separately
```

## Run

```bash
python3 -m venv .venv
. .venv/bin/activate
pip install -r requirements.txt
python budget_transfer_bot.py --topic universidades --dry-run
```

Preview with detail thread:

```bash
python budget_transfer_bot.py --topic universidades --dry-run --json
```

## Production mode

```bash
PRESUPUESTO_ABIERTO_TOKEN=... python budget_transfer_bot.py --topic auto --dry-run
```

When X auth is ready:

```bash
ENABLE_POSTING=1 PRESUPUESTO_ABIERTO_TOKEN=... python budget_transfer_bot.py --topic auto --post --thread
```

## Notes

- Amounts from Presupuesto Abierto are in **millions of pesos**.
- This is budget execution data, not bank-transfer-by-CBU data.
- Conservative wording: "se registraron pagos" / "Presupuesto Abierto".
