webull icon indicating copy to clipboard operation
webull copied to clipboard

Trouble working in colab

Open giterdun345 opened this issue 4 years ago • 5 comments

Hello, I am working on this in colab and keep ending up with the same message after trying multiple workarounds. I have a True when I log in but with the next line 'get_account_info()' I continue to get this message. Thank you in advance. `--------------------------------------------------------------------------- KeyError Traceback (most recent call last) in () 2 webull = webull() 3 webull.login('j**********', '*********') ----> 4 webull.get_account_id() 5 #webull.get_trade_token('123456') 6 #print(webull.get_account())

in get_account_id(self) 276 277 if result['success']: --> 278 self.account_id = str(result['data'][0]['secAccountId']) 279 return True 280 else:

KeyError: 'secAccountId'`

When I comment out the above code the results show as '{'success': True, 'data': [{'brokerId': 8, 'brokerName': 'Individual', 'status': 'unopen', 'registerTradeUrl': '/mgt/redirect/tradeh5', 'openAccountUrl': 'https://tradeh5.webull.com/register/ib/continue.html', 'supportOutsideRth': True, 'userTradePermissionVOs': [{'type': 'stock', 'hasPermission': False, 'brokerId': 8}], 'supportClickIPO': True, 'isDefaultChecked': False, 'supportOpenOption': True}]}'

giterdun345 avatar Mar 08 '20 01:03 giterdun345

From the response you posted, it doesn't look like your account has been approved.

'status': 'unopen',

alexonab avatar Mar 09 '20 15:03 alexonab

Could it be a result of using a mobile login? I am not sure why I am having these issues. I have one account that has been approved and has money deposited. Yet, I am still returned the same result.

giterdun345 avatar Mar 10 '20 02:03 giterdun345

@giterdun345 Yes, the version you are using does not support login using mobile number. The pending pull request addresses this issue.

Calrider avatar May 12 '20 05:05 Calrider

Thank you Christian!

On Tue, May 12, 2020 at 1:52 AM Christian [email protected] wrote:

@giterdun345 https://github.com/giterdun345 Yes, the version you are using does not support login using mobile number. The pending pull request addresses this issue.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/tedchou12/webull/issues/23#issuecomment-627125524, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALCTCNEP5I3JUQOHV2QRDSDRRDPZFANCNFSM4LDU373Q .

giterdun345 avatar May 12 '20 20:05 giterdun345

I am having a similar issue. Regardless of whether I use the email or phone for initial auth, I am receiving a payload that appears to state my account is not real (which it very much so is / lots of trades taking place).

from webull import webull # for paper trading, import 'paper_webull' webull_email = '[email protected]' webull_pass = 'MyPassword' webull_phone = '+1-2105551212' webull_client_name = 'WeBull API Client' webull_security_question_id = '1001' webull_dob = '0000' webull_mfa = webull_email # Can be webull_phone or webull_email

wb = webull()

webull_account_id_exists = wb._account_id print(webull_account_id_exists) if webull_account_id_exists: wb.login(webull_email,webull_pass) else: wb.login(webull_email,webull_pass) wb.get_mfa(webull_mfa) wb.get_security(webull_email) #get your security question. otp = input("Provide the OTP from your email/phone: ") data = wb.login(webull_email, webull_pass, webull_client_name, otp, webull_security_question_id, webull_dob) print(data)

print('Finished with login routine.') print('Running get_account_id:') print(wb.get_account_id())

Endpoint: https://tradeapi.webullbroker.com/api/trade/account/getSecAccountList/v5 <Response [200]> {'brokerId': 8, 'brokerName': 'Individual', 'status': 'unopen', 'registerTradeUrl': '/mgt/redirect/tradeh5', 'openAccountUrl': 'https://tradeh5.webull.com/register/ib/continue.html', 'supportOutsideRth': True, 'userTradePermissionVOs': [{'type': 'stock', 'hasPermission': False, 'brokerId': 8}, {'type': 'crypto', 'hasPermission': False, 'brokerId': 8}], 'accountPermissions': [{'type': 'stock', 'hasPermission': False, 'brokerId': 8}, {'type': 'crypto', 'hasPermission': False, 'brokerId': 8}], 'supportClickIPO': True, 'supportOpenOption': True, 'supportOpenCrypto': False, 'defaultChecked': False} Traceback (most recent call last): File "./test.py", line 34, in print(wb.get_account_id()) File "/usr/local/lib/python3.8/dist-packages/webull/webull.py", line 268, in get_account_id id = str(result['data'][0]['secAccountId']) KeyError: 'secAccountId'

Thank you in advance for any thoughts you have. I greatly appreciate your time and attention to this!

mark-bakermd avatar Feb 19 '21 13:02 mark-bakermd