1

An orderbook call of an asset pair returns bids as, for example:

amount: "599.3762459"
price: "0.0599376"
price_r:
d: 10427507
n: 625000

where the amount should be 10,000. Whereas, asks are returned as:

amount: "10000.0000000"
price: "0.0601957"
price_r:
d: 10000000
n: 601957

accurately reflecting the amount.

How does one compute or get the accurate bid amount? I tried all sorts of multiplication and division with big numbers but I could not quite get to an accurate 10,000 for the bid.

(The asset pair is XLM [native] and USD [GDUKMGUGDZQK6YHYA5Z6AY2G4XDSZPSZ3SW5UN3ARVMO6QSRDWP5YLEX].)

  • 1
    What do you mean by "an accurate 10,000 for the bid"? – kolten Sep 11 at 13:56
  • @kolten In the order book, I should display the bid amount as 10,000, not 599.3762459. How do I manipulate the given figures in the bid data to arrive at 10,000? – J R Sep 12 at 0:25
  • 1
    Wouldn't the bid and ask amounts be different? The orderbooks don't generally mirror each other in that way. – kolten Sep 12 at 13:08
  • If you look at the pair at stellarport, for example, the bid amount is reflected as 10,000. – J R Sep 12 at 17:15
3

I think the confusion comes from the fact that Stellar offers amount is always quoted in the amount of the selling asset.

When you are selling 10000 XLM for USD the ask offers shows 10000 as expected, since you are selling XLM.

When you are buying 10000 XLM for USD, it is effectively an offer to sell USD for XLM. The amount of USD is given by the XLM amount times the price, or 10000 * (625000/10427507) = 599.3762459234.

  • Good point actually. – kolten Sep 16 at 21:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.