Skip to content

Quote Policies TCP API

Quote policies define which provider may update a symbol's live price. A policy is reusable: several symbols can reference the same policy through quote_policy_id while using their own provider-symbol mapping.

Supported provider types:

Value Name provider_id refers to
1 FEEDER Feeder index
2 GATEWAY Gateway ID
3 PLUGIN Plugin index

Supported modes:

Value Name Behavior
1 FIXED Accept only the first enabled source after priority sorting.
2 PRIORITY_FAILOVER Keep one active source and fail over deterministically when it becomes stale.
3 LATEST Accept matching ticks from every configured source. This can mix prices and should be used deliberately.

System policies

ID Name Purpose
1 System unconfigured Safe default for new symbols. No quotes are accepted.
2 Legacy any source Compatibility policy accepting all sources.

System policies cannot be updated or deleted. During migration, symbols with a specific legacy feeder share one generated Legacy feeder N policy per feeder; symbols using legacy feeder = 0 are assigned policy 2. A policy source identifies only a provider. Provider-specific symbol names are normalized to a symbol's source name at the feeder or gateway boundary before policy matching.

Failover behavior

Sources are sorted by descending priority. In PRIORITY_FAILOVER mode the first source is primary. The server:

  1. accepts ticks only from the active source;
  2. declares it stale using the greater of failover_after_ms and its stale_after_ms;
  3. switches to the highest-priority healthy source;
  4. optionally switches back after both recovery_after_ms and minimum_active_ms have elapsed.

The compiled policy snapshot and runtime health state are held in memory. Ticks do not query the database. Policy writes update the cache first and are persisted asynchronously as a transaction.

Commands

Command Description
GetQuotePolicies Return all policies and ordered sources.
SetQuotePolicy Create or update a policy.
DeleteQuotePolicy Delete an unused non-system policy.

Policy fields

Field Type Description
id int Server-assigned ID. Required for updates.
name string Policy name.
mode int 1 fixed, 2 priority failover, 3 latest.
is_system bool Read-only system-policy marker.
failover_after_ms int Minimum silence before failover.
recovery_after_ms int Stable recovery window before automatic switch-back.
minimum_active_ms int Minimum time a fallback remains active.
switch_back_mode int 1 automatic, 2 manual, 3 never.
unavailable_action int 1 freeze and disable trading, 2 market closed, 3 freeze and keep trading.
reject_crossed_price bool Reject ask prices below bid.
max_spread_points int Policy spread limit; 0 disables it.
max_price_jump_points int Policy price-jump limit; 0 disables it.
max_switch_deviation_points int Maximum deviation while switching; 0 disables it.
max_future_time_ms int Maximum accepted future timestamp offset.
max_past_time_ms int Maximum accepted past timestamp offset.
enabled bool Whether the policy can be assigned and used.
version int Server-managed revision.
sources array Ordered provider mappings. Maximum 8 enabled/configured sources.

Source fields

Field Type Description
provider_type int 1 feeder, 2 gateway, 3 plugin.
provider_id int Positive provider identifier.
priority int Higher values have higher priority.
enabled bool Enables this source.
stale_after_ms int Positive source-health timeout.
max_spread_points int Per-source override; 0 uses the policy limit.
max_price_jump_points int Per-source override; 0 uses the policy limit.

Symbol mappings are separate provider-boundary records, not QuotePolicy configuration. A record maps provider_symbol to source_name. If no entry exists, the received name is used unchanged. The existing symbol index then resolves that source name to one or more internal symbols.

{"provider_symbol":"EUR/USD","source_name":"EURUSD"}

Create mappings with the dedicated feeder or gateway mapping commands. They are persisted separately from feeder config and gateway provider_config. Matching is exact and case-sensitive; masks and wildcards are not used.

Disabling or deleting a non-system policy automatically assigns system policy 1 to every affected symbol. The reassignment and policy write are persisted in one database transaction; individual symbol updates are not required.