mirror of
https://github.com/Xahau/xahau.js.git
synced 2026-04-29 15:37:50 +00:00
* remove yarn.lock * reinstall with npm * fix package.json * update xrplf eslint * fix all other instances of yarn
35 lines
1.3 KiB
Plaintext
35 lines
1.3 KiB
Plaintext
## getOrderbook
|
|
|
|
`getOrderbook(address: string, orderbook: object, options: object): Promise<object>`
|
|
|
|
Returns open orders for the specified account. Open orders are orders that have not yet been fully executed and are still in the order book.
|
|
|
|
**Breaking change:** In ripple-lib 1.1.0 and earlier, orders returned by this method were not sorted correctly. Orders are now sorted correctly, from best to worst.
|
|
|
|
**See also:** An alternative way to get orderbooks is with `request` and [`formatBidsAndAsks`](#formatbidsandasks).
|
|
|
|
### Parameters
|
|
|
|
<%- renderSchema('input/get-orderbook.json') %>
|
|
|
|
### Return Value
|
|
|
|
This method returns a promise that resolves with an object with the following structure Both `bids` and `asks` have the same format:
|
|
|
|
<%- renderSchema('output/get-orderbook.json') %>
|
|
|
|
**Raw order data:** The response includes a `data` property containing the raw order data. This may include `owner_funds`, `Flags`, and other fields.
|
|
|
|
For details, see the `rippled` [book_offers method](https://xrpl.org/book_offers.html).
|
|
|
|
### Example
|
|
|
|
```javascript
|
|
const address = 'r9cZA1mLK5R5Am25ArfXFmqgNwjZgnfk59';
|
|
const orderbook = <%- importFile('test/fixtures/requests/getOrderbook.json') %>;
|
|
return api.getOrderbook(address, orderbook)
|
|
.then(orderbook => {/* ... */});
|
|
```
|
|
|
|
<%- renderFixture('responses/getOrderbook.json') %>
|