update.py not working
Hello all,
Today, I started working with the degiro connector api. I got 2FA working, but i was trying to run the update.py example. However, any of the UpdateRequests gives me a bad request.
credentials = build_credentials(
location="config/config.json",
override={
"username": username,
"password": password,
"totp_secret_key": totp,
},
)
trading_api = TradingAPI(credentials=credentials)
trading_api.connect()
# FETCH ACCOUNT UPDATE
account_update = trading_api.get_update(
request_list=[
UpdateRequest(
option=UpdateOption.ALERTS,
last_updated=0,
),
UpdateRequest(
option=UpdateOption.CASH_FUNDS,
last_updated=0,
),
UpdateRequest(
option=UpdateOption.HISTORICAL_ORDERS,
last_updated=0,
),
UpdateRequest(
option=UpdateOption.ORDERS,
last_updated=0,
),
UpdateRequest(
option=UpdateOption.PORTFOLIO,
last_updated=0,
),
UpdateRequest(
option=UpdateOption.TOTAL_PORTFOLIO,
last_updated=0,
),
UpdateRequest(
option=UpdateOption.TRANSACTIONS,
last_updated=0,
),
],
raw=True,
)
print(account_update)
CRITICAL:degiro_connector.trading.actions.action_get_update:400 Client Error: for url XXXXXXXXX CRITICAL:degiro_connector.trading.actions.action_get_update:{"errors":[{"text":"Bad request"}]} None
Anybody an idea on how to solve this?
Hello @SjoerdTimovanVliet,
I cannot reproduce this issues: the update.py example works for me.
Are you able to run any other example successfully?
I can take a quick look if you want to show me the exact issue.
Feel free to contact me on discord.
Thanks
Hello @Chavithra thank you for your fast response. I can run most other examples without a problem. I get the same 400 bad request when trying to call the get_account_info() method. That would be awesome, what is your discord user?
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): trader.degiro.nl:443 DEBUG:urllib3.connectionpool:https://trader.degiro.nl:443 "POST /login/secure/login/totp HTTP/1.1" 200 None INFO:degiro_connector.trading.actions.action_connect:login_sucess: {'isPassCodeEnabled': False, 'locale': 'XXXXX', 'redirectUrl': 'https://trader.degiro.nl/trader/', 'sessionId': 'XXXXXXXXX', 'status': 0, 'statusText': 'success'} DEBUG:degiro_connector.core.models.model_session:session:getter: MainThread DEBUG:urllib3.connectionpool:https://trader.degiro.nl:443 "GET /trading/secure/v5/update/None;jsessionid=XXXXXXX?alerts=0&cashFunds=0&historicalOrders=0&orders=0&portfolio=0&totalPortfolio=0&transactions=0&sessionId=XXXXXXX HTTP/1.1" 400 None CRITICAL:degiro_connector.trading.actions.action_get_update:400 Client Error: for url: https://trader.degiro.nl/trading/secure/v5/update/None;jsessionid=XXXXXXXXXX?alerts=0&cashFunds=0&historicalOrders=0&orders=0&portfolio=0&totalPortfolio=0&transactions=0&XXXXXXXX CRITICAL:degiro_connector.trading.actions.action_get_update:{"errors":[{"text":"Bad request"}]} None
You need to provide the int_account field in the Credentials model for this method to work.
My discord is on my Github profile.