Closed WisdomCreation closed 1 year ago
Same problem... the API isn't made by Webull, nor is it currently well maintained. Webull probably added slider puzzle for checking bot after this api is last updated.
https://github.com/tedchou12/webull/wiki/Workaround-for-Login-Method-2 I tried this method suggested by author but it didn't work.
https://github.com/tedchou12/webull/wiki/Workaround-for-Login-Method-2 I tried this method suggested by author but it didn't work.
me too tried and it does not work
I use the steps from Method 2 with the following CTraderBot class without issues.
from webull import webull, paper_webull
from _secrets import WEBULL_LOGIN_EMAIL, WEBULL_LOGIN_PWD, WEBULL_DEVICE_ID, \
WEBULL_TRADING_PIN, WEBULL_SECURITY_DID
class CTraderBot:
def __init__(self, paper_trading: bool = False) -> None:
self._webull = paper_webull() if (paper_trading) else webull()
self._loggedin = False
def login(self, use_workaround: bool = False) -> bool:
wb = self._webull
if (use_workaround):
wb._set_did(WEBULL_SECURITY_DID)
wb.login(username=WEBULL_LOGIN_EMAIL, password=WEBULL_LOGIN_PWD, device_name=WEBULL_DEVICE_ID)
self._loggedin = wb.get_trade_token(WEBULL_TRADING_PIN)
self._webull = wb
return self._loggedin
def main():
my_bot = CTraderBot(True)
success = "Success!" if (my_bot.login()) else "Failed!"
print(f"Logging into webull: {success}")
if __name__ == '__main__':
main()
For me, the key was to make sure I was logged into webull in my browser first. Minimize the browser after getting the DID as described and then call the CTraderBot.login() passing True so that the DID file gets created. As I'm sure you can tell, the info in the _secrects.py contain all of the relevant Webull information within a file that gets .gitignore'd at check-ins.
Once my app connects to webull, then I can close the browser. Once connected in this way, the app will continue to work until you log out of the browser version. Closing the browser does not log me out - I'm sure somehow cookies are involved so if you don't allow cookies then it may be a problem.
I hope this helps,
I use the steps from Method 2 with the following CTraderBot class without issues.
from webull import webull, paper_webull from _secrets import WEBULL_LOGIN_EMAIL, WEBULL_LOGIN_PWD, WEBULL_DEVICE_ID, \ WEBULL_TRADING_PIN, WEBULL_SECURITY_DID class CTraderBot: def __init__(self, paper_trading: bool = False) -> None: self._webull = paper_webull() if (paper_trading) else webull() self._loggedin = False def login(self, use_workaround: bool = False) -> bool: wb = self._webull if (use_workaround): wb._set_did(WEBULL_SECURITY_DID) wb.login(username=WEBULL_LOGIN_EMAIL, password=WEBULL_LOGIN_PWD, device_name=WEBULL_DEVICE_ID) self._loggedin = wb.get_trade_token(WEBULL_TRADING_PIN) self._webull = wb return self._loggedin def main(): my_bot = CTraderBot(True) success = "Success!" if (my_bot.login()) else "Failed!" print(f"Logging into webull: {success}") if __name__ == '__main__': main()
For me, the key was to make sure I was logged into webull in my browser first. Minimize the browser after getting the DID as described and then call the CTraderBot.login() passing True so that the DID file gets created. As I'm sure you can tell, the info in the _secrects.py contain all of the relevant Webull information within a file that gets .gitignore'd at check-ins.
Once my app connects to webull, then I can close the browser. Once connected in this way, the app will continue to work until you log out of the browser version. Closing the browser does not log me out - I'm sure somehow cookies are involved so if you don't allow cookies then it may be a problem.
I hope this helps,
I tried this but this still doesn't work for me, followed all your steps and my _secrets.py file has the correct information and I have my webull open in the browser but it's still saying "Logging into webull: Failed! " any help?
I don't know. All I can think is that you didn't get the correct DID. Are you sure that you followed the directions from here? Remember that the instructions say to refresh the page before getting your DID.
And for clarity, the contents of my __secrets.py_ are as follows:
WEBULL_LOGIN_EMAIL: str = "xxxxxxxxxxxxxxxxxxxxxx"
WEBULL_LOGIN_PWD: str = "xxxxxxxxxxxx"
WEBULL_TRADING_PIN: str = "xxxxxx"
WEBULL_DEVICE_ID: str = "Trader-Bot"
WEBULL_SECURITY_DID: str = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
EDIT: Oh, and call CTraderBot.login(True) to save the DID to the .bin file for the first call. Then you can drop the True in further calls
I don't know. All I can think is that you didn't get the correct DID. Are you sure that you followed the directions from here? Remember that the instructions say to refresh the page before getting your DID.
And for clarity, the contents of my __secrets.py_ are as follows:
WEBULL_LOGIN_EMAIL: str = "xxxxxxxxxxxxxxxxxxxxxx" WEBULL_LOGIN_PWD: str = "xxxxxxxxxxxx" WEBULL_TRADING_PIN: str = "xxxxxx" WEBULL_DEVICE_ID: str = "Trader-Bot" WEBULL_SECURITY_DID: str = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
EDIT: Oh, and call CTraderBot.login(True) to save the DID to the .bin file for the first call. Then you can drop the True in further calls
i set the .login(True) but now i'm getting AttributeError: 'paper_webull' object has no attribute '_set_did'
i'm new to programming so sorry i'm missing something obvious. Also yes, I'm positive I got the correct DID and followed those steps.
I don't know. All I can think is that you didn't get the correct DID. Are you sure that you followed the directions from here? Remember that the instructions say to refresh the page before getting your DID.
And for clarity, the contents of my __secrets.py_ are as follows:
WEBULL_LOGIN_EMAIL: str = "xxxxxxxxxxxxxxxxxxxxxx" WEBULL_LOGIN_PWD: str = "xxxxxxxxxxxx" WEBULL_TRADING_PIN: str = "xxxxxx" WEBULL_DEVICE_ID: str = "Trader-Bot" WEBULL_SECURITY_DID: str = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
EDIT: Oh, and call CTraderBot.login(True) to save the DID to the .bin file for the first call. Then you can drop the True in further calls
okay I figured it out, my mistake, your code works perfectly and logs me in-- i just for some reason had a really old version of the API installed. Thanks!
Hi, I'm getting error while login to my account, using Webull API,
res = wb.login(user_id , passw , "PythonTest" , mfa , ques_id , ques_ans)
I'm using this line of code with everything correct details, I'm getting the response (erros) as,Please let me know where I'm not getting it, and how can I solve this issue, Thanks,