book_offers
The book_offers
method retrieves a list of Offers between two currencies, also known as an order book. The response omits unfunded Offers and reports how much of each remaining Offer's total is currently funded.
Request Format
An example of the request format:
The request includes the following parameters:
| Type | Required? | Description |
| Object | Yes | The asset the account taking the Offer would receive, as a currency without an amount. |
| Object | Yes | The asset the account taking the Offer would pay, as a currency without an amount. |
| [Hash][] | No | A 20-byte hex string for the ledger version to use. (See [Specifying Ledgers][]) |
| [Ledger Index][] | No | The [ledger index][] of the ledger to use, or a shortcut string to choose a ledger automatically. (See [Specifying Ledgers][]) |
| Number | No | The maximum number of Offers to return. The response may include fewer results. |
| String | No | The [Address][] of an account to use as a perspective. The response includes this account's Offers even if they are unfunded. (You can use this to see what Offers are above or below yours in the order book.) |
Response Format
An example of a successful response:
The response follows the [standard format][], with a successful result containing the following fields:
| Type | Description |
| [Ledger Index][] | (Omitted if |
| [Ledger Index][] | (Omitted if |
| [Hash][] | (May be omitted) The identifying hash of the ledger version that was used when retrieving this data, as requested. |
| Array | Array of offer objects, each of which has the fields of an Offer object |
In addition to the standard Offer fields, the following fields may be included in members of the offers
array:
| Type | Description |
| String | Amount of the |
| [Currency Amount][] | (Only included in partially-funded offers) The maximum amount of currency that the taker can get, given the funding status of the offer. |
| [Currency Amount][] | (Only included in partially-funded offers) The maximum amount of currency that the taker would pay, given the funding status of the offer. |
| String | The exchange rate, as the ratio |
Possible Errors
Any of the [universal error types][].
invalidParams
- One or more fields are specified incorrectly, or one or more required fields are missing.lgrNotFound
- The ledger specified by theledger_hash
orledger_index
does not exist, or it does exist but the server does not have it.srcCurMalformed
- Thetaker_pays
field in the request is not formatted properly.dstAmtMalformed
- Thetaker_gets
field in the request is not formatted properly.srcIsrMalformed
- Theissuer
field of thetaker_pays
field in the request is not valid.dstIsrMalformed
- Theissuer
field of thetaker_gets
field in the request is not valid.badMarket
- The desired order book does not exist; for example, offers to exchange a currency for itself.
Last updated