Pricing Engine

How does Concordia collect and stream real-time prices

Concordia’s pricing system provides real-time 1-minute granularity information on digital assets. It is designed to provide accurate spot prices with low latency, detect anomalous behavior in price movements, and gracefully smooth out corrupt or missing data.

Aggregation algorithm

For every instrument tracked by the Concordia pricing engine, there are numerous high quality data providers that measure market data to produce a current spot price. Different instruments will have different sets of data providers – for example equities data will come from different sources than cryptocurrency data.

In order to narrow the confidence interval and find an accurate price out of the collection of different data providers, the pricing engine filters the outliers using a standard interquartile range (IQR) filter. This method is very robust against outliers resulting from errant or corrupt data providers. After filtering outliers, Concordia takes the median of the remaining set. The reason to choose the median rather than the mean is to make the final quote less sensitive to outliers. In the case of price data, the expectation is that statistical dispersion is more likely a sign of a set of corrupted (or latent) data providers, rather than true volatility in the markets.

Price record elements

Concordia’s pricing engine constructs aggregations and statistical measurements out of the raw 1-minute streaming data. These include:

  • Current spot price - The median of the confidence interval for the price

  • Last observed timestamp

  • 1h return (delta since 1 hour prior)

  • 24h return (delta since 24 hours prior)

  • 1 hour moving average. The average price for the last 60 minutes.

  • 1 day moving average. The average price for the last day.

  • 1 hour half-life exponential moving average of price

  • 1 day half-life exponential moving average of price

  • T-score on a 20 day t-distribution of hourly returns

  • T-score on a 90 day t-distribution of daily returns

  • 1h return volatility - rolling exponential moving average

  • 1d return volatility - rolling exponential moving average

Historical data

The history of all Concordia’s price data is stored at hourly granularity. Users can retrieve historical data to analyze trends on all data points.

Application to quantitative risk

The elements in the price datum were included with risk assessment in mind. For applications that need to put the price in context of its past, these several data points can help to paint that picture.

Here are some ways the Concordia Risk Engine uses these data in practice:

  • New position circuit breaker. A market manipulator can take advantage of naive risk engines by moving the price of a collateral suddenly up, borrowing funds, and then letting the price of the collateral drop back down to a “true” market price. Even if the attacker defaults, and gets their portfolio liquidated, they may still profit from the borrowed funds they pocketed. There is a reverse attack where they push the price of an asset down, and borrow a large amount of it at an unnaturally reduced value. Concordia uses the t-score on returns to decide whether or not a price movement is bonafide, and then prevents new positions from being opened on abnormal changes. When a 1h return is above the 99% p-score for the instrument, Concordia will not allow anyone to add to their collateral balance in that instrument. When a 1h return is beneath a 1% p-score for the instrument, Concordia will not allow anyone to add to their liability balance in that instrument. Once the hourly changes converge back within a nominal range on the t-distribution, positions can be modified as usual.

  • Portfolio valuation clamps. The value of collaterals and liabilities are “clamped” within ranges of the exponential moving average of the instrument. For instance, if the reported price of Bitcoin is $44,000 while the 1h EMA is $40,000, then Bitcoin is 10% above its EMA. The risk engine may clamp Bitcoin’s price to 5% within the 1h EMA, treating Bitcoin as effectively worth $42,000 for purposes of portfolio valuation. Not only does this protect against price manipulation, but it helps mitigate the effect of flash crashes or flash pumps on borrowers who would need time to make margin calls. Without price smoothing, inappropriate liquidations could occur when a price suddenly “wicks” in one direction or another.

Price Sources

API Documentation

The API for the price warehouse is hosted at https://price.dev.concordia.systems/docs/

Last updated