Repository Public
1# =============================================================================2# SP BOUCHER | SOFTWARE & RESEARCH3# ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING4# =============================================================================5#6# PROJECT METADATA7# -----------------------------------------------------------------------------8# Project : Immo·Ka9# File : immoka/mortgage/providers/mcap.py10# Module : immoka11# Repository : https://git.spboucher.ai/immo-ka12# Created : 2026-08-2413# Last Modified : 2026-08-2414#15# =============================================================================16# AUTHOR & PROFESSIONAL AFFILIATION17# =============================================================================18#19# Author : Simon-Pierre Boucher20# Position : Professor of Finance21# Institution : Université du Québec en Outaouais (UQO)22# Department : Département des sciences administratives23# Organization : SP Boucher24#25# Website : https://spboucher.ai26# Git : https://git.spboucher.ai27#28# =============================================================================29# OFFICIAL CONTACT DIRECTORY30# =============================================================================31#32# General : info@spboucher.ai33# Professional : contact@spboucher.ai34# Direct : simon@spboucher.ai35# Research : research@spboucher.ai36# Development : dev@spboucher.ai37# Support : support@spboucher.ai38# Security/Admin : admin@spboucher.ai39# Notifications : notifications@spboucher.ai40#41# Preferred Contact: contact@spboucher.ai42#43# =============================================================================44# COPYRIGHT & INTELLECTUAL PROPERTY45# =============================================================================46#47# Copyright (c) 202648# Simon-Pierre Boucher49#50# All rights reserved where applicable.51#52# This file is governed by the applicable project license,53# copyright notices, institutional agreements and relevant law.54#55# Unless expressly authorized by the applicable license or56# rights holder, copying, redistribution, sublicensing,57# publication and commercial exploitation are not permitted.58#59# Existing third-party rights and notices remain unaffected.60#61# =============================================================================62# CONFIDENTIALITY & SECURITY63# =============================================================================64#65# Classification : Public66# Distribution : Public repository; use is governed by the project license67# Security Contact : admin@spboucher.ai68#69# Access to this source does not independently grant permission70# to redistribute or disclose confidential materials.71#72# Do not embed credentials, private keys, access tokens,73# certificates or confidential personal information.74#75# =============================================================================76# LICENSE & MAINTENANCE77# =============================================================================78#79# License : None specified (no license file in this repository)80# Maintainer : Simon-Pierre Boucher81# Technical Contact: dev@spboucher.ai82#83# =============================================================================84# END OF SP BOUCHER SOURCE HEADER85# =============================================================================8687# -----------------------------------------------------------------------------88# Immo-Ka — Agrégateur de maisons à vendre (province de Québec)89# Auteur : Simon-Pierre Boucher — contact@spboucher.ai90# mortgage/providers/mcap.py : MCAP — distribution 100 % courtiers, aucune91# table publique de taux par terme (vérifié 2026-08). Seul signal public :92# le taux préférentiel MCAP (+ date d'effet). Collecté comme référence,93# exclu du comparateur de prêteurs (rate_type="other", purpose="unknown").94# -----------------------------------------------------------------------------95from __future__ import annotations9697import re9899from .base import RateProvider100101102class McapProvider(RateProvider):103 provider_id = "mcap"104 institution = "MCAP"105 source_url = ("https://www.mcap.com/residential-mortgages/advice/"106 "mortgage-rates-canada")107 request_delay = 1.0108109 def fetch(self) -> list[dict]:110 return self.parse(self.get(self.source_url).text)111112 def parse(self, payload: str) -> list[dict]:113 m = re.search(114 r'prime-rate-module.*?round-number-box[^>]*>\s*([\d.]+)\s*%',115 payload, re.S)116 if not m:117 return []118 prime = float(m.group(1))119 dm = re.search(r'Effective\s+([A-Z][a-z]+ \d{1,2},? \d{4})', payload)120 conditions = ("Taux préférentiel MCAP"121 + (f" — en vigueur le {dm.group(1)}" if dm else ""))122 return [self.make_product(123 rate=prime, rate_type="other", term_months=12, kind="posted",124 product_name="Taux préférentiel MCAP", purpose="unknown",125 conditions=conditions,126 raw={"prime": prime, "effective": dm.group(1) if dm else None})]127