fix symbols in transacion name
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -0,0 +1,2 @@
|
|||||||
|
*.log
|
||||||
|
__*
|
||||||
@@ -8,6 +8,7 @@ import datetime
|
|||||||
from correpy.domain.enums import TransactionType
|
from correpy.domain.enums import TransactionType
|
||||||
from correpy.parsers.brokerage_notes.parser_factory import ParserFactory
|
from correpy.parsers.brokerage_notes.parser_factory import ParserFactory
|
||||||
from fastapi import UploadFile
|
from fastapi import UploadFile
|
||||||
|
import re
|
||||||
|
|
||||||
account_id = '1590f1bb-b3ee-4dc8-ac46-bd1f15a83e87'
|
account_id = '1590f1bb-b3ee-4dc8-ac46-bd1f15a83e87'
|
||||||
|
|
||||||
@@ -51,11 +52,13 @@ def convert_to_ghostfolio(brokerage_list: list, filename: str):
|
|||||||
transaction_type = 'BUY'
|
transaction_type = 'BUY'
|
||||||
elif transaction.transaction_type == TransactionType.SELL:
|
elif transaction.transaction_type == TransactionType.SELL:
|
||||||
transaction_type = 'SELL'
|
transaction_type = 'SELL'
|
||||||
|
|
||||||
|
name = re.sub(r'@|#' , '', transaction.security.name.strip())
|
||||||
|
|
||||||
activity = {'accountId': account_id, 'comment': filename, 'date': reference_date,
|
activity = {'accountId': account_id, 'comment': filename, 'date': reference_date,
|
||||||
'type': transaction_type,
|
'type': transaction_type,
|
||||||
'fee': fees, 'unitPrice': transaction.unit_price, 'quantity': transaction.amount,
|
'fee': fees, 'unitPrice': transaction.unit_price, 'quantity': transaction.amount,
|
||||||
'symbol': mappings.name_to_tickers[transaction.security.name.strip()].strip(),
|
'symbol': mappings.name_to_tickers[name.strip()].strip(),
|
||||||
'currency': 'BRL',
|
'currency': 'BRL',
|
||||||
'dataSource': 'YAHOO'}
|
'dataSource': 'YAHOO'}
|
||||||
activities['activities'].append(activity)
|
activities['activities'].append(activity)
|
||||||
|
|||||||
6
main.py
6
main.py
@@ -10,7 +10,11 @@ import io
|
|||||||
app = FastAPI()
|
app = FastAPI()
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
logging.basicConfig(filename='rico-to-ghostfolio.log', level=logging.INFO)
|
logging.basicConfig(
|
||||||
|
level=logging.INFO,
|
||||||
|
format="%(asctime)s - %(name)s - %(levelname)s - %(message)s",
|
||||||
|
datefmt="%Y-%m-%d %H:%M:%S",
|
||||||
|
)
|
||||||
|
|
||||||
@app.post("/brokerage")
|
@app.post("/brokerage")
|
||||||
async def convert_pdf(file: UploadFile = File(...)):
|
async def convert_pdf(file: UploadFile = File(...)):
|
||||||
|
|||||||
BIN
notas-teste/2025-11-06 NotaNegociacao-11775539-04-11-2025-0.pdf
Normal file
BIN
notas-teste/2025-11-06 NotaNegociacao-11775539-04-11-2025-0.pdf
Normal file
Binary file not shown.
Reference in New Issue
Block a user