ubahmapk / ynab-format-csv

Python script to prepare CSV transaction files for import into YNAB
MIT License
0 stars 0 forks source link

Interpret Transaction Type for CapitalOne transaction files #7

Open ubahmapk opened 6 days ago

ubahmapk commented 6 days ago

Capital One (C1) uses a single field for inflow and outflow transactions. In both cases, the dollar amounts are shown as a positive number!

In order to accurately represent whether the transaction increases or decreases the balance, C1 uses a separate field titled "Transaction Type", which can either be of "Debit" or "Credit".

Sample transaction table from C1: Account Number Transaction Description Transaction Date Transaction Type Transaction Amount Balance
0238 Salary Deposit 11/04/24 Credit 2000.00 4000.00
0238 Purchase at Grocery Store 11/04/24 Debit 50.00 3050.00

When processing a file like this, the "Transaction Type" field should be used to either flip the "Transaction Amount" field to a negative value or to add a column and use those as Inflow and Outflow columns. (Probably the former)

The resulting sample data file above would look like this:

Account Number Transaction Description Transaction Date Transaction Type Transaction Amount Balance
0238 Salary Deposit 11/04/24 Credit 2000.00 4000.00
0238 Purchase at Grocery Store 11/04/24 Debit -50.00 3050.00
ubahmapk commented 6 days ago

Perhaps if the program detects a column header value with a name like "Transaction Type", it could prompt the user for the desired behavior.

ubahmapk commented 6 days ago

Another challenge here is the storage of the mappings in YAML. How would we store the fields that should be flipped?

ubahmapk commented 5 days ago

OR - have the program attempt to detect the Inflow/Outflow vs Amount column and provide suggested mappings, where possible.