Skip to content

B3 Agricultural Futures

Overview

Field Value
Provider B3 — Brasil, Bolsa, Balcao
Data Daily settlements (settlement prices) + open interest of agricultural futures
Access ZIP/XML BVBG-086 (b3.com.br) + CSV API (arquivos.b3.com.br)
Format Nested ZIP (XML streaming via lxml.etree.iterparse) + CSV (; separator)
Authentication None
License zona_cinza — D-1 FAQ and website terms have different scopes
Contracts BGI (cattle), CCM (corn), ICF (arabica coffee), CNL (conillon coffee), ETH (ethanol), SJC (soybean cross), SOY (soybean FOB)

Data Origin

B3 publishes daily the settlements (settlement prices) of all traded futures contracts. The source is the BVBG-086 file (nested ZIP containing XML snapshots) available at b3.com.br/pesquisapregao/download. The ZIP contains intraday snapshots; agrobr uses the last one (snapshot 03, definitive). Parsing via lxml.etree.iterparse (streaming, without loading the entire XML into memory). It filters only the 7 agricultural contracts.

Additionally, B3 makes open interest of derivatives available via public CSV at arquivos.b3.com.br. The download follows a 2-step flow: (1) obtain a token via requestname, (2) download the CSV with the token. The parser filters only the AGRIBUSINESS segment and classifies each position as future or option.

Agricultural Contracts

Ticker Contract Unit
BGI Live Cattle BRL/@
CCM Corn BRL/sc60kg
ICF Arabica Coffee USD/sc60kg
CNL Conillon Coffee BRL/sc60kg
ETH Hydrous Ethanol BRL/m3
SJC Soybean Cross USD/sc60kg
SOY Soybean FOB Santos USD/ton

Technical Details — Settlements

Primary source: BVBG-086 ZIP

  • URL: https://www.b3.com.br/pesquisapregao/download?filelist=PR{yymmdd}.zip
  • Structure: outer ZIP → inner ZIP (BVBG086.zip) → 3 XML snapshots (PR{yymmdd}01.xml, 02, 03)
  • Snapshot: The last one (03) is the definitive
  • XML namespace: urn:bvmf.217.01.xsd (inner), urn:bvmf.052.01.xsd (outer envelope)
  • Parsing: lxml.etree.iterparse with cleanup of parent refs (streaming, ~51K records per file)
  • Filtering: Only agricultural futures (regex ^[A-Z]{2,4}[FGHJKMNQUVXZ]\d{2}$, base ticker in TICKERS_AGRO)

Usage Example

import agrobr

# Settlements for a date
df = await agrobr.b3.ajustes(data="13/02/2025")

# Filter by contract (name or ticker)
df = await agrobr.b3.ajustes(data="13/02/2025", contrato="boi")
df = await agrobr.b3.ajustes(data="13/02/2025", contrato="CCM")

# Historical series (loop over business days)
from datetime import date
df = await agrobr.b3.historico(
    contrato="boi",
    inicio=date(2025, 2, 10),
    fim=date(2025, 2, 14),
)

# Filter by maturity
df = await agrobr.b3.historico(
    contrato="boi",
    inicio=date(2025, 2, 10),
    fim=date(2025, 2, 14),
    vencimento="G25",
)

# List available contracts
print(agrobr.b3.contratos())

# With metadata
df, meta = await agrobr.b3.ajustes(data="13/02/2025", return_meta=True)

Open Interest

Open interest of agricultural futures and options, via B3's public CSV.

import agrobr
from datetime import date

# Open interest for a date
df = await agrobr.b3.posicoes_abertas(data=date(2025, 12, 19))

# Filter by contract
df = await agrobr.b3.posicoes_abertas(data=date(2025, 12, 19), contrato="boi")

# Futures only (no options)
df = await agrobr.b3.posicoes_abertas(data=date(2025, 12, 19), tipo="futuro")

# Historical series of open interest
df = await agrobr.b3.posicoes_abertas_historico(
    contrato="boi",
    inicio=date(2025, 12, 15),
    fim=date(2025, 12, 19),
)

