This script automates the reconciliation of transactions from Monarch Money with the balances in each account. It performs the following tasks:
- Initializes a database to store transactions and balances.
- Imports transactions and balance data from CSV files.
- Sets initial balances for each account.
- Reconciles transactions against the balances and identifies discrepancies.
- Backup Database: Creates a backup of the database before making any changes.
- Import Transactions: Imports transaction data from a CSV file and handles discrepancies.
- Set Initial Balances: Sets the initial balances for each account using balance data or user input.
- Reconcile Accounts: Reconciles the transactions against the balances, identifies discrepancies, and prompts the user for action if needed.
- Parallel Processing: Uses parallel processing to efficiently find matching transactions.
- Python 3.7+
- Required Python libraries:
pandas
,sqlite3
,multiprocessing
,decimal
,shutil
,glob
,datetime
,random
,timeit
Before running the script, ensure you have updated the configuration variables within the script body.
Update the following variables in the script body section near the top conveniently labeled "### Configuration ###":
db_path
: Path to the SQLite database file.db_path = "C:\\Users\\Me\\Documents\\reconciliation.db"
max_backups
: Maximum number of database backups to keep.max_backups = 20
import_folder
: Folder where the CSV files are stored.import_folder = "C:\\Users\\Me\\Downloads\\"
earliest_reconcile_date
: The earliest date from which to start the reconciliation process. Format yyyy-mm-ddearliest_reconcile_date = "2023-01-01"
combine_sofi_vaults
: Special case for SoFi bank accounts.combine_sofi_vaults = True
- Clone or download the repository to your local machine.
- Install the required Python libraries, if not already installed:
pip install pandas
- Go to Monarch Money and click "Download CSV" under the Summary widget. Save it as
balances.csv
in the folder specified inimport_folder
. - Go to Monarch Money Settings and click "Download transactions" and save it in the same folder.
- Open a terminal or command prompt.
- Navigate to the directory where the script is located.
- Run the script:
python MMReconcile.py
- Follow the prompts to complete the reconciliation process.
Creates the necessary tables in the SQLite database.
Imports transaction data from a CSV file, filtering out transactions before a specified earliest reconciliation date. It also checks for existing non-reconciled transactions before this date and prompts the user for action.
Prompts the user to set the initial balances for each account, using the balance data from the CSV file or prompting the user if the data is not available.
Loads the daily balances from a CSV file.
Reconciles the transactions against the balances and identifies any discrepancies. It uses parallel processing to find matching transactions efficiently.