DegiroAPI
DegiroAPI copied to clipboard
KeyError: 'vwdId' with the response
This seems to be a new issue only started over the weekend and only effects some shares.
It works if I check Tesla and other shares
degiro = degiroapi.DeGiro()
degiro.login(USERNAME, PASSWORD)
products = degiro.search_products('TSLA')
realprice = degiro.real_time_price(Product(products[0]).id, degiroapi.Interval.Type.One_Day)
print(realprice[0])
Now this is probably a change on Degiros part but if I check this share Glanbia
degiro = degiroapi.DeGiro()
degiro.login(USERNAME, PASSWORD)
products = degiro.search_products('GL9')
realprice = degiro.real_time_price(Product(products[0]).id, degiroapi.Interval.Type.One_Day)
print(realprice[0])
Traceback (most recent call last):
File "send_mail.py", line 4, in <module>
import share_details
File "/home/myacc/projects/degiroholdings/share_details.py", line 99, in <module>
sh.main()
File "/home/myacc/projects/degiroholdings/share_details.py", line 23, in main
self.get_shares()
File "/home/myacc/projects/degiroholdings/share_details.py", line 44, in get_shares
realprice = self.degiro.real_time_price(Product(products[0]).id, degiroapi.Interval.Type.One_Day)
File "/usr/local/lib/python3.7/dist-packages/degiroapi/__init__.py", line 221, in real_time_price
vw_id = self.product_info(product_id)['vwdId']
KeyError: 'vwdId'
The response doesn't seem to have a key 'vwdId'
Share Details: SHARES IRL | GL9 | IE0000669501 | EUR | ED GLANBIA PLC
From the payload returned I can see there is no 'vwdId' or vwdIdSecondary
Probably as "No realtime data available for this exchange; trading is supported. Your orders will be sent to the exchange directly."
{'id': '353237', 'name': 'GLANBIA PLC', 'isin': 'IE0000669501', 'symbol': 'GL9', 'contractSize': 1.0, 'productType': 'STOCK', 'productTypeId': 1, 'tradable': True, 'category': 'B', 'currency': 'EUR', 'exchangeId': '384', 'onlyEodPrices': True, 'orderTimeTypes': ['DAY', 'GTC'], 'buyOrderTypes': ['LIMIT', 'MARKET', 'STOPLOSS', 'STOPLIMIT'], 'sellOrderTypes': ['LIMIT', 'MARKET', 'STOPLOSS', 'STOPLIMIT'], 'productBitTypes': [], 'closePrice': 11.84, 'closePriceDate': '2021-03-17'}
What would be the best course of action?
Thanks again for this library
I've tried a few things but can't get over the error.
Is there a option how I could skip the KeyError: 'vwdId' and just use the info in the payload?
Hello, what kind of properties about this product are you looking for ?
Hi Chavithra
The only figure I needed from the payload was the last price realprice[0]['data']['lastPrice']
But I can't see away around it if Degiro has stopped reporting this share in real time now
I'll just use the close of day price → Product(products[0]).close_price instead and that will work for me.
I've learnt a lot about the library in the last couple of days looking for a solution!