Chavithra / degiro-connector

This is yet another library to access Degiro's API.
BSD 3-Clause "New" or "Revised" License
205 stars 46 forks source link

ConnectionError: 429 Client Error: Too Many Requests for url: https://trader.degiro.nl/login/secure/login/totp #110

Closed 123m321 closed 1 year ago

123m321 commented 1 year ago

After a few minutes running, my algo gets kicked out by DeGiro. Unsure why it throws the 429 error, as I associate it with sending too many orders in a second.

It looks like the order issue, but for me I can get connection, retrieve orders and update them. But only for a few minutes.

In addition, when I try to restart it immediately it fails directly. After 15 minutes it works again (for a few minutes..). It looks like #107 but not sure. Maybe the 2fa is the only difference, and i can get a few minutes of trading.

4802 Traceback (most recent call last):
4803   File "/home/ubuntu/.local/lib/python3.9/site-packages/degiro_connector/trading/actions/action_connect.py", line 98, in get_session_id
4804     response_raw.raise_for_status()
4805   File "/home/ubuntu/.local/lib/python3.9/site-packages/requests/models.py", line 960, in raise_for_status
4806     raise HTTPError(http_error_msg, response=self)
4807 requests.exceptions.HTTPError: 429 Client Error: Too Many Requests for url: https://trader.degiro.nl/login/secure/login/totp
4808 
4809 During handling of the above exception, another exception occurred:
4810 
4811 Traceback (most recent call last):
(some code getting the last orders and portfolio)
4817     trading_api.connect()
4818   File "/home/ubuntu/.local/lib/python3.9/site-packages/degiro_connector/core/abstracts/abstract_action.py", line 73, in __call__
4819     return self.call(*args, **kwargs)
4820   File "/home/ubuntu/.local/lib/python3.9/site-packages/degiro_connector/trading/actions/action_connect.py", line 121, in call
4821     connection_storage.session_id = self.get_session_id(
4822   File "/home/ubuntu/.local/lib/python3.9/site-packages/degiro_connector/trading/actions/action_connect.py", line 102, in get_session_id
4823     raise ConnectionError(e)
4824 ConnectionError: 429 Client Error: Too Many Requests for url: https://trader.degiro.nl/login/secure/login/totp
123m321 commented 1 year ago

Any idea @Chavithra ? Or would disabling 2FA solve the problem here?

123m321 commented 1 year ago

I thought maybe the issue is I login too often for every small request (get prices from the market, where are my orders, adjust prices) and somehow I should try to remain connected (instead of connecting again and again)?