Implement flip sign support for Amex

This commit is contained in:
2026-06-06 11:00:27 -04:00
parent ec6586769f
commit d0fb8bb50f
2 changed files with 3 additions and 0 deletions
+1
View File
@@ -25,6 +25,7 @@ class CsvConfig(BaseModel):
delimiter: str = ","
quotechar: str = '"'
currency: str = "USD"
flip_amount: bool = False
class Config(BaseModel):
+2
View File
@@ -43,6 +43,8 @@ def get_transactions(csv_file: str, config: CsvConfig) -> list[Transaction]:
required fields date, amount and description via the CsvConfig."""
t = {field: row[index] for index, field in fields}
amount = t["amount"]
if config.flip_amount:
amount = flip_sign(amount)
return Transaction(
currency=config.currency,
debit=flip_sign(amount),