From 1b4829d1aff405c7deda88d744c0f290561a53f1 Mon Sep 17 00:00:00 2001 From: Quentin Defenouillere Date: Wed, 3 Jun 2020 14:10:13 +0200 Subject: [PATCH] [boursorama] Fix bugs on iter_market_orders MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The quantity has changed from French to SI format. The ordervalue can be unavailable (for Market types). Also added 'AM' (Au marché) and 'ASD' (A seuil de déclenchement) order_types. --- modules/boursorama/pages.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/boursorama/pages.py b/modules/boursorama/pages.py index df6f93de6a..2c7f28e624 100644 --- a/modules/boursorama/pages.py +++ b/modules/boursorama/pages.py @@ -711,6 +711,8 @@ def inner(page, *args, **kwargs): MARKET_ORDER_TYPES = { 'LIM': MarketOrderType.LIMIT, + 'AM': MarketOrderType.MARKET, + 'ASD': MarketOrderType.TRIGGER, } MARKET_DIRECTIONS = { @@ -837,14 +839,14 @@ class item(ItemElement): # Unitprice may be absent if the order is still ongoing obj_unitprice = CleanDecimal.US(TableCell('state'), default=NotAvailable) obj_unitvalue = CleanDecimal.French(TableCell('unitvalue')) - obj_ordervalue = CleanDecimal.French(TableCell('order_type')) - obj_quantity = CleanDecimal.French(TableCell('quantity')) + obj_ordervalue = CleanDecimal.French(TableCell('order_type'), default=NotAvailable) + obj_quantity = CleanDecimal.SI(TableCell('quantity')) obj_date = Date(Base(TableCell('date'), CleanText('.//span')), dayfirst=True) obj_validity_date = Date(CleanText(TableCell('validity_date')), dayfirst=True) # Text format looks like 'LIM 49,000', we only use the 'LIM' for typing - obj_order_type = Map(Regexp(CleanText(TableCell('order_type')), r'^([^ ]+) '), MARKET_ORDER_TYPES, MarketOrderType.UNKNOWN) + obj_order_type = MapIn(CleanText(TableCell('order_type')), MARKET_ORDER_TYPES, MarketOrderType.UNKNOWN) # Text format looks like 'Exécuté 12.345 $' or 'En cours', we only fetch the first words obj_state = CleanText(Regexp(CleanText(TableCell('state')), r'^(\D+)')) -- GitLab