dex-services icon indicating copy to clipboard operation
dex-services copied to clipboard

Improve token price estimates in reference token.

Open nlordell opened this issue 4 years ago • 0 comments

We currently use OWL buy orders for estimating token prices, but these estimates tend to be quite far from the final OWL prices for tokens found by the solvers.

The issue was first identified in #1183 where the average error was computed to be around 28000% :warning:. Here is a case that illustrates the issue well:

The solved batch 5294097

The solver submitted a solution with the price of WETH of 20625175134022798 OWL atoms, or roughly 0.0206 OWL. The price (see the event log in the above link).

However, the price estimator computed: /api/v1/markets/1-0/estimated-buy-amount/1?atoms=false:

{
  "baseTokenId": 1,
  "quoteTokenId": 0,
  "buyAmountInBase": "0.0004905633233318732",
  "sellAmountInQuote": "1"
}

Which ends up as a price of 2038472817755854995456 OWL atoms, or 2038.47 OWL. This is off by 5 orders of magnitude :warning:.

Note that this is a very extreme case. However, in recent batches, it is not uncommon for the error to be around 100% (such as 5303968). Note that so far, the batches I have found with these large error margins are with the open solver.

nlordell avatar Jul 27 '20 08:07 nlordell