Last updated
Edit

account_offers

[Source]

The account_offers method retrieves a list of offers made by a given account that are outstanding as of a particular ledger version.

Request Format

An example of the request format:

{
  "id": 9,
  "command": "account_offers",
  "account": "rpP2JgiMyTF5jR5hLG3xHCPi1knBb1v9cM"
}

Try it! >

A request can include the following parameters:

FieldTypeRequired?Description
accountString - AddressYesLook up Offers placed by this account.
ledger_hashHashNoA 20-byte hex string for the ledger version to use. (See Specifying Ledgers)
ledger_indexLedger IndexNoThe ledger index of the ledger to use, or a shortcut string to choose a ledger automatically. (See Specifying Ledgers)
limitNumberNoLimit the number of Offers to retrieve. The server may return fewer than this number of results. Must be within the inclusive range 10 to 400. Positive values outside this range are replaced with the closest valid option.The default is 200.
markerMarkerNoValue from a previous paginated response. Resume retrieving data where that response left off.

The following parameters are deprecated should not be provided: ledger, strict.

Response Format

An example of a successful response:

{
  "id": 9,
  "status": "success",
  "type": "response",
  "result": {
    "account": "rpP2JgiMyTF5jR5hLG3xHCPi1knBb1v9cM",
    "ledger_current_index": 18539550,
    "offers": [
      {
        "flags": 0,
        "quality": "0.00000000574666765650638",
        "seq": 6577664,
        "taker_gets": "33687728098",
        "taker_pays": {
          "currency": "EUR",
          "issuer": "rhub8VRN55s94qWKDv6jmDy1pUykJzF3wq",
          "value": "193.5921774819578"
        }
      },
      {
        "flags": 0,
        "quality": "7989247009094510e-27",
        "seq": 6572128,
        "taker_gets": "2361918758",
        "taker_pays": {
          "currency": "XAU",
          "issuer": "rrh7rf1gV2pXAoqA8oYbpHd8TKv5ZQeo67",
          "value": "0.01886995237307572"
        }
      },
      ... trimmed for length ...
    ],
    "validated": false
  }
}

The response follows the standard format, with a successful result containing the following fields:

FieldTypeDescription
accountStringUnique Address identifying the account that made the offers
offersArrayArray of objects, where each object represents an offer made by this account that is outstanding as of the requested ledger version. If the number of offers is large, only returns up to limit at a time.
ledger_current_indexNumber - Ledger Index(Omitted if ledger_hash or ledger_index provided) The ledger index of the current in-progress ledger version, which was used when retrieving this data.
ledger_indexNumber - Ledger Index(Omitted if ledger_current_index provided instead) The ledger index of the ledger version that was used when retrieving this data, as requested.
ledger_hashString - Hash(May be omitted) The identifying hash of the ledger version that was used when retrieving this data.
markerMarker(May be omitted) Server-defined value indicating the response is paginated. Pass this to the next call to resume where this call left off. Omitted when there are no pages of information after this one.

Each offer object contains the following fields:

FieldTypeDescription
flagsUnsigned integerOptions set for this offer entry as bit-flags.
seqUnsigned integerSequence number of the transaction that created this entry. (Transaction sequence numbers are relative to accounts.)
taker_getsString or ObjectThe amount the account accepting the offer receives, as a String representing an amount in XRP, or a currency specification object. (See Specifying Currency Amounts)
taker_paysString or ObjectThe amount the account accepting the offer provides, as a String representing an amount in XRP, or a currency specification object. (See Specifying Currency Amounts)
qualityStringThe exchange rate of the offer, as the ratio of the original taker_pays divided by the original taker_gets. When executing offers, the offer with the most favorable (lowest) quality is consumed first; offers with the same quality are executed from oldest to newest.
expirationUnsigned integer(May be omitted) A time after which this offer is considered unfunded, as the number of seconds since the Ripple Epoch. See also: Offer Expiration.

Possible Errors

  • Any of the universal error types.
  • invalidParams - One or more fields are specified incorrectly, or one or more required fields are missing.
  • actNotFound - The Address specified in the account field of the request does not correspond to an account in the ledger.
  • lgrNotFound - The ledger specified by the ledger_hash or ledger_index does not exist, or it does exist but the server does not have it.
  • actMalformed - The marker field provided is incorrect.