# Can somebody explain pricing like I'm 5?

For Manage Offers:

Can someone please explain offer pricing with a concrete example? (no foo/bar references please).

Stellar wants a numerator and denominator for a price? How does this make any sense?

If I sell 1 share of GOOG at 50, the PRICE IS 50 USD per share. I offer 1 share and my limit price is USD 50. If another market participant wants to BUY GOOG at USD 50 or better, my order is filled.

Why is Stellar asking for two numbers, and how in the world does that make sense as a price.

"For example, if you wanted to sell 30 XLM and buy 5 BTC, the price would be {5,30}".

Ummm no... If I have 30 XLM, I'm selling them for 0.0013983 BTC since that's the current market price of 30 XLM priced in BTC.

I'm obviously missing something since the parameter type is an Integer.

Can somebody please explain the logic here?

Treat the "price" as a "trading ratio".

If I am hungry and would offer 1 USD for 7 apples, then I need someone to be willing to give 7 apples for my dollar.

The "trading ratio" of {USD:apple} is 1:7. In terms of "price", you would say \$0.14285/apple. But note that 0.142 is not an exact value; so, Stellar pricing system was designed to hold the ratio (therefore, nominator and denominator) instead of a single value.

It doesn't matter much when I am buying a few apples at \$0.142 or \$0.143, but when I buy many many shares of a stock, there stands a difference. People can exploit the trading platforms to capture the "spread" of the stocks (business stuff, but I guess you get what I mean).

By the way, the current market price has nothing to do with the example :) You can make meaningless offers like "sell 1XLM for 99USD" just as an example.

• Appreciate the answer, but I still don't understand why this makes sense. I understand the rounding issue of 1/7 = 0.142857142857142... But the difference between 0.142857142857143 & 0.142857142857142 is sufficiently small enough that it wouldn't change the actual value delivered in a trade. SO again... why aren't assets priced as a single decimal? If I want to sell 30XLM for 0.0013983 BTC, whats the Stellar price? And more importantly, how do you calculate it? The price of 30XLM on any other exchange would be priced as: 0.0013983 BTC That is, the number of units of bitcoin required to – p3scobar Apr 30 '18 at 20:27
• Stellar helps users to pick the best one among "offers". When A offers to pay \$0.142 for one Apple while B offers \$0.143, you would prefer to sell your apple to B. Keeping figures in fractions/ratios lets Stellar to do the precise comparison for you. (further info: at same selling price, the older offer is adopted to fill buyers' requests - stellar.org/developers/guides/concepts/exchange.html#offers) – cesarm May 2 '18 at 1:23
• For your case `sell 30XLM for 0.0013983 BTC`, for every XLM you should get (0.0013983÷30) = 0.0004661 BTC. So, the `Stellar price` is the "unit price" (price for each unit/item) in decimal number is 0.0004661, which is close to that listed on [BitTrex][bittrex.com/Market/Index?MarketName=btc-XLM]. And for the ratio, as 4661÷1e7=0.0004661, Stellar will record numerator("n")=4661, and denominator("d")=10000000. – cesarm May 2 '18 at 1:50
• The "price" is the normal everyday-life concept , just works like in the supermarket, and suits normal users/traders. The numerator/denominator pair is for computation and comparison, and is used by the backend system. – cesarm May 2 '18 at 1:52
• p.s. To represent numbers with a decimal point, it is often better for computers to use numerator/denominator integer pair instead of a single number with a decimal point (i.e. "float" numbers in computer science) - reference en.wikipedia.org/wiki/… – cesarm May 2 '18 at 1:58