0

I'm hoping to eventually set up a bot to trade paper stocks for me in WeBull. I'm working with code offered up by a youtube comrade: https://github.com/Jake0303/Webull-Trading-Bot/blob/master/WebullBot.py. I've saved it in my anaconda3 folder as 'TradingBotRedux.py'
I'm just trying to get it up and running, for which I will need it to be able to log in to WeBull. So my goal is for it to request my email address and password to login for the first time--but the next time it should remember my info. (Really, I would not mind entering my info every time I run it). The following is what occurs:

In anaconda navigator, I open CMD.exe Prompt. Then:

(MyEnvironment) C:\Users\XXX>python "C:\Users\XXX\anaconda3\TradingBotRedux.py"
Logging in to WeBull...
Traceback (most recent call last):
  File "C:\Users\XXX\anaconda3\TradingBotRedux.py", line 101, in <module>
    if not loginInfo['accessToken'] is None and len(loginInfo['accessToken']) > 1:
KeyError: 'accessToken'

It used to say

Logging in to WeBull...

First time login.

Enter MFA Code :

but I accidentally entered my password when I think it wanted my email address.

I've tried a few things, like exchanging my real email address in lines 40, 42, and 48. I also tried creating a .txt file called 'token' (as this is referenced in line 29) but I wasn't sure what to put in it. For both of these, running the TradingBotRedux.py yields the same message as above.

Line 101 looks fine to me; idk how to proceed. Would greatly appreciate your help!

This looks relevant but I'm too new to coding to fit the puzzle pieces together: https://www.nylas.com/blog/use-python-requests-module-rest-apis/

Matty Ice
  • 23
  • 1
  • 5
  • Delete the file `token.txt` created when you used wrong credentials. Then run the script with correct credentials and it should act as if firs login and create new file `token.txt`. At least that is what I think should work. That said, the script is very low quality - using globals, bare except, hardcoded/stored credentials, etc. – buran Jan 26 '22 at 18:43
  • Zounds! Yes this allowed me to try again but entering the correct login info yields the same error. Back to the drawing board... Early on in the setup, I had not been able to install all of the packages recommended by the OP of the source code due to "invalid requirement." Supposedly this is due to problem with ```setuptools``` described here: https://stackoverflow.com/questions/35625488/invalidrequirement-invalid-requirement-parse-error-error-after-updating-a-py. I will try that and report back! – Matty Ice Jan 27 '22 at 03:04
  • Did you check the content of the new `token.txt`? What was it? – buran Jan 27 '22 at 05:17

0 Answers0