generated from felixm/defaultpy
Implement flip sign support for Amex
This commit is contained in:
@@ -25,6 +25,7 @@ class CsvConfig(BaseModel):
|
||||
delimiter: str = ","
|
||||
quotechar: str = '"'
|
||||
currency: str = "USD"
|
||||
flip_amount: bool = False
|
||||
|
||||
|
||||
class Config(BaseModel):
|
||||
|
||||
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user