From 2adeaa5d8c4014437543a87ad4c2845928f2f3d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Louck=C3=BD?= Date: Tue, 17 Nov 2020 22:47:11 +0100 Subject: [PATCH] Allow for missing close price in Product --- degiroapi/product.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/degiroapi/product.py b/degiroapi/product.py index e97aa8e..1a995b1 100644 --- a/degiroapi/product.py +++ b/degiroapi/product.py @@ -10,8 +10,9 @@ def __init__(self, product): self.__currency = product['currency'] self.__product_type = product['productTypeId'] self.__tradable = product['tradable'] - self.__close_price = product['closePrice'] - self.__close_price_date = datetime.strptime(product['closePriceDate'], '%Y-%m-%d').date() + self.__close_price = product.get('closePrice') + close_price_date = product.get('closePriceDate') + self.__close_price_date = datetime.strptime(close_price_date, '%Y-%m-%d').date() if close_price_date else None @property def id(self):