<p>Extend ExchangeRateService in pricenode to add basic support for multiple providers per currency.</p>
<p>When the service detects that multiple providers have exchange rates for the same currency, it automatically aggregates (averages) these rates into a single ExchangeRate.</p>
<p>The client thus receives a single ExchangeRate per currency, regardless of the number of providers which gathered exchange rates for it (be it a single provider, or multiple). This ensures compatibility with previous and existing clients.</p>
<p>The purpose of this WIP is to test and review whether:</p>
<ul>
<li>this approach to support multiple ExchangeRateProviders is viable</li>
<li>the client transparently handles both normal and aggregate rates "as is" (so without any client modifications)</li>
<li>the pricenode correctly handles multiple providers (multi-threading, caching of rates, calculation of aggregate price, etc)</li>
<li>there are any fundamental showstoppers with this approach (risks, incompatibilities, etc)</li>
</ul>
<p>Addresses <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="635993032" data-permission-text="Title is private" data-url="https://github.com/bisq-network/projects/issues/35" data-hovercard-type="issue" data-hovercard-url="/bisq-network/projects/issues/35/hovercard" href="https://github.com/bisq-network/projects/issues/35">bisq-network/projects#35</a></p>

<hr>

<h4>You can view, comment on, or merge this pull request online at:</h4>
<p>  <a href='https://github.com/bisq-network/bisq/pull/4315'>https://github.com/bisq-network/bisq/pull/4315</a></p>

<h4>Commit Summary</h4>
<ul>
  <li>Simplify validation in ExchangeRateServiceTest</li>
  <li>ExchangeRateService: Support aggregate rates</li>
  <li>Integrate initial set of ExchangeRateProviders</li>
</ul>

<h4>File Changes</h4>
<ul>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/4315/files#diff-90740c91fea4f2d8b7b4de94ab0bdf61">pricenode/src/main/java/bisq/price/spot/ExchangeRateProvider.java</a>
    (93)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/4315/files#diff-52ebe0bbb902ed90df69694b0935621f">pricenode/src/main/java/bisq/price/spot/ExchangeRateService.java</a>
    (79)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/bisq-network/bisq/pull/4315/files#diff-6d8f57dee165650cfca60363d7d06cac">pricenode/src/main/java/bisq/price/spot/providers/Binance.java</a>
    (46)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/bisq-network/bisq/pull/4315/files#diff-d1be6bf4931516cd5b52a90b3d263cf4">pricenode/src/main/java/bisq/price/spot/providers/Bitfinex.java</a>
    (46)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/bisq-network/bisq/pull/4315/files#diff-a2d7b80e1c8fb0a6bcb71a901df3e5b9">pricenode/src/main/java/bisq/price/spot/providers/Kraken.java</a>
    (46)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/4315/files#diff-89e2fd6c50a6668bc2c61fd77f9ca2d6">pricenode/src/main/java/bisq/price/spot/providers/Poloniex.java</a>
    (58)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/bisq-network/bisq/pull/4315/files#diff-99d2dbe6f01ed9e1a1ff2963048f7d40">pricenode/src/test/java/bisq/price/ExchangeTestBase.java</a>
    (74)
  </li>
  <li>
    <strong>M</strong>
    <a href="https://github.com/bisq-network/bisq/pull/4315/files#diff-9821c1b3bffbf3c6f980c70f6ab26dac">pricenode/src/test/java/bisq/price/spot/ExchangeRateServiceTest.java</a>
    (149)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/bisq-network/bisq/pull/4315/files#diff-116d634e89a38e61eabd475e433eab65">pricenode/src/test/java/bisq/price/spot/providers/BinanceTest.java</a>
    (34)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/bisq-network/bisq/pull/4315/files#diff-ff127ac33f5ff77c1f7b1443405762fc">pricenode/src/test/java/bisq/price/spot/providers/BitfinexTest.java</a>
    (34)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/bisq-network/bisq/pull/4315/files#diff-8027a29c4959c89bcb1e8d8f90d9d767">pricenode/src/test/java/bisq/price/spot/providers/KrakenTest.java</a>
    (34)
  </li>
  <li>
    <strong>A</strong>
    <a href="https://github.com/bisq-network/bisq/pull/4315/files#diff-cea2da84b16e2ef4d258ce0be71f7a8e">pricenode/src/test/java/bisq/price/spot/providers/PoloniexTest.java</a>
    (34)
  </li>
</ul>

<h4>Patch Links:</h4>
<ul>
  <li><a href='https://github.com/bisq-network/bisq/pull/4315.patch'>https://github.com/bisq-network/bisq/pull/4315.patch</a></li>
  <li><a href='https://github.com/bisq-network/bisq/pull/4315.diff'>https://github.com/bisq-network/bisq/pull/4315.diff</a></li>
</ul>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/bisq-network/bisq/pull/4315">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/AJFFTNTSNW6NY736JK6VJETRW7D4PANCNFSM4N75VIBA">unsubscribe</a>.<img src="https://github.com/notifications/beacon/AJFFTNSNJ73OSSTPAG6V3KLRW7D4PA5CNFSM4N75VIBKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4JRERLMQ.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/bisq-network/bisq/pull/4315",
"url": "https://github.com/bisq-network/bisq/pull/4315",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>