From ed37f6eda8ce4c482d74bac045e9498b1fb8834e Mon Sep 17 00:00:00 2001 From: Herculino Trotta Date: Thu, 30 Jan 2025 11:01:10 -0300 Subject: [PATCH] Created Transaction Rules (markdown) --- Transaction-Rules.md | 72 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 Transaction-Rules.md diff --git a/Transaction-Rules.md b/Transaction-Rules.md new file mode 100644 index 0000000..a5c3203 --- /dev/null +++ b/Transaction-Rules.md @@ -0,0 +1,72 @@ +### Transaction Rules + +Transaction Rules are a powerful feature in WYGIWYH that allow for automatic modification of transactions based on specified criteria. This can save time and ensure consistency in your financial tracking. + +Key Aspects of Transaction Rules: + +* **Conditions**: Set specific criteria that a transaction must meet for the rule to apply. This can include attributes like description, amount, account, etc. +* **Actions**: Define what changes should be made to a transaction when the conditions are met. This can include setting categories, tags, or modifying other fields. +* **Activation Options**: Rules can be set to apply when transactions are created, updated, or both. + +#### Actions and Conditions + +When creating a new rule, you will need to add a Condition and, later, Actions. + +Both use a limited subset of Python, via [SimpleEval](https://github.com/danthedeckie/simpleeval). + +The Condition must evaluate to True or False, and the Action must evaluate to a value that will be set on the selected field. + +You may use any of the available [variables](#available-variables) and [functions](#available-functions). + +#### Available variables + +* `account_name` +* `account_id` +* `account_group_name` +* `account_group_id` +* `is_asset_account` +* `is_archived_account` +* `category_name` +* `category_id` +* `tag_names` +* `tag_ids` +* `entities_names` +* `entities_ids` +* `is_expense` +* `is_income` +* `is_paid` +* `description` +* `amount` +* `notes` +* `date` +* `reference_date` + +#### Available functions + +* `relativedelta` + +#### Examples + +Add a tag to an income transaction if it happens in a specific account + +``` +If... +account_name == "My Investing Account" and is_income + +Then... +Set Tags to +tag_names + ["Yield"] +``` + +--- + +Move credit card transactions to next month when they happen at a cutoff date + +``` +If... +account_name == "My credit card" and date.day >= 26 and reference_date.month == date.month + +Then... +Set Reference Date to +reference_date + relativedelta(months=1)).replace(day=1) +``` \ No newline at end of file