ripple / ripple-client

A UI for the Ripple payment network built using web technologies
ISC License
1.34k stars 493 forks source link

BTC <--> XRP trade doesn't seem to work #350

Closed ripper234 closed 11 years ago

ripper234 commented 11 years ago

I am trying to trade some BTCs for Ripple, and it does not seem to work.

What I tried:

  1. Create an offer to sell 0.01 WeExchange-BTC in exchange for 0.01 XRPs. This is far below the market price of XRPs so my offer should be filled.
  2. I noted my BTC & XRP balance before this transaction: 0.7994 BTC and 37,700 XRPs.
  3. After the trade, I got some confirmation message.

Howver, my balance after the trade remains exactly the same in both currencies. I've tried waiting a few minutes and reloading the page.

Here is the tx number: CE60E7A60136C648183BF8714CA131A521FF1DA3147B403AD2F662FEA9E8816E

JoelKatz commented 11 years ago

Your balance was 37699.999650 XRP before the transaction and 37700.009640 after.

ripper234 commented 11 years ago

So wait, are you telling me that I really got just 0.01 XRP for my 0.01 BTC ??? How come? My offer should have matched the best sell offer and bought XRP for a about 50,000 per 1 BTC = total of 500 XRP.

ahbritto commented 11 years ago

Your BTC balance also changed from 0.899500000000001 to 0.8994998453846164.

ripper234 commented 11 years ago

I see, sorry, jumping to conclusions here.

So I guess the only bug here is the fact that I created a sell order for 0.01 BTC, and thus expected an actual 0.01 BTC to be sold for the best possible price. Isn't this how this is supposed to work?

Instead of selling 0.01 BTC for 50,0 XRP, the system sold 0.0000001546153846 BTC for 0.00999 XRP.

ahbritto commented 11 years ago

So, the effective rate was 64611.9401166016 XRP for 1 BTC.

But, the offer was not complete at that time and stayed in the ledger.

ripper234 commented 11 years ago

I don't understand. My order should have been fully completed and sold 0.01 BTC. Do you agere that this a bug or not?

ahbritto commented 11 years ago

Your transaction: https://gist.github.com/ahbritto/5290259

ahbritto commented 11 years ago

This looks like the best offer on the book at the time:

    {
        "Account" : "rnziParaNb8nsU4aruQdwYE3j5jUcqjzFm",
        "BookDirectory" : "06CBAF8742478FEDCE721A6B54E13E89378FD6910B9979BC4A057738FD802762",
        "BookNode" : "0000000000000000",
        "Flags" : 0,
        "LedgerEntryType" : "Offer",
        "OwnerNode" : "000000000000000A",
        "PreviousTxnID" : "104B048EBD44DDAD9D1904F10005C8DA651F52CC114D50A230F66B84F67051BB",
        "PreviousTxnLgrSeq" : 416480,
        "Sequence" : 730,
        "TakerGets" : "6500000000",
        "TakerPays" : {
           "currency" : "BTC",
           "issuer" : "rpvfJ4mR6QQAeogpXEKnuyGBx8mYCSnYZi",
           "value" : "0.1"
        },
        "index" : "186DC6A016D018277EF35B4EC1B3199EB30BCE90E8F28639C29B0AD669A60520"
     },

With a rate of 65000 for 1 BTC.

I'll look further into this tomorrow. It's 11:30pm here after a long day.

ahbritto commented 11 years ago

You may have wanted to sell more than you sold. But, you got very close to what you wanted to buy for less than you were willing to pay. System worked to the limits of rounding. Round is improving.

ahbritto commented 11 years ago

Actually, order stayed. Need to think more about this.

ahbritto commented 11 years ago

The other order stayed. This order completed.

ahbritto commented 11 years ago

BTW, there was also a .50% transfer fee from the issuer in there.

ripper234 commented 11 years ago

I don't understand the confusion. The facts, from my perspective, are:

  1. I recorded my account balance in BTC and XRP
  2. I made an order to sell 0.05 BTC for 0.05 XRP
  3. Expected result: my account would have been about 0.05 BTC short and 2,500 XRP long after the order
  4. From recording the account balance, that didn't happen.

I might have exchanged a smaller amount of BTC for XRP, but I'm fairly certain that I didn't exchange 0.05 BTC for ~ 2500 XRP. Perhaps the exchange did happen after a while, but certainly for a few minutes after my sell order I didn't see a 2500 increase in XRP.

So, can you clarify what did happen, and whether it's a bug or not?

JoelKatz commented 11 years ago

The system was able to get you the 0.01 XRP you asked for without selling anywhere near the 0.01 Bitcoins you offered. So you got the result you asked for at a much lower cost. Now, the question is, is that the correct behavior or should it have sold everything just because it could?

ahbritto commented 11 years ago

Just to be clear. Not a bug. The system gave you what you asked to purchase for less than you were willing to pay. We could add a feature saying get as much as possible. But, that's another issue.

ripper234 commented 11 years ago

I think that depends how you define it. I understood the operation as "sell X BTC, get howmuch you can for it". I believe this is how these things work ... e.g. on Mt. Gox, if you issue a sell order for X BTC for a low enough price, you end up selling X BTC and not less.

ahbritto commented 11 years ago

If you want to convert funds, there will be a tab for converting funds. Market orders are yet another option.

JoelKatz commented 11 years ago

At a minimum, it's a UI bug. The UI says "Amount To Sell" and "Price of Each". But what actually happens is that it sells far less if possible. Perhaps there shouldn't be a "Sell" tab. If you're showing BTC/XRP, the options should be "Buy BTC" and "Buy XRP", since that's what it does.