We should add some info to the endpoint's response message about the average price for the requested markets. This average price should be expressed in the requested reference currency.
This formula helps us understand how much the entries of a set differ from each other under certain criteria. The more an entry is different, the less it weights when calculating the average.
In our context, one discriminant is for sure the price of a market (if it's very low or very high, it will have very little weight on the final price average, compared to one with a "more common" price), we could take into account also market liquidity (their balances) though to be even more accurate.
I'll provide some test vectors for making sure we properly unit-test this feature.
We should add some info to the endpoint's response message about the average price for the requested markets. This average price should be expressed in the requested reference currency.
The standard deviation formula should be what we're looking for in calculating our average price.
This formula helps us understand how much the entries of a set differ from each other under certain criteria. The more an entry is different, the less it weights when calculating the average.
In our context, one discriminant is for sure the price of a market (if it's very low or very high, it will have very little weight on the final price average, compared to one with a "more common" price), we could take into account also market liquidity (their balances) though to be even more accurate.
I'll provide some test vectors for making sure we properly unit-test this feature.