TradeAlertRuleRequest trade.alert-rule-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/alert-rule-request.v1.json

trade.alert-rule-request@1: the body of POST /api/v1/alerts on OpenVibe.Trade (trade.alert.create; the acting person): an active instrument by symbol and the rule kind. threshold needs metric, operator (above or below), threshold (a finite decimal) and unit, and may name a currency; filing_type needs 1-10 form_types (a list or comma-separated, e.g. 10-K, 8-K); new_document needs nothing more. There is a per-person limit (429 alert.limit).

Fields

FieldTypeRequiredDescriptionConstraints
symbolstringyes
kindenumyes
  • one of "threshold", "filing_type", "new_document"
metricstring
  • maxLength 80
operatorenum
  • one of "above", "below"
thresholdstring | number
unitstring
  • maxLength 20
currencystring | nullISO 4217.
  • pattern ^\s*[A-Za-z]{3}\s*$|^$
form_typesarray | string

Examples

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

Valid: filings
{
  "symbol": "ACME",
  "kind": "filing_type",
  "form_types": "10-K, 10-Q, 8-K"
}
Rejected: threshold-incomplete
{
  "symbol": "ACME",
  "kind": "threshold",
  "metric": "close"
}

Validate

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