BRASIL ON ATZ NM mapping

This commit is contained in:
2025-11-09 13:12:45 -03:00
parent 5474644580
commit 0680f22e4d
3 changed files with 14 additions and 6 deletions

View File

@@ -10,6 +10,8 @@ from correpy.parsers.brokerage_notes.parser_factory import ParserFactory
from fastapi import UploadFile
import re
import ntfy_service
account_id = '1590f1bb-b3ee-4dc8-ac46-bd1f15a83e87'
logger = logging.getLogger(__name__)
@@ -54,11 +56,21 @@ def convert_to_ghostfolio(brokerage_list: list, filename: str):
transaction_type = 'SELL'
name = re.sub(r'@|#' , '', transaction.security.name.strip())
symbol = ''
try:
symbol = mappings.name_to_tickers[name.strip()].strip()
except:
logger.error(name.strip() + ' is not mapped.')
ntfy_service.send_notification(f'Failed to import: {name.strip()} is not mapped.')
activity = {'accountId': account_id, 'comment': filename, 'date': reference_date,
'type': transaction_type,
'fee': fees, 'unitPrice': transaction.unit_price, 'quantity': transaction.amount,
'symbol': mappings.name_to_tickers[name.strip()].strip(),
'symbol': symbol,
'currency': 'BRL',
'dataSource': 'YAHOO'}
activities['activities'].append(activity)