Add basis_movement/basis_detail tools; make history + latest fully filterable

New MCP tools:
- basis_movement: aggregated basis trend, one headline line per crop. The cheap
  "how is basis moving overall" view; optional commodity/source/delivery/days.
- basis_detail: per-(elevator, crop, delivery) basis first→last drill-down.

Both do the aggregation MCP-side and return compact markdown to keep token
burn low, so a client can call the cheap aggregate first and drill in only when
needed.

Flexibility/parity changes:
- price_history: commodity is now optional (spans all crops); groups by
  (source, commodity, delivery); surfaces basis first→last in the summary and
  adds a futures column to the raw table.
- latest_prices: expose the `kind` filter (grain/fertilizer) that the API and
  client already supported.
- client.history(): commodity optional.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-29 15:25:39 -04:00
parent e78733d55e
commit 3340747600
5 changed files with 313 additions and 31 deletions
+1 -1
View File
@@ -59,7 +59,7 @@ def latest(commodity: str | None = None, source: str | None = None,
commodity=commodity, source=source, delivery=delivery, kind=kind)
def history(commodity: str, source_id: int | None = None,
def history(commodity: str | None = None, source_id: int | None = None,
delivery: str | None = None, days: int = 30) -> dict:
return _get("/api/data/history",
commodity=commodity, source_id=source_id,