Giter VIP home page Giter VIP logo

robinhood-google-sheets's Issues

Volume data showing incorrectly?

Did I miss anything, it looks like =ROBINHOOD_GET_POSITIONS(0) function returns wrong volume data, including columns like the following:
volume_fundamentals | market_date_fundamentals | average_volume_2_weeks_fundamentals | average_volume_fundamentals

Anyone else has similar experiences?

Thanks!

Positions API request failed "due to inactive_instruments"

Hey, first off -- this is such a cool tool. I'm loving playing around here. Thank you so much for sharing @rghuckins !

I have a stock in my purchase history that is no longer active (TECS), so when I run "=ROBINHOOD_GET_POSITIONS()" I get the following error:

"Robinhood API request failed. 400: {"inactive_instruments":["TECS"]} (line 90)."

Screenshot: https://puu.sh/FBiad/83d12a0119.png

Is there anyway to edit the script, to have it exclude inactive_instruments? Big thanks in advance.

  • Sam

Can't change cell type to allow for manipulation of decimal points

I have the situation where I want the average cost in my excel sheet to display the average cost with a dollar sign down to the hundreds place. Something I think is being implemented preventing me from doing so.

When I have an excel sheet that says =Robinhood!BX2 it responds with 1.2345 but would like it to say $1.23. I changed the cell type to currency, and used the decimal format button (.0<--) and yet nothing changes.

Incorrect Authentication credentials. Error while running script.

HI

I followed the instructions and when i try to login , i get this error.

I have changed the username and password to the correct details. i confirmed using the same login credentials and they are correct.

Could you help please

Error Robinhood API request failed. 401: {"detail":"Incorrect authentication credentials."} (line 89).

error on load

Getting an Error on load with the following tooltip output:

Cannot find method put(string,(class),(class)). (line 78).

I'm not seeing a call to api.robinhood.com in the loading sequence.

Perhaps this is failing because of MFA... investigating...

Custom list not accessible

hi, when i use the watchlists api, i get results from the default watchlist.
I'd like to query a custom watchlist.
i tried using the /watchlists/ end point instead of /watchlists/Default/ that's configured in the script, i only get back the default list in the result, however, i have a couple custom lists on Robinhood and have actually deleted the default list. Any clue?

Option quotes

Is this script able to pull option quotes / option chain for a given stock symbol?

SyntaxError

I am getting this error when I try to run the script or use any function in my sheet.

SyntaxError: Unexpected token: < (line 41, file "Code")

Why is this and how do I fix it?

script not working

I've had a google spreadsheet with the script working for a year now, but haven't used it in a while when I opened the file nothing was loading so updated the device id but it still won't work

ROBINHOOD_GET_ACH_TRANSFERS returning numbers stored as text

The above-referenced function as well as all functions in this code are correctly pulling the data, but returns numbers stored as text for any and all data with numbers in it. Running a subsequent query command on another tab to pull in this data will not mitigate this scenario, as the numbers (i.e., column Y = amount_achTransfers) are still returned as text and not values. Nesting this within an arrayformula does not do it any justice either.

Login Issue

Hi,

I had been using your code to trade until recently. Does your login still work? I have modified the code for the latest changes but I get an error. Could you please check the following code and see where it is going wrong?

Thanks

var deviceToken = generateDeviceToken();
var robinhoodApiBaseUrl = 'https://api.robinhood.com';

function generateDeviceToken(){
rands = []

for(i=0; i<16; i++){
r = Math.random()
rand = 4294967296 * r
rands.push((parseInt(rand) >> ((3 & i) << 3)) & 255)
}

hexa = []
for(i=0; i<256; ++i){
hexa.push((parseInt(i) + 256).toString(16).substring(1));
}

id = ""
for(i=0; i<16; i++){
id += hexa[rands[i]]
if ((i == 3) || (i == 5) || (i == 7) || (i == 9)){
id += "-"
}
}
Logger.log(id);
return id;
}

