From 2e58900a48e4530fe63d0b95c22ee6b16aadadce Mon Sep 17 00:00:00 2001 From: Christoffer Hjortlund Date: Thu, 19 Aug 2021 10:30:53 +0200 Subject: [PATCH] Added support for multiple vwd keys In the real_time_price class method, the price_payload query now gets adjusted, depending on the type of vwdIdentifierType is returned. This is needed for some products e.g. ES (E-mini S&P 500) to work --- degiroapi/__init__.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/degiroapi/__init__.py b/degiroapi/__init__.py index c26e1a1..a826f8c 100644 --- a/degiroapi/__init__.py +++ b/degiroapi/__init__.py @@ -218,17 +218,15 @@ def getdata(self, datatype, filter_zero=None): error_message='Could not get data') def real_time_price(self, product_id, interval): - vw_id = self.product_info(product_id)['vwdId'] - tmp = vw_id - try: - int(tmp) - except: - vw_id = self.product_info(product_id)['vwdIdSecondary'] - + product_info = self.product_info(product_id) + + vw_id = product_info['vwdId'] + vw_id_type = product_info['vwdIdentifierType'] + price_payload = { 'requestid': 1, 'period': interval, - 'series': ['issueid:' + vw_id, 'price:issueid:' + vw_id], + 'series': [vw_id_type + ':' + vw_id, 'price:' + vw_id_type + ':' + vw_id], 'userToken': self.client_token }