Skip to main content

Overview

Termo is B3’s forward market: a trade agreed today for settlement a fixed number of days out. It rides the same COTAHIST tape as quotes under tpmerc = 030, and it is a small segment — on the order of a hundred prints per session, against tens of thousands of options. Everything is unadjusted; every row carries adjusted: false.
The grain is (codneg, trade_date, market, board, term_days). One code can print several terms or boards in the same session. Preserve those distinctions when indexing the observations.There is no underlying column, for the same reason as options: the codneg root usually names the underlying paper, but B3 publishes no mapping, and deriving one would be inventing an identity join.

POST /rpc/termo_history

One code’s daily prints over a window.
Parameters, response columns and types are generated from the SQL catalog and render under Endpoints → Derivatives in the sidebar. This page carries what a schema cannot.
p_from and p_to are both inclusive.

Field notes

Only the columns that need explaining: Source-field provenance for the price columns, since the names differ from B3’s: spec ← especi, bid ← oferta_compra, ask ← oferta_venda, trades ← negocios, quantity ← quantidade, quotation_factor ← fator_cotacao. Every COTAHIST field is defined on the COTAHIST dictionary. Rows are ordered by trade_date, then term_days shortest-first — sorted by length and then as text, so 30 precedes 60 precedes 120 without a numeric cast that could fail on malformed source data.

Example

One 1,000-row page, and it refuses above it. A wider window raises SQLSTATE 22023 naming the function — never a truncated series. Because several terms can print per session, a busy code reaches the page faster than a cash ticker: roughly 1,000 ÷ (terms per session) sessions.termo_history has no cursor: narrow p_from / p_to and call again. A term series over a page is a sign the window is too wide, not something to walk.

Termo in panel

panel accepts termo codnegs for close and volume, as id_type termo / asset_class derivative. But a panel row is one value per (id, date, metric), and termo’s real grain has term_days in it — so when several terms print in one session the panel keeps the shortest term and drops the rest, rather than averaging them into a number nobody quoted. That is a deliberate narrowing, and it is why the full grain lives here: for anything term-aware, use termo_history, not panel. close_return is not offered for termo (or for options) — it accepts ticker ids only.

Prices are raw

No split, dividend, or corporate-action adjustment anywhere in this warehouse; adjusted is a constant false. If you need returns, difference close yourself, and be aware that a corporate action in the window will show up as a large move that is not a return.

Empty and error behavior

  • Unknown code → 200 []. Never a fabricated price.
  • Known code, no prints in the window → also 200 []. Termo is thin; a code can go days without a print, and a quiet window is indistinguishable from a wrong code. Check coverage’s derivatives row for what the warehouse actually holds.
  • A malformed date returns 400.