<p>Offers are always filled best first. Among tying offers, the one placed first is taken first.</p>

<p>Once they're placed, offers are always taken at the rate they were placed. Offers are always placed at their original rate, regardless of what crossing offers they take.</p>

<p>When an offer is placed, any crossing offers (existing offers in the other direction that can satisfy all or part of the new offer) are taken. It is up to the person who placed the offer whether counter-offers that tie their rate are taken.</p>

<p>The difference between a "buy" offer and a "sell" offer is only how the offer is placed after crossing offers are taken. For example:</p>

<p>If there are no crossing offers, there is no difference between an offer to buy 1 XYZ for 1 XRP and an offer to sell 1 XRP for 1 XYZ. But ...</p>

<p>If you place an offer to buy 1 XYZ for 1 XRP and crossing offers allow you to buy .5 XYZ for .1 XRP, the remaining offer will be to buy .5 XYZ for .5 XRP. (So, when/if your offer is fully consumed, you will buy 1 XYZ for .6 XRP.)</p>

<p>If you place an offer to sell 1 XRP for 1 XYZ and crossing offers allow you to sell .1 XRP for .5 XYZ, the remaining offer will be to sell .9 XRP for .9 XYZ. (So when/if your offer is fully consumed, you will sell 1 XRP for 1.4 XYZ.)</p>

CC BY-SA 3.0
2014-02-09T20:15:09.687Z
Wow.  I'm sure the answer to my question is in there somewhere.  I'm trying to grok.  What exactly is a "crossing offer"?  Is it one that's already in the ledger when my offer is placed?
Dave Cohen
CC BY-SA 3.0
2014-02-09T20:15:49.323Z
A "crossing offer" is an existing offer in the other direction that can satisfy all or part of the offer you are placing.
David Schwartz
CC BY-SA 3.0
2014-02-09T20:21:26.087Z
Forgive my density.  You said "...offers are always taken at the rate they were placed. Offers are always placed at their original rate, regardless of what crossing offers they take." Later, you describe a scenario in which a buy offer is consumed for a more advantageous rate, and then same for a sell offer.  What am I missing here?
Dave Cohen
CC BY-SA 3.0
2014-02-09T20:29:14.077Z
In those cases, the offers aren't being taken, they're being placed. They are taking existing offers, which they take at the rate at which those offers were placed. "*Once they're placed*, offers are always taken at the rate they were placed.
David Schwartz
CC BY-SA 3.0
2014-02-09T20:30:17.900Z
OK. I think I see the light.  A crossing offer is chronologically first, right?  So when I ask " will Bob spend just 2 XRP (what Alice asked) or 3 XRP (what he offered)?"  It is the person who offers last who gets the most advantageous rate.  Please correct me if I'm wrong.  And thanks for the explanations.
Dave Cohen
CC BY-SA 3.0
2014-02-09T20:32:05.540Z
Correct. Crossing offers must already be on the books when your offer is placed and they affect the way your offer is placed. (If they can consume the whole offer, then no offer will be placed.) If they permit you to consume part of your offer at a more advantageous rate, then you get to do that. But once your offer is placed, it can only be taken at the placed rate.
David Schwartz
CC BY-SA 3.0
2014-02-07T17:50:26.187Z
2014-02-09T20:17:22.407Z
2014-02-09T20:17:22.407Z
David Schwartz
<p>I'm trying to better understand how buy and sell offers work on the Ripple network.  </p>

<p>Let's say Alice creates a new Ripple currency, calls it XYZ, and describes it to her friends Bob and Carol.</p>

<p>Bob loves the new XYZ currency.  He submits an offer to buy 1 XYZ for <strong>3 XRP</strong>.</p>

<p>Carol merely likes XYZ.  She offers to buy 1 XYZ for just <strong>1 XRP</strong>.</p>

<p>That's the set up.  I'm wondering what happens in the following cases...</p>

<p><em>What if Alice offers to sell 2 XYZ for 4 XRP?</em>  Will the ripple network transfer 1 XYZ each to Bob and Carol?  Or, must Alice wait until someone offers to buy exactly the number of XYZ she is selling?</p>

<p><em>What if instead Alice offers to sell just 1 XYZ for 2 XRP?</em>  Only Bob's offer of 3 XRP meets the price. But will Bob spend just 2 XRP (what Alice asked) or 3 XRP (what he offered)?</p>

