You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Nov 27, 2023. It is now read-only.
rh.instruments('',(err,response,body)=>{if(err){console.error(err);}else{if(body.next){//which means has more pages , but how to retrieve the next page? it needs to pass a parameter cursor into the url }}})
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:
liuhongbo
changed the title
How do you list all the instruments
How to list all the instruments
Dec 4, 2020
@liuhongbo
here is a snippet of code that worked for me when using the next param to fetch more orders in the transaction history. Hopefully this helps you!
letorders=[];letcursor=null;letnext=null;do{try{constoptions={};if(cursor){options.cursor=cursor;}const{ body }=awaitpromisify(robinhood.orders)(options);orders=[...orders, ...body.results];if(body.next){next=newURL(body.next);cursor=next.searchParams.get('cursor');}else{next=null;}}catch(err){internal.log(err);cursor=null;}}while(next!==null);
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: