TradeObservationResult trade.observation-result@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-result.v1.json

trade.observation-result@1: the answer of POST /api/v1/observations on OpenVibe.Trade: { observation, created } — 201 when recorded (trade.observation.created is announced, alerts are checked), 200 for a repeat of the same statement.

Fields

FieldTypeRequiredDescriptionConstraints
observationtrade.observationyes
createdbooleanyes

Examples

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

Valid: created
{
  "observation": {
    "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"
    }
  },
  "created": true
}
Rejected: no-observation
{
  "created": true
}

Validate

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