anthonyk1225 / robinhood-to-xlsx

Python package that grabs your robinhood data and exports it to excel
MIT License
15 stars 3 forks source link

Unable to generate json and login #13

Closed anthonyk1225 closed 4 years ago

anthonyk1225 commented 4 years ago

line 70, in generate_auth_tokens return response["access_token"], response["refresh_token"] KeyError: 'access_token'

Originally posted by @Georgedumpers in https://github.com/anthonyk1225/robinhood-to-xlsx/issues/11#issuecomment-556914909

anthonyk1225 commented 4 years ago

@Georgedumpers I moved this over to a new issue.

That error is thrown when you don't have valid credentials in the credentials.py file. Make sure you've created that file and replaced it with your info. Instructions are laid out in the readme.

Excel files won't get generated unless you've successfully generated trading history from the json prompt first.

I would suggest trying to generate one entity from json to start and seeing if that populates in the data folder for the respective entity you chose. If it does, then from there you can choose the xlsx option.

Feel free to let me know what happens and I'll continue to help you out.

Georgedumpers commented 4 years ago

I have the correct credentials, please tell me whether the username should be like this meaning the format is within double quotes and everything. Also the device_token I got from inspecting source in the browser from this field window.oauthClientId =

username="test"

anthonyk1225 commented 4 years ago

yup that username in quotes looks fine. Just plug all that information into the credentials.py with this template.

# your credentials
username = "xxx" # Your robinhood username or email
password = "xxx" # Your robinhood password

# should also be generated, but needs to be found for now
device_token = "xxx" # Your device token in the headers
Georgedumpers commented 4 years ago

thanks what about device_token from this field in windows window.oauthClientId =

is that fine

anthonyk1225 commented 4 years ago

No, you have to find out your device_id in document.cookie when signed into robinhood on your computer.

Use that for device_token in the credentials.py file.

Georgedumpers commented 4 years ago

sorry I dont know how to get that, can I get step by step instructions

Georgedumpers commented 4 years ago

Never mind got it working.

Georgedumpers commented 4 years ago

But I have a error in excel for options

File "app.py", line 48, in run() File "app.py", line 41, in run json_to_xlsx.run(answer) File "C:\Users\Downloads\robinhood-to-xlsx-master\robinhood-to-xlsx-master\controllers\json_to_xlsx.py", line 81, in run formula_pipelines[entity](formula_worksheet, workbook, sorted_data) File "C:\Users\Downloads\robinhood-to-xlsx-master\robinhood-to-xlsx-master\formulas\options.py", line 102, in handle_formulas write_aggregates(worksheet, workbook, data) File "C:\Users\Downloads\robinhood-to-xlsx-master\robinhood-to-xlsx-master\formulas\options.py", line 48, in write_aggregates aggregates = aggregate_data(data) File "C:\Users\Downloads\robinhood-to-xlsx-master\robinhood-to-xlsx-master\formulas\options.py", line 31, in aggregate_data aggregate_strike = aggregates[symbol][strike_price] KeyError: '220.0000'

anthonyk1225 commented 4 years ago

Alright, pull down from the master branch and try again. It sounds like one of your legs in options has neither an opening_strategy or a closing_strategy. Let me know if it still throws you an error after pulling or if it still complains.

Your options xlsx file should have still been created with your history, but failed on the P/L calculation. If you could, look through that and let me know if there are any rows that have neither opening_strategy, or closing_strategy. Thanks

anthonyk1225 commented 4 years ago

Hey, did this solve your issue? Was the problem a missing leg from your history?