---
title: "trade.observation.created@1 · OpenVibe.Services"
canonical: "https://openvibe.services/docs/contracts/trade.observation.created"
updated: null
---

# trade.observation.created@1 · OpenVibe.Services

HTML: [trade.observation.created@1 · OpenVibe.Services](https://openvibe.services/docs/contracts/trade.observation.created)

# TradeObservationCreatedPayload `trade.observation.created@1`

Generated at 2026-12-01 05:42:00 UTC from [`openvibe-contracts v0.454.0`](https://github.com/OpenVibers/OpenVibe.Contracts/tree/v0.454.0) and [`openvibe-sdk v0.193.0`](https://github.com/OpenVibers/OpenVibe.SDK/tree/v0.193.0).

- Version: 1.0.0
- Owner: trade
- Visibility: first-party
- Status: active
- Compatibility: backward
- Schema: [`https://openvibe.network/contracts/events/payloads/trade.observation.created.v1.json`](/docs/contracts/trade.observation.created.json)

trade.observation.created v1 (OpenVibe.Trade server/domain/observations.js record). A market observation was recorded: one value a source stated for an instrument (metric, the decimal exactly as stated, unit, currency when monetary, period), when it was true per the source (observed\_at), when the source was fetched (retrieved\_at) and when Trade recorded it, with the source reference. Recorded by a feed service through POST /api/v1/observations (trade.observation.write) or by the Sources sync (server/domain/sync.js). Only on creation: a replay of the same (source\_key, source\_ref) sends nothing, and a different value under the same reference is refused. Written in the transaction that inserted the immutable row, together with the source's freshness update (trade.source.recovered|stale), alert evaluation (trade.alert.triggered) and the instrument's Search document. Leaves out the freshness verdict (computed at read time) and recorded\_by (the envelope actor). Envelope: subject { type: observation, id }, visibility public, priority low, actor service:<recording service> (service:trade for the Sources sync). Information only, not investment advice.

## Fields

| Field | Type | Required | Description | Constraints |
| --- | --- | --- | --- | --- |
| `instrument` | object | yes |  | - `no other fields` |
| `instrument.id` | string | yes |  | - `pattern ^ins_[0-9A-HJKMNP-TV-Z]{26}$` |
| `instrument.symbol` | string | yes |  | - `pattern ^[A-Z0-9][A-Z0-9.-]{0,15}$` |
| `id` | string | yes |  | - `pattern ^obs_[0-9A-HJKMNP-TV-Z]{26}$` |
| `metric` | string | yes | e.g. price.close, volume, us-gaap:Revenues. | - `pattern ^[A-Za-z][A-Za-z0-9_.:-]{0,79}$` |
| `value` | string | yes | The decimal exactly as the source stated it (text, never rounded). | - `pattern ^-?[0-9]+(\.[0-9]+)?([eE][-+]?[0-9]+)?$`<br>- `maxLength 64` |
| `unit` | string | yes | e.g. USD, shares, USD/shares. | - `pattern ^[A-Za-z][A-Za-z0-9/%._-]{0,19}$` |
| `currency` | string \| null | yes | ISO 4217 when the value is monetary; null otherwise. | - `pattern ^[A-Z]{3}$` |
| `period` | string \| null | yes | The period the value covers when the source states one (e.g. a fiscal quarter). | - `minLength 1`<br>- `maxLength 40` |
| `observed_at` | string | yes | When the value was true, per the source. | - `format date-time` |
| `retrieved_at` | string | yes | When the source was fetched. | - `format date-time` |
| `recorded_at` | string | yes | When Trade recorded the row. | - `format date-time` |
| `max_age_sec` | integer \| null | yes | The value's own maximum age, when the recorder gave one. | - `minimum 60`<br>- `maximum 315360000` |
| `source` | object | yes |  | - `no other fields` |
| `source.key` | string | yes | OpenVibe.Sources source key. | - `pattern ^[a-z0-9][a-z0-9-]{1,63}$` |
| `source.item_id` | string \| null | yes | The Sources item the value came from, when there is one. | - `pattern ^itm_[0-9A-HJKMNP-TV-Z]{26}$` |
| `source.url` | string \| null | yes | The source's page for the value (absolute http(s) URL, normalised). | - `pattern ^https?://` |
| `source.ref` | string | yes | The source's own reference for this datum; unique per source\_key. | - `minLength 1`<br>- `maxLength 300` |

## Examples

From the contract's own test fixtures: valid ones validate, rejected ones must fail.

 Valid: price-close

~~~~
{
  "instrument": {
    "id": "ins_01JAB2C3D4E5F6G7H8J9K0MNPQ",
    "symbol": "ACME"
  },
  "id": "obs_01JAB2C3D4E5F6G7H8J9K0MNPR",
  "metric": "price.close",
  "value": "10.50",
  "unit": "USD",
  "currency": "USD",
  "period": null,
  "observed_at": "2026-09-22T11:59:00.000Z",
  "retrieved_at": "2026-09-22T12:00:00.000Z",
  "recorded_at": "2026-09-22T12:00:03.412Z",
  "max_age_sec": null,
  "source": {
    "key": "test-feed",
    "item_id": null,
    "url": "https://example.org/acme/close",
    "ref": "r1"
  }
}
~~~~

Valid: shares-outstanding

~~~~
{
  "instrument": {
    "id": "ins_01JAB2C3D4E5F6G7H8J9K0MNPQ",
    "symbol": "ACME"
  },
  "id": "obs_01JAB2C3D4E5F6G7H8J9K0MNPS",
  "metric": "dei:EntityCommonStockSharesOutstanding",
  "value": "152300000",
  "unit": "shares",
  "currency": null,
  "period": "2026-06-30",
  "observed_at": "2026-06-30T00:00:00.000Z",
  "retrieved_at": "2026-09-23T03:10:00.000Z",
  "recorded_at": "2026-09-23T03:10:02.000Z",
  "max_age_sec": 7776000,
  "source": {
    "key": "sec-xbrl-filings",
    "item_id": "itm_01JAB2C3D4E5F6G7H8J9K0MNPT",
    "url": null,
    "ref": "0000000000-26-000123:dei:EntityCommonStockSharesOutstanding"
  }
}
~~~~

Rejected: missing-observed-at

~~~~
{
  "instrument": {
    "id": "ins_01JAB2C3D4E5F6G7H8J9K0MNPQ",
    "symbol": "ACME"
  },
  "id": "obs_01JAB2C3D4E5F6G7H8J9K0MNPR",
  "metric": "price.close",
  "value": "10.50",
  "unit": "USD",
  "currency": "USD",
  "period": null,
  "retrieved_at": "2026-09-22T12:00:00.000Z",
  "recorded_at": "2026-09-22T12:00:03.412Z",
  "max_age_sec": null,
  "source": {
    "key": "test-feed",
    "item_id": null,
    "url": "https://example.org/acme/close",
    "ref": "r1"
  }
}
~~~~

Rejected: numeric-value

~~~~
{
  "instrument": {
    "id": "ins_01JAB2C3D4E5F6G7H8J9K0MNPQ",
    "symbol": "ACME"
  },
  "id": "obs_01JAB2C3D4E5F6G7H8J9K0MNPR",
  "metric": "price.close",
  "value": 10.5,
  "unit": "USD",
  "currency": "USD",
  "period": null,
  "observed_at": "2026-09-22T11:59:00.000Z",
  "retrieved_at": "2026-09-22T12:00:00.000Z",
  "recorded_at": "2026-09-22T12:00:03.412Z",
  "max_age_sec": null,
  "source": {
    "key": "test-feed",
    "item_id": null,
    "url": "https://example.org/acme/close",
    "ref": "r1"
  }
}
~~~~

Rejected: with-freshness

~~~~
{
  "instrument": {
    "id": "ins_01JAB2C3D4E5F6G7H8J9K0MNPQ",
    "symbol": "ACME"
  },
  "id": "obs_01JAB2C3D4E5F6G7H8J9K0MNPR",
  "metric": "price.close",
  "value": "10.50",
  "unit": "USD",
  "currency": "USD",
  "period": null,
  "observed_at": "2026-09-22T11:59:00.000Z",
  "retrieved_at": "2026-09-22T12:00:00.000Z",
  "recorded_at": "2026-09-22T12:00:03.412Z",
  "max_age_sec": null,
  "source": {
    "key": "test-feed",
    "item_id": null,
    "url": "https://example.org/acme/close",
    "ref": "r1"
  },
  "freshness": {
    "stale": false
  }
}
~~~~

## Validate

~~~~
const contracts = require('openvibe-contracts');
contracts.validate('trade.observation.created@1', value);   // { valid, errors: [{ path, message }] }
~~~~
