From 314f2c829b7ce39bdc9267cf1990cb315bad123e Mon Sep 17 00:00:00 2001 From: Quentin Defenouillere Date: Wed, 13 May 2020 18:53:55 +0200 Subject: [PATCH] [banquepopulaire] Implemented Market Orders --- modules/banquepopulaire/browser.py | 18 ++++++++++++++++++ modules/banquepopulaire/module.py | 3 +++ 2 files changed, 21 insertions(+) diff --git a/modules/banquepopulaire/browser.py b/modules/banquepopulaire/browser.py index 864d046b9a..7f02a3096f 100644 --- a/modules/banquepopulaire/browser.py +++ b/modules/banquepopulaire/browser.py @@ -787,6 +787,24 @@ def iter_investments(self, account): for inv in self.page.iter_investments(): yield inv + @need_login + def iter_market_orders(self, account): + if account.type not in (Account.TYPE_PEA, Account.TYPE_MARKET): + return + + if account.type == Account.TYPE_PEA and account.id.startswith('CPT'): + # Liquidity PEA have no market orders + return + + if self.go_investments(account, get_account=True): + # Redirection URL is https://www.linebourse.fr/ReroutageSJR + if 'linebourse' in self.url: + self.logger.warning('Going to Linebourse space to fetch investments.') + # Eliminating the 3 letters prefix to match IDs on Linebourse: + linebourse_id = account.id[3:] + for order in self.linebourse.iter_market_orders(linebourse_id): + yield order + @need_login def get_invest_history(self, account): if not self.go_investments(account): diff --git a/modules/banquepopulaire/module.py b/modules/banquepopulaire/module.py index 7a2c38ff57..8710e7b562 100644 --- a/modules/banquepopulaire/module.py +++ b/modules/banquepopulaire/module.py @@ -126,6 +126,9 @@ def iter_coming(self, account): def iter_investment(self, account): return self.browser.iter_investments(account) + def iter_market_orders(self, account): + return self.browser.iter_market_orders(account) + def iter_contacts(self): return self.browser.get_advisor() -- GitLab