The Lab

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Hard-Coded Initial Values - The hard-coded initial values are known to be correct at some point in time, and is taken as the reference to judge whether newer values are sensible.
  • Settings File - A new snapshot of all settings is written any time there is a settings change (which includes reference rate changes). The most recent settings file is read at startup. Failure to apply the settings file aborts Reflector.
  • Web Server : Reflector's web server allows for the updating of reference rates. Failure to apply exchange rates from a web request is silently ignored.

Internal Mechanism

The Reflector run-time works parses the JSON, and the update function is given a set of currencies to update, along with a numeric value per entry to be updated. The following "fat finger" validation is performed:

  1. If the update set contains the reserve currency and it rate isn't 1, the update is rejected.
  2. If any new rate falls outside the range [10^{-6}, 10^6]; update is rejected.
  3. If any new rate falls outside the range OldRate/2, 2 x OldRate; update is rejected.
  4. if all new rates fall within a multiple of 1.0001 of old rates, then the update is accepted but not performed (i.e. all or none are accepted).

If the above validation checks all pass, then exchange rates are updated and rate-dependent cached values are recomputed.

External Mechanism

A worker process supports the use of custom market data feeds. This process also interprets, sanity-checks, and filters these feeds for consumption by the Reflector run-time.

...