function getClassicToken() {
//Trying to login with the new device id for the first time. This is where I get a prompt to select sms or email. This part works.
var url = robinhoodApiBaseUrl + '/oauth2/token/';
var payload = {
'username': robinhoodUsername,
'password': robinhoodPassword,
'device_token': deviceToken,
'expires_in': 86400,
'grant_type': 'password',
'client_id': 'c82SH0WZOsabOXGP2sxqcj34FxkvfnWRZBKlBjFS',
'scope': 'internal'
};
var options = {
'method': 'post',
'payload': payload,
'muteHttpExceptions': true
};
var response = UrlFetchApp.fetch(url, options);
Logger.log(response);

Utilities.sleep(1000);

//This portion says I would like to receive the code by email. I am able to get the challenge id in resonse. This works too
var payload = {
'challenge_type': 'email',
'username': robinhoodUsername,
'password': robinhoodPassword,
'device_token': deviceToken,
'expires_in': 86400,
'grant_type': 'password',
'client_id': 'c82SH0WZOsabOXGP2sxqcj34FxkvfnWRZBKlBjFS',
'scope': 'internal'
};
var options = {
'method': 'post',
'payload': payload,
'muteHttpExceptions': true
};
var response = UrlFetchApp.fetch(url, options);
Logger.log(response);
var responseJson = JSON.parse(response.getContentText());
var id = responseJson["challenge"]["id"];
Logger.log('Challenge ID: ' + id);

Utilities.sleep(20000);

//This portion checks my email and gets extracts the code. This works too
var threads = GmailApp.search("subject:Your Email Verification Code");
Logger.log(threads.length);
threads = threads[threads.length-1];
var message = threads.getMessages();
Logger.log(message.length);
message = message[message.length-1];
var body = message.getPlainBody();
var ind = body.indexOf("you.");
var code = body.substring(ind+8, ind+14);
Logger.log(code);
threads.moveToTrash();

Utilities.sleep(10000);

//This portion posts the challenge id and I get the validated response. I also get an email saying that I have logged in from another device with the IP but the browser says Other and location United States
url = robinhoodApiBaseUrl + '/challenge/' + id + '/respond/';
var payload = {
'response': code
};
var options = {
'method': 'post',
'payload': payload,
'muteHttpExceptions': true
};
var response = UrlFetchApp.fetch(url, options);
Logger.log(response);

Utilities.sleep(10000);

//When I post the device id along with the challenge id, I do not get the token, instead I am getting Server Error 500
var url = robinhoodApiBaseUrl + '/oauth2/token/';
var payload = {
'challenge_type': 'email',
'username': robinhoodUsername,
'password': robinhoodPassword,
'device_token': deviceToken,
'expires_in': 86400,
'grant_type': 'password',
'client_id': 'c82SH0WZOsabOXGP2sxqcj34FxkvfnWRZBKlBjFS',
'scope': 'internal'
};

var options = {
'method': 'post',
'payload': payload,
'muteHttpExceptions': true,
'headers': {
'X-ROBINHOOD-CHALLENGE-RESPONSE-ID': id
}
};
Logger.log('Device Token: ' + deviceToken);
Logger.log('URL: ' + url);
var response = UrlFetchApp.fetch(url, options);
Logger.log(response);
var responseJson = JSON.parse(response.getContentText());
var classicToken = responseJson.access_token;
Logger.log('classic token: ' + classicToken);

return classicToken;
}

dont understand step 6

