s0up / robinhood-api Goto Github PK
View Code? Open in Web Editor NEWRobinhood API Library for NodeJS w/ Async/Await support (WIP)
License: ISC License
Robinhood API Library for NodeJS w/ Async/Await support (WIP)
License: ISC License
I'm trying the sample code given:
`const RobinHood = require('robinhood-api');
const robinhood = new RobinHood();
(async () => {
try{
let loginResult = await robinhood.login({ username:'[email protected]', password:'mycoolpassword' });
let myUserData = await robinhood.getUserData();
console.log(myUserData);
}catch(e){
console.log('Oh noes! Login probably failed!', e);
}
})();`
Of course I am actually changing out [email protected] and mycoolpassword with my actual credentials, but I'm getting the error APIError: API Response Error. | Request routing error - unsafe method
Hey. I'm a little confused, hopefully I'm just missing something. Here is what I've got in an attempt to get historicals for the user.
// Auth into Robinhood
router.get('/auth', ensureAuthenticated, function(req, res){
(async () => {
try {
let loginResult = await robinhood.login({ username:req.user.robinhood_user, password:req.user.robinhood_password });
let account = await robinhood.getUserData();
var opts = {
account_number:account.id,
interval:"day"
};
let historicals = await robinhood.getHistoricals(opts);
res.json(historicals);
} catch(e) {
console.log(e);
}
})();
});
and the error I'm getting says simply that
{ Error: API Response Error. | <h1>Not Found</h1><p>The requested URL /portfolios/historicals/<my account id>/ was not found on this server.</p>
at RobinHood.request (C:\Users\Dylan\Documents\hunch2.0\node_modules\robinhood-api\index.js:144:18)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:169:7)
additionalInfo: '<h1>Not Found</h1><p>The requested URL /portfolios/historicals/<my account id>/ was
not found on this server.</p>',
code: 'E_API_ERROR' }
Is there another account number I should be using or is the API broken? What's up?
Thanks in advance for taking a look.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.