Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI bug fix: show trade's contract volume, not moving offer volume #5704

Merged
merged 4 commits into from
Sep 27, 2021

Conversation

ghubstan
Copy link
Member

This fixes a an API CLI gettrade bug that could have resulted in loss of funds (explained below).
There are two minor changes:

  • Show correct, frozen Buyer Cost (trade volume, not offer volume) in CLI console.
    This corrects the CLI's displayed fiat trade cost value, which should be trade.volume, not offer.volume. Offer volume varies with BTC volatility, and the CLI should be showing the trade.volume value instead, frozen when the contract was made.

  • Show correct, frozen altcoin Amount (trade volume, not offer volume) in CLI console.
    This corrects the CLI's displayed altcoin trade amount value, which should be trade.volume, not offer.volume. The bug has been hidden by the stability of the BSQ price, and exposed while testing API support for XMR trades.

The bug could have resulted in loss of funds for traders who used the API to buy BTC in the following scenario:

(1) A trader made or took a market-price-margin based offer to buy BTC, using the API.

(2) The BTC price was volatile between the time the trade was taken and the payment was sent.

(3) The payer did not pay the amount shown by the API CLI at the time the trade was created.

	She waited, then returned to the API to find out how much to pay -- minutes to days 
	after the contract was created -- when the trade price (volume) was frozen.  The CLI
	would have shown her a different amount in the `Buyer Cost` column than it showed 
	immediately after the trade was created.

The CLI's gettrade command has been showing the moving offer volume in the Buyer Cost column -- how
much the buyer pays. This value varies with BTC price if the offer is market-price-margin based.

The CLI should be showing the constant trade volume, frozen at the time a trade contract is written.

This bug does not affect BSQ trading because all BSQ trades are at fixed prices.
This bug would have affected XMR trading if the fix was not applied before XMR trading support in the API is released.

To check to see if you paid too much or too little, you could use the desktop app to view your trade history,
and match the correct payment amounts to your bank transfer records.

This is a bug fix for the CLI's displayed fiat trade cost
value, which should be trade.volume, not offer.volume.  Offer volume
varies with BTC volatility, and the CLI should be showing the trade.volume
value instead, frozen when the contract is made.
This is a bug fix for the CLI's displayed altcoin trade amount
value, which should be trade.volume, not offer.volume.  It has been
hidden by the stability of the BSQ price, and exposed while testing
API support for XMR trades.
Fixes problem simlar to other CLI output changes in this PR.
CLI's 'gettrade' output should show contracted trade.price instead of
moving offer.price value for price margin based altcoin offers.

This fixed bug did not affect any fiat or BSQ trades, only price margin
based XMR trades, and API support for XMR trading has not yet been
released.
ghubstan added a commit to ghubstan/bisq that referenced this pull request Sep 18, 2021
ghubstan added a commit to ghubstan/bisq that referenced this pull request Sep 21, 2021
@ripcurlx ripcurlx added this to the v1.7.5 milestone Sep 27, 2021
Copy link
Contributor

@ripcurlx ripcurlx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK

@ripcurlx ripcurlx merged commit 14c2e37 into bisq-network:master Sep 27, 2021
@ghubstan ghubstan deleted the fix-cli-alt-trade-volume-bug branch November 10, 2021 13:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants