Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/chrisvander/trader. A trading site to test algorithms and run them on live portfolios
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283const request = require("request");const locals = require("../locals.json");
module.exports = {
// GENERAL get: (url, next) => request(url, (err, res, body) => next(err, res, body)),
// ROBINHOOD robinhood: { login: (user, pass, next) => { request({ uri: "https://api.robinhood.com/oauth2/token/", method: "POST", form: { username: user, password: pass, grant_type: 'password', scope: 'internal', client_id: 'c82SH0WZOsabOXGP2sxqcj34FxkvfnWRZBKlBjFS', device_token: locals.device_token, } }, (err, res, body) => next(err, res, body)); },
logout: (token, next) => { request({ uri: "https://api.robinhood.com/api-token-logout/", method: "POST", headers: { "Authorization": "Token " + token } }, (err, res, body) => next(err, res, body)); },
user: (token, next) => { request({ uri: "https://api.robinhood.com/user/", method: "GET", headers: { "Authorization": "Token " + token } }, (err, res, body) => next(err, res, body)); },
position: (token, id, next) => { request({ uri: "https://api.robinhood.com/accounts/"+id+"/positions", method: "GET", headers: { "Authorization": "Token " + token } }, (err, res, body) => next(err, res, body)); },
get: (token, url, next) => { request({ uri: url, method: "GET", headers: { "Authorization": "Token " + token } }, (err, res, body) => next(err, res, body)); }, },
// ALPHA VANTAGE
alphavantage: { crypto_intra: (symbol, next) => { request({ uri: "https://www.alphavantage.co/query", method: "GET", qs: { "function": "DIGITAL_CURRENCY_INTRADAY", "symbol": (symbol) ? symbol : "BTC", "market": "USD", "apikey": locals.alpha_vantage } }, (err, res, body) => next(err, res, body)); } }}