(As of 1/19/20) Log into Robinhood on the Web to [https://stackoverflow.com/questions/55902967/is-there-any-way-to-get-a-bearer-token-now-since-robinhood-has-changed-the-api/56841942](obtain a device_id) and add it to your payload to get past RH's Oauth flow.

Retrieve data on Crypto assets?

Hi

Thanks for all the work on this! It's a great tool.

I've scoured the commands, run them all, and looked through the results, and I don't seem to see any way of retrieving info on crypto holdings in a given robinhood account. Any insight on how one might go about getting that info?

Thanks again for putting this code out there!

Creates new sheet called 'Refresh', cells keep moving

Just wanted a cell that'd display the full balance in the account, including cash. Saw no way to pull up that information directly (tried =ROBINHOOD_GET_PORTFOLIOS(equity_portfolios), it displayed all content), so I created a new sheet called RobinHood, put the reference to the full content displayed by ROBINHOOD_GET_PORTFOLIOS, then in my original sheet, I referenced the same cell that contained the value of 'equity_portfolios'. Displayed the desired info, great!

Then I hit refresh in browser to confirm the value updated to the latest balance value. That's when it broke. I saw a new sheet tab called "Refresh" with nothing in it, and when I looked at RobinHood sheet, instead of the function being in A1, it was now at A17. I'm not sure why it's creating new tab or moving the cells around.

Skip stocks that no longer exist and/or are not tradable on Robinhood

Reporting an issue brought up by @xtego

a42df8e#commitcomment-29282798

I just stumbled across this code today and it's awesome. Thanks so much for your work that you put into this. However, I think i have uncovered a bug given certain scenarios using get positions and get orders. I am getting the following error : "Robinhood API request failed. 404: (line 107)"
Using google's debug tools, it looks like it's failing on a ticker that no longer exists.
For example, I used to own a position in RPRX which no longer exists in robinhood. This is causing robinhood_get_positions() and robinhood_get_orders() to error. Other functions like robinhood_get_portfolios() are working fine for me.
Unfortunately, that's about the best I can help. I'm not a good enough coder to fix it, but I was wondering if you or someone else had an easy fix to the code to skip over tickers that don't exist.

Refresh menu conflicts custom menus with onOpen(){ SpreadsheetsApp.getUi()

Hi Folks,
Thank you all for creating a maintaining this awesome repo. This is my crashcourse in Javascript/GAS, as well as Github, and I've only pulled out a little bit of my hair so far.

As you know, the existing repo has a section of code that among other things, creates a new menu item that refreshes the data from the Robinhood_get custom function calls by updating the time in a cell in the 'Refresh' sheet. A great feature, but it seems to interfere with an improvement I'm trying to make that would call for a different menu to be added.

I want to create a menu with userProperties, so end user can input their username, password, and device_token without having to do any scripting. I've gotten as far as creating the menu. However, once implemented into the robinhood-google-sheets script, I get this funny error that I haven't been able to troubleshoot on my own.

Basically, either one or the other custom menu will load in the menu bar, but not both.

Any help would be appreciated.

Here's the existing onOpen() code that is in the repo, which creates the "Refresh Data" menu:

function onOpen() { var cache = CacheService.getScriptCache(); cache.remove('accessToken'); var spreadsheet = SpreadsheetApp.getActiveSpreadsheet(); var refreshSheet = spreadsheet.getSheetByName('Params'); if (refreshSheet === null) { refreshSheet = spreadsheet.insertSheet('Params'); } var entries = [{ name: 'Refresh Data', functionName: 'refreshLastUpdate_' }]; spreadsheet.addMenu('Refresh Data', entries); }

This is my proposed additional menu:

`var scriptProperties = PropertiesService.getScriptProperties();
var userProperties = PropertiesService.getUserProperties();

function onOpen(){
SpreadsheetApp.getUi()
.createMenu('Azeem')
.addSubMenu(SpreadsheetApp.getUi().createMenu('Robinhood Credentials')
.addItem('Robinhood Username', 'userUsername')
.addItem('Robinhood Password', 'userPassword')
.addItem('Robinhood Device Token', 'userDeviceToken'))
.addSubMenu(SpreadsheetApp.getUi().createMenu('Show Credentials')
.addItem('Show All Robinhood User Keys', 'alertAllUserProperties'))
.addSubMenu(SpreadsheetApp.getUi().createMenu('Delete Credentials')
.addItem('Delete all Robinhood User Account Info', 'deleteAllUser'))
.addToUi();
}

function userUsername(){
var ui = SpreadsheetApp.getUi();
var userUsername = ui.prompt('Robinhood Username (usually an email address) ' , ui.ButtonSet.OK_CANCEL);
userProperties.setProperty('RH Username', userUsername.getResponseText());
}

function userPassword(){
var ui = SpreadsheetApp.getUi();
var userPassword = ui.prompt('Robinhood Password ' , ui.ButtonSet.OK_CANCEL);
userProperties.setProperty('RH Password', userPassword.getResponseText());
}

function userDeviceToken(){
var ui = SpreadsheetApp.getUi();
var userDeviceToken = ui.prompt('Robinhood Device_Token (See Instructions on the first Tab) ' , ui.ButtonSet.OK_CANCEL);
userProperties.setProperty('RH Device Token', userDeviceToken.getResponseText());
}

// ----------- Operations ---------------------------

function deleteAllUser(){
userProperties.deleteAllProperties();
}

function alertAllUserProperties(){
var ui = SpreadsheetApp.getUi();
var stringUserProperties = '';
var userdata = userProperties.getProperties();
for (var userkey in userdata){
stringUserProperties = stringUserProperties + '(userKey): ' + userkey + ' Value: ' + userdata[userkey] + '\n';
}
ui.alert(stringUserProperties);
}

function alertAllUserKeys(){
var ui = SpreadsheetApp.getUi();
var stringUserKeys= '';
var allUserKeys = userProperties.getKeys()
Logger.log('allUserKeys: ' + allUserKeys);
for (var userkey in allUserKeys){
stringUserKeys = stringUserKeys + '(userKey): ' + allUserKeys[userkey] + '\n';
}
ui.alert(stringUserKeys);
}
`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.