This repository has been archived by the owner on Nov 27, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 184
How to list all the instruments #117
Comments
liuhongbo
changed the title
How do you list all the instruments
How to list all the instruments
Dec 4, 2020
@liuhongbo let orders = [];
let cursor = null;
let next = null;
do {
try {
const options = {};
if (cursor) {
options.cursor = cursor;
}
const { body } = await promisify(robinhood.orders)(options);
orders = [...orders, ...body.results];
if (body.next) {
next = new URL(body.next);
cursor = next.searchParams.get('cursor');
} else {
next = null;
}
} catch (err) {
internal.log(err);
cursor = null;
}
} while (next !== null); |
also, see url in documentation |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Code being executed:
the instruments only get the first page of the instruments with the body.next has the url for next page, but seems there is no way to call the instruments method with the cursor parameter
The text was updated successfully, but these errors were encountered: