Add spread on exchange rate decreases the rate spread instead of increasing it
See original GitHub issueDescribe the bug
This bug has been reported by devoutness on Mattermost.
In the Store Settings > Rates when you input the % for example 10%
the generated invoice actually lowers the spread instead of increasing it by 10%.
To Reproduce the bug Steps to reproduce the reported bug:
- Go to Store > Rates >
Add spread on exchange rate
- Set exchange rate to 10%
- Create an invoice for that store
- See the invoice logs
BTC_USD: The rating rule is (coingecko(BTC_USD)) * (0.9, 1.1)
This means that spread is actually 10% lower which makes no sense.
Expected behavior
If user inputs 10% add spread
implies 10% increase, I am not sure what we can do for decreases, but this is def a bad UX we have here. This question abotu this particular field gets asked here and there and is def confusing for the users.
Screenshots
Your BTCPay Environment (please complete the following information):
- BTCPay Server Version:
v1.1.2.0 Environment: Development Build: Debug
- Deployment Method: Dev Enviroment
- Browser: Safari
Logs (if applicable)
Setup Parameters
Additional context
SInce it’s late and Sunday, I haven’t looked in-depth into the issue, so it could as well be a poor UX rather than a technical bug ,but def confusing.
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (9 by maintainers)
Top GitHub Comments
For example, a -50% would mean this:
((33211.5, 33211.6)) * (1.50, 0.5)
, which mean(49817.25, 16605.8)
. But this means the bid, would be higher than the ask, so this would be transformed to(16605.8, 49817.25)
and the final rate chosen would be16605.8
.We could potentially solve this by applying the spread only to the bid and not to the BidAsk. But I think this is a can of worms that might trigger some other non obvious issues for a hack to implement what is essentially a discount.
Closing this as it is working as expected, and is indeed what the merchant wants when they add a spread. Adding a spread = get more money.
The definition of spread is always to get more money. The spread of an exchange is the same concept. If the exchange add a spread the customer pays more. If the merchant add a spread the customer pays more.