pynomina API Documentation
account_view
Created on 2024-10-12
@author: wf
AccountView
account display
Source code in nomina/account_view.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | |
__init__(solution, grid_row)
constructor
Source code in nomina/account_view.py
19 20 21 22 23 24 25 26 | |
style_grid(col_name, col_option, option_value)
style a part of the grid
Source code in nomina/account_view.py
32 33 34 35 36 37 38 39 | |
update(book, account)
update my user interface with the given account
Source code in nomina/account_view.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | |
bean_query
Created on 2024-11-02
@author: wf
BeanQueryHandler
Handles executing named parameterized queries using the BQLShell interface from beanquery.
Source code in nomina/bean_query.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | |
__init__(beancount_file, format='text', numberify=False)
Initialize the BeanQueryHandler with a Beancount file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
beancount_file
|
str
|
Path to the Beancount file. |
required |
format
|
str
|
Output format (default: 'text'). |
'text'
|
numberify
|
bool
|
Whether to remove currencies from the output (default: False). |
False
|
Source code in nomina/bean_query.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | |
execute_query(query)
Execute a beanquery query
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
query
|
str
|
The query to execute. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
list |
list
|
The query result rows as a list of dicts. |
Source code in nomina/bean_query.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | |
beancount_ledger
Created on 2024-10-07
@author: wf
BeancountToLedgerConverter
Bases: BaseToLedgerConverter
Convert Beancount format to Ledger Book
Source code in nomina/beancount_ledger.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | |
__init__(debug=False)
Constructor for Beancount to Ledger Book conversion.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
debug
|
bool
|
Whether to enable debug logging. |
False
|
Source code in nomina/beancount_ledger.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | |
convert_account(entry)
Create a Ledger account from a Beancount Open directive.
Source code in nomina/beancount_ledger.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | |
convert_to_target()
Convert the Beancount file to a Ledger Book.
Source code in nomina/beancount_ledger.py
62 63 64 65 66 67 68 69 70 71 72 73 | |
convert_transaction(entry)
Create a Ledger transaction from a Beancount Transaction.
Source code in nomina/beancount_ledger.py
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | |
load(input_path)
load the beancount file
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_path
|
str
|
The path to the input file. |
required |
Source code in nomina/beancount_ledger.py
44 45 46 47 48 49 50 51 52 53 54 55 56 | |
LedgerToBeancountConverter
Bases: BaseFromLedgerConverter
converter for Ledger Book to Beancount
Source code in nomina/beancount_ledger.py
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 | |
__init__(debug=False)
Constructor for Ledger Book to Beancount conversion.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
debug
|
bool
|
Whether to enable debug logging. |
False
|
Source code in nomina/beancount_ledger.py
127 128 129 130 131 132 133 134 135 136 137 138 139 140 | |
convert_account(account)
Convert a ledger account to a Beancount Open directive.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account
|
Account
|
The ledger account to convert. |
required |
Returns:
| Type | Description |
|---|---|
Optional[Open]
|
Optional[data.Open]: The Beancount Open directive, or None if conversion fails. |
Source code in nomina/beancount_ledger.py
214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 | |
convert_to_target()
Convert the ledger book to a Beancount object. Args: lbook (LedgerBook): The ledger book to convert.
Returns:
| Name | Type | Description |
|---|---|---|
Beancount |
Beancount
|
The converted Beancount object. |
Source code in nomina/beancount_ledger.py
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | |
convert_transaction(transaction)
Convert a ledger transaction to a Beancount Transaction directive.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
transaction
|
Transaction
|
The ledger transaction to convert. |
required |
Returns:
| Type | Description |
|---|---|
Optional[Transaction]
|
Optional[data.Transaction]: The Beancount Transaction directive, or None if conversion fails. |
Source code in nomina/beancount_ledger.py
236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 | |
get_beancount_name_for_account(account)
get the beancount name for the ledger account name
Source code in nomina/beancount_ledger.py
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 | |
load(input_path)
load the Ledger Book
Returns:
| Name | Type | Description |
|---|---|---|
LedgerBook |
Book
|
the ledger book |
Source code in nomina/beancount_ledger.py
142 143 144 145 146 147 148 149 150 151 | |
beanquery_cmd
Created on 2024-11-02
@author: wf
BeanQueryCmd
Bases: QueryCmd
Extended version of QueryCmd to support named parameterized queries for beanquery
Source code in nomina/beanquery_cmd.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | |
handle_args()
Handle the command line arguments, ensure the query is loaded and parameters are parsed.
Source code in nomina/beanquery_cmd.py
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 | |
main(argv=None)
Main entry point for the npbeanquery script.
Source code in nomina/beanquery_cmd.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | |
book_view
Created on 2024-10-12
@author: wf
BookView
view a Ledger Book (of any accounting file format)
Source code in nomina/book_view.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | |
__init__(solution)
constructor
Source code in nomina/book_view.py
29 30 31 32 33 34 35 36 37 | |
load_book()
async
load Ledger Book
Source code in nomina/book_view.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | |
read_and_optionally_render(input_str, with_render=False)
async
Reads the given input and optionally renders the given input
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_str
|
str
|
The input string representing a URL or local file. |
required |
with_render(bool)
|
if True also render |
required |
Source code in nomina/book_view.py
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | |
select_account(args)
async
select an account
Source code in nomina/book_view.py
102 103 104 105 106 107 108 109 110 | |
setup_ui()
setup my user interface
Source code in nomina/book_view.py
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | |
bzv
Banking ZV Subsembly json export Created on 2024-10-05
@author: wf
Book
a Banking ZV Book
Source code in nomina/bzv.py
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 | |
add_category_account(category)
add a category account for the given category
Source code in nomina/bzv.py
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 | |
create_category_accounts()
create the category accounts
Source code in nomina/bzv.py
200 201 202 203 204 205 206 207 208 209 210 | |
get_stats()
Calculates and returns statistics related to the transactions, accounts, and other properties of the Book.
Returns:
| Name | Type | Description |
|---|---|---|
Stats |
Stats
|
An object containing various statistics about the Book. |
Source code in nomina/bzv.py
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | |
load_accounts_from_accounts_dict(account_json_dict)
Loads transactions from a dictionary of JSON file paths and populates the accounts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account_json_dict
|
dict
|
A dictionary where keys are account IDs and values are paths to JSON files containing transaction data. |
required |
Source code in nomina/bzv.py
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 | |
organize_batches()
Organize transactions into batches
Source code in nomina/bzv.py
102 103 104 105 106 107 108 109 110 111 112 113 114 | |
Transaction
Represents a Subsembly/Banking ZV financial transaction with detailed information about the transaction, account details, and remittance information.
Source code in nomina/bzv.py
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | |
bzv_ledger
Created on 2024-10-05
@author: wf
BankingZVToLedgerConverter
Bases: BaseToLedgerConverter
convert BankingZV Entries to Ledger format
Source code in nomina/bzv_ledger.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | |
__init__(debug=False)
Constructor for BankingZV to Ledger Book conversion.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
debug
|
bool
|
Whether to enable debug logging. |
False
|
Source code in nomina/bzv_ledger.py
26 27 28 29 30 31 32 33 | |
convert_to_target()
convert my Banking ZV book to a ledger book
Source code in nomina/bzv_ledger.py
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | |
create_batch_transaction(batch_id, batch_transactions)
Create a single ledger transaction for a batch of BZV transactions
Source code in nomina/bzv_ledger.py
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | |
create_ledger_account(bzv_account)
create a ledger account from a banking ZV account
Source code in nomina/bzv_ledger.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 | |
create_ledger_splits(transaction)
create the ledger split
Source code in nomina/bzv_ledger.py
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | |
load(input_path)
load the book
Source code in nomina/bzv_ledger.py
35 36 37 38 39 40 41 | |
map_account_type(bzv_account)
get the account type
Source code in nomina/bzv_ledger.py
48 49 50 51 52 53 54 55 56 57 | |
converter
Created on 2024-10-06
@author: wf
Converter
General converter for personal accounting formats using hub and spoke model
Source code in nomina/converter.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | |
convert(input_path=None, output_format=None)
Convert the input file to the specified output format.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_path
|
str
|
Path to the input file. Defaults to None. |
None
|
output_format
|
str
|
Acronym of the output format. Defaults to None. |
None
|
Source code in nomina/converter.py
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | |
get_supported_formats()
Get a list of supported input and output formats
Returns:
| Type | Description |
|---|---|
Dict[str, list]
|
Dict[str, list]: A dictionary with 'input' and 'output' keys, each containing a list of supported format acronyms |
Source code in nomina/converter.py
104 105 106 107 108 109 110 111 112 113 | |
date_utils
Created on 2024-10-02
@author: wf
DateUtils
date utilities
Source code in nomina/date_utils.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | |
iso_date(date)
staticmethod
Format a datetime object to a string in 'YYYY-MM-DD' format.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
date
|
datetime
|
The date to format. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The formatted date as a string. |
Source code in nomina/date_utils.py
16 17 18 19 20 21 22 23 24 25 26 27 | |
parse_date(date_str, date_formats=None)
classmethod
Parse the given date string using the provided formats.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
date_str
|
str
|
The date string to parse. |
required |
date_formats
|
List[str]
|
List of date formats to try. If None, uses a default list of formats. |
None
|
Returns:
| Type | Description |
|---|---|
Optional[str]
|
Optional[str]: The parsed date in ISO format (YYYY-MM-DD) or None if parsing fails. |
Source code in nomina/date_utils.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | |
split_date_range(start_date, end_date, num_ranges)
classmethod
Splits a date range into a predefined number of sub-ranges.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start_date
|
str
|
The start date in "YYYY-MM-DD" format. |
required |
end_date
|
str
|
The end date in "YYYY-MM-DD" format. |
required |
num_ranges
|
int
|
The number of ranges to split into. |
required |
Returns:
| Type | Description |
|---|---|
List[Tuple[str, str]]
|
List[Tuple[str, str]]: A list of tuples representing the sub-ranges. |
Source code in nomina/date_utils.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | |
file_formats
Created on 2024-10-06
@author: wf
AccountingFileFormat
dataclass
A personal account file format
Source code in nomina/file_formats.py
17 18 19 20 21 22 23 24 25 26 27 28 29 | |
AccountingFileFormats
Detector for various accounting file formats
Source code in nomina/file_formats.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 | |
detect_format(file_path)
Detect the accounting file format based on content and extension
Source code in nomina/file_formats.py
125 126 127 128 129 130 131 132 133 134 | |
get_by_acronym(acronym)
get format by acronym
Source code in nomina/file_formats.py
119 120 121 122 123 | |
gnc_ledger
Created on 2024-10-04
@author: wf
GnuCashToLedgerConverter
Bases: BaseToLedgerConverter
Convert GnuCash Book to Ledger Book
Source code in nomina/gnc_ledger.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | |
__init__(debug=False)
constructor
Source code in nomina/gnc_ledger.py
37 38 39 40 41 42 43 44 | |
convert_to_target()
Convert the GnuCash V2 structure to a Ledger Book.
Source code in nomina/gnc_ledger.py
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | |
create_ledger_account(gnc_account)
Create a Ledger account from a GnuCash account.
Source code in nomina/gnc_ledger.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | |
create_ledger_split(gnc_split)
Create a Ledger split from a GnuCash split.
Source code in nomina/gnc_ledger.py
75 76 77 78 79 80 81 82 83 84 85 | |
create_ledger_transaction(gnc_transaction)
Create a Ledger transaction from a GnuCash transaction.
Source code in nomina/gnc_ledger.py
87 88 89 90 91 92 93 94 95 96 97 98 99 | |
load(input_path)
Load the GnuCash XML file from the input file and parse it into a GncV2 object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_path
|
str
|
The input path to read the GnuCash XML data from. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
GncV2 |
GncV2
|
The parsed GncV2 object. |
Source code in nomina/gnc_ledger.py
46 47 48 49 50 51 52 53 54 55 56 57 | |
to_text()
create the output text
Source code in nomina/gnc_ledger.py
124 125 126 127 128 129 | |
LedgerToGnuCashConverter
Bases: BaseFromLedgerConverter
Convert Ledger Book to GnuCash Book
Source code in nomina/gnc_ledger.py
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 | |
__init__(debug=False)
Constructor for Ledger Book to GnuCash conversion.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
debug
|
bool
|
Whether to enable debug logging. |
False
|
Source code in nomina/gnc_ledger.py
137 138 139 140 141 142 143 144 145 146 147 148 149 | |
convert_to_target()
Convert the Ledger Book to a GnuCash V2 structure.
Source code in nomina/gnc_ledger.py
241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 | |
create_gnucash_account(laccount)
Create a GnuCash account from a Ledger account.
Source code in nomina/gnc_ledger.py
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | |
create_gnucash_split(lsplit, transaction_currency)
Create a GnuCash split from a Ledger split.
Source code in nomina/gnc_ledger.py
192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 | |
create_gnucash_transaction(ltransaction)
Create a GnuCash transaction from a Ledger transaction.
Source code in nomina/gnc_ledger.py
214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 | |
generate_guid()
Generate a GUID for GnuCash entities.
Source code in nomina/gnc_ledger.py
166 167 168 | |
load(input_path)
load the Ledger Book
Returns:
| Name | Type | Description |
|---|---|---|
LedgerBook |
Book
|
the ledger book |
Source code in nomina/gnc_ledger.py
151 152 153 154 155 156 157 158 159 160 | |
to_text()
convert to text
Source code in nomina/gnc_ledger.py
274 275 276 277 278 279 | |
gnucash
Created on 2024-10-02
@author: wf
GncV2
dataclass
Source code in nomina/gnucash.py
378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 | |
get_stats()
Get statistics for the GncV2 object.
Source code in nomina/gnucash.py
402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 | |
GnuCashXml
GnuCash XML reader/writer
Source code in nomina/gnucash.py
436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 | |
__init__(indent=' ')
constructor using two space indentation
Source code in nomina/gnucash.py
441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 | |
parse_gnucash_xml(xml_file)
parse the given gnucash xml file - plain or gzipped as GnuCash saves by default, see issue #31
Source code in nomina/gnucash.py
479 480 481 482 483 484 485 486 487 488 489 | |
to_text(gnucash_data)
Serialize the GnuCash data object to an XML string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gnucash_data
|
GncV2
|
The GnuCash data object to serialize. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The serialized XML string. |
Source code in nomina/gnucash.py
516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 | |
write_gnucash_xml(gnucash_data, output_file)
Serialize the GnuCash data object to an XML file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gnucash_data
|
GnuCashXml
|
The GnuCash data object to serialize. |
required |
output_file
|
str
|
The file path where the XML will be written. |
required |
Source code in nomina/gnucash.py
543 544 545 546 547 548 549 550 551 552 553 554 555 | |
xml_format(xml_string)
adapt the format of the xml_string to gnu cash conventions
Source code in nomina/gnucash.py
491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 | |
TsDate
dataclass
Source code in nomina/gnucash.py
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | |
__post_init__()
format date to 1970-01-01 00:00:00 +0000
Source code in nomina/gnucash.py
69 70 71 72 73 74 | |
ledger
Created on 04.10.2024
@author: wf
Account
Represents a ledger account.
Source code in nomina/ledger.py
19 20 21 22 23 24 25 26 27 28 29 30 | |
Book
Represents a ledger book containing accounts and transactions.
Source code in nomina/ledger.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 | |
__post_init__()
post construct actions
Source code in nomina/ledger.py
83 84 85 86 87 | |
add_account(account)
add the given account
Source code in nomina/ledger.py
216 217 218 219 220 221 | |
calc_balances()
Calculate the balances for all accounts, including propagation up the account hierarchy. Unused accounts will have a balance of None.
Returns:
| Type | Description |
|---|---|
Dict[str, Optional[float]]
|
Dict[str, Optional[float]]: A dictionary mapping account IDs to their balances or None if unused. |
Source code in nomina/ledger.py
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 | |
create_account(name, description, account_type='EXPENSE', parent_account_id=None)
Create a ledger account with the given parameters.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the account. |
required |
description(str)
|
the description of the account |
required | |
account_type
|
str
|
The type of the account. Defaults to "EXPENSE". |
'EXPENSE'
|
parent_account_id
|
Optional[str]
|
The id of the parent account, if any. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
Account |
Account
|
A new Account object. |
Source code in nomina/ledger.py
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 | |
filter(start_date=None, end_date=None, remove_unused_accounts=True)
Filter the transactions based on the given date range.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start_date
|
str
|
The start date in 'YYYY-MM-DD' format. |
None
|
end_date
|
str
|
The end date in 'YYYY-MM-DD' format. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
Book |
Book
|
A new Book object with filtered transactions. |
Source code in nomina/ledger.py
140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | |
fq_account_name(account, separator=':')
Returns the fully qualified name of the account, using the specified separator.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account
|
Account
|
The account for which to generate the fully qualified name. |
required |
separator
|
str
|
The separator to use between parent and child account names. Defaults to ':'. |
':'
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The fully qualified name of the account. |
Source code in nomina/ledger.py
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | |
get_stats()
Get statistics about the Book.
Returns:
| Name | Type | Description |
|---|---|---|
Stats |
Stats
|
An object containing various statistics about the Book. |
Source code in nomina/ledger.py
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | |
lookup_account(account_id)
Get the account for the given account id.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
account_id(str)
|
The id of the account to look up. |
required |
Returns:
| Type | Description |
|---|---|
Optional[Account]
|
Optional[Account]: The found account or None if not found. |
Source code in nomina/ledger.py
223 224 225 226 227 228 229 230 231 232 233 | |
remove_unused_accounts()
Remove accounts that have not been used in any transactions.
Source code in nomina/ledger.py
273 274 275 276 277 278 279 280 281 282 283 284 | |
Split
Represents a split in a transaction.
Source code in nomina/ledger.py
33 34 35 36 37 38 39 40 41 42 43 | |
Transaction
Represents a transaction in the ledger.
Source code in nomina/ledger.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | |
total_amount()
Calculates the total amount of the transaction. Returns: float: The sum of all split amounts.
Source code in nomina/ledger.py
58 59 60 61 62 63 64 | |
money_zip
Created on 2024-10-14
@author: wf
MnyToZipConverter
Convert Microsoft Money Files to ZIP file with JSON dumps of all tables and a header YAML file
Source code in nomina/money_zip.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | |
check_tools()
Check if required tools are available.
Source code in nomina/money_zip.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 | |
color_msg(color, msg)
Display colored messages with UTF-8 symbols.
Source code in nomina/money_zip.py
39 40 41 | |
create_yaml_declaration(mny_file, yaml_file)
Create YAML declaration file.
Source code in nomina/money_zip.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | |
error(msg)
Display errors and exit.
Source code in nomina/money_zip.py
43 44 45 46 | |
export_mny_to_zip(mny_file)
Export the given money file to a zip file that pynomina might be able to read.
Source code in nomina/money_zip.py
125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | |
export_tables_to_json(mny_file, output_dir)
Export tables of the given Microsoft Money file to JSON files.
Source code in nomina/money_zip.py
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 | |
negative(msg)
Display negative messages.
Source code in nomina/money_zip.py
52 53 54 | |
positive(msg)
Display positive messages.
Source code in nomina/money_zip.py
48 49 50 | |
msmoney
Created on 2024-10-09
@author: wf
MsMoney
Wrapper for Microsoft Money content
Source code in nomina/msmoney.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | |
add_node(table_name, data)
Add a single node to the graph
Source code in nomina/msmoney.py
99 100 101 102 103 104 | |
add_nodes_from_json(file_name, file_content)
Add nodes from JSON data to the graph
Source code in nomina/msmoney.py
84 85 86 87 88 89 90 91 92 93 94 95 96 97 | |
get_stats()
Get statistics about the Microsoft Money data.
Returns:
| Name | Type | Description |
|---|---|---|
Stats |
Stats
|
An object containing various statistics about the data. |
Source code in nomina/msmoney.py
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | |
load(path)
Load Microsoft Money data from a ZIP file or a directory
Source code in nomina/msmoney.py
39 40 41 42 43 44 45 46 47 48 | |
to_transaction_dict(data)
convert a data node to a transcaction dict with transaction_id and isodate
Source code in nomina/msmoney.py
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | |
msmoney_ledger
Created on 09.10.2024
@author: wf
MicrosoftMoneyToLedgerConverter
Bases: BaseToLedgerConverter
Microsoft Money to Ledger Converter
Source code in nomina/msmoney_ledger.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | |
__init__(debug=False)
Constructor for Microsoft Money to Ledger Book conversion.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
debug
|
bool
|
Whether to enable debug logging. |
False
|
Source code in nomina/msmoney_ledger.py
19 20 21 22 23 24 25 26 27 | |
convert_to_target()
convert the microsoft money entries to a Ledger Book
Source code in nomina/msmoney_ledger.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | |
load(input_path)
Load Microsoft Money data
Source code in nomina/msmoney_ledger.py
29 30 31 32 33 34 35 36 | |
nomina_beancount
Created on 2024-10-07
@author: wf
Beancount
Encapsulates Beancount-specific operations and conversions
Source code in nomina/nomina_beancount.py
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 | |
__init__()
constructor
Source code in nomina/nomina_beancount.py
47 48 49 50 51 52 53 | |
add_entry(entry)
add the given entry to my entries
Source code in nomina/nomina_beancount.py
75 76 77 78 79 80 | |
create_open_directive(fq_account_name, date, currencies=None, meta=None)
Create a Beancount Open account directive
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fq_account_name
|
str
|
fully qualifying Account name |
required |
date
|
date
|
Opening date |
required |
currencies
|
Optional[List[str]]
|
List of currencies for the account |
None
|
meta
|
Optional[Dict]
|
Metadata for the Open directive |
None
|
Returns:
| Type | Description |
|---|---|
Open
|
data.Open: Beancount Open directive |
Source code in nomina/nomina_beancount.py
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 | |
create_transaction(date, description, postings, payee=None, metadata=None)
Create a Beancount Transaction directive
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
date
|
date
|
Transaction date |
required |
description
|
str
|
Transaction description |
required |
postings
|
List[Tuple]
|
List of (account, amount, currency) or (account, amount, currency, posting_meta) tuples |
required |
payee
|
str
|
Payee name |
None
|
metadata
|
Dict
|
Transaction metadata |
None
|
Returns:
| Type | Description |
|---|---|
Transaction
|
data.Transaction: Beancount Transaction directive |
Source code in nomina/nomina_beancount.py
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | |
entries_to_string(preamble, entries=None)
Get a text version of the entries, including the preamble.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
preamble
|
Preamble
|
The preamble object to generate the header. |
required |
entries
|
Optional[List[Directive]]
|
List of Beancount directives. If None, use self.entries. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The Beancount file content as a string. |
Source code in nomina/nomina_beancount.py
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 | |
get_stats()
Get statistics about the Beancount data
Returns:
| Name | Type | Description |
|---|---|---|
Stats |
Stats
|
An object containing various statistics about the Beancount data |
Source code in nomina/nomina_beancount.py
206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 | |
load_file(file_path)
Load a Beancount file
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_path
|
str
|
Path to the Beancount file |
required |
Source code in nomina/nomina_beancount.py
55 56 57 58 59 60 61 62 | |
load_string(beancount_string)
Load Beancount data from a string
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
beancount_string
|
str
|
Beancount data as a string |
required |
Source code in nomina/nomina_beancount.py
64 65 66 67 68 69 70 71 72 73 | |
sanitize_account_name(fq_name)
Sanitize the account name by replacing spaces, slashes, dots, commas, and removing paired square brackets but keeping the content inside.
https://beancount.github.io/docs/beancount_language_syntax.html#syntax-overview
Source code in nomina/nomina_beancount.py
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 | |
nomina_cmd
Created on 2024-10-06
@author: wf
NominaCmd
Bases: WebserverCmd
command line handling for nomina
Source code in nomina/nomina_cmd.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | |
__init__()
constructor
Source code in nomina/nomina_cmd.py
22 23 24 25 26 27 28 | |
getArgParser(description, version_msg)
override the default argparser call
Source code in nomina/nomina_cmd.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | |
handle_args(args)
handle the command line args
Source code in nomina/nomina_cmd.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | |
main(argv=None)
main call
Source code in nomina/nomina_cmd.py
86 87 88 89 90 91 92 | |
nomina_converter
Created on 2024-10-06
@author: wf
AccountingFileConverter
Abstract base class for accounting file converters. This class provides a structure for converting accounting data from one format to another.
Source code in nomina/nomina_converter.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | |
__init__(from_format_acronym, to_format_acronym, debug=False)
Constructor that initializes the converter instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
from_format_acronym
|
str
|
Acronym of the source format |
required |
to_format_acronym
|
str
|
Acronym of the target format |
required |
debug
|
bool
|
If True, enable debug output |
False
|
Source code in nomina/nomina_converter.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | |
convert_to_target()
Convert the loaded source content to the target format.
Returns:
| Name | Type | Description |
|---|---|---|
object |
object
|
The converted content object (could be any personal accounting book type). |
Raises:
| Type | Description |
|---|---|
ValueError
|
If called on the abstract base class. |
Source code in nomina/nomina_converter.py
60 61 62 63 64 65 66 67 68 69 70 | |
load(input_stream)
Load the content from the input stream.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_stream
|
TextIO
|
The input stream |
required |
Returns:
| Name | Type | Description |
|---|---|---|
object |
object
|
The loaded content |
Raises:
| Type | Description |
|---|---|
ValueError
|
If called on the abstract base class. |
Source code in nomina/nomina_converter.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 | |
show_stats()
Display statistics about the source and target objects.
Source code in nomina/nomina_converter.py
84 85 86 87 88 89 90 91 92 93 | |
to_text()
Convert the target object into a text representation.
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The text representation of the target content. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If not implemented by a subclass. |
Source code in nomina/nomina_converter.py
72 73 74 75 76 77 78 79 80 81 82 | |
BaseFromLedgerConverter
Bases: AccountingFileConverter
Base class for converters that convert from LedgerBook format to various formats.
Source code in nomina/nomina_converter.py
131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 | |
__init__(to_format_acronym, debug=False)
Constructor for BaseFromLedgerConverter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
to_format_acronym
|
str
|
Acronym of the target format |
required |
debug
|
bool
|
If True, enable debug output |
False
|
Source code in nomina/nomina_converter.py
136 137 138 139 140 141 142 143 144 | |
convert_from_ledger(ledger_book)
Convert from LedgerBook format to the target format object.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ledger_book
|
Book
|
The LedgerBook object to convert |
required |
Returns:
| Name | Type | Description |
|---|---|---|
object |
object
|
The converted object in the target format |
Source code in nomina/nomina_converter.py
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 | |
to_text(target)
Convert the target object into a text representation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
object
|
The target object to convert to text |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The text representation of the target content. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If not implemented by a subclass. |
Source code in nomina/nomina_converter.py
165 166 167 168 169 170 171 172 173 174 175 176 177 178 | |
BaseToLedgerConverter
Bases: AccountingFileConverter
Base class for converters that convert from various formats to LedgerBook format.
Source code in nomina/nomina_converter.py
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | |
__init__(from_format_acronym, debug=False)
Constructor for BaseToLedgerConverter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
from_format_acronym
|
str
|
Acronym of the source format |
required |
debug
|
bool
|
If True, enable debug output |
False
|
Source code in nomina/nomina_converter.py
101 102 103 104 105 106 107 108 109 | |
convert_to_ledger(input_path)
Convert the input file to LedgerBook format.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_path
|
str
|
Path to the input file |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Book |
Book
|
The converted LedgerBook object |
Source code in nomina/nomina_converter.py
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | |
qif
Created on 2024-10-01
Quicken Interchange Format (QIF) Parser see https://en.wikipedia.org/wiki/Quicken_Interchange_Format
@author: wf
Category
dataclass
Bases: ParseRecord
a QIF tag (Class or Category)
Source code in nomina/qif.py
91 92 93 94 95 96 97 98 | |
ParseRecord
dataclass
generic parse record to keep track of lines and errors
Source code in nomina/qif.py
25 26 27 28 29 30 31 32 33 | |
QifClass
dataclass
Bases: ParseRecord
a QIF tag (Class or Category)
Source code in nomina/qif.py
101 102 103 104 105 106 107 108 | |
QifField
A QIF field with possible context-dependent meanings for the marker used e.g. D for isodate or description and T for amount or account_type marker meaning might also be unclear - denoted by a None field_name
Source code in nomina/qif.py
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 | |
__init__(marker, field_name=None, context_fields=None)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
marker
|
str
|
QIF marker character |
required |
field_name
|
str
|
default field name, None if unclear |
None
|
context_fields
|
Dict[str, str]
|
optional mapping of record_type to field_name |
None
|
Source code in nomina/qif.py
216 217 218 219 220 221 222 223 224 225 226 227 | |
add_line_value_to_record(line, record_type, current_record)
handle a QIF line for this field by adding the value to the record with the field being resolved according to our marker and the record type it should be applied to
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
line
|
str
|
the raw QIF line |
required |
record_type
|
str
|
the record type context |
required |
current_record
|
dict
|
the record being built |
required |
Source code in nomina/qif.py
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 | |
resolve(record_type)
get field name based on record type context
Source code in nomina/qif.py
229 230 231 232 | |
SimpleQifParser
a QIF parser
Source code in nomina/qif.py
259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 | |
date_formats()
the date formats of this file: month first when the file declares !Option:MDY (Finanzmanager Deluxe and Quicken exports), else the defaults of DateUtils
Returns:
| Name | Type | Description |
|---|---|---|
list |
Optional[List[str]]
|
the formats or None for the defaults |
Source code in nomina/qif.py
494 495 496 497 498 499 500 501 502 503 504 505 | |
generate_error_report(max_errors_per_type=10)
Generate a detailed error report.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_errors_per_type
|
int
|
Maximum number of errors to show for each error type. |
10
|
Returns:
| Name | Type | Description |
|---|---|---|
str |
A formatted error report. |
Source code in nomina/qif.py
618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 | |
get_lod()
Get a list of dictionaries representing all transactions.
Returns:
| Type | Description |
|---|---|
List[Dict[str, Any]]
|
List[Dict[str, Any]]: A list of dictionaries, each representing a transaction. |
Source code in nomina/qif.py
507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 | |
parse(lines, verbose=False, debug=False)
parse the given list of lines
Source code in nomina/qif.py
335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 | |
parse_file(qif_file, encoding='iso-8859-1', name=None, verbose=False, debug=False)
parse a qif file
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
qif_file
|
str
|
Path to the input QIF file. |
required |
encoding
|
str
|
File encoding. Defaults to 'iso-8859-1'. |
'iso-8859-1'
|
name
|
str
|
name to set if None use the basename of the qif_file |
None
|
verbose
|
bool
|
if True give verbose output |
False
|
debug
|
bool
|
if True show debug output |
False
|
Source code in nomina/qif.py
310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 | |
transaction_summary(transaction)
Helper function to provide a summary of a transaction.
Source code in nomina/qif.py
654 655 656 657 658 659 660 | |
tx_for_record(t)
convert the transaction record
Source code in nomina/qif.py
476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 | |
SplitCategory
dataclass
a Quicken Interchange Format (QIF) Split target
Source code in nomina/qif.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | |
__post_init__()
parse my target string
Source code in nomina/qif.py
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 | |
Transaction
dataclass
Bases: ParseRecord
a single transaction
Source code in nomina/qif.py
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 | |
__post_init__()
extract details
Source code in nomina/qif.py
143 144 145 146 147 148 149 150 | |
normalize(date_formats=None)
Normalize the transaction data, converting string amounts to floats.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
date_formats
|
Optional[List[str]]
|
the date formats to try, e.g. month first for !Option:MDY files |
None
|
Source code in nomina/qif.py
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | |
total_split_amount()
Calculate the total amount for split transactions.
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The sum of all split amounts. |
Source code in nomina/qif.py
197 198 199 200 201 202 203 204 | |
qif_ledger
Created on 2024-10-04
@author: wf
QifToLedgerConverter
Bases: BaseToLedgerConverter
Convert Quicken QIF file to a Ledger Book.
Source code in nomina/qif_ledger.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 | |
__init__(debug=False, vat_codes=None)
Constructor for QIF to Ledger Book conversion.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
debug
|
bool
|
Whether to enable debug logging. |
False
|
vat_codes
|
VatCodes
|
the VAT code map, None for the default map |
None
|
Source code in nomina/qif_ledger.py
21 22 23 24 25 26 27 28 29 30 31 | |
add_split(qt, ledger_book, amount, split_category, memo, negative=False)
Helper method to add a split for a given split category
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
qt(QifTransaction)
|
the QIF transaction the split is for |
required | |
ledger_book
|
Book
|
The ledger book containing accounts. |
required |
amount
|
float
|
The amount for the split. |
required |
split_category
|
SplitCategory
|
The split category. |
required |
memo
|
str
|
The memo for the split. |
required |
negative(bool)
|
if True the amount should be negated |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Split |
Split
|
The created Split object. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the target is not found in the ledger book. |
Source code in nomina/qif_ledger.py
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | |
calc_splits(qt, ledger_book)
Create the debit and credit splits for a QIF transaction.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
qt
|
Transaction
|
The QIF transaction object containing transaction details. |
required |
ledger_book
|
Book
|
The ledger book containing accounts. |
required |
Returns:
| Type | Description |
|---|---|
List[Split]
|
List[Split]: A list of splits for the transaction. |
Source code in nomina/qif_ledger.py
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 | |
convert_to_target()
Convert the QIF content to a Ledger Book.
Returns:
| Name | Type | Description |
|---|---|---|
Book |
Book
|
A ledger book containing accounts and transactions. |
Source code in nomina/qif_ledger.py
261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 | |
create_account_lookup(ledger_book)
Create a lookup of account names to Account objects from the QIF data.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
ledger_book
|
Book
|
The ledger book to populate with accounts to use |
required |
Source code in nomina/qif_ledger.py
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | |
load(input_path)
Load the content from the input stream.
Source code in nomina/qif_ledger.py
56 57 58 59 60 61 62 | |
to_text()
Convert the target Ledger Book to YAML text.
Source code in nomina/qif_ledger.py
68 69 70 71 72 | |
vat_code_for(qt, split_class)
get the VAT code for the given split class
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
qt(QifTransaction)
|
the QIF transaction the split is for |
required | |
split_class(str)
|
the class markup of the split e.g. _VATCode_N1_I |
required |
Returns:
| Type | Description |
|---|---|
Optional[str]
|
Optional[str]: the VAT code with direction e.g. N1_I or None if the class is no VAT code |
Source code in nomina/qif_ledger.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 | |
stats
Created on 2024-10-06
@author: wf
Stats
Ledger statistics
Source code in nomina/stats.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | |
main_currency()
Determine the main currency used in the ledger.
Returns:
| Type | Description |
|---|---|
Optional[str]
|
Optional[str]: The currency with the highest count, or None if no currencies are present. |
Source code in nomina/stats.py
53 54 55 56 57 58 59 60 61 62 | |
vat_codes
Created on 2026-10-19
@author: wf
VAT codes as found in Finanzmanager Deluxe QIF exports, see issue #16
VatCode
a VAT code e.g. N1 with its rates
Source code in nomina/vat_codes.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | |
rate_for(isodate)
get the rate valid at the given ISO date
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
isodate
|
Optional[str]
|
the ISO date to check, None for the first rate |
required |
Returns:
| Type | Description |
|---|---|
Optional[VatRate]
|
Optional[VatRate]: the matching rate or None |
Source code in nomina/vat_codes.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | |
VatCodes
configurable map of VAT codes
Source code in nomina/vat_codes.py
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | |
default_path()
classmethod
get the path of the default VAT code map
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
the path of vat_codes.yaml in nomina_examples |
Source code in nomina/vat_codes.py
79 80 81 82 83 84 85 86 87 88 89 90 91 | |
lookup(code)
lookup the given VAT code
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
code
|
str
|
the code e.g. N1 |
required |
Returns:
| Type | Description |
|---|---|
Optional[VatCode]
|
Optional[VatCode]: the VAT code or None if unknown |
Source code in nomina/vat_codes.py
127 128 129 130 131 132 133 134 135 136 137 138 | |
of_yaml(yaml_path=None)
classmethod
load the VAT codes
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
yaml_path
|
Optional[str]
|
the path of the yaml file, None for the default map |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
VatCodes |
VatCodes
|
the loaded VAT code map |
Source code in nomina/vat_codes.py
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | |
parse(markup)
classmethod
parse the given QIF class markup
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
markup
|
Optional[str]
|
the class markup e.g. _VATCode_N1_I |
required |
Returns:
| Type | Description |
|---|---|
Optional[Tuple[str, str]]
|
Optional[Tuple[str, str]]: code and direction or None if the markup is no VAT code |
Source code in nomina/vat_codes.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | |
VatRate
a VAT rate with its validity period
Source code in nomina/vat_codes.py
17 18 19 20 21 22 23 24 25 | |
version
Created on 2024-10-06 @author: wf
Version
dataclass
Bases: object
Version handling for MoneyBrowser
Source code in nomina/version.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | |
webserver
Created on 2024-10-06
@author: wf
NominaSolution
Bases: InputWebSolution
the Nomina solution
Source code in nomina/webserver.py
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | |
__init__(webserver, client)
Initialize the solution
Calls the constructor of the base solution Args: webserver (NiceScadWebServer): The webserver instance associated with this context. client (Client): The client instance this context is associated with.
Source code in nomina/webserver.py
67 68 69 70 71 72 73 74 75 76 77 78 79 | |
configure_menu()
configure additional non-standard menu entries
Source code in nomina/webserver.py
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | |
home()
async
Home screen
Source code in nomina/webserver.py
135 136 137 138 139 140 141 | |
prepare_ui()
prepare the user interface
Source code in nomina/webserver.py
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 | |
read_and_optionally_render(input_str, with_render=False)
async
Reads the given input and optionally renders the given input
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_str
|
str
|
The input string representing a URL or local file. |
required |
with_render(bool)
|
if True also render |
required |
Source code in nomina/webserver.py
100 101 102 103 104 105 106 107 108 109 | |
show_ui()
show the ui
Source code in nomina/webserver.py
127 128 129 130 131 132 133 | |
NominaWebServer
Bases: InputWebserver
Nomina Webserver
Source code in nomina/webserver.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | |
__init__()
Constructs all the necessary attributes for the WebServer object.
Source code in nomina/webserver.py
35 36 37 | |
configure_run()
configure things before the server rung
Source code in nomina/webserver.py
39 40 41 42 43 44 45 46 47 48 49 50 51 52 | |