question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add spread on exchange rate decreases the rate spread instead of increasing it

See original GitHub issue

Describe 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:

  1. Go to Store > Rates > Add spread on exchange rate
  2. Set exchange rate to 10%
  3. Create an invoice for that store
  4. 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

Screenshot 2021-07-04 at 23 22 40

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:closed
  • Created 2 years ago
  • Comments:10 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
NicolasDoriercommented, Jul 9, 2021

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 be 16605.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.

1reaction
NicolasDoriercommented, Jul 9, 2021

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bid-Ask Spreads in the Foreign Currency Exchange Market
The bid-ask spread (informally referred to as the buy-sell spread) is the difference between the price a dealer will buy and sell a...
Read more >
Calculating Foreign Exchange Spread
The foreign exchange spread (or bid-ask spread) refers to the difference in the bid and ask prices for a given currency pair. The...
Read more >
Forward Points in Currency: The Basics and Examples
A discount spread is the currency forward points that are subtracted from the spot rate, to obtain a forward rate for a currency....
Read more >
Were Bid-Ask Spreads in the Foreign Exchange Market ...
First, bid-ask spreads are correlated between markets on a daily basis, and this correlation increased significantly during the crisis. One reason for this....
Read more >
Multiple Exchange Rates: Expectations and Experiences in
With an exchange spread, it is a moot point whether the tax which is implied by the less devalued rate for exports than...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found