<p><em>Finally, what if Alice offers to sell just 1 XYZ for 1 XRP?</em> Will she end up with 3 XRP from Bob, 1 XRP from Bob, or 1 XRP from Carol?</p>

<ripple>
How are offers matched up on Ripple trades?
Dave Cohen
# How are offers matched up on Ripple trades?

(Asked by: username_0 on 2014-02-07)

I'm trying to better understand how buy and sell offers work on the Ripple network.

Let's say Alice creates a new Ripple currency, calls it XYZ, and describes it to her friends Bob and Carol.

Bob loves the new XYZ currency. He submits an offer to buy 1 XYZ for **3 XRP**.

Carol merely likes XYZ. She offers to buy 1 XYZ for just **1 XRP**.

That's the set up. I'm wondering what happens in the following cases...

*What if Alice offers to sell 2 XYZ for 4 XRP?* Will the ripple network transfer 1 XYZ each to Bob and Carol? Or, must Alice wait until someone offers to buy exactly the number of XYZ she is selling?

*What if instead Alice offers to sell just 1 XYZ for 2 XRP?* Only Bob's offer of 3 XRP meets the price. But will Bob spend just 2 XRP (what Alice asked) or 3 XRP (what he offered)?

*Finally, what if Alice offers to sell just 1 XYZ for 1 XRP?* Will she end up with 3 XRP from Bob, 1 XRP from Bob, or 1 XRP from Carol?

**Tags:** ripple


---

## 1 answers

### Answer by username_1 on 2014-02-07. Score: 5 | Accepted answer

Offers are always filled best first. Among tying offers, the one placed first is taken first.

Once they're placed, offers are always taken at the rate they were placed. Offers are always placed at their original rate, regardless of what crossing offers they take.

When an offer is placed, any crossing offers (existing offers in the other direction that can satisfy all or part of the new offer) are taken. It is up to the person who placed the offer whether counter-offers that tie their rate are taken.

The difference between a "buy" offer and a "sell" offer is only how the offer is placed after crossing offers are taken. For example:

If there are no crossing offers, there is no difference between an offer to buy 1 XYZ for 1 XRP and an offer to sell 1 XRP for 1 XYZ. But ...

If you place an offer to buy 1 XYZ for 1 XRP and crossing offers allow you to buy .5 XYZ for .1 XRP, the remaining offer will be to buy .5 XYZ for .5 XRP. (So, when/if your offer is fully consumed, you will buy 1 XYZ for .6 XRP.)

If you place an offer to sell 1 XRP for 1 XYZ and crossing offers allow you to sell .1 XRP for .5 XYZ, the remaining offer will be to sell .9 XRP for .9 XYZ. (So when/if your offer is fully consumed, you will sell 1 XRP for 1.4 XYZ.)

> **Comments:**
> **username_0**: Wow.  I'm sure the answer to my question is in there somewhere.  I'm trying to grok.  What exactly is a "crossing offer"?  Is it one that's already in the ledger when my offer is placed?  
> **username_1**: A "crossing offer" is an existing offer in the other direction that can satisfy all or part of the offer you are placing.  
> **username_0**: Forgive my density.  You said "...offers are always taken at the rate they were placed. Offers are always placed at their original rate, regardless of what crossing offers they take." Later, you describe a scenario in which a buy offer is consumed for a more advantageous rate, and then same for a sell offer.  What am I missing here?  
> **username_1**: In those cases, the offers aren't being taken, they're being placed. They are taking existing offers, which they take at the rate at which those offers were placed. "*Once they're placed*, offers are always taken at the rate they were placed.  
> **username_0**: OK. I think I see the light.  A crossing offer is chronologically first, right?  So when I ask " will Bob spend just 2 XRP (what Alice asked) or 3 XRP (what he offered)?"  It is the person who offers last who gets the most advantageous rate.  Please correct me if I'm wrong.  And thanks for the explanations.  
> **username_1**: Correct. Crossing offers must already be on the books when your offer is placed and they affect the way your offer is placed. (If they can consume the whole offer, then no offer will be placed.) If they permit you to consume part of your offer at a more advantageous rate, then you get to do that. But once your offer is placed, it can only be taken at the placed rate.  

---