Technical Details — Open Interest

  • URL: https://arquivos.b3.com.br/api/download/requestname?fileName=DerivativesOpenPosition&date=YYYY-MM-DD
  • Flow: 2 steps (token + download)
  • Format: CSV, separator ;, UTF-8 encoding
  • Data: ~500 agricultural rows per day (futures + options)
  • Agricultural assets: BGI, CCM, ETH, ICF, SJC (+ CNL on older dates)
  • Contract: POSICOES_ABERTAS_V1 (PK: data + ticker_completo)
  • Expiration: vencimento_codigo is the published XprtnCd, in the two formats of B3's UP2DATA glossary: MYY for futures (e.g. F26) and MYOA for options (e.g. FVI1: month, year, option code and sequence). vencimento_mes and vencimento_ano are the contract month and year, options included. They come from the series ticker (BGIF26C030000 → January 2026), checked against the month letter of the code. A ticker or code outside these formats raises ParseError.
  • Expiring before the contract month: the date on which the instrument expires (XprtnDt in B3's instrument file) can fall in the previous month. In the 2026-09-22 file, this holds for arabica and conillon coffee options and for soybean cross and soybean FOB futures and options. E.g. ICFH27C035000 expires on 2027-02-12 and SJCF27 on 2026-12-29. Cattle, corn and ethanol expire in the contract month.
  • vencimento filter (posicoes_abertas_historico): the contract month code (e.g. F26, any case) returns the future and the options of that month; an option's published code (e.g. FVI1) returns only that series. Any other format raises InvalidParameterError before the network.

Limitations

  • Open interest: does not include breakdown by investor category (COT), only totals
  • Weekends and holidays return an empty DataFrame (no trading session), with the contract dtypes (ajuste_diario or posicoes_abertas). In ajustes, a session not yet published (before about 18:00) also comes out empty, with no warning: B3 answers with an empty ZIP in both cases (22 bytes, no file inside). Any other short body, such as an unavailability JSON with HTTP 200, raises SourceUnavailableError and, in historico, goes into failed_dates
  • A contract outside b3.contratos() (name or ticker, case-insensitive), a date outside YYYY-MM-DD/DD/MM/YYYY, inicio after fim, and tipo outside futuro/opcao raise InvalidParameterError before the request
  • historico downloads a ~11 MB ZIP per business day, with at most AGROBR_HTTP_MAX_CONCURRENT_B3 days (default 3) open at the same time; one year is ~250 downloads
  • historico raises SourceUnavailableError when every requested day fails with a network or parsing error; successfully queried days without a publication preserve the empty result. A day without a session (holiday or session not yet published) does not count as a failure: it goes to meta.source_details["coverage"]["empty_dates"], without the incomplete-history warning, and a period made only of such days comes out empty.
  • Without an explicit date, datasets.futuros_agricolas searches the five recent business days and continues after empty days. An explicit date does not trigger that search.
  • Recommended rate limit: 1 req/s (respect the server)

Cache and Update

  • There is no local cache: every call downloads the data from B3.
  • Settlements are published once a day, after about 18:00 on the trading day.
  • For live cattle (BGI), the last trading day's settlement is not the final settlement price: under B3's contract specification, final settlement uses the average of 5 publications of the DATAGRO Live Cattle Indicator from the February 2025 expiry (BGIG25) onward, and of the CEPEA/B3 Live Cattle Indicator up to the January 2025 expiry (BGIF25), per B3 Circular Letter 135/2024-PRE; agrobr's preco_diario publishes CEPEA, not DATAGRO. For corn (CCM), the settlement at expiry is the final settlement price.
  • The trading-day file also carries after-hours records dated D+1 with the same settlement; ajustes() returns only rows dated as requested (historico does not repeat contracts across consecutive days).
  • Historical data is static and does not change retroactively.

License

B3 retains the zona_cinza classification. Its FAQ waives prior authorization for certain end-of-day and historical data from D-1 obtained from B3 Market Data platforms, while website terms condition commercial use and redistribution. The waiver was not shown to cover the settlement and open-position files used by agrobr. The policy effective through 2026-10-31 and the policy announced for 2026-11-01 have separate effective dates; the future policy's content does not underpin this classification. Check the channel and actual use in B3's official documents. The category establishes neither commercial permission nor absence of terms.

Open-interest availability

B3 retains some recent DerivativesOpenPosition files, including dates before the current day, without guaranteeing a complete archive. HTTP 400/404 when requesting a token indicates an unpublished file and returns an empty result after date validation. At download time, HTTP 404 returns empty data, but HTTP 400 raises SourceUnavailableError. Token/download operations are serialized within the process; historical queries fetch days sequentially. If another open-interest query does not release the turn for AGROBR_HTTP_TIMEOUT_READ seconds (default 30), for example a task of the loop blocked by agrobr.sync, the waiting one raises ResourceLimitError (not SourceUnavailableError: the session is not unavailable); retry the query or serialize the calls, and inside a loop prefer await.