opa_create_price_subscription
Create recurring price subscriptions that snapshot commodity prices at defined intervals and record events for later review.
Instructions
Create a PERSISTENT, recurring price subscription (a 'watch') tied to the user's OilPriceAPI account. The API snapshots the watched commodities every interval and records an event each time — so the agent can come back later and poll for what changed via opa_get_subscription_events. Use when the user wants ONGOING monitoring of one or more commodities (e.g. 'keep watching Brent and WTI every hour'). This is different from a price alert: a watch ALWAYS emits an event every interval (a running log), whereas an alert only fires when a threshold is crossed. REQUIRES an API key (OILPRICEAPI_KEY) — this writes to the user's account. Events are POLLED, not pushed: there is no always-on connection. Manage watches with opa_list_subscriptions and opa_delete_subscription. Per-tier limits apply (free: 1 watch, 3 codes, 1h minimum interval); the API returns the exact limit if exceeded.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| codes | Yes | Commodity names or codes to watch (e.g., ['brent', 'wti'] or ['BRENT_CRUDE_USD']). Free tier allows up to 3 codes per watch. | |
| interval | Yes | How often to snapshot: a friendly interval like '5m', '1h', '6h', 'daily', or a bare number of seconds ('3600'). The minimum allowed interval depends on the plan (free: 1h). If below the floor the API returns the exact minimum. | |
| name | No | Optional human-readable label for the watch (e.g., 'Crude desk hourly'). |