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

# trade.observation@1 · OpenVibe.Services

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

# TradeObservation `trade.observation@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/trade/observation.v1.json`](/docs/contracts/trade.observation.json)

trade.observation@1: one market observation on OpenVibe.Trade (server/domain/observations.js dto): a value a source stated (the decimal exactly as stated), when it was true and when it was fetched, where from, and (in reads) whether it is stale by its source's freshness or its own max age. Rows are immutable.

## Fields

| Field | Type | Required | Description | Constraints |
| --- | --- | --- | --- | --- |
| `id` | string | yes |  |  |
| `metric` | string | yes |  |  |
| `value` | string | yes | The decimal as the source stated it. |  |
| `unit` | string | yes |  |  |
| `currency` | string \| null |  |  |  |
| `period` | string \| null |  |  |  |
| `observed_at` | string \| null | yes |  | - `format date-time` |
| `retrieved_at` | string \| null | yes |  | - `format date-time` |
| `recorded_at` | string \| null | yes |  | - `format date-time` |
| `max_age_sec` | integer \| null |  |  |  |
| `source` | object | yes |  |  |
| `source.key` | string | yes |  |  |
| `source.item_id` | string \| null |  |  |  |
| `source.url` | string \| null |  |  |  |
| `source.ref` | string |  |  |  |
| `freshness` | object |  |  |  |
| `freshness.stale` | boolean |  |  |  |
| `freshness.stale_since` | string \| null |  |  | - `format date-time` |
| `freshness.reason` | enum |  |  | - `one of "value_older_than_max_age", "source_unknown", "source_stale", null` |
| `freshness.source_status` | any |  |  |  |
| `freshness.source_last_success_at` | any |  |  |  |

## Examples

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

 Valid: close

~~~~
{
  "id": "obs_01JAB2C3D4E5F6G7H8J9K0MNPQ",
  "metric": "close",
  "value": "182.40",
  "unit": "USD",
  "currency": "USD",
  "period": "2026-09-24",
  "observed_at": "2026-09-24T20:00:00.000Z",
  "retrieved_at": "2026-09-24T21:05:00.000Z",
  "recorded_at": "2026-09-24T21:05:02.000Z",
  "max_age_sec": 172800,
  "source": {
    "key": "example-quotes",
    "item_id": null,
    "url": "https://quotes.example.com/ACME",
    "ref": "ACME:2026-09-24:close"
  },
  "freshness": {
    "stale": false,
    "stale_since": null,
    "reason": null,
    "source_status": "healthy",
    "source_last_success_at": "2026-09-24T21:05:00.000Z"
  }
}
~~~~

Rejected: number-value

~~~~
{
  "id": "o",
  "metric": "close",
  "value": 182.4,
  "unit": "USD",
  "observed_at": null,
  "retrieved_at": null,
  "recorded_at": null,
  "source": {
    "key": "k"
  }
}
~~~~

## Validate

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