TradeObservationRequest trade.observation-request@1
Generated at from
openvibe-contracts v0.53.0 and
openvibe-sdk v0.11.0.
- Version
- 1.0.0
- Owner
- trade
- Visibility
- first-party
- Status
- active
- Compatibility
- backward
- Schema
https://openvibe.network/contracts/trade/observation-request.v1.json
trade.observation-request@1: the body of POST /api/v1/observations on OpenVibe.Trade (trade.observation.write; services only): one value a source stated for an instrument (symbol or instrument_id). value is the finite decimal as stated; observed_at and retrieved_at are date-times with a zone and not in the future; source_key names the OpenVibe.Sources source and source_ref the statement within it. The same source reference with the same value is answered as it was (200); a different value under the same reference is 409 observation.conflict (a correction needs its own source_ref).
Fields
| Field | Type | Required | Description | Constraints |
|---|---|---|---|---|
symbol | string | |||
instrument_id | string | |||
metric | string | yes |
| |
value | string | number | yes | ||
unit | string | yes |
| |
currency | string | null |
| ||
period | string | null |
| ||
observed_at | string | yes | ||
retrieved_at | string | yes | ||
source_key | string | yes |
| |
source_ref | string | yes |
| |
source_item_id | string | null |
| ||
source_url | string | null |
| ||
max_age_sec | integer | string | null |
|
Examples
From the contract's own test fixtures: valid ones validate, rejected ones must fail.
Valid: close
{
"symbol": "ACME",
"metric": "close",
"value": "182.40",
"unit": "USD",
"currency": "USD",
"period": "2026-09-24",
"observed_at": "2026-09-24T20:00:00Z",
"retrieved_at": "2026-09-24T21:05:00Z",
"source_key": "example-quotes",
"source_ref": "ACME:2026-09-24:close",
"source_url": "https://quotes.example.com/ACME",
"max_age_sec": 172800
}Rejected: no-source-ref
{
"symbol": "ACME",
"metric": "close",
"value": "182.40",
"unit": "USD",
"observed_at": "2026-09-24T20:00:00Z",
"retrieved_at": "2026-09-24T21:05:00Z",
"source_key": "example-quotes"
}Validate
const contracts = require('openvibe-contracts');
contracts.validate('trade.observation-request@1', value); // { valid, errors: [{ path, message }] }