├── .gitignore ├── Dockerfile ├── LICENSE ├── README.md ├── data ├── accounts.bean ├── accounts.gen.bean ├── accounts_config.yml ├── beancount_import_data │ ├── monzo │ │ └── .gitkeep │ ├── revolut_eur │ │ └── .gitkeep │ ├── revolut_gbp │ │ └── .gitkeep │ ├── revolut_usd │ │ └── .gitkeep │ ├── wise_eur │ │ └── .gitkeep │ ├── wise_gbp │ │ └── .gitkeep │ └── wise_usd │ │ └── .gitkeep ├── beancount_import_output │ ├── accounts.bean │ ├── balance_accounts.bean │ ├── ignored.bean │ ├── prices.bean │ └── transactions.bean ├── beangrow-simple.config ├── budgets.bean ├── commodities.bean ├── dashboards.yaml ├── docker-compose.yaml ├── importers_config.yml ├── main.bean ├── manual_totals_tracking.bean ├── manual_transactions.bean ├── prices.bean ├── prices │ └── prices-2024-01-03.gen.bean ├── prices_config.yml └── totals │ └── .gitkeep ├── example_data ├── accounts.bean ├── accounts.gen.bean ├── accounts_config.yml ├── beancount_import_data │ ├── binance │ │ └── example-binance.csv │ ├── ibkr │ │ └── example-beancount.xml │ ├── monzo │ │ └── .gitkeep │ ├── revolut_eur │ │ └── .gitkeep │ ├── revolut_gbp │ │ └── .gitkeep │ ├── revolut_usd │ │ └── .gitkeep │ ├── wise_eur │ │ └── .gitkeep │ ├── wise_gbp │ │ └── .gitkeep │ └── wise_usd │ │ └── .gitkeep ├── beancount_import_output │ ├── accounts.bean │ ├── balance_accounts.bean │ ├── ignored.bean │ ├── prices.bean │ └── transactions.bean ├── beangrow.config ├── budgets.bean ├── commodities.bean ├── dashboards.yaml ├── docker-compose.yaml ├── filter_map.bean ├── importers_config.yml ├── main.bean ├── manual_transactions.bean ├── prices │ ├── prices-2023-12-02.gen.bean │ ├── prices-2024-01-02.gen.bean │ ├── prices-2024-02-02.gen.bean │ ├── prices-2024-02-20.gen.bean │ ├── prices-2024-03-02.gen.bean │ ├── prices-2024-04-02.gen.bean │ ├── prices-2024-04-11.gen.bean │ ├── prices-2024-05-02.gen.bean │ ├── prices-2024-06-02.gen.bean │ ├── prices-2024-06-17.gen.bean │ ├── prices-2024-08-01.gen.bean │ └── prices-2024-08-19.gen.bean ├── prices_config.yml ├── regular_postings_fix.bean └── totals │ ├── initial.gen.bean │ ├── update-2024-01-03.gen.bean │ ├── update-2024-02-03.gen.bean │ ├── update-2024-03-03.gen.bean │ └── update-2024-04-03.gen.bean ├── gen_accounts.py ├── images ├── beancount_import_interface.png ├── config_accounts.png ├── dashboards_sankey.png ├── demo_dashboard.png ├── demo_dashboard_0_3_5.png ├── demo_expenses.png ├── expenses_detailed.png ├── expenses_heatmap.png ├── logo.png ├── net_worth_with_title.png ├── prices_page.png └── totals_example.png ├── lazy_beancount.sh ├── lazy_beancount_podman.sh ├── requirements.txt ├── run_daemons.sh └── streamlit_frontend ├── .streamlit └── config.toml └── frontend.py /.gitignore: -------------------------------------------------------------------------------- 1 | *.DS_Store 2 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3.12.3-slim 2 | 3 | ENV PATH="/opt/venv/bin:$PATH" 4 | ENV PYTHONUNBUFFERED=1 5 | 6 | ENV LAZY_BEANCOUNT_HOST="localhost" 7 | ENV LAZY_BEANCOUNT_PORT="8777" 8 | ENV BEANCOUNT_IMPORT_PORT="8101" 9 | ENV FAVA_PORT="5003" 10 | ENV FAVA_PORT_INTERNAL="5000" 11 | 12 | RUN adduser --uid 1245 beancount-user \ 13 | && apt-get update \ 14 | && apt-get install -y git dumb-init \ 15 | && apt-get clean \ 16 | && apt-get autoclean \ 17 | && apt-get autoremove --purge -y \ 18 | && rm -rf /var/lib/apt/lists/* 19 | COPY ./requirements.txt /tmp/requirements.txt 20 | RUN python -m venv /opt/venv \ 21 | && pip3 install --no-cache-dir -r /tmp/requirements.txt 22 | 23 | ENV PYTHONPATH="/beancount:/beancount/beangulp:$PYTHONPATH" 24 | ENV PATH="/beancount/:$PATH" 25 | 26 | COPY gen_accounts.py /beancount/gen_accounts.py 27 | COPY streamlit_frontend /beancount/streamlit_frontend 28 | COPY run_daemons.sh /beancount/run_daemons.sh 29 | 30 | WORKDIR /workspace 31 | USER beancount-user 32 | 33 | ENTRYPOINT ["/usr/bin/dumb-init", "--"] 34 | CMD [ "/beancount/run_daemons.sh" ] -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | , 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | ### [Lazy Beancount](https://lazy-beancount.xyz/) 4 | 5 | [![License: GPL v2](https://img.shields.io/badge/License-GPL%20v2-blue.svg)](LICENSE) 6 | [![Docker Image Version](https://img.shields.io/docker/v/vandereer/lazy-beancount?color=goldenrod)](https://github.com/Evernight/lazy-beancount/releases) 7 | [![Docker Pulls](https://img.shields.io/docker/pulls/vandereer/lazy-beancount?color=silver)](https://hub.docker.com/r/vandereer/lazy-beancount) 8 | 9 | 10 | Lazy Beancount is [Beancount](https://github.com/beancount/beancount) accounting system packaged in Docker with batteries included: 11 | 12 | - [Fava](https://github.com/beancount/fava) with [fava-dashboards](https://github.com/andreasgerstmayr/fava-dashboards) 13 | - [Beancount-import](https://github.com/jbms/beancount-import) for automatic transaction categorisation and review UI: 14 | - Importers set up to work out of the box: 15 | - Wise, Monzo, Revolut, IBKR ([Evernight/beancount-importers](https://github.com/Evernight/beancount-importers), [uabean](https://github.com/OSadovy/uabean/)) 16 | - more importers can be integrated/enabled on request 17 | - configuration for multiple accounts via YAML config file 18 | - UI for statement file upload 19 | - Additional web interfaces ([Streamlit](https://github.com/streamlit/streamlit)-based) for: 20 | - regularly providing total values of the accounts for automatic balancing 21 | - fetching currency rates / commodity prices 22 | - Pre-installed plugins: 23 | - collections: 24 | - [beancount-lazy-plugins](https://github.com/Evernight/beancount-lazy-plugins) ([valuation](https://github.com/Evernight/beancount-lazy-plugins?tab=readme-ov-file#valuation), [filter_map](https://github.com/Evernight/beancount-lazy-plugins?tab=readme-ov-file#filter_map), [group_pad_transactions](https://github.com/Evernight/beancount-lazy-plugins?tab=readme-ov-file#group_pad_transactions)) 25 | - [beancount_reds_plugins](https://github.com/redstreet/beancount_reds_plugins/tree/main/beancount_reds_plugins) ([rename_accounts](https://github.com/redstreet/beancount_reds_plugins/tree/main/beancount_reds_plugins/rename_accounts), [effective_date](https://github.com/redstreet/beancount_reds_plugins/tree/main/beancount_reds_plugins/effective_date), and more), 26 | - [autobean](https://github.com/SEIAROTg/autobean/tree/master/autobean/) ([stock_split](https://github.com/SEIAROTg/autobean/tree/master/autobean/stock_split), [share](https://github.com/SEIAROTg/autobean/tree/master/autobean/share), and more) 27 | - large plugins: [fava-dashboards](https://github.com/andreasgerstmayr/fava-dashboards), [fava-portfolio-returns](https://github.com/andreasgerstmayr/fava-portfolio-returns), [fava_investor](https://github.com/redstreet/fava_investor) 28 | - smaller ones: [beancount_share](https://github.com/Akuukis/beancount_share), [beancount_interpolate](https://github.com/Akuukis/beancount_interpolate), [generate_base_ccy_prices](https://github.com/tarioch/beancounttools/blob/master/src/tariochbctools/plugins/generate_base_ccy_prices.py) 29 | - Configuration generator allows to define any number of accounts (cash, investments, savings, crypto) 30 | - Multiple currencies and auto-conversions between them 31 | - Extensive configuration example with comments, including common useful shortcuts and solutions to common problems 32 | - All tested together (manually) in a coherent setup 33 | 34 | with the goal to enable **gradual** and **incremental** migration of personal finances into Beancount. 35 | 36 | ![lazy-beancount](images/demo_dashboard_0_3_5.png) 37 | 38 | Full guide is located at https://lazy-beancount.xyz/. The approach follows these principles: 39 | - Some of the values should be tracked precisely (e.g. net worth) 40 | - Other things are an approximation (e.g. in expenses breakdown, unclassified or some misclassified entires are ok) 41 | - Data entry should be automated or easy 42 | - But it should be possible to track things to any level of precision if you choose to 43 | 44 | # Screenshots 45 |

46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 |

55 | 56 | # Setup (docker-compose, recommended) 57 | 58 | git clone https://github.com/Evernight/lazy-beancount 59 | 60 | cd lazy-beancount/example_data 61 | env UID=$(id -u) GID=$(id -g) docker compose up 62 | 63 | This will pull repository with the example and config templates, and also pull and run the latest version of the package from the [Docker Hub](https://hub.docker.com/r/vandereer/lazy-beancount/tags). 64 | After this is done, go to http://localhost:8777/. 65 | 66 | Fava is also available on port 5003, importer interface is available on port 8101 (ports are overridable via config in docker-compose.yml). 67 | 68 | On Mac you can also remove ```user``` parameter from ```docker-compose.yaml``` and just use ```docker compose up``` 69 | 70 | # Setup (docker) 71 | 72 | You can pull image from the public repository: 73 | 74 | docker pull vandereer/lazy-beancount:latest 75 | 76 | or build it yourself: 77 | 78 | git clone https://github.com/Evernight/lazy-beancount 79 | cd lazy-beancount 80 | 81 | docker build . -t vandereer/lazy-beancount:latest 82 | 83 | To start, run: 84 | 85 | ./lazy_beancount.sh example_data 86 | 87 | Use ```./lazy_beancount.sh data``` when you want to start adding your own data under the ```data``` directory. 88 | 89 | Commands are available in the container as: 90 | 91 | docker exec -it lazybean bean-price example_data/main.bean -i --date=2024-01-05 92 | 93 | You can also run container using Podman, via ```lazy_beancount_podman.sh``` script. 94 | 95 | # Setup (local, conda, for development) 96 | 97 | If you want to be able to upgrade individual packages and experiment with other (and your own) plugins or additional importers, you may go down this route. 98 | 99 | First, clone this repository into your desired location 100 | 101 | git clone https://github.com/Evernight/lazy-beancount 102 | cd lazy-beancount 103 | 104 | Install conda 105 | 106 | brew install miniconda 107 | 108 | Then create and activate the environment 109 | 110 | conda create -n lazy-beancount-env python=3.12.3 111 | conda activate lazy-beancount-env 112 | 113 | Install required packages in the environment 114 | 115 | pip3 install -r requirements.txt 116 | 117 | Run Fava on your ledger from the repository folder 118 | 119 | PYTHONPATH=PYTHONPATH:. fava main.bean 120 | 121 | Go to http://127.0.0.1:5000 and explore Fava. 122 | 123 | ## Note 124 | I'd not recommend exposing the ports, various system and data through a public server unless you really know what you're doing. This setup has not been developed and tested for security and authentication when run as a public service. 125 | 126 | # Acknowledgements 127 | This is mostly an integration project and would not have been possible without all of the great code from authors and contributors of all the repositories mentioned above, the Beancount and plain text accounting community. Please support, star and otherwise contribute to respective projects. 128 | 129 | # Similar projects 130 | * [paisa](https://paisa.fyi/) 131 | * [full-fledged-hledger](https://github.com/adept/full-fledged-hledger) 132 | * [hledger-docker](https://github.com/adept/hledger-docker) 133 | 134 | # Feedback and contributions 135 | * Feel free to [create an issue](https://github.com/Evernight/lazy-beancount/issues) or contribute a fix. 136 | * [lazy-beancount.xyz](https://lazy-beancount.xyz/) has giscus connected to enable commenting directly at pages. 137 | * [matrix chat](https://matrix.to/#/#lazy-beancount:matrix.org) for small questions. 138 | -------------------------------------------------------------------------------- /data/accounts.bean: -------------------------------------------------------------------------------- 1 | ; Classified expenses with the level of detalisation that you want 2 | 1970-01-01 open Expenses:EatingOut 3 | 1970-01-01 open Expenses:EatingOut:Coffee 4 | 1970-01-01 open Expenses:EatingOut:Drinks 5 | 1970-01-01 open Expenses:Tips 6 | 1970-01-01 open Expenses:Groceries 7 | 1970-01-01 open Expenses:Groceries:Drinks 8 | 1970-01-01 open Expenses:Groceries:Coffee 9 | 1970-01-01 open Expenses:Shopping 10 | 1970-01-01 open Expenses:Accommodation 11 | 1970-01-01 open Expenses:Bills 12 | 1970-01-01 open Expenses:Bills:Internet 13 | 1970-01-01 open Expenses:Bills:Housing 14 | 1970-01-01 open Expenses:Bills:Phone 15 | 1970-01-01 open Expenses:Bills:Electricity 16 | 1970-01-01 open Expenses:Hobbies 17 | 1970-01-01 open Expenses:Wellness 18 | 1970-01-01 open Expenses:Wellness:Expendables 19 | 1970-01-01 open Expenses:Transport 20 | 1970-01-01 open Expenses:Travel 21 | 1970-01-01 open Expenses:Travel:Flights 22 | 1970-01-01 open Expenses:Travel:Accommodation 23 | 1970-01-01 open Expenses:Travel:Transport 24 | 1970-01-01 open Expenses:Entertainment 25 | 1970-01-01 open Expenses:Donations 26 | 1970-01-01 open Expenses:Services 27 | 1970-01-01 open Expenses:Education 28 | 1970-01-01 open Expenses:Health 29 | 1970-01-01 open Expenses:Taxes 30 | 1970-01-01 open Expenses:Projects 31 | 1970-01-01 open Expenses:Gifts 32 | 1970-01-01 open Expenses:Work 33 | 1970-01-01 open Expenses:Documents 34 | 35 | ; Any long-term loans 36 | 1970-01-01 open Liabilities:Loans 37 | 38 | ; Income 39 | 1970-01-01 open Income:Salary:MyEmployer 40 | 1970-01-01 open Income:SideHustle 41 | 42 | ; Commissions 43 | 1970-01-01 open Expenses:MyStockBroker:Commissions 44 | 1970-01-01 open Expenses:MyCryptoBroker:Commissions 45 | 46 | ; Used for transactions or transaction parts that will be refunded or otheriwse returned soon 47 | 1970-01-01 open Assets:TemporaryHold 48 | 49 | ; for beancount-import 50 | 1970-01-01 open Expenses:FIXME -------------------------------------------------------------------------------- /data/accounts.gen.bean: -------------------------------------------------------------------------------- 1 | ; account Physical:Cash (cash) 2 | 1970-01-01 open Assets:Physical:Cash 3 | 1970-01-01 open Equity:OpeningBalances:Physical:Cash 4 | 1970-01-01 open Income:Unattributed:Physical:Cash 5 | 1970-01-01 open Income:Uncategorized:Physical:Cash 6 | 1970-01-01 open Expenses:Unattributed:Physical:Cash 7 | 1970-01-01 open Expenses:Uncategorized:Physical:Cash 8 | 9 | ; account MyFavouriteBank:Cash (cash) 10 | 1970-01-01 open Assets:MyFavouriteBank:Cash 11 | 1970-01-01 open Equity:OpeningBalances:MyFavouriteBank:Cash 12 | 1970-01-01 open Income:Unattributed:MyFavouriteBank:Cash 13 | 1970-01-01 open Income:Uncategorized:MyFavouriteBank:Cash 14 | 1970-01-01 open Expenses:Unattributed:MyFavouriteBank:Cash 15 | 1970-01-01 open Expenses:Uncategorized:MyFavouriteBank:Cash 16 | 17 | ; account MyFavouriteBank:Savings:GBP (cash) 18 | 1970-01-01 open Assets:MyFavouriteBank:Savings:GBP 19 | 1970-01-01 open Equity:OpeningBalances:MyFavouriteBank:Savings:GBP 20 | 1970-01-01 open Income:Unattributed:MyFavouriteBank:Savings:GBP 21 | 1970-01-01 open Income:Uncategorized:MyFavouriteBank:Savings:GBP 22 | 1970-01-01 open Expenses:Unattributed:MyFavouriteBank:Savings:GBP 23 | 1970-01-01 open Expenses:Uncategorized:MyFavouriteBank:Savings:GBP 24 | 25 | ; account MyLessFavouriteBank:Cash (cash) 26 | 1970-01-01 open Assets:MyLessFavouriteBank:Cash 27 | 1970-01-01 open Equity:OpeningBalances:MyLessFavouriteBank:Cash 28 | 1970-01-01 open Income:Unattributed:MyLessFavouriteBank:Cash 29 | 1970-01-01 open Income:Uncategorized:MyLessFavouriteBank:Cash 30 | 1970-01-01 open Expenses:Unattributed:MyLessFavouriteBank:Cash 31 | 1970-01-01 open Expenses:Uncategorized:MyLessFavouriteBank:Cash 32 | 33 | ; account MyStockBroker:Cash (cash) 34 | 1970-01-01 open Assets:MyStockBroker:Cash 35 | 1970-01-01 open Equity:OpeningBalances:MyStockBroker:Cash 36 | 1970-01-01 open Income:Unattributed:MyStockBroker:Cash 37 | 1970-01-01 open Income:Uncategorized:MyStockBroker:Cash 38 | 1970-01-01 open Expenses:Unattributed:MyStockBroker:Cash 39 | 1970-01-01 open Expenses:Uncategorized:MyStockBroker:Cash 40 | 41 | ; account MyAutomaticBroker:Total (opaque_funds_valuation) 42 | 1970-01-01 open Assets:MyAutomaticBroker:Total "FIFO" 43 | 1970-01-01 open Equity:OpeningBalances:MyAutomaticBroker:Total 44 | 1970-01-01 open Income:MyAutomaticBroker:Total:PnL 45 | 46 | ; account MyStockBroker:SPY (investments) 47 | 1970-01-01 open Assets:MyStockBroker:SPY "LIFO" 48 | 1970-01-01 open Equity:OpeningBalances:MyStockBroker:SPY 49 | 50 | ; account MyStockBroker:XVV (investments) 51 | 1970-01-01 open Assets:MyStockBroker:XVV 52 | 1970-01-01 open Equity:OpeningBalances:MyStockBroker:XVV 53 | 54 | ; account MyCryptoBroker:ETH (investments) 55 | 1970-01-01 open Assets:MyCryptoBroker:ETH 56 | 1970-01-01 open Equity:OpeningBalances:MyCryptoBroker:ETH 57 | 58 | ; account Shared:Unspecified (liabilities) 59 | 1970-01-01 open Liabilities:Shared:Unspecified 60 | 1970-01-01 open Equity:OpeningBalances:Shared:Unspecified 61 | 1970-01-01 open Expenses:Unattributed:Shared:Unspecified 62 | 63 | ; account Shared:SomeDude (liabilities) 64 | 1970-01-01 open Liabilities:Shared:SomeDude 65 | 1970-01-01 open Equity:OpeningBalances:Shared:SomeDude 66 | 1970-01-01 open Expenses:Unattributed:Shared:SomeDude 67 | 68 | -------------------------------------------------------------------------------- /data/accounts_config.yml: -------------------------------------------------------------------------------- 1 | # Use the date from which you want to start tracking values of the accounts 2 | opening_balances_date: "2023-12-01" 3 | 4 | # Following are the groups of accounts of various types 5 | # The configuration is defined in tree-like structure, the names of accounts 6 | # will be built traversing down to the leaves(e.g. Assets:Physical:Cash) 7 | # If the leaf node (can be a dict or str) doesn't have a 'currencies' key, its 8 | # name will be treated as a currency (e.g. Assets:MyFavouriteBank:Savings:GBP) 9 | 10 | # booking_method is an optional configuration, see 11 | # https://beancount.github.io/docs/how_inventories_work.html#per-account-booking-method 12 | # it's recommended for the opaque funds or investments where you don't care about 13 | # specific lots traded explicitly or don't have access to this information 14 | 15 | # Accounts holding cash values 16 | cash: 17 | - Physical: 18 | - Cash: 19 | currencies: [USD, GBP, EUR] 20 | 21 | - MyFavouriteBank: 22 | - Cash: 23 | currencies: [GBP] 24 | - Savings: 25 | - GBP 26 | 27 | - MyLessFavouriteBank: 28 | - Cash: 29 | currencies: [GBP] 30 | 31 | - MyStockBroker: 32 | - Cash: 33 | currencies: [USD] 34 | 35 | # Funds where you can only track total value converted to currency and not 36 | # specific stocks (see https://github.com/Evernight/beancount-valuation) 37 | opaque_funds_valuation: 38 | - MyAutomaticBroker: 39 | - Total: 40 | currencies: [USD] 41 | booking_method: FIFO 42 | 43 | # Accounts holding investments (stocks, crypto, funds, etc) 44 | investments: 45 | - MyStockBroker: 46 | - SPY: 47 | booking_method: LIFO 48 | - XVV 49 | 50 | - MyCryptoBroker: 51 | - ETH 52 | 53 | # Liabilities accounts 54 | liabilities: 55 | - Shared: 56 | - Unspecified: 57 | currencies: [USD] 58 | 59 | - SomeDude: 60 | currencies: [USD] 61 | -------------------------------------------------------------------------------- /data/beancount_import_data/monzo/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Evernight/lazy-beancount/75502272d56ee1248782bb75e0067551f8c6a485/data/beancount_import_data/monzo/.gitkeep -------------------------------------------------------------------------------- /data/beancount_import_data/revolut_eur/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Evernight/lazy-beancount/75502272d56ee1248782bb75e0067551f8c6a485/data/beancount_import_data/revolut_eur/.gitkeep -------------------------------------------------------------------------------- /data/beancount_import_data/revolut_gbp/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Evernight/lazy-beancount/75502272d56ee1248782bb75e0067551f8c6a485/data/beancount_import_data/revolut_gbp/.gitkeep -------------------------------------------------------------------------------- /data/beancount_import_data/revolut_usd/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Evernight/lazy-beancount/75502272d56ee1248782bb75e0067551f8c6a485/data/beancount_import_data/revolut_usd/.gitkeep -------------------------------------------------------------------------------- /data/beancount_import_data/wise_eur/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Evernight/lazy-beancount/75502272d56ee1248782bb75e0067551f8c6a485/data/beancount_import_data/wise_eur/.gitkeep -------------------------------------------------------------------------------- /data/beancount_import_data/wise_gbp/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Evernight/lazy-beancount/75502272d56ee1248782bb75e0067551f8c6a485/data/beancount_import_data/wise_gbp/.gitkeep -------------------------------------------------------------------------------- /data/beancount_import_data/wise_usd/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Evernight/lazy-beancount/75502272d56ee1248782bb75e0067551f8c6a485/data/beancount_import_data/wise_usd/.gitkeep -------------------------------------------------------------------------------- /data/beancount_import_output/accounts.bean: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Evernight/lazy-beancount/75502272d56ee1248782bb75e0067551f8c6a485/data/beancount_import_output/accounts.bean -------------------------------------------------------------------------------- /data/beancount_import_output/balance_accounts.bean: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Evernight/lazy-beancount/75502272d56ee1248782bb75e0067551f8c6a485/data/beancount_import_output/balance_accounts.bean -------------------------------------------------------------------------------- /data/beancount_import_output/ignored.bean: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Evernight/lazy-beancount/75502272d56ee1248782bb75e0067551f8c6a485/data/beancount_import_output/ignored.bean -------------------------------------------------------------------------------- /data/beancount_import_output/prices.bean: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Evernight/lazy-beancount/75502272d56ee1248782bb75e0067551f8c6a485/data/beancount_import_output/prices.bean -------------------------------------------------------------------------------- /data/beancount_import_output/transactions.bean: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Evernight/lazy-beancount/75502272d56ee1248782bb75e0067551f8c6a485/data/beancount_import_output/transactions.bean -------------------------------------------------------------------------------- /data/beangrow-simple.config: -------------------------------------------------------------------------------- 1 | investments { 2 | } 3 | groups { 4 | } 5 | 6 | -------------------------------------------------------------------------------- /data/budgets.bean: -------------------------------------------------------------------------------- 1 | ; add your budget limitations here 2 | ; 2024-01-01 custom "budget" Expenses:EatingOut "monthly" 300.00 USD 3 | -------------------------------------------------------------------------------- /data/commodities.bean: -------------------------------------------------------------------------------- 1 | ; Asset allocation: 2 | ; https://github.com/redstreet/fava_investor/tree/main/fava_investor/modules/assetalloc_class#readme 3 | 4 | 1970-01-01 commodity GBP 5 | price: "USD:yahoo/GBPUSD=X" 6 | asset_class: "currency" 7 | 8 | 1970-01-01 commodity USD 9 | price: "GBP:yahoo/USDGBP=X" 10 | asset_class: "currency" 11 | 12 | 1970-01-01 commodity EUR 13 | price: "USD:yahoo/EURUSD=X" 14 | asset_class: "currency" 15 | 16 | 1970-01-01 commodity ETH 17 | price: "GBP:yahoo/ETH-GBP" 18 | asset_class: "crypto" 19 | asset_allocation_crypto: 100 20 | 21 | -------------------------------------------------------------------------------- /data/docker-compose.yaml: -------------------------------------------------------------------------------- 1 | version: '1.0' 2 | services: 3 | lazybean: 4 | image: vandereer/lazy-beancount:latest 5 | # default values are valid for Mac setup, but prefer to run with 6 | # env UID=$(id -u) GID=$(id -g) docker compose up 7 | user: "${UID:-501}:${GID:-20}" 8 | ports: 9 | - "5003:5000" 10 | - "8101:8101" 11 | - "8777:8501" 12 | volumes: 13 | - .:/workspace 14 | environment: 15 | - FAVA_PORT=5003 16 | - BEANCOUNT_IMPORT_PORT=8101 17 | - LAZY_BEANCOUNT_HOST=localhost 18 | - LAZY_BEANCOUNT_PORT=8777 19 | - MPLCONFIGDIR=/tmp/matplotlib-temp 20 | -------------------------------------------------------------------------------- /data/importers_config.yml: -------------------------------------------------------------------------------- 1 | importers: 2 | # Importer key also corresponds to the subdirectory in the beancount_import_data 3 | # directory where the csv files will be looked up 4 | # Possible "importer" values are "monzo", "revolut" and "wise" 5 | # You can use different accounts for different directories 6 | monzo: 7 | importer: monzo 8 | account: Assets:Monzo:Cash 9 | currency: GBP 10 | params: 11 | # This will ignore Monzo's automatic categories. At some point beancount-import predictions will be better 12 | # so you may want to enable it 13 | ignore_bank_categories: False 14 | revolut_eur: 15 | importer: revolut 16 | account: Assets:Revolut:Cash 17 | currency: EUR 18 | revolut_gbp: 19 | importer: revolut 20 | account: Assets:Revolut:Cash 21 | currency: GBP 22 | revolut_usd: 23 | importer: revolut 24 | account: Assets:Revolut:Cash 25 | currency: USD 26 | wise_eur: 27 | importer: wise 28 | account: Assets:Wise:Cash 29 | currency: EUR 30 | wise_gbp: 31 | importer: wise 32 | account: Assets:Wise:Cash 33 | currency: GBP 34 | wise_usd: 35 | importer: wise 36 | account: Assets:Wise:Cash 37 | currency: USD -------------------------------------------------------------------------------- /data/main.bean: -------------------------------------------------------------------------------- 1 | * Beancount configuration 2 | ; See https://github.com/beancount/beancount/issues/742 3 | ; This is required for the beancount_interpolate and beancount_share plugins 4 | ; to work together with pad directives 5 | option "plugin_processing_mode" "raw" 6 | 7 | * Operating currencies 8 | ** All and default definitions 9 | ; Define all currencies that you want to be able to use as operating currency 10 | ; First of these will be used as the currency for Dashboards 11 | option "operating_currency" "EUR" 12 | option "operating_currency" "USD" 13 | option "operating_currency" "GBP" 14 | 15 | ** Precision options 16 | ; See https://beancount.github.io/docs/precision_tolerances.html 17 | ; and https://beancount.github.io/docs/rounding_precision_in_beancount.html 18 | option "inferred_tolerance_default" "*:0.00000001" 19 | option "inferred_tolerance_default" "USD:0.003" 20 | option "inferred_tolerance_default" "GBP:0.003" 21 | 22 | option "inferred_tolerance_multiplier" "1.2" 23 | 24 | ** Other settings 25 | plugin "beancount.ops.documents" 26 | 27 | ; Define folder where the documents are stored 28 | ; option "documents" "documents" 29 | 30 | * Fava options 31 | ** Other Fava options 32 | 1970-01-01 custom "fava-option" "default-file" "manual_transactions.bean" 33 | 34 | ; You can switch default interface language if needed 35 | ; 2021-01-01 custom "fava-option" "language" "en" 36 | 37 | ; I've had this enabled for a while but then found that it's actually not more but 38 | ; less intuitive once you get used to standard Beancount conventions 39 | ; 1970-01-01 custom "fava-option" "invert-income-liabilities-equity" "True" 40 | 41 | ** Default page 42 | ; Redefine default starting page when you go to the Fava host (localhost by default) 43 | 1970-01-01 custom "fava-option" "default-page" "extension/FavaDashboards/?dashboard=0" 44 | 45 | ** Sidebar links 46 | ; A set of useful shortcut links for the Fava's menu (left side) 47 | 1970-01-01 custom "fava-sidebar-link" "💸 Expenses" "/beancount/extension/FavaDashboards/?dashboard=4&conversion=USD&time=month" 48 | 1970-01-01 custom "fava-sidebar-link" "📅 Subscriptions" "/beancount/extension/FavaDashboards/?dashboard=8&conversion=USD" 49 | 1970-01-01 custom "fava-sidebar-link" "🚥 Budgets" "/beancount/account/Expenses/?r=changes&conversion=USD" 50 | 1970-01-01 custom "fava-sidebar-link" "📜 M-3 to day" "/beancount/journal/?time=month-3+to+day" 51 | 1970-01-01 custom "fava-sidebar-link" "📜 #fix" "/beancount/journal/?filter=%23fix" 52 | 1970-01-01 custom "fava-sidebar-link" "🔁 Reset filters" ".?" 53 | 54 | ** Filter presets 55 | 1970-01-01 custom "fava-filter-preset" "time" "month" "month" 56 | 1970-01-01 custom "fava-filter-preset" "time" "month-1" "month-1" 57 | 1970-01-01 custom "fava-filter-preset" "time" "day-89 to day" "quarter" 58 | 1970-01-01 custom "fava-filter-preset" "time" "day-365 to day" "year" 59 | 1970-01-01 custom "fava-filter-preset" "time" "year-2 to year" "3Y" 60 | 1970-01-01 custom "fava-filter-preset" "time" "year-4 to year" "5Y" 61 | 1970-01-01 custom "fava-filter-preset" "advanced" "#recurring" "#recurring" 62 | 1970-01-01 custom "fava-filter-preset" "advanced" "-#irregular" "-#irregular" 63 | 1970-01-01 custom "fava-filter-preset" "advanced" "-any(account:'Expenses:Taxes')" "-Expenses:Taxes" 64 | 1970-01-01 custom "fava-filter-preset" "advanced" "-any(account:'Expenses:Unattributed')" "-Expenses:Unattributed" 65 | 66 | ** Fava extensions 67 | ; Dashboards are a great feature that may partially work from the start 68 | ; May need some configuration and fine-tuning via dashboards.yaml 69 | 2010-01-01 custom "fava-extension" "fava_dashboards" 70 | 71 | ; Track portfolios' performance 72 | 2024-01-01 custom "fava-extension" "fava_portfolio_returns" "{ 73 | 'beangrow_config': 'beangrow.config', 74 | }" 75 | 76 | ; Investing tools 77 | 2010-01-01 custom "fava-extension" "fava_investor" "{}" 78 | 79 | * Includes 80 | ; Lazy Beancount: accounts generated from accounts_config.yml 81 | include "accounts.gen.bean" 82 | 83 | ; File where the rest of accounts are defined (manually) 84 | include "accounts.bean" 85 | ; File where commodities are defined 86 | include "commodities.bean" 87 | 88 | ; (example/deprecated) Include all files from archive//.bean 89 | ; include "archive/*/*.bean" 90 | 91 | ; Lazy Beancount: include generated files from Totals 92 | include "totals/*.bean" 93 | 94 | ; Lazy Beancount: include fetched prices 95 | include "prices/*.bean" 96 | 97 | ; File to track transactions manually 98 | include "manual_transactions.bean" 99 | 100 | ; Budget definitions 101 | include "budgets.bean" 102 | 103 | ; Import files generated using beancount-import 104 | include "beancount_import_output/transactions.bean" 105 | include "beancount_import_output/balance_accounts.bean" 106 | 107 | * Plugins 108 | ** Valuation plugin 109 | ; Configure accounts that have opaque changes in value 110 | plugin "beancount_lazy_plugins.valuation" 111 | 1970-01-01 custom "valuation" "config" 112 | account: "Assets:MyAutomaticBroker:Total" 113 | currency: "AUTO_BROKER_USD" 114 | pnlAccount: "Assets:MyAutomaticBroker:Total:PnL" 115 | 116 | ** Autogenerating prices 117 | ; Generate implicit prices from costs 118 | ; It's better to place it before beancount_generate_base_ccy_prices so that transitive conversions may happen 119 | plugin "beancount.plugins.implicit_prices" 120 | 121 | ; https://github.com/tarioch/beancounttools/ 122 | ; Generate indirect prices for the current main currency 123 | plugin "beancount_generate_base_ccy_prices.generate_base_ccy_prices" "EUR" 124 | plugin "beancount_generate_base_ccy_prices.generate_base_ccy_prices" "USD" 125 | plugin "beancount_generate_base_ccy_prices.generate_base_ccy_prices" "GBP" 126 | 127 | ** Shared expenses 128 | ; Plugin to share expenses 129 | plugin "beancount_share.share" "{ 130 | 'mark_name': 'share', 131 | 'meta_name': 'shared', 132 | 'open_date': None, 133 | 'account_debtors': 'Liabilities:Shared', 134 | 'account_creditors': 'Liabilities:Shared', 135 | }" 136 | 137 | ; Some hacky fix for dashboards to work properly. 138 | ; At least one transaction per month needs to be present to display historical chart 139 | ; include "regular_postings_fix.bean" 140 | 141 | ; See https://github.com/beancount/beancount/issues/742 142 | ; This is required for the beancount_interpolate and beancount_share plugins 143 | ; to work together with pad directives 144 | plugin "beancount.ops.pad" 145 | plugin "beancount.ops.balance" 146 | 147 | ; Should be included after beancount.ops.pad 148 | plugin "beancount_lazy_plugins.group_pad_transactions" 149 | 150 | ; Comes after almost everything but before the split plugin (it's used in some examples) 151 | plugin "beancount_lazy_plugins.filter_map" 152 | ; include "filter_map.bean" 153 | 154 | ; Run beancount_interpolate after pad/balance generation as these plugins are mostly 155 | ; used for cleaner graphs but we don't want to alter underlying source of truth 156 | ; data too much. 157 | ; You may choose to disable split plugin in some cases, if you want more precise 158 | ; actual data rather than more convenient view on Expenses 159 | plugin "beancount_interpolate.recur" 160 | plugin "beancount_interpolate.split" 161 | 162 | ; May cause some errors to go unnoticed but also may be helpful while testing various naming options 163 | ;plugin "beancount.plugins.auto_accounts" -------------------------------------------------------------------------------- /data/manual_totals_tracking.bean: -------------------------------------------------------------------------------- 1 | ; Add your data here -------------------------------------------------------------------------------- /data/manual_transactions.bean: -------------------------------------------------------------------------------- 1 | ; Add your data here -------------------------------------------------------------------------------- /data/prices.bean: -------------------------------------------------------------------------------- 1 | ; Fetch your data here -------------------------------------------------------------------------------- /data/prices/prices-2024-01-03.gen.bean: -------------------------------------------------------------------------------- 1 | 2024-01-03 price ETH 1866.28186035 GBP 2 | 2024-01-03 price EUR 1.09417570 USD 3 | 2024-01-03 price GBP 1.26230741 USD 4 | 2024-01-03 price USD 0.79220003 GBP 5 | -------------------------------------------------------------------------------- /data/prices_config.yml: -------------------------------------------------------------------------------- 1 | commodities: [] 2 | -------------------------------------------------------------------------------- /data/totals/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Evernight/lazy-beancount/75502272d56ee1248782bb75e0067551f8c6a485/data/totals/.gitkeep -------------------------------------------------------------------------------- /example_data/accounts.bean: -------------------------------------------------------------------------------- 1 | ; Classified expenses with the level of detalisation that you want 2 | 1970-01-01 open Expenses:EatingOut 3 | 1970-01-01 open Expenses:EatingOut:Coffee 4 | 1970-01-01 open Expenses:EatingOut:Drinks 5 | 1970-01-01 open Expenses:Tips 6 | 1970-01-01 open Expenses:Groceries 7 | 1970-01-01 open Expenses:Groceries:Drinks 8 | 1970-01-01 open Expenses:Groceries:Coffee 9 | 1970-01-01 open Expenses:Shopping 10 | 1970-01-01 open Expenses:Accommodation 11 | 1970-01-01 open Expenses:Bills 12 | 1970-01-01 open Expenses:Bills:Internet 13 | 1970-01-01 open Expenses:Bills:Housing 14 | 1970-01-01 open Expenses:Bills:Phone 15 | 1970-01-01 open Expenses:Bills:Electricity 16 | 1970-01-01 open Expenses:Hobbies 17 | 1970-01-01 open Expenses:Wellness 18 | 1970-01-01 open Expenses:Wellness:Expendables 19 | 1970-01-01 open Expenses:Transport 20 | 1970-01-01 open Expenses:Travel 21 | 1970-01-01 open Expenses:Travel:Flights 22 | 1970-01-01 open Expenses:Travel:Accommodation 23 | 1970-01-01 open Expenses:Travel:Transport 24 | 1970-01-01 open Expenses:Entertainment 25 | 1970-01-01 open Expenses:Donations 26 | 1970-01-01 open Expenses:Services 27 | 1970-01-01 open Expenses:Education 28 | 1970-01-01 open Expenses:Health 29 | 1970-01-01 open Expenses:Taxes 30 | 1970-01-01 open Expenses:Projects 31 | 1970-01-01 open Expenses:Gifts 32 | 1970-01-01 open Expenses:Work 33 | 1970-01-01 open Expenses:Documents 34 | 35 | ; Any long-term loans 36 | 1970-01-01 open Liabilities:Loans 37 | 38 | ; ; Income 39 | 1970-01-01 open Income:Salary:MyEmployer 40 | 1970-01-01 open Income:SideHustle 41 | 1970-01-01 open Income:MyStockBroker:PnL 42 | 1970-01-01 open Income:MyCryptoBroker:PnL 43 | 44 | ; Commissions 45 | 1970-01-01 open Expenses:MyStockBroker:Commissions 46 | 1970-01-01 open Expenses:MyCryptoBroker:Commissions 47 | 48 | ; Used for transactions or transaction parts that will be refunded or otheriwse returned soon 49 | 1970-01-01 open Assets:TemporaryHold 50 | 51 | 1970-01-01 open Equity:TechnicalPurposes 52 | 1970-01-01 open Assets:MyAutomaticBroker:RegularFix 53 | 1970-01-01 open Assets:MyStockBroker:RegularFix 54 | 55 | ; for beancount-import 56 | 1970-01-01 open Expenses:FIXME -------------------------------------------------------------------------------- /example_data/accounts.gen.bean: -------------------------------------------------------------------------------- 1 | ; account Physical:Cash (cash) 2 | 1970-01-01 open Assets:Physical:Cash 3 | 1970-01-01 open Equity:OpeningBalances:Physical:Cash 4 | 1970-01-01 open Income:Unattributed:Physical:Cash 5 | 1970-01-01 open Income:Uncategorized:Physical:Cash 6 | 1970-01-01 open Expenses:Unattributed:Physical:Cash 7 | 1970-01-01 open Expenses:Uncategorized:Physical:Cash 8 | 9 | ; account MyFavouriteBank:Cash (cash) 10 | 1970-01-01 open Assets:MyFavouriteBank:Cash 11 | 1970-01-01 open Equity:OpeningBalances:MyFavouriteBank:Cash 12 | 1970-01-01 open Income:Unattributed:MyFavouriteBank:Cash 13 | 1970-01-01 open Income:Uncategorized:MyFavouriteBank:Cash 14 | 1970-01-01 open Expenses:Unattributed:MyFavouriteBank:Cash 15 | 1970-01-01 open Expenses:Uncategorized:MyFavouriteBank:Cash 16 | 17 | ; account MyFavouriteBank:Savings:GBP (cash) 18 | 1970-01-01 open Assets:MyFavouriteBank:Savings:GBP 19 | 1970-01-01 open Equity:OpeningBalances:MyFavouriteBank:Savings:GBP 20 | 1970-01-01 open Income:Unattributed:MyFavouriteBank:Savings:GBP 21 | 1970-01-01 open Income:Uncategorized:MyFavouriteBank:Savings:GBP 22 | 1970-01-01 open Expenses:Unattributed:MyFavouriteBank:Savings:GBP 23 | 1970-01-01 open Expenses:Uncategorized:MyFavouriteBank:Savings:GBP 24 | 25 | ; account MyLessFavouriteBank:Cash (cash) 26 | 1970-01-01 open Assets:MyLessFavouriteBank:Cash 27 | 1970-01-01 open Equity:OpeningBalances:MyLessFavouriteBank:Cash 28 | 1970-01-01 open Income:Unattributed:MyLessFavouriteBank:Cash 29 | 1970-01-01 open Income:Uncategorized:MyLessFavouriteBank:Cash 30 | 1970-01-01 open Expenses:Unattributed:MyLessFavouriteBank:Cash 31 | 1970-01-01 open Expenses:Uncategorized:MyLessFavouriteBank:Cash 32 | 33 | ; account MyStockBroker:Cash (cash) 34 | 1970-01-01 open Assets:MyStockBroker:Cash 35 | 1970-01-01 open Equity:OpeningBalances:MyStockBroker:Cash 36 | 1970-01-01 open Income:Unattributed:MyStockBroker:Cash 37 | 1970-01-01 open Income:Uncategorized:MyStockBroker:Cash 38 | 1970-01-01 open Expenses:Unattributed:MyStockBroker:Cash 39 | 1970-01-01 open Expenses:Uncategorized:MyStockBroker:Cash 40 | 41 | ; account SomeBroker:Total (opaque_funds) 42 | 1970-01-01 open Assets:SomeBroker:Total 43 | 1970-01-01 open Equity:OpeningBalances:SomeBroker:Total 44 | 1970-01-01 open Income:SomeBroker:Total:PnL 45 | 46 | ; account MyAutomaticBroker:Total (opaque_funds_valuation) 47 | 1970-01-01 open Assets:MyAutomaticBroker:Total "FIFO" 48 | 1970-01-01 open Equity:OpeningBalances:MyAutomaticBroker:Total 49 | 1970-01-01 open Income:MyAutomaticBroker:Total:PnL 50 | 51 | ; account MyStockBroker:SPY (investments) 52 | 1970-01-01 open Assets:MyStockBroker:SPY "LIFO" 53 | 1970-01-01 open Equity:OpeningBalances:MyStockBroker:SPY 54 | 55 | ; account MyStockBroker:XVV (investments) 56 | 1970-01-01 open Assets:MyStockBroker:XVV 57 | 1970-01-01 open Equity:OpeningBalances:MyStockBroker:XVV 58 | 59 | ; account MyCryptoBroker:ETH (investments) 60 | 1970-01-01 open Assets:MyCryptoBroker:ETH 61 | 1970-01-01 open Equity:OpeningBalances:MyCryptoBroker:ETH 62 | 63 | ; account Shared:Unspecified (liabilities) 64 | 1970-01-01 open Liabilities:Shared:Unspecified 65 | 1970-01-01 open Equity:OpeningBalances:Shared:Unspecified 66 | 1970-01-01 open Expenses:Unattributed:Shared:Unspecified 67 | 68 | ; account Shared:SomeDude (liabilities) 69 | 1970-01-01 open Liabilities:Shared:SomeDude 70 | 1970-01-01 open Equity:OpeningBalances:Shared:SomeDude 71 | 1970-01-01 open Expenses:Unattributed:Shared:SomeDude 72 | 73 | -------------------------------------------------------------------------------- /example_data/accounts_config.yml: -------------------------------------------------------------------------------- 1 | # Use the date from which you want to start tracking values of the accounts 2 | opening_balances_date: "2023-12-01" 3 | 4 | # Following are the groups of accounts of various types 5 | # The configuration is defined in tree-like structure, the names of accounts 6 | # will be built traversing down to the leaves(e.g. Assets:Physical:Cash) 7 | # If the leaf node (can be a dict or str) doesn't have a 'currencies' key, its 8 | # name will be treated as a currency (e.g. Assets:MyFavouriteBank:Savings:GBP) 9 | 10 | # booking_method is an optional configuration, see 11 | # https://beancount.github.io/docs/how_inventories_work.html#per-account-booking-method 12 | # it's recommended for the opaque funds or investments where you don't care about 13 | # specific lots traded explicitly or don't have access to this information 14 | 15 | # Accounts holding cash values 16 | cash: 17 | - Physical: 18 | - Cash: 19 | currencies: [USD, GBP] 20 | 21 | - MyFavouriteBank: 22 | - Cash: 23 | currencies: [GBP] 24 | - Savings: 25 | - GBP 26 | 27 | - MyLessFavouriteBank: 28 | - Cash: 29 | currencies: [GBP] 30 | 31 | - MyStockBroker: 32 | - Cash: 33 | currencies: [USD] 34 | 35 | # Funds where you can only track total value converted to currency and not 36 | # specific stocks (see https://github.com/Evernight/beancount-valuation) 37 | opaque_funds_valuation: 38 | - MyAutomaticBroker: 39 | - Total: 40 | currencies: [USD] 41 | booking_method: FIFO 42 | 43 | # Same but balanced via pad/balance (opaque_funds_valuation is recommended to 44 | # use instead) 45 | opaque_funds: 46 | - SomeBroker: 47 | - Total: 48 | currencies: [USD] 49 | 50 | # Accounts holding investments (stocks, crypto, funds, etc) 51 | investments: 52 | - MyStockBroker: 53 | - SPY: 54 | booking_method: LIFO 55 | - XVV 56 | 57 | - MyCryptoBroker: 58 | - ETH 59 | 60 | # Liabilities accounts 61 | liabilities: 62 | - Shared: 63 | - Unspecified: 64 | currencies: [USD] 65 | 66 | - SomeDude: 67 | currencies: [USD] 68 | -------------------------------------------------------------------------------- /example_data/beancount_import_data/binance/example-binance.csv: -------------------------------------------------------------------------------- 1 | User_ID,UTC_Time,Account,Operation,Coin,Change,Remark 2 | 123456789,2000-01-01 00:00:00,Spot,Deposit,USD,1024.36945387, 3 | 123456789,2000-01-02 00:00:00,Spot,Transaction Related,BUSD,1023.05320737, 4 | 123456789,2000-01-02 00:00:00,Spot,Transaction Related,USD,-1026.69615134, 5 | 123456789,2000-01-03 00:00:00,Spot,Buy,BTC,0.02034238, 6 | 123456789,2000-01-03 00:00:00,Spot,Transaction Related,BUSD,-931.42075454, 7 | 123456789,2000-01-04 00:00:00,Spot,Commission Fee Shared With You,USDT,0.18598274, 8 | 123456789,2000-01-04 00:00:00,Spot,Buy,USDT,1041.21706373, 9 | 123456789,2000-01-04 00:00:00,Spot,Transaction Related,UAH,-26485.06725145, 10 | 123456789,2000-01-04 00:00:00,Spot,Fee,USDT,-0.97265207, 11 | 123456789,2000-01-05 00:00:00,Spot,Small assets exchange BNB,BNB,0.00007906, 12 | 123456789,2000-01-05 00:00:00,Spot,Small assets exchange BNB,BNB,0.01375134, 13 | 123456789,2000-01-05 00:00:00,Spot,Small assets exchange BNB,UAH,-0.86769501, 14 | 123456789,2000-01-05 00:00:00,Spot,Small assets exchange BNB,BUSD,-5.95185739, 15 | 123456789,2000-01-06 00:00:00,Spot,Fee,BNB,-0.00103959, 16 | 123456789,2000-01-06 00:00:00,Spot,Buy,MATIC,388.38298596, 17 | 123456789,2000-01-06 00:00:00,Spot,Buy,USDT,-548.58043205, 18 | 123456789,2000-01-06 00:00:00,Spot,Referral Kickback,BNB,0.00020007, 19 | 123456789,2000-01-07 00:00:00,Spot,Sell,USDT,747.28644210, 20 | 123456789,2000-01-07 00:00:00,Spot,Referral Kickback,BNB,0.00022374, 21 | 123456789,2000-01-07 00:00:00,Spot,Sell,MATIC,-421.34313399, 22 | 123456789,2000-01-08 00:00:00,Spot,Simple Earn Locked Rewards,MATIC,0.03058477, 23 | 123456789,2000-01-09 00:00:00,Earn,Simple Earn Flexible Interest,USDT,0.15080434, 24 | 123456789,2000-01-10 00:00:00,Spot,Simple Earn Locked Rewards,MATIC,0.04779077, 25 | 123456789,2000-01-11 00:00:00,Earn,Simple Earn Flexible Interest,BUSD,0.15907286, 26 | 123456789,2000-01-12 00:00:00,Earn,Simple Earn Flexible Redemption,LDBUSD,-1000.00000000,"" 27 | 123456789,2000-01-12 00:00:00,Earn,Simple Earn Flexible Redemption,BUSD,1000.00000000,"" 28 | 123456789,2000-01-13 00:00:00,SPOT,Simple Earn Locked Redemption,MATIC,250.00000000,"" 29 | 123456789,2000-01-14 00:00:00,Savings,Savings purchase,BUSD,-2000.00000000,"" 30 | 123456789,2000-01-14 00:00:00,Savings,Savings purchase,LDBUSD,2000.00000000,"" 31 | 123456789,2000-01-15 00:00:00,Spot,Withdraw,USDT,-500.29000000,Withdraw fee is included 32 | 123456789,2000-01-16 00:00:00,Spot,Distribution,ETHW,0.29976000,"" 33 | 123456789,2000-01-17 00:00:00,Spot,POS savings purchase,MATIC,-250.00000000,"" 34 | 123456789,2000-01-18 00:00:00,P2P,P2P Trading,USDT,-491.63000000,"" -------------------------------------------------------------------------------- /example_data/beancount_import_data/ibkr/example-beancount.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 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 | -------------------------------------------------------------------------------- /example_data/beancount_import_data/monzo/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Evernight/lazy-beancount/75502272d56ee1248782bb75e0067551f8c6a485/example_data/beancount_import_data/monzo/.gitkeep -------------------------------------------------------------------------------- /example_data/beancount_import_data/revolut_eur/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Evernight/lazy-beancount/75502272d56ee1248782bb75e0067551f8c6a485/example_data/beancount_import_data/revolut_eur/.gitkeep -------------------------------------------------------------------------------- /example_data/beancount_import_data/revolut_gbp/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Evernight/lazy-beancount/75502272d56ee1248782bb75e0067551f8c6a485/example_data/beancount_import_data/revolut_gbp/.gitkeep -------------------------------------------------------------------------------- /example_data/beancount_import_data/revolut_usd/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Evernight/lazy-beancount/75502272d56ee1248782bb75e0067551f8c6a485/example_data/beancount_import_data/revolut_usd/.gitkeep -------------------------------------------------------------------------------- /example_data/beancount_import_data/wise_eur/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Evernight/lazy-beancount/75502272d56ee1248782bb75e0067551f8c6a485/example_data/beancount_import_data/wise_eur/.gitkeep -------------------------------------------------------------------------------- /example_data/beancount_import_data/wise_gbp/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Evernight/lazy-beancount/75502272d56ee1248782bb75e0067551f8c6a485/example_data/beancount_import_data/wise_gbp/.gitkeep -------------------------------------------------------------------------------- /example_data/beancount_import_data/wise_usd/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Evernight/lazy-beancount/75502272d56ee1248782bb75e0067551f8c6a485/example_data/beancount_import_data/wise_usd/.gitkeep -------------------------------------------------------------------------------- /example_data/beancount_import_output/accounts.bean: -------------------------------------------------------------------------------- 1 | 2000-01-01 open Assets:Crypto:Binance:Cash BUSD,USD 2 | -------------------------------------------------------------------------------- /example_data/beancount_import_output/balance_accounts.bean: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Evernight/lazy-beancount/75502272d56ee1248782bb75e0067551f8c6a485/example_data/beancount_import_output/balance_accounts.bean -------------------------------------------------------------------------------- /example_data/beancount_import_output/ignored.bean: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Evernight/lazy-beancount/75502272d56ee1248782bb75e0067551f8c6a485/example_data/beancount_import_output/ignored.bean -------------------------------------------------------------------------------- /example_data/beancount_import_output/prices.bean: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Evernight/lazy-beancount/75502272d56ee1248782bb75e0067551f8c6a485/example_data/beancount_import_output/prices.bean -------------------------------------------------------------------------------- /example_data/beancount_import_output/transactions.bean: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Evernight/lazy-beancount/75502272d56ee1248782bb75e0067551f8c6a485/example_data/beancount_import_output/transactions.bean -------------------------------------------------------------------------------- /example_data/beangrow.config: -------------------------------------------------------------------------------- 1 | investments { 2 | investment { 3 | currency: "SPY" 4 | asset_account: "Assets:MyStockBroker:SPY" 5 | cash_accounts: "Assets:MyStockBroker:Cash" 6 | } 7 | investment { 8 | currency: "GBP" 9 | asset_account: "Assets:MyAutomaticBroker:Total" 10 | cash_accounts: "Assets:MyFavouriteBank:Cash" 11 | } 12 | investment { 13 | currency: "GBP" 14 | asset_account: "Assets:MyCryptoBroker:ETH" 15 | cash_accounts: "Assets:MyFavouriteBank:Cash" 16 | } 17 | } 18 | groups { 19 | group { 20 | name: "MyStockBroker Picks" 21 | investment: "Assets:MyStockBroker:SPY" 22 | currency: "USD" 23 | } 24 | group { 25 | name: "MyAutomaticBroker Investment" 26 | investment: "Assets:MyAutomaticBroker:*" 27 | currency: "USD" 28 | } 29 | group { 30 | name: "Buy High Sell Low ETH" 31 | investment: "Assets:MyCryptoBroker:*" 32 | currency: "GBP" 33 | } 34 | } 35 | 36 | -------------------------------------------------------------------------------- /example_data/budgets.bean: -------------------------------------------------------------------------------- 1 | 2024-01-01 custom "budget" Expenses:EatingOut "monthly" 75.00 USD 2 | 2024-01-01 custom "budget" Expenses:Groceries "monthly" 200.00 USD 3 | 2024-01-01 custom "budget" Expenses:Accommodation "monthly" 700.00 USD 4 | 5 | 2024-06-01 custom "budget" Expenses:EatingOut "monthly" 150.00 USD 6 | 2024-06-01 custom "budget" Expenses:Groceries "monthly" 300.00 USD 7 | 2024-06-01 custom "budget" Expenses:Accommodation "monthly" 700.00 USD 8 | -------------------------------------------------------------------------------- /example_data/commodities.bean: -------------------------------------------------------------------------------- 1 | ; Asset allocation: 2 | ; https://github.com/redstreet/fava_investor/tree/main/fava_investor/modules/assetalloc_class#readme 3 | 4 | 1970-01-01 commodity GBP 5 | price: "USD:yahoo/GBPUSD=X" 6 | ; price: "USD:yahoo/GBPUSD=X" 7 | asset_class: "currency" 8 | 9 | 1970-01-01 commodity USD 10 | price: "GBP:yahoo/USDGBP=X" 11 | asset_class: "currency" 12 | 13 | 1970-01-01 commodity EUR 14 | price: "USD:yahoo/EURUSD=X" 15 | asset_class: "currency" 16 | 17 | 1970-01-01 commodity GOLD 18 | price: "USD:yahoo/GC=F" 19 | asset_class: "currency" 20 | 21 | 1970-01-01 commodity SPY 22 | price: "USD:yahoo/SPY" 23 | asset_class: "stock" 24 | asset_allocation_stocks: 100 25 | 26 | ; Example showing that even more specific assets can be found on Yahoo 27 | 1970-01-01 commodity VANGUARD-LS-80 28 | price: "GBP:yahoo/0P0000TKZM.L" 29 | asset_class: "fund" 30 | ; https://www.vanguardinvestor.co.uk/investments/vanguard-lifestrategy-80-equity-fund-accumulation-shares/portfolio-data 31 | asset_allocation_bonds_corporate: 1.7 32 | asset_allocation_bonds_government: 18.3 33 | asset_allocation_equity_emerging: 7.5 34 | asset_allocation_equity_global: 72.5 35 | 36 | 1970-01-01 commodity ETH 37 | price: "GBP:yahoo/ETH-GBP" 38 | asset_class: "crypto" 39 | asset_allocation_crypto: 100 40 | 41 | 1970-01-01 commodity AUTO_BROKER_USD 42 | asset_class: "fund" 43 | ; from valuation reports 44 | asset_allocation_other: 3 45 | asset_allocation_bonds_government: 7 46 | asset_allocation_bonds_corporate: 10 47 | asset_allocation_equity_global: 20 48 | asset_allocation_equity_emerging: 20 49 | asset_allocation_equity_developed: 40 50 | -------------------------------------------------------------------------------- /example_data/docker-compose.yaml: -------------------------------------------------------------------------------- 1 | version: '1.0' 2 | services: 3 | lazybean: 4 | image: vandereer/lazy-beancount:latest 5 | # default values are valid for Mac setup, but prefer to run with 6 | # env UID=$(id -u) GID=$(id -g) docker compose up 7 | user: "${UID:-501}:${GID:-20}" 8 | ports: 9 | - "5003:5000" 10 | - "8101:8101" 11 | - "8777:8501" 12 | volumes: 13 | - .:/workspace 14 | environment: 15 | - FAVA_PORT=5003 16 | - BEANCOUNT_IMPORT_PORT=8101 17 | - LAZY_BEANCOUNT_HOST=localhost 18 | - LAZY_BEANCOUNT_PORT=8777 19 | - MPLCONFIGDIR=/tmp/matplotlib-temp 20 | -------------------------------------------------------------------------------- /example_data/filter_map.bean: -------------------------------------------------------------------------------- 1 | ; Regular, irregular, etc 2 | 2021-01-01 custom "filter-map" "apply" 3 | account: "Expenses:Shopping" 4 | addTags: "irregular" 5 | 6 | 2021-01-01 custom "filter-map" "apply" 7 | account: "Expenses:Bills" 8 | addTags: "recurring" 9 | 10 | ; subscription-year 11 | 2021-01-01 custom "filter-map" "apply" 12 | filter: "#subscription-year" 13 | addTags: "recurring" 14 | addMeta: "{'split': '12 months / month'}" 15 | 16 | ; mark specific recurring transactions 17 | 2021-01-01 custom "filter-map" "apply" 18 | filter: "narration:'Monthly rent'" 19 | addTags: "recurring" 20 | -------------------------------------------------------------------------------- /example_data/importers_config.yml: -------------------------------------------------------------------------------- 1 | importers: 2 | # Importer key also corresponds to the subdirectory in the beancount_import_data 3 | # directory where the csv files will be looked up 4 | # Possible "importer" values are: 5 | # "monzo", "revolut", "wise", 6 | # "ibkr", "kraken", "binance" 7 | # You can use different directories to distinguish between different accounts 8 | monzo: 9 | importer: monzo 10 | account: Assets:Monzo:Cash 11 | currency: GBP 12 | params: 13 | # This will ignore Monzo's automatic categories. At some point beancount-import predictions will be better 14 | # so you may want to enable it 15 | ignore_bank_categories: True 16 | revolut_eur: 17 | importer: revolut 18 | account: Assets:Revolut:Cash 19 | currency: EUR 20 | revolut_gbp: 21 | importer: revolut 22 | account: Assets:Revolut:Cash 23 | currency: GBP 24 | revolut_usd: 25 | importer: revolut 26 | account: Assets:Revolut:Cash 27 | currency: USD 28 | wise_eur: 29 | importer: wise 30 | account: Assets:Wise:Cash 31 | currency: EUR 32 | wise_gbp: 33 | importer: wise 34 | account: Assets:Wise:Cash 35 | currency: GBP 36 | wise_usd: 37 | importer: wise 38 | account: Assets:Wise:Cash 39 | currency: USD 40 | 41 | kraken: 42 | importer: kraken 43 | account: Assets:Kraken 44 | currency: USD 45 | binance: 46 | importer: binance 47 | account: Assets:Binance 48 | currency: USD 49 | params: 50 | spot_wallet_account: "Assets:Crypto:Binance:Cash" 51 | fees_account: "Expenses:Fees:Crypto:Binance" 52 | p2p_account: "Assets:Crypto:Binance:P2P" 53 | savings_account: "Assets:Crypto:Binance:Savings" 54 | income_interest_account: "Income:Crypto:Binance:Interest" 55 | income_referal_account: "Income:Crypto:Binance:Referal" 56 | income_distributions_account: "Income:Crypto:Binance:Distribution" 57 | ibkr: 58 | importer: ibkr 59 | account: Assets:IB:Cash 60 | currency: USD 61 | params: 62 | cash_account: "Assets:IB:Cash" 63 | assets_account: "Assets:IB:{symbol}" 64 | div_account: "Income:IB:{symbol}:Div" 65 | interest_account: "Income:IB:Interest" 66 | wht_account: "Expenses:IB:WithholdingTax" 67 | fees_account: "Expenses:IB:Commissions" 68 | pnl_account: "Income:IB:PnL" -------------------------------------------------------------------------------- /example_data/main.bean: -------------------------------------------------------------------------------- 1 | * Beancount configuration 2 | ; See https://github.com/beancount/beancount/issues/742 3 | ; This is required for the beancount_interpolate and beancount_share plugins 4 | ; to work together with pad directives 5 | option "plugin_processing_mode" "raw" 6 | 7 | * Operating currencies 8 | ** All and default definitions 9 | ; Define all currencies that you want to be able to use as operating currency 10 | ; First of these will be used as the currency for Dashboards 11 | option "operating_currency" "EUR" 12 | option "operating_currency" "USD" 13 | option "operating_currency" "GBP" 14 | 15 | ** Precision options 16 | ; See https://beancount.github.io/docs/precision_tolerances.html 17 | ; and https://beancount.github.io/docs/rounding_precision_in_beancount.html 18 | option "inferred_tolerance_default" "*:0.00000001" 19 | option "inferred_tolerance_default" "USD:0.003" 20 | option "inferred_tolerance_default" "GBP:0.003" 21 | 22 | option "inferred_tolerance_multiplier" "1.2" 23 | 24 | ** Other settings 25 | plugin "beancount.ops.documents" 26 | 27 | ; Define folder where the documents are stored 28 | ; option "documents" "documents" 29 | 30 | * Fava options 31 | ** Default page 32 | ; Redefine default starting page when you go to the Fava host (localhost by default) 33 | 1970-01-01 custom "fava-option" "default-page" "extension/FavaDashboards/?dashboard=0" 34 | 35 | ** Sidebar links 36 | ; A set of useful shortcut links for the Fava's menu (left side) 37 | 1970-01-01 custom "fava-sidebar-link" "💸 Expenses" "/beancount/extension/FavaDashboards/?dashboard=4&conversion=USD&time=month" 38 | 1970-01-01 custom "fava-sidebar-link" "📅 Subscriptions" "/beancount/extension/FavaDashboards/?dashboard=8&conversion=USD" 39 | 1970-01-01 custom "fava-sidebar-link" "🚥 Budgets" "/beancount/account/Expenses/?r=changes&conversion=USD" 40 | 1970-01-01 custom "fava-sidebar-link" "📜 M-3 to day" "/beancount/journal/?time=month-3+to+day" 41 | 1970-01-01 custom "fava-sidebar-link" "📜 #fix" "/beancount/journal/?filter=%23fix" 42 | 1970-01-01 custom "fava-sidebar-link" "🔁 Reset filters" ".?" 43 | 44 | ** Filter presets 45 | 1970-01-01 custom "fava-filter-preset" "time" "month" "month" 46 | 1970-01-01 custom "fava-filter-preset" "time" "month-1" "month-1" 47 | 1970-01-01 custom "fava-filter-preset" "time" "day-89 to day" "quarter" 48 | 1970-01-01 custom "fava-filter-preset" "time" "day-365 to day" "year" 49 | 1970-01-01 custom "fava-filter-preset" "time" "year-2 to year" "3Y" 50 | 1970-01-01 custom "fava-filter-preset" "time" "year-4 to year" "5Y" 51 | 1970-01-01 custom "fava-filter-preset" "advanced" "#recurring" "#recurring" 52 | 1970-01-01 custom "fava-filter-preset" "advanced" "-#irregular" "-#irregular" 53 | 1970-01-01 custom "fava-filter-preset" "advanced" "-any(account:'Expenses:Taxes')" "-Expenses:Taxes" 54 | 1970-01-01 custom "fava-filter-preset" "advanced" "-any(account:'Expenses:Unattributed')" "-Expenses:Unattributed" 55 | 56 | ** Other Fava options 57 | 1970-01-01 custom "fava-option" "default-file" "manual_transactions.bean" 58 | 59 | ; You can switch default interface language if needed 60 | ; 2021-01-01 custom "fava-option" "language" "en" 61 | 62 | ; I've had this enabled for a while but then found that it's actually not more but 63 | ; less intuitive once you get used to standard Beancount conventions 64 | ; 1970-01-01 custom "fava-option" "invert-income-liabilities-equity" "True" 65 | 66 | ** Fava extensions 67 | ; Dashboards are a great feature that may partially work from the start 68 | ; May need some configuration and fine-tuning via dashboards.yaml 69 | 2010-01-01 custom "fava-extension" "fava_dashboards" 70 | 71 | ; Track portfolios' performance 72 | 2024-01-01 custom "fava-extension" "fava_portfolio_returns" "{ 73 | 'beangrow_config': 'beangrow.config', 74 | }" 75 | 76 | ; Investing tools 77 | 2010-01-01 custom "fava-extension" "fava_investor" "{}" 78 | 79 | * Includes 80 | ; Lazy Beancount: accounts generated from accounts_config.yml 81 | include "accounts.gen.bean" 82 | 83 | ; File where the rest of accounts are defined (manually) 84 | include "accounts.bean" 85 | ; File where commodities are defined 86 | include "commodities.bean" 87 | 88 | ; (example/deprecated) Include all files from archive//.bean 89 | ; include "archive/*/*.bean" 90 | 91 | ; Lazy Beancount: include generated files from Totals 92 | include "totals/*.bean" 93 | 94 | ; Lazy Beancount: include fetched prices 95 | include "prices/*.bean" 96 | 97 | ; File to track transactions manually 98 | include "manual_transactions.bean" 99 | 100 | ; Budget definitions 101 | include "budgets.bean" 102 | 103 | ; Import files generated using beancount-import 104 | include "beancount_import_output/transactions.bean" 105 | include "beancount_import_output/balance_accounts.bean" 106 | 107 | * Plugins 108 | ** Valuation plugin 109 | ; Configure accounts that have opaque changes in value 110 | plugin "beancount_lazy_plugins.valuation" 111 | 1970-01-01 custom "valuation" "config" 112 | account: "Assets:MyAutomaticBroker:Total" 113 | currency: "AUTO_BROKER_USD" 114 | pnlAccount: "Assets:MyAutomaticBroker:Total:PnL" 115 | 116 | ** Autogenerating prices 117 | ; Generate implicit prices from costs 118 | ; It's better to place it before beancount_generate_base_ccy_prices so that transitive conversions may happen 119 | plugin "beancount.plugins.implicit_prices" 120 | 121 | ; https://github.com/tarioch/beancounttools/ 122 | ; Generate indirect prices for the current main currency 123 | plugin "beancount_generate_base_ccy_prices.generate_base_ccy_prices" "EUR" 124 | plugin "beancount_generate_base_ccy_prices.generate_base_ccy_prices" "USD" 125 | plugin "beancount_generate_base_ccy_prices.generate_base_ccy_prices" "GBP" 126 | 127 | ** Shared expenses 128 | ; Plugin to share expenses 129 | plugin "beancount_share.share" "{ 130 | 'mark_name': 'share', 131 | 'meta_name': 'shared', 132 | 'open_date': None, 133 | 'account_debtors': 'Liabilities:Shared', 134 | 'account_creditors': 'Liabilities:Shared', 135 | }" 136 | 137 | 138 | plugin "beancount_reds_plugins.effective_date.effective_date" "{ 139 | 'Expenses': { 140 | 'earlier': 'Liabilities:Hold:Expenses', 'later': 'Assets:Hold:Expenses' 141 | }, 142 | 'Income': { 143 | 'earlier': 'Assets:Hold:Income', 'later': 'Liabilities:Hold:Income' 144 | }, 145 | }" 146 | 147 | ; Some hacky fix for dashboards to work properly. 148 | ; At least one transaction per month needs to be present to display historical chart 149 | include "regular_postings_fix.bean" 150 | 151 | ; See https://github.com/beancount/beancount/issues/742 152 | ; This is required for the beancount_interpolate and beancount_share plugins 153 | ; to work together with pad directives 154 | plugin "beancount.ops.pad" 155 | plugin "beancount.ops.balance" 156 | 157 | ; Should be included after beancount.ops.pad 158 | plugin "beancount_lazy_plugins.group_pad_transactions" 159 | 160 | ; Comes after almost everything but before the split plugin (it's used in some examples) 161 | plugin "beancount_lazy_plugins.filter_map" 162 | include "filter_map.bean" 163 | 164 | ; Run beancount_interpolate after pad/balance generation as these plugins are mostly 165 | ; used for cleaner graphs but we don't want to alter underlying source of truth 166 | ; data too much. 167 | ; You may choose to disable split plugin in some cases, if you want more precise 168 | ; actual data rather than more convenient view on Expenses 169 | plugin "beancount_interpolate.recur" 170 | plugin "beancount_interpolate.split" 171 | 172 | ; May cause some errors to go unnoticed but also may be helpful while testing various naming options 173 | ;plugin "beancount.plugins.auto_accounts" -------------------------------------------------------------------------------- /example_data/manual_transactions.bean: -------------------------------------------------------------------------------- 1 | ; 2023-11-02 balance Assets:MyAutomaticBroker:Total 7500 USD 2 | 3 | 2023-11-01 * "MyAutomaticBroker initial" 4 | Assets:MyAutomaticBroker:Total 7500 USD 5 | Equity:OpeningBalances:MyAutomaticBroker:Total -7500 USD 6 | 7 | 2024-01-03 * "Salary from MyEmployer" 8 | Assets:MyFavouriteBank:Cash 2000 GBP 9 | Income:Salary:MyEmployer -2000 GBP 10 | 11 | 2024-02-03 * "Salary from MyEmployer" 12 | Assets:MyFavouriteBank:Cash 2000 GBP 13 | Income:Salary:MyEmployer -2000 GBP 14 | 15 | 2024-03-03 * "Salary from MyEmployer" 16 | Assets:MyFavouriteBank:Cash 2000 GBP 17 | Income:Salary:MyEmployer -2000 GBP 18 | 19 | 2024-04-03 * "Salary from MyEmployer" 20 | Assets:MyFavouriteBank:Cash 2000 GBP 21 | Income:Salary:MyEmployer -2000 GBP 22 | 23 | 2024-05-03 * "Salary from MyEmployer" 24 | Assets:MyFavouriteBank:Cash 2000 GBP 25 | Income:Salary:MyEmployer -2000 GBP 26 | 27 | 2024-06-03 * "Salary from MyEmployer" 28 | Assets:MyFavouriteBank:Cash 2000 GBP 29 | Income:Salary:MyEmployer -2000 GBP 30 | 31 | 32 | 2024-01-15 * "Withdrawn cash" 33 | Assets:MyFavouriteBank:Cash -100 GBP 34 | Assets:Physical:Cash 100 GBP 35 | 36 | 2024-02-19 * "Withdrawn cash" 37 | Assets:MyFavouriteBank:Cash -150 GBP 38 | Assets:Physical:Cash 150 GBP 39 | 40 | 2024-04-11 * "Withdrawn cash" 41 | Assets:MyFavouriteBank:Cash -100 GBP 42 | Assets:Physical:Cash 100 GBP 43 | 44 | ; Normally transacrions would be ordered historically but these are just example 45 | ; ones 46 | ; and the numbers are obviously fictional 47 | 2024-01-03 * "Monthly rent" 48 | Assets:MyFavouriteBank:Cash -500 GBP 49 | Expenses:Accommodation 500 GBP 50 | 51 | 2024-02-03 * "Monthly rent" 52 | Assets:MyFavouriteBank:Cash -500 GBP 53 | Expenses:Accommodation 500 GBP 54 | 55 | 2024-03-03 * "Monthly rent" 56 | Assets:MyFavouriteBank:Cash -500 GBP 57 | Expenses:Accommodation 500 GBP 58 | 59 | 2024-04-03 * "Monthly rent" 60 | Assets:MyFavouriteBank:Cash -500 GBP 61 | Expenses:Accommodation 500 GBP 62 | 63 | 2024-05-03 * "Monthly rent" 64 | Assets:MyFavouriteBank:Cash -500 GBP 65 | Expenses:Accommodation 500 GBP 66 | 67 | 2024-06-03 * "Monthly rent" 68 | Assets:MyFavouriteBank:Cash -500 GBP 69 | Expenses:Accommodation 500 GBP 70 | 71 | 72 | 2024-03-10 * "Subscription for SomeService paid in a year-instalment" #subscription-year 73 | Assets:MyFavouriteBank:Cash -70 USD 74 | Expenses:Services -70 USD 75 | 76 | 2024-01-03 * "Some transaction for Expenses:Donations" 77 | Assets:MyLessFavouriteBank:Cash -90 USD 78 | Expenses:Donations 90 USD 79 | 80 | 2024-01-04 * "Some transaction for Expenses:Groceries" 81 | Assets:MyFavouriteBank:Cash -11 USD 82 | Expenses:Groceries 11 USD 83 | 84 | 2024-01-07 * "Some transaction for Expenses:EatingOut:Coffee" 85 | Assets:Physical:Cash -3 USD 86 | Expenses:EatingOut:Coffee 3 USD 87 | 88 | 2024-01-08 * "Some transaction for Expenses:Shopping" 89 | Assets:Physical:Cash -68 USD 90 | Expenses:Shopping 68 USD 91 | 92 | 2024-01-09 * "Some transaction for Expenses:Groceries" 93 | Assets:MyFavouriteBank:Cash -9 USD 94 | Expenses:Groceries 9 USD 95 | 96 | 2024-01-11 * "Some transaction for Expenses:Travel:Flights" #travel #trip-island-vacation 97 | Assets:MyLessFavouriteBank:Cash -203 USD 98 | Expenses:Travel:Flights 203 USD 99 | 100 | 2024-01-15 * "Some transaction for Expenses:EatingOut" #trip-island-vacation 101 | Assets:MyFavouriteBank:Cash -17 USD 102 | Expenses:EatingOut 17 USD 103 | 104 | 2024-01-18 * "Some transaction for Expenses:EatingOut:Coffee" 105 | Assets:MyFavouriteBank:Cash -4 USD 106 | Expenses:EatingOut:Coffee 4 USD 107 | 108 | 2024-01-19 * "Some transaction for Expenses:Groceries" 109 | Assets:MyFavouriteBank:Cash -35 USD 110 | Expenses:Groceries 35 USD 111 | 112 | 2024-01-20 * "Some transaction for Expenses:Groceries" 113 | Assets:MyFavouriteBank:Cash -34 USD 114 | Expenses:Groceries 34 USD 115 | 116 | 2024-01-22 * "Some transaction for Expenses:EatingOut" 117 | Assets:Physical:Cash -28 USD 118 | Expenses:EatingOut 28 USD 119 | 120 | 2024-01-27 * "Some transaction for Expenses:Groceries" 121 | Assets:Physical:Cash -5 USD 122 | Expenses:Groceries 5 USD 123 | 124 | 2024-01-30 * "Some transaction for Expenses:Groceries" 125 | Assets:MyFavouriteBank:Cash -28 USD 126 | Expenses:Groceries 28 USD 127 | 128 | 2024-01-31 * "Some transaction for Expenses:Groceries" 129 | Assets:MyFavouriteBank:Cash -16 USD 130 | Expenses:Groceries 16 USD 131 | 132 | 2024-02-04 * "Some transaction for Expenses:Groceries" 133 | Assets:Physical:Cash -24 USD 134 | Expenses:Groceries 24 USD 135 | 136 | 2024-02-07 * "Some transaction for Expenses:Groceries" 137 | Assets:MyLessFavouriteBank:Cash -31 USD 138 | Expenses:Groceries 31 USD 139 | 140 | 2024-02-12 * "Some transaction for Expenses:EatingOut" 141 | Assets:MyLessFavouriteBank:Cash -24 USD 142 | Expenses:EatingOut 24 USD 143 | 144 | 2024-02-14 * "Some transaction for Expenses:EatingOut:Coffee" 145 | Assets:Physical:Cash -4 USD 146 | Expenses:EatingOut:Coffee 4 USD 147 | 148 | 2024-02-15 * "Some transaction for Expenses:Groceries" 149 | Assets:MyFavouriteBank:Cash -37 USD 150 | Expenses:Groceries 37 USD 151 | 152 | 2024-02-15 * "Some transaction for Expenses:EatingOut" 153 | Assets:MyLessFavouriteBank:Cash -19 USD 154 | Expenses:EatingOut 19 USD 155 | 156 | 2024-02-17 * "Some transaction for Expenses:Groceries" 157 | Assets:MyLessFavouriteBank:Cash -12 USD 158 | Expenses:Groceries 12 USD 159 | 160 | 2024-02-19 * "Some transaction for Expenses:Groceries" 161 | Assets:MyLessFavouriteBank:Cash -12 USD 162 | Expenses:Groceries 12 USD 163 | 164 | 2024-02-22 * "Some transaction for Expenses:EatingOut:Coffee" 165 | Assets:MyLessFavouriteBank:Cash -3 USD 166 | Expenses:EatingOut:Coffee 3 USD 167 | 168 | 2024-02-23 * "Some transaction for Expenses:EatingOut" 169 | Assets:MyLessFavouriteBank:Cash -15 USD 170 | Expenses:EatingOut 15 USD 171 | 172 | 2024-02-25 * "Some transaction for Expenses:Groceries" 173 | Assets:MyFavouriteBank:Cash -10 USD 174 | Expenses:Groceries 10 USD 175 | 176 | 2024-02-28 * "Some transaction for Expenses:EatingOut" 177 | Assets:Physical:Cash -15 USD 178 | Expenses:EatingOut 15 USD 179 | 180 | 2024-02-29 * "Some transaction for Expenses:Groceries" 181 | Assets:MyFavouriteBank:Cash -39 USD 182 | Expenses:Groceries 39 USD 183 | 184 | 2024-03-04 * "Some transaction for Expenses:Groceries" 185 | Assets:MyFavouriteBank:Cash -34 USD 186 | Expenses:Groceries 34 USD 187 | 188 | 2024-03-04 * "Some transaction for Expenses:EatingOut:Coffee" 189 | Assets:MyFavouriteBank:Cash -3 USD 190 | Expenses:EatingOut:Coffee 3 USD 191 | 192 | 2024-03-05 * "Some transaction for Expenses:Groceries" 193 | Assets:MyFavouriteBank:Cash -38 USD 194 | Expenses:Groceries 38 USD 195 | 196 | 2024-03-08 * "Some transaction for Expenses:Groceries" 197 | Assets:Physical:Cash -20 USD 198 | Expenses:Groceries 20 USD 199 | 200 | 2024-03-12 * "Some transaction for Expenses:Groceries" 201 | Assets:MyFavouriteBank:Cash -21 USD 202 | Expenses:Groceries 21 USD 203 | 204 | 2024-03-14 * "Some transaction for Expenses:Groceries" 205 | Assets:MyFavouriteBank:Cash -32 USD 206 | Expenses:Groceries 32 USD 207 | 208 | 2024-03-20 * "Some transaction for Expenses:Travel:Flights" 209 | Assets:MyFavouriteBank:Cash -149 USD 210 | Expenses:Travel:Flights 149 USD 211 | 212 | 2024-03-21 * "Some transaction for Expenses:Groceries" 213 | Assets:Physical:Cash -30 USD 214 | Expenses:Groceries 30 USD 215 | 216 | 2024-03-24 * "Some transaction for Expenses:Groceries" 217 | Assets:MyLessFavouriteBank:Cash -7 USD 218 | Expenses:Groceries 7 USD 219 | 220 | 2024-03-24 * "Some transaction for Expenses:EatingOut" 221 | Assets:MyFavouriteBank:Cash -28 USD 222 | Expenses:EatingOut 28 USD 223 | 224 | 2024-03-25 * "Some transaction for Expenses:Donations" 225 | Assets:MyFavouriteBank:Cash -95 USD 226 | Expenses:Donations 95 USD 227 | 228 | 2024-03-27 * "Some transaction for Expenses:EatingOut" 229 | Assets:MyLessFavouriteBank:Cash -21 USD 230 | Expenses:EatingOut 21 USD 231 | 232 | 2024-03-28 * "Some transaction for Expenses:Groceries" 233 | Assets:MyFavouriteBank:Cash -14 USD 234 | Expenses:Groceries 14 USD 235 | 236 | 2024-03-29 * "Some transaction for Expenses:EatingOut" 237 | Assets:MyFavouriteBank:Cash -29 USD 238 | Expenses:EatingOut 29 USD 239 | 240 | 2024-03-30 * "Some transaction for Expenses:Groceries" 241 | Assets:Physical:Cash -10 USD 242 | Expenses:Groceries 10 USD 243 | 244 | 2024-04-01 * "Some transaction for Expenses:Groceries" 245 | Assets:MyFavouriteBank:Cash -25 USD 246 | Expenses:Groceries 25 USD 247 | 248 | 2024-04-05 * "Some transaction for Expenses:Travel:Flights" 249 | Assets:MyLessFavouriteBank:Cash -196 USD 250 | Expenses:Travel:Flights 196 USD 251 | 252 | 2024-04-09 * "Some transaction for Expenses:Groceries" 253 | Assets:Physical:Cash -19 USD 254 | Expenses:Groceries 19 USD 255 | 256 | 2024-04-13 * "Some transaction for Expenses:Groceries" 257 | Assets:MyFavouriteBank:Cash -7 USD 258 | Expenses:Groceries 7 USD 259 | 260 | 2024-04-14 * "Some transaction for Expenses:Groceries" 261 | Assets:MyFavouriteBank:Cash -10 USD 262 | Expenses:Groceries 10 USD 263 | 264 | 2024-04-19 * "Some transaction for Expenses:Groceries" 265 | Assets:MyFavouriteBank:Cash -33 USD 266 | Expenses:Groceries 33 USD 267 | 268 | 2024-04-21 * "Some transaction for Expenses:EatingOut:Coffee" 269 | Assets:MyFavouriteBank:Cash -3 USD 270 | Expenses:EatingOut:Coffee 3 USD 271 | 272 | 2024-04-22 * "Some transaction for Expenses:EatingOut:Coffee" 273 | Assets:MyFavouriteBank:Cash -3 USD 274 | Expenses:EatingOut:Coffee 3 USD 275 | 276 | 2024-04-24 * "Some transaction for Expenses:Groceries" 277 | Assets:MyFavouriteBank:Cash -27 USD 278 | Expenses:Groceries 27 USD 279 | 280 | 2024-04-28 * "Some transaction for Expenses:Groceries" 281 | Assets:MyFavouriteBank:Cash -13 USD 282 | Expenses:Groceries 13 USD 283 | 284 | 2024-04-28 * "Some transaction for Expenses:EatingOut" 285 | Assets:MyLessFavouriteBank:Cash -17 USD 286 | Expenses:EatingOut 17 USD 287 | 288 | 2024-04-30 * "Some transaction for Expenses:Travel" 289 | Assets:Physical:Cash -160 USD 290 | Expenses:Travel 160 USD 291 | 292 | 2024-05-01 * "Some transaction for Expenses:Groceries" 293 | Assets:MyFavouriteBank:Cash -30 USD 294 | Expenses:Groceries 30 USD 295 | 296 | 2024-05-02 * "Some transaction for Expenses:EatingOut" 297 | Assets:MyFavouriteBank:Cash -17 USD 298 | Expenses:EatingOut 17 USD 299 | 300 | 2024-05-07 * "Some transaction for Expenses:Groceries" 301 | Assets:MyFavouriteBank:Cash -29 USD 302 | Expenses:Groceries 29 USD 303 | 304 | 2024-05-09 * "Some transaction for Expenses:Groceries" 305 | Assets:MyLessFavouriteBank:Cash -15 USD 306 | Expenses:Groceries 15 USD 307 | 308 | 2024-05-13 * "Some transaction for Expenses:EatingOut" 309 | Assets:MyLessFavouriteBank:Cash -27 USD 310 | Expenses:EatingOut 27 USD 311 | 312 | 2024-05-13 * "Some transaction for Expenses:Shopping" 313 | Assets:MyFavouriteBank:Cash -52 USD 314 | Expenses:Shopping 52 USD 315 | 316 | 2024-05-17 * "Some transaction for Expenses:EatingOut" 317 | Assets:MyLessFavouriteBank:Cash -16 USD 318 | Expenses:EatingOut 16 USD 319 | 320 | 2024-05-18 * "Some transaction for Expenses:Groceries" 321 | Assets:MyFavouriteBank:Cash -12 USD 322 | Expenses:Groceries 12 USD 323 | 324 | 2024-05-20 * "Some transaction for Expenses:EatingOut" 325 | Assets:MyLessFavouriteBank:Cash -17 USD 326 | Expenses:EatingOut 17 USD 327 | 328 | 2024-05-23 * "Some transaction for Expenses:Groceries" 329 | Assets:MyLessFavouriteBank:Cash -12 USD 330 | Expenses:Groceries 12 USD 331 | 332 | 2024-05-24 * "Some transaction for Expenses:EatingOut" 333 | Assets:Physical:Cash -15 USD 334 | Expenses:EatingOut 15 USD 335 | 336 | 2024-05-25 * "Some transaction for Expenses:Groceries" 337 | Assets:MyFavouriteBank:Cash -26 USD 338 | Expenses:Groceries 26 USD 339 | 340 | 2024-05-31 * "Some transaction for Expenses:EatingOut" 341 | Assets:MyFavouriteBank:Cash -23 USD 342 | Expenses:EatingOut 23 USD 343 | 344 | 2024-06-03 * "Some transaction for Expenses:EatingOut" 345 | Assets:MyFavouriteBank:Cash -18 USD 346 | Expenses:EatingOut 18 USD 347 | 348 | 2024-06-07 * "Some transaction for Expenses:EatingOut" 349 | Assets:MyFavouriteBank:Cash -17 USD 350 | Expenses:EatingOut 17 USD 351 | 352 | 2024-06-11 * "Some transaction for Expenses:Groceries" 353 | Assets:MyLessFavouriteBank:Cash -22 USD 354 | Expenses:Groceries 22 USD 355 | 356 | 2024-06-11 * "Some transaction for Expenses:EatingOut:Coffee" 357 | Assets:MyFavouriteBank:Cash -3 USD 358 | Expenses:EatingOut:Coffee 3 USD 359 | 360 | 2024-06-13 * "Some transaction for Expenses:EatingOut:Coffee" 361 | Assets:MyFavouriteBank:Cash -4 USD 362 | Expenses:EatingOut:Coffee 4 USD 363 | 364 | 2024-06-17 * "Some transaction for Expenses:EatingOut" 365 | Assets:MyFavouriteBank:Cash -20 USD 366 | Expenses:EatingOut 20 USD 367 | 368 | 2024-06-18 * "Some transaction for Expenses:Travel" 369 | Assets:MyFavouriteBank:Cash -134 USD 370 | Expenses:Travel 134 USD 371 | 372 | 2024-06-19 * "Some transaction for Expenses:EatingOut" 373 | Assets:MyFavouriteBank:Cash -24 USD 374 | Expenses:EatingOut 24 USD 375 | 376 | 2024-06-23 * "Some transaction for Expenses:EatingOut" 377 | Assets:MyLessFavouriteBank:Cash -23 USD 378 | Expenses:EatingOut 23 USD 379 | 380 | 2024-06-27 * "Some transaction for Expenses:EatingOut" 381 | Assets:MyFavouriteBank:Cash -34 USD 382 | Expenses:EatingOut 34 USD 383 | 384 | 2024-06-29 * "Some transaction for Expenses:Groceries" 385 | Assets:MyLessFavouriteBank:Cash -10 USD 386 | Expenses:Groceries 10 USD 387 | 388 | ; Some demo stock transactions 389 | 2024-04-11 * "Buy SPY" 390 | Assets:MyStockBroker:SPY 3 SPY {517.9 USD} 391 | Assets:MyStockBroker:Cash -1556.12 USD 392 | Expenses:MyStockBroker:Commissions 2.42 USD 393 | 394 | 2024-06-17 * "Sell SPY" 395 | Assets:MyStockBroker:SPY -2 SPY {} @ 547 USD 396 | Assets:MyStockBroker:Cash 1090.99 USD 397 | Expenses:MyStockBroker:Commissions 3.01 USD 398 | Income:MyStockBroker:PnL 399 | 400 | 401 | 2024-02-20 * "Buy ETH" 402 | Assets:MyCryptoBroker:ETH 0.8 ETH {2338 GBP} 403 | Assets:MyFavouriteBank:Cash -1875.8 GBP 404 | Expenses:MyCryptoBroker:Commissions 5.4 GBP 405 | 406 | 2024-08-19 * "Sell ETH" 407 | Assets:MyCryptoBroker:ETH -0.7 ETH {} @ 2018 GBP 408 | Assets:MyFavouriteBank:Cash 1412.6 GBP 409 | Expenses:MyCryptoBroker:Commissions 7 GBP 410 | Income:MyCryptoBroker:PnL -------------------------------------------------------------------------------- /example_data/prices/prices-2023-12-02.gen.bean: -------------------------------------------------------------------------------- 1 | 2023-12-02 price ETH 1643.54760742 GBP 2 | 2023-12-01 price EUR 1.08900000 USD 3 | 2023-12-01 price GBP 1.26300000 USD 4 | 2023-12-01 price GOLD 2071.00000000 USD 5 | 2023-12-01 price USD 0.79166001 GBP 6 | 2023-12-01 price VANGUARD-LS-80 26440.57031250 GBP 7 | -------------------------------------------------------------------------------- /example_data/prices/prices-2024-01-02.gen.bean: -------------------------------------------------------------------------------- 1 | 2024-01-02 price ETH 1848.20056152 GBP 2 | 2024-01-02 price EUR 1.10400000 USD 3 | 2024-01-02 price GBP 1.27300000 USD 4 | 2024-01-02 price GOLD 2064.40000000 USD 5 | 2024-01-02 price USD 0.78561997 GBP 6 | 2024-01-02 price VANGUARD-LS-80 27365.57031250 GBP 7 | -------------------------------------------------------------------------------- /example_data/prices/prices-2024-02-02.gen.bean: -------------------------------------------------------------------------------- 1 | 2024-02-02 price ETH 1807.44958496 GBP 2 | 2024-02-02 price EUR 1.08700000 USD 3 | 2024-02-02 price GBP 1.27500000 USD 4 | 2024-02-02 price GOLD 2036.10000000 USD 5 | 2024-02-02 price USD 0.78447998 GBP 6 | 2024-02-02 price VANGUARD-LS-80 27621.94921875 GBP 7 | -------------------------------------------------------------------------------- /example_data/prices/prices-2024-02-20.gen.bean: -------------------------------------------------------------------------------- 1 | 2024-02-20 price ETH 2338.44067383 GBP 2 | 2024-02-20 price EUR 1.07753968 USD 3 | 2024-02-20 price GBP 1.25876415 USD 4 | 2024-02-20 price GOLD 2027.50000000 USD 5 | 2024-02-20 price SPY 496.76000977 USD 6 | 2024-02-20 price USD 0.79443002 GBP 7 | 2024-02-20 price VANGUARD-LS-80 27817.73046875 GBP 8 | -------------------------------------------------------------------------------- /example_data/prices/prices-2024-03-02.gen.bean: -------------------------------------------------------------------------------- 1 | 2024-03-02 price ETH 2713.95703125 GBP 2 | 2024-03-01 price EUR 1.08000000 USD 3 | 2024-03-01 price GBP 1.26300000 USD 4 | 2024-03-01 price GOLD 2086.90000000 USD 5 | 2024-03-01 price USD 0.79205000 GBP 6 | 2024-03-01 price VANGUARD-LS-80 28328.46093750 GBP 7 | -------------------------------------------------------------------------------- /example_data/prices/prices-2024-04-02.gen.bean: -------------------------------------------------------------------------------- 1 | 2024-04-02 price ETH 2794.00000000 GBP 2 | 2024-04-01 price EUR 1.00000000 USD 3 | 2024-04-01 price GBP 1.00000000 USD 4 | 2024-04-02 price GOLD 2261.00000000 USD 5 | 2024-04-01 price USD 1.00000000 GBP 6 | 2024-04-02 price VANGUARD-LS-80 28887.00000000 GBP 7 | -------------------------------------------------------------------------------- /example_data/prices/prices-2024-04-11.gen.bean: -------------------------------------------------------------------------------- 1 | 2024-04-11 price ETH 2826.73291016 GBP 2 | 2024-04-10 price EUR 1.07417154 USD 3 | 2024-04-10 price GBP 1.25376129 USD 4 | 2024-04-11 price GOLD 2354.80004883 USD 5 | 2024-04-11 price SPY 518.00000000 USD 6 | 2024-04-10 price USD 0.79759997 GBP 7 | 2024-04-11 price VANGUARD-LS-80 28864.72070312 GBP 8 | -------------------------------------------------------------------------------- /example_data/prices/prices-2024-05-02.gen.bean: -------------------------------------------------------------------------------- 1 | 2024-05-02 price ETH 2369.00000000 GBP 2 | 2024-05-01 price EUR 1.00000000 USD 3 | 2024-05-01 price GBP 1.00000000 USD 4 | 2024-05-02 price GOLD 2299.00000000 USD 5 | 2024-05-01 price USD 1.00000000 GBP 6 | 2024-05-02 price VANGUARD-LS-80 28731.00000000 GBP 7 | -------------------------------------------------------------------------------- /example_data/prices/prices-2024-06-02.gen.bean: -------------------------------------------------------------------------------- 1 | 2024-06-02 price ETH 2994.00000000 GBP 2 | 2024-05-30 price EUR 1.00000000 USD 3 | 2024-05-30 price GBP 1.00000000 USD 4 | 2024-05-31 price GOLD 2323.00000000 USD 5 | 2024-05-30 price USD 1.00000000 GBP 6 | 2024-05-31 price VANGUARD-LS-80 29128.00000000 GBP 7 | -------------------------------------------------------------------------------- /example_data/prices/prices-2024-06-17.gen.bean: -------------------------------------------------------------------------------- 1 | 2024-06-17 price ETH 2854.65869141 GBP 2 | 2024-06-16 price EUR 1.07021689 USD 3 | 2024-06-16 price GBP 1.26831126 USD 4 | 2024-06-17 price GOLD 2312.39990234 USD 5 | 2024-06-17 price SPY 547.09997559 USD 6 | 2024-06-16 price USD 0.78845000 GBP 7 | 2024-06-17 price VANGUARD-LS-80 29542.57031250 GBP 8 | -------------------------------------------------------------------------------- /example_data/prices/prices-2024-08-01.gen.bean: -------------------------------------------------------------------------------- 1 | 2024-08-01 price ETH 2514.05151367 GBP 2 | 2024-07-31 price EUR 1.08239162 USD 3 | 2024-07-31 price GBP 1.28531396 USD 4 | 2024-08-01 price GOLD 2435.00000000 USD 5 | 2024-08-01 price SPY 543.01000977 USD 6 | 2024-07-31 price USD 0.77802002 GBP 7 | 2024-08-01 price VANGUARD-LS-80 29773.75976562 GBP 8 | -------------------------------------------------------------------------------- /example_data/prices/prices-2024-08-19.gen.bean: -------------------------------------------------------------------------------- 1 | 2024-08-19 price ETH 2018.57275391 GBP 2 | 2024-08-18 price EUR 1.10249937 USD 3 | 2024-08-18 price GBP 1.29471624 USD 4 | 2024-08-19 price GOLD 2501.80004883 USD 5 | 2024-08-19 price SPY 559.60998535 USD 6 | 2024-08-18 price USD 0.77236998 GBP 7 | 2024-08-19 price VANGUARD-LS-80 30028.93945312 GBP 8 | -------------------------------------------------------------------------------- /example_data/prices_config.yml: -------------------------------------------------------------------------------- 1 | commodities: 2 | # # Example: if that's necessary for some commodity, multiplier can be set 3 | # # to use after the value is fetched via bean-price via the UI 4 | # - EUR: 5 | # multiplier: 1.0 -------------------------------------------------------------------------------- /example_data/regular_postings_fix.bean: -------------------------------------------------------------------------------- 1 | ; see issue and explanation: 2 | ; https://github.com/andreasgerstmayr/fava-dashboards/issues/28 3 | 4 | 2023-12-03 * "Fake transaction for generating summaries" 5 | recur: " / week" 6 | Assets:MyAutomaticBroker:RegularFix 0.000001 USD 7 | Equity:TechnicalPurposes 8 | 9 | 2023-12-03 * "Fake transaction for generating summaries" 10 | recur: " / week" 11 | Assets:MyStockBroker:RegularFix 0.000001 USD 12 | Equity:TechnicalPurposes 13 | -------------------------------------------------------------------------------- /example_data/totals/initial.gen.bean: -------------------------------------------------------------------------------- 1 | 2023-11-30 pad Assets:Physical:Cash Equity:OpeningBalances:Physical:Cash 2 | 2023-11-30 pad Assets:MyFavouriteBank:Cash Equity:OpeningBalances:MyFavouriteBank:Cash 3 | ; 2023-11-30 pad Assets:MyFavouriteBank:Savings:GBP Equity:OpeningBalances:MyFavouriteBank:Savings:GBP 4 | 2023-11-30 pad Assets:MyLessFavouriteBank:Cash Equity:OpeningBalances:MyLessFavouriteBank:Cash 5 | 2023-11-30 pad Assets:MyStockBroker:Cash Equity:OpeningBalances:MyStockBroker:Cash 6 | ; 2023-11-30 pad Assets:SomeBroker:Total Equity:OpeningBalances:SomeBroker:Total 7 | ; 2023-11-30 pad Liabilities:Shared:Unspecified Equity:OpeningBalances:Shared:Unspecified 8 | ; 2023-11-30 pad Liabilities:Shared:SomeDude Equity:OpeningBalances:Shared:SomeDude 9 | 10 | 2023-12-01 balance Assets:Physical:Cash 150.0 GBP 11 | 2023-12-01 balance Assets:MyFavouriteBank:Cash 4106.0 GBP 12 | 2023-12-01 balance Assets:MyLessFavouriteBank:Cash 243.0 GBP 13 | 2023-12-01 balance Assets:MyStockBroker:Cash 2100.0 USD 14 | 2023-12-01 custom "valuation" Assets:MyAutomaticBroker:Total 7500.0 USD 15 | -------------------------------------------------------------------------------- /example_data/totals/update-2024-01-03.gen.bean: -------------------------------------------------------------------------------- 1 | 2024-01-02 pad Assets:Physical:Cash Expenses:Unattributed:Physical:Cash 2 | 2024-01-02 pad Assets:MyFavouriteBank:Cash Expenses:Unattributed:MyFavouriteBank:Cash 3 | ; 2024-01-02 pad Assets:MyFavouriteBank:Savings:GBP Expenses:Unattributed:MyFavouriteBank:Savings:GBP 4 | 2024-01-02 pad Assets:MyLessFavouriteBank:Cash Expenses:Unattributed:MyLessFavouriteBank:Cash 5 | ; 2024-01-02 pad Assets:MyStockBroker:Cash Expenses:Unattributed:MyStockBroker:Cash 6 | ; 2024-01-02 pad Assets:SomeBroker:Total Income:SomeBroker:Total:PnL 7 | ; 2024-01-02 pad Liabilities:Shared:Unspecified Expenses:Unattributed:Shared:Unspecified 8 | 2024-01-02 pad Liabilities:Shared:SomeDude Expenses:Unattributed:Shared:SomeDude 9 | 10 | 2024-01-03 balance Assets:Physical:Cash 100.0 USD 11 | 2024-01-03 balance Assets:Physical:Cash 40.0 GBP 12 | 2024-01-03 balance Assets:MyFavouriteBank:Cash 3640.0 GBP 13 | 2024-01-03 balance Assets:MyLessFavouriteBank:Cash 200.0 GBP 14 | 2024-01-03 balance Assets:MyStockBroker:Cash 2100.0 USD 15 | 2024-01-03 custom "valuation" Assets:MyAutomaticBroker:Total 7635.0 USD 16 | 2024-01-03 balance Liabilities:Shared:SomeDude 30.0 USD 17 | -------------------------------------------------------------------------------- /example_data/totals/update-2024-02-03.gen.bean: -------------------------------------------------------------------------------- 1 | 2024-02-02 pad Assets:Physical:Cash Expenses:Unattributed:Physical:Cash 2 | 2024-02-02 pad Assets:MyFavouriteBank:Cash Expenses:Unattributed:MyFavouriteBank:Cash 3 | ; 2024-02-02 pad Assets:MyFavouriteBank:Savings:GBP Expenses:Unattributed:MyFavouriteBank:Savings:GBP 4 | 2024-02-02 pad Assets:MyLessFavouriteBank:Cash Expenses:Unattributed:MyLessFavouriteBank:Cash 5 | ; 2024-02-02 pad Assets:MyStockBroker:Cash Expenses:Unattributed:MyStockBroker:Cash 6 | ; 2024-02-02 pad Assets:SomeBroker:Total Income:SomeBroker:Total:PnL 7 | ; 2024-02-02 pad Liabilities:Shared:Unspecified Expenses:Unattributed:Shared:Unspecified 8 | ; 2024-02-02 pad Liabilities:Shared:SomeDude Expenses:Unattributed:Shared:SomeDude 9 | 10 | 2024-02-03 balance Assets:Physical:Cash 100.0 USD 11 | 2024-02-03 balance Assets:Physical:Cash 40.0 GBP 12 | 2024-02-03 balance Assets:MyFavouriteBank:Cash 3520.0 GBP 13 | 2024-02-03 balance Assets:MyLessFavouriteBank:Cash 180.0 GBP 14 | 2024-02-03 balance Assets:MyStockBroker:Cash 2100.0 USD 15 | 2024-02-03 custom "valuation" Assets:MyAutomaticBroker:Total 7522.0 USD 16 | -------------------------------------------------------------------------------- /example_data/totals/update-2024-03-03.gen.bean: -------------------------------------------------------------------------------- 1 | 2024-03-02 pad Assets:Physical:Cash Expenses:Unattributed:Physical:Cash 2 | 2024-03-02 pad Assets:MyFavouriteBank:Cash Expenses:Unattributed:MyFavouriteBank:Cash 3 | ; 2024-03-02 pad Assets:MyFavouriteBank:Savings:GBP Expenses:Unattributed:MyFavouriteBank:Savings:GBP 4 | ; 2024-03-02 pad Assets:MyLessFavouriteBank:Cash Expenses:Unattributed:MyLessFavouriteBank:Cash 5 | ; 2024-03-02 pad Assets:MyStockBroker:Cash Expenses:Unattributed:MyStockBroker:Cash 6 | ; 2024-03-02 pad Assets:SomeBroker:Total Income:SomeBroker:Total:PnL 7 | ; 2024-03-02 pad Liabilities:Shared:Unspecified Expenses:Unattributed:Shared:Unspecified 8 | ; 2024-03-02 pad Liabilities:Shared:SomeDude Expenses:Unattributed:Shared:SomeDude 9 | 10 | 2024-03-03 balance Assets:Physical:Cash 90.0 USD 11 | 2024-03-03 balance Assets:Physical:Cash 40.0 GBP 12 | 2024-03-03 balance Assets:MyFavouriteBank:Cash 1745.0 GBP 13 | 2024-03-03 balance Assets:MyLessFavouriteBank:Cash 180.0 GBP 14 | 2024-03-03 balance Assets:MyStockBroker:Cash 2100.0 USD 15 | 2024-03-03 custom "valuation" Assets:MyAutomaticBroker:Total 7419.0 USD 16 | -------------------------------------------------------------------------------- /example_data/totals/update-2024-04-03.gen.bean: -------------------------------------------------------------------------------- 1 | 2024-04-02 pad Assets:Physical:Cash Expenses:Unattributed:Physical:Cash 2 | 2024-04-02 pad Assets:MyFavouriteBank:Cash Expenses:Unattributed:MyFavouriteBank:Cash 3 | ; 2024-04-02 pad Assets:MyFavouriteBank:Savings:GBP Expenses:Unattributed:MyFavouriteBank:Savings:GBP 4 | 2024-04-02 pad Assets:MyLessFavouriteBank:Cash Expenses:Unattributed:MyLessFavouriteBank:Cash 5 | ; 2024-04-02 pad Assets:MyStockBroker:Cash Expenses:Unattributed:MyStockBroker:Cash 6 | ; 2024-04-02 pad Assets:SomeBroker:Total Income:SomeBroker:Total:PnL 7 | ; 2024-04-02 pad Liabilities:Shared:Unspecified Expenses:Unattributed:Shared:Unspecified 8 | ; 2024-04-02 pad Liabilities:Shared:SomeDude Expenses:Unattributed:Shared:SomeDude 9 | 10 | 2024-04-03 balance Assets:Physical:Cash 20.0 USD 11 | 2024-04-03 balance Assets:Physical:Cash 40.0 GBP 12 | 2024-04-03 balance Assets:MyFavouriteBank:Cash 2153.0 GBP 13 | 2024-04-03 balance Assets:MyLessFavouriteBank:Cash 150.0 GBP 14 | 2024-04-03 balance Assets:MyStockBroker:Cash 2100.0 USD 15 | 2024-04-03 custom "valuation" Assets:MyAutomaticBroker:Total 7521.0 USD 16 | -------------------------------------------------------------------------------- /gen_accounts.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import datetime 4 | import io 5 | from collections import namedtuple 6 | from dataclasses import dataclass, field 7 | from datetime import datetime, timedelta 8 | from typing import Optional 9 | 10 | import click 11 | import yaml 12 | 13 | ACCOUNTS_OPENING_DATE = "1970-01-01" 14 | ACCOUNTS_GEN_BY_TYPE = { 15 | "cash": [ 16 | "Assets:@", 17 | "Equity:OpeningBalances:@", 18 | "Income:Unattributed:@", 19 | "Income:Uncategorized:@", 20 | "Expenses:Unattributed:@", 21 | "Expenses:Uncategorized:@", 22 | ], 23 | "opaque_funds": ["Assets:@", "Equity:OpeningBalances:@", "Income:@:PnL"], 24 | "opaque_funds_valuation": ["Assets:@", "Equity:OpeningBalances:@", "Income:@:PnL"], 25 | "investments": [ 26 | "Assets:@", 27 | "Equity:OpeningBalances:@", 28 | ], 29 | "liabilities": [ 30 | "Liabilities:@", 31 | "Equity:OpeningBalances:@", 32 | "Expenses:Unattributed:@", 33 | ], 34 | } 35 | 36 | ACCOUNT_TYPES = ACCOUNTS_GEN_BY_TYPE.keys() 37 | 38 | 39 | @dataclass 40 | class LeafConfig: 41 | type: str = field() 42 | name: str = field() 43 | currencies: list[str] = field() 44 | booking_method: Optional[str] = field() 45 | 46 | 47 | @dataclass 48 | class ParsedConfig: 49 | account_configs: list = field() 50 | opening_balances_date: datetime = field() 51 | 52 | 53 | def generate_accounts_recursive(account_type, node, cur_name, last_parent_key=None): 54 | # print(f'Gen {account_type} {cur_name}') 55 | if isinstance(node, list): 56 | result = [] 57 | for item in node: 58 | result.extend(generate_accounts_recursive(account_type, item, cur_name)) 59 | return result 60 | elif isinstance(node, dict): 61 | results = [] 62 | booking_method = None 63 | for key in node.keys(): 64 | if key == "currencies": 65 | results = [LeafConfig(account_type, cur_name, node[key], None)] 66 | # elif key == 'leaf_currencies': 67 | # for currency in node[key]: 68 | # results.append( 69 | # LeafConfig(account_type, f"{cur_name}:{currency}" if cur_name else currency, [currency], None) 70 | # ) 71 | elif key == "booking_method": 72 | booking_method = node[key] 73 | else: 74 | # Part of account name 75 | return generate_accounts_recursive( 76 | account_type, 77 | node[key], 78 | f"{cur_name}:{key}" if cur_name else key, 79 | last_parent_key=key, 80 | ) 81 | if not results: 82 | # If currencies not specified, assume the leaf dictionary is named as currency 83 | results = [ 84 | LeafConfig( 85 | account_type, 86 | cur_name if cur_name else last_parent_key, 87 | [last_parent_key], 88 | None, 89 | ) 90 | ] 91 | for result in results: 92 | result.booking_method = booking_method 93 | return results 94 | elif isinstance(node, str): 95 | return [ 96 | LeafConfig( 97 | account_type, f"{cur_name}:{node}" if cur_name else node, [node], None 98 | ) 99 | ] 100 | else: 101 | return [] 102 | 103 | 104 | def _config_object_to_parsed_config(config_object): 105 | # print(json.dumps(config_object, indent=4)) 106 | configs = [] 107 | for account_type in ACCOUNT_TYPES: 108 | if account_type in config_object: 109 | configs.extend( 110 | generate_accounts_recursive( 111 | account_type, config_object.get(account_type), "" 112 | ) 113 | ) 114 | opening_balances_date = datetime.strptime( 115 | config_object["opening_balances_date"], "%Y-%m-%d" 116 | ) 117 | return ParsedConfig( 118 | account_configs=configs, opening_balances_date=opening_balances_date 119 | ) 120 | 121 | 122 | def parse_config_from_string(config_string): 123 | config_object = yaml.safe_load(io.StringIO(config_string)) 124 | return _config_object_to_parsed_config(config_object) 125 | 126 | 127 | def parse_config(filename): 128 | parsed_config = None 129 | with open(filename, "r") as config: 130 | config_object = yaml.safe_load(config) 131 | parsed_config = _config_object_to_parsed_config(config_object) 132 | 133 | return parsed_config 134 | 135 | 136 | def gen_update_totals( 137 | config, date, values, is_initial_check=False, comment_accounts=set() 138 | ): 139 | output = io.StringIO() 140 | 141 | pad_date = (date - timedelta(days=1)).strftime("%Y-%m-%d") 142 | balance_date = date.strftime("%Y-%m-%d") 143 | 144 | for cfg in config.account_configs: 145 | account_type = cfg.type 146 | name = cfg.name 147 | currencies = cfg.currencies 148 | if account_type in [ 149 | "cash", 150 | "opaque_funds", 151 | "opaque_funds_valuation", 152 | "liabilities", 153 | ]: 154 | account_name = ( 155 | f"Liabilities:{name}" 156 | if account_type == "liabilities" 157 | else f"Assets:{name}" 158 | ) 159 | if is_initial_check: 160 | pad_account = f"Equity:OpeningBalances:{name}" 161 | elif account_type == "opaque_funds": 162 | pad_account = f"Income:{name}:PnL" 163 | else: 164 | pad_account = f"Expenses:Unattributed:{name}" 165 | if account_name in comment_accounts: 166 | output.write(f"; {pad_date} pad {account_name:65} {pad_account} \n") 167 | else: 168 | output.write(f"{pad_date} pad {account_name:65} {pad_account} \n") 169 | 170 | output.write("\n") 171 | for cfg in config.account_configs: 172 | account_type = cfg.type 173 | name = cfg.name 174 | currencies = cfg.currencies 175 | for currency in currencies: 176 | if (name, currency) in values: 177 | balance_statement = "" 178 | if account_type in ["cash", "opaque_funds", "liabilities"] or ( 179 | account_type == "opaque_funds_valuation" and is_initial_check 180 | ): 181 | balance_statement = ( 182 | f"{balance_date} balance Liabilities:{name}" 183 | if account_type == "liabilities" 184 | else f"{balance_date} balance Assets:{name}" 185 | ) 186 | elif account_type == "opaque_funds_valuation": 187 | balance_statement = ( 188 | f'{balance_date} custom "valuation" Assets:{name}' 189 | ) 190 | output.write( 191 | f"{balance_statement:65} {values[(name, currency)]} {currency}\n" 192 | ) 193 | 194 | return output.getvalue() 195 | 196 | 197 | def gen_accounts(config): 198 | output = io.StringIO() 199 | for cfg in config.account_configs: 200 | account_type = cfg.type 201 | name = cfg.name 202 | booking_method = cfg.booking_method 203 | account_names = [ 204 | account.replace("@", name) for account in ACCOUNTS_GEN_BY_TYPE[account_type] 205 | ] 206 | output.write(f"; account {name} ({account_type})\n") 207 | for account in account_names: 208 | if booking_method and account.startswith("Assets:"): 209 | output.write( 210 | f'{ACCOUNTS_OPENING_DATE} open {account} "{booking_method}"\n' 211 | ) 212 | else: 213 | output.write(f"{ACCOUNTS_OPENING_DATE} open {account}\n") 214 | output.write("\n") 215 | return output.getvalue() 216 | 217 | 218 | @click.group() 219 | @click.option("--config_file", type=click.Path(), default="accounts_config.yml") 220 | @click.pass_context 221 | def cli(ctx, config_file): 222 | ctx.obj["config"] = parse_config(config_file) 223 | 224 | 225 | @cli.command() 226 | @click.pass_context 227 | def accounts(ctx): 228 | config = ctx.obj["config"] 229 | for account_type, name, _ in config.account_configs: 230 | account_names = [ 231 | account.replace("@", name) for account in ACCOUNTS_GEN_BY_TYPE[account_type] 232 | ] 233 | for account in account_names: 234 | print(f"{ACCOUNTS_OPENING_DATE} open {account}") 235 | print() 236 | 237 | 238 | @cli.command() 239 | @click.pass_context 240 | def totals_init(ctx): 241 | config = ctx.obj["config"] 242 | pad_date = (config.opening_balances_date - timedelta(days=1)).strftime("%Y-%m-%d") 243 | balance_date = config.opening_balances_date.strftime("%Y-%m-%d") 244 | 245 | for cfg in config.account_configs: 246 | account_type = cfg.type 247 | name = cfg.name 248 | currencies = cfg.currencies 249 | for currency in currencies: 250 | if account_type in ["cash", "opaque_funds", "liabilities"]: 251 | pad_statement_left = ( 252 | f"{pad_date} pad Liabilities:{name}" 253 | if account_type == "liabilities" 254 | else f"{pad_date} pad Assets:{name}" 255 | ) 256 | print(f"{pad_statement_left:60} Equity:OpeningBalances:{name}") 257 | 258 | print() 259 | for cfg in config.account_configs: 260 | account_type = cfg.type 261 | name = cfg.name 262 | currencies = cfg.currencies 263 | for currency in currencies: 264 | if account_type in ["cash", "opaque_funds", "liabilities"]: 265 | balance_statement = ( 266 | f"{balance_date} balance Liabilities:{name}" 267 | if account_type == "liabilities" 268 | else f"{balance_date} balance Assets:{name}" 269 | ) 270 | print(f"{balance_statement:60}" + f"0 {currency}") 271 | 272 | 273 | @cli.command() 274 | @click.argument("date") 275 | @click.pass_context 276 | def totals_update(ctx, date): 277 | config = ctx.obj["config"] 278 | parsed_date = datetime.strptime(date, "%Y-%m-%d") 279 | 280 | pad_date = (parsed_date - timedelta(days=1)).strftime("%Y-%m-%d") 281 | balance_date = parsed_date.strftime("%Y-%m-%d") 282 | 283 | print("\n") 284 | for account_type, name, currencies in config.account_configs: 285 | if account_type in ["cash", "opaque_funds", "liabilities"]: 286 | pad_statement_left = ( 287 | f"{pad_date} pad Liabilities:{name}" 288 | if account_type == "liabilities" 289 | else f"{pad_date} pad Assets:{name}" 290 | ) 291 | pad_account = ( 292 | f"Income:{name}:PnL" 293 | if account_type == "opaque_funds" 294 | else f"Expenses:Unattributed:{name}" 295 | ) 296 | print(f"{pad_statement_left:60}" + pad_account) 297 | 298 | print() 299 | for account_type, name, currencies in config.account_configs: 300 | for currency in currencies: 301 | if account_type in ["cash", "opaque_funds", "liabilities"]: 302 | balance_statement = ( 303 | f"{balance_date} balance Liabilities:{name}" 304 | if account_type == "liabilities" 305 | else f"{balance_date} balance Assets:{name}" 306 | ) 307 | print(f"{balance_statement:60}" + f"0 {currency}") 308 | elif account_type == "opaque_funds_valuation": 309 | balance_statement = f'{balance_date} custom "valuation" Assets:{name}' 310 | print(f"{balance_statement:60}" + f"0 {currency}") 311 | 312 | 313 | if __name__ == "__main__": 314 | cli(obj={}) 315 | -------------------------------------------------------------------------------- /images/beancount_import_interface.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Evernight/lazy-beancount/75502272d56ee1248782bb75e0067551f8c6a485/images/beancount_import_interface.png -------------------------------------------------------------------------------- /images/config_accounts.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Evernight/lazy-beancount/75502272d56ee1248782bb75e0067551f8c6a485/images/config_accounts.png -------------------------------------------------------------------------------- /images/dashboards_sankey.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Evernight/lazy-beancount/75502272d56ee1248782bb75e0067551f8c6a485/images/dashboards_sankey.png -------------------------------------------------------------------------------- /images/demo_dashboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Evernight/lazy-beancount/75502272d56ee1248782bb75e0067551f8c6a485/images/demo_dashboard.png -------------------------------------------------------------------------------- /images/demo_dashboard_0_3_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Evernight/lazy-beancount/75502272d56ee1248782bb75e0067551f8c6a485/images/demo_dashboard_0_3_5.png -------------------------------------------------------------------------------- /images/demo_expenses.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Evernight/lazy-beancount/75502272d56ee1248782bb75e0067551f8c6a485/images/demo_expenses.png -------------------------------------------------------------------------------- /images/expenses_detailed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Evernight/lazy-beancount/75502272d56ee1248782bb75e0067551f8c6a485/images/expenses_detailed.png -------------------------------------------------------------------------------- /images/expenses_heatmap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Evernight/lazy-beancount/75502272d56ee1248782bb75e0067551f8c6a485/images/expenses_heatmap.png -------------------------------------------------------------------------------- /images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Evernight/lazy-beancount/75502272d56ee1248782bb75e0067551f8c6a485/images/logo.png -------------------------------------------------------------------------------- /images/net_worth_with_title.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Evernight/lazy-beancount/75502272d56ee1248782bb75e0067551f8c6a485/images/net_worth_with_title.png -------------------------------------------------------------------------------- /images/prices_page.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Evernight/lazy-beancount/75502272d56ee1248782bb75e0067551f8c6a485/images/prices_page.png -------------------------------------------------------------------------------- /images/totals_example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Evernight/lazy-beancount/75502272d56ee1248782bb75e0067551f8c6a485/images/totals_example.png -------------------------------------------------------------------------------- /lazy_beancount.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | LAZY_BEANCOUNT_HOST=${LAZY_BEANCOUNT_HOST:-"localhost"} 4 | LAZY_BEANCOUNT_PORT=${LAZY_BEANCOUNT_PORT:-8777} 5 | FAVA_PORT=${FAVA_PORT:-5003} 6 | BEANCOUNT_IMPORT_PORT=${BEANCOUNT_IMPORT_PORT:-8101} 7 | 8 | docker rm lazybean; 9 | docker run -it \ 10 | -v $PWD/$1:/workspace \ 11 | -p ${FAVA_PORT}:5000 \ 12 | -p ${BEANCOUNT_IMPORT_PORT}:8101 \ 13 | -p ${LAZY_BEANCOUNT_PORT}:8501 \ 14 | -e LAZY_BEANCOUNT_HOST=$LAZY_BEANCOUNT_HOST \ 15 | -e LAZY_BEANCOUNT_PORT=$LAZY_BEANCOUNT_PORT \ 16 | -e FAVA_PORT=$FAVA_PORT \ 17 | -e BEANCOUNT_IMPORT_PORT=$BEANCOUNT_IMPORT_PORT \ 18 | --name lazybean \ 19 | --user $(id -u):$(id -g) \ 20 | vandereer/lazy-beancount:latest 21 | -------------------------------------------------------------------------------- /lazy_beancount_podman.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | LAZY_BEANCOUNT_HOST=${LAZY_BEANCOUNT_HOST:-"localhost"} 4 | LAZY_BEANCOUNT_PORT=${LAZY_BEANCOUNT_PORT:-8777} 5 | FAVA_PORT=${FAVA_PORT:-5003} 6 | BEANCOUNT_IMPORT_PORT=${BEANCOUNT_IMPORT_PORT:-8101} 7 | 8 | podman rm lazybean; 9 | podman run -it \ 10 | -v $PWD/$1:/workspace \ 11 | -p ${FAVA_PORT}:5000 \ 12 | -p ${BEANCOUNT_IMPORT_PORT}:8101 \ 13 | -p ${LAZY_BEANCOUNT_PORT}:8501 \ 14 | -e LAZY_BEANCOUNT_HOST=$LAZY_BEANCOUNT_HOST \ 15 | -e LAZY_BEANCOUNT_PORT=$LAZY_BEANCOUNT_PORT \ 16 | -e FAVA_PORT=$FAVA_PORT \ 17 | -e BEANCOUNT_IMPORT_PORT=$BEANCOUNT_IMPORT_PORT \ 18 | --name lazybean \ 19 | --userns=keep-id:uid=1245,gid=1245 \ 20 | vandereer/lazy-beancount:latest 21 | 22 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | beancount==3.1.0 2 | 3 | # fava prebuilt with https://github.com/beancount/fava/pull/1950 to install via wheel 4 | # changes from upstream fava: 5 | # * includes behaviour change for filters: https://github.com/beancount/fava/pull/1969 6 | # * includes dark mode switch: https://github.com/beancount/fava/pull/1950 7 | # * includes filter presets feature 8 | # browse full changes history here: https://github.com/Evernight/fava/commits/custom-fava-build/ 9 | fava @ https://github.com/Evernight/fava/raw/e5b1e94ced91144816b07808c79fb383f4616f8e/prebuilt_wheels/fava-1.31.dev25+g4c745bc5.tar.gz#sha1=1e24b9583fd802bc4255a3ab9290154465ceed74 10 | # not on pypi, using fixed commit, also depending on Beancount v2 11 | beanprice @ git+https://github.com/beancount/beanprice@7a6efa7e0b0c9567df27c98e3fd4e8fc3e1c7117 12 | # last commit before ec250696e1955edbbef8d01e5a33030be94d935c that breaks current Fava compatibility 13 | beanquery @ git+https://github.com/beancount/beanquery.git@4a0e62a61e64807c9cd01ce32fb24721907b4c3b 14 | pricehist==1.4.12 15 | 16 | # this version resolution needed for features compatibility, need to double-check if it's needed anymore 17 | numpy==1.26.4 18 | 19 | # missing requirements for beancount-import 20 | setuptools_scm>=5.0.2 21 | 22 | # streamlit/frontend 23 | streamlit==1.38.0 24 | streamlit_option_menu==0.3.13 25 | streamlit_ace==0.1.1 26 | streamlit-echarts==0.4.0 27 | 28 | # Fava extensions 29 | # fava-dashboards with local fixes for the ThemeToggle switch to work correctly (see https://github.com/beancount/fava/pull/1950) 30 | fava-dashboards @ git+https://github.com/Evernight/fava-dashboards.git@9e89792c985935ae610a096625399fa558ba59bf 31 | # fava-portfolio-returns also with the fix for the dark-mode 32 | fava-portfolio-returns @ git+https://github.com/Evernight/fava-portfolio-returns.git@7be2b3a7a3b6d18bead952391eea9dededb2b3ae 33 | fava-investor==1.0.1 34 | 35 | # Beancount plugins 36 | beancount_share @ git+https://github.com/Akuukis/beancount_share.git@8f925422b9947e88babbeab3fdf7d71c53c9aa9e 37 | beancount_interpolate @ git+https://github.com/Akuukis/beancount_interpolate.git@e9c1241d5980781d270a7cc5c17cf2ca99c10faa 38 | beancount-reds-plugins @ git+https://github.com/redstreet/beancount_reds_plugins@081acc4c7751d354d1c1481891fc983710428e7d 39 | autobean @ git+https://github.com/SEIAROTg/autobean@b14d040eaa75a55731ef650e76425d7d356ec2b9 40 | 41 | # Plugins without PyPI releases 42 | beancount-lazy-plugins @ git+https://github.com/Evernight/beancount-lazy-plugins@cf4780d9c8a259ac4d7c06cdde984bbc686fa9d6 43 | beancount-generate-base-ccy-prices @ git+https://github.com/Evernight/beancount-generate-base-ccy-prices@b40999e2b2307f7ce121ce06821628ec0ad70f91 44 | beancount-importers @ git+https://github.com/Evernight/beancount-importers@06fcd1200d3825eb7a0669f35bd313b2efcaf8cd 45 | -------------------------------------------------------------------------------- /run_daemons.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | echo "================================================================" 3 | echo "Lazy Beancount is available on http://$LAZY_BEANCOUNT_HOST:$LAZY_BEANCOUNT_PORT/" 4 | echo "(configurable via LAZY_BEANCOUNT_PORT environment variable)" 5 | echo "" 6 | echo "Fava available on http://$LAZY_BEANCOUNT_HOST:$FAVA_PORT/" 7 | echo "Beancount-import available on http://$LAZY_BEANCOUNT_HOST:$BEANCOUNT_IMPORT_PORT/" 8 | echo "================================================================" 9 | echo "" 10 | 11 | echo "" > lazy-beancount.log 12 | fava -H 0.0.0.0 -p $FAVA_PORT_INTERNAL main.bean 2>&1 | tee lazy-beancount.log & 13 | python3 -m beancount_importers.beancount_import_run \ 14 | --address 0.0.0.0 \ 15 | --journal_file main.bean \ 16 | --importers_config_file importers_config.yml \ 17 | 2>&1 | tee lazy-beancount.log & 18 | streamlit run /beancount/streamlit_frontend/frontend.py \ 19 | --server.address 0.0.0.0 \ 20 | --server.headless "true" \ 21 | --server.enableStaticServing "true" \ 22 | --browser.gatherUsageStats "false" \ 23 | --client.showSidebarNavigation "false" \ 24 | --theme.base "dark" \ 25 | --theme.primaryColor "#004583" \ 26 | >&1 | tee lazy-beancount.log & 27 | 28 | # Wait for any process to exit 29 | wait -n 30 | 31 | # Exit with status of process that exited first 32 | exit $? 33 | -------------------------------------------------------------------------------- /streamlit_frontend/.streamlit/config.toml: -------------------------------------------------------------------------------- 1 | [browser] 2 | gatherUsageStats = false 3 | 4 | [client] 5 | showSidebarNavigation = false 6 | 7 | [server] 8 | headless = true 9 | enableStaticServing = true 10 | 11 | [theme] 12 | base="dark" 13 | primaryColor="#004583" -------------------------------------------------------------------------------- /streamlit_frontend/frontend.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | import io 4 | import os 5 | import pprint 6 | import re 7 | import subprocess 8 | from collections import defaultdict 9 | from datetime import datetime, timedelta 10 | from decimal import Decimal 11 | 12 | import streamlit as st 13 | import streamlit.components.v1 as components 14 | import yaml 15 | from beancount import loader 16 | from beancount_importers import beancount_import_run 17 | from streamlit_ace import st_ace 18 | from streamlit_echarts import JsCode, st_echarts 19 | from streamlit_option_menu import option_menu 20 | 21 | import gen_accounts 22 | 23 | ACCOUNT_TYPE_DESC = { 24 | "cash": "💶 Cash", 25 | "opaque_funds": "🏦 Fund", 26 | "opaque_funds_valuation": "🏦 Fund", 27 | "liabilities": "👥 Shared", 28 | } 29 | TOTALS_DIR = "totals" 30 | PRICES_DIR = "prices" 31 | ACCOUNTS_CONFIG_FILE = "accounts_config.yml" 32 | GENERATED_ACCOUNTS_FILE = "accounts.gen.bean" 33 | PRICES_CONFIG_FILE = "prices_config.yml" 34 | MAIN_LEDGER_FILE = "main.bean" 35 | 36 | hostname = os.environ.get("LAZY_BEANCOUNT_HOST", "localhost") 37 | fava_port = os.environ.get("FAVA_PORT", 5003) 38 | beancount_import_port = os.environ.get("BEANCOUNT_IMPORT_PORT", 8101) 39 | lazy_beancount_port = os.environ.get("LAZY_BEANCOUNT_PORT", 8777) 40 | 41 | st.set_page_config( 42 | layout="wide", 43 | page_title="Lazy Beancount", 44 | page_icon=f"http://{hostname}:{lazy_beancount_port}/app/static/favicon-32x32.png", 45 | menu_items=None, 46 | initial_sidebar_state="collapsed", 47 | ) 48 | 49 | hide_st_style = """ 50 | 59 | """ 60 | st.markdown(hide_st_style, unsafe_allow_html=True) 61 | 62 | 63 | def trigger_fava_reload(): 64 | command = ["touch", MAIN_LEDGER_FILE] 65 | subprocess.check_output(command) 66 | print("Triggered Fava reload") 67 | 68 | 69 | def fava_page(): 70 | components.iframe(f"http://{hostname}:{fava_port}", height=640) 71 | st.page_link( 72 | f"http://{hostname}:{fava_port}", 73 | label="open in new tab", 74 | icon=":material/arrow_outward:", 75 | ) 76 | 77 | 78 | @st.dialog("File already exists. Overwrite?") 79 | def write_file_dialog(filename, file_contents, on_confirm=None): 80 | st.text(f"Overwrite file {filename}?") 81 | if st.button("Yes"): 82 | with open(filename, "w") as file: 83 | file.write(file_contents) 84 | if on_confirm: 85 | with st.spinner("Saving..."): 86 | on_confirm() 87 | st.text("Saved!") 88 | st.rerun() 89 | if st.button("Cancel"): 90 | st.rerun() 91 | 92 | 93 | def file_editor_with_save(filename, additional_editor_params={}): 94 | with open(filename, "r") as f: 95 | file_contents = f.read() 96 | editor_params = { 97 | "language": "yaml", 98 | "theme": "nord_dark", 99 | "height": 560, 100 | **additional_editor_params, 101 | } 102 | result = st_ace(file_contents, **editor_params) 103 | st.text( 104 | "Don't forget to apply changes (cmd+enter) before clicking the button below" 105 | ) 106 | if st.button("Save", type="primary"): 107 | if not os.path.exists(filename): 108 | with open(filename, "w") as file: 109 | file.write(result) 110 | st.text("File created!") 111 | st.rerun() 112 | else: 113 | write_file_dialog(filename, result) 114 | 115 | 116 | def totals_page(): 117 | col1, col2, col3 = st.columns([1, 2, 2]) 118 | with col1: 119 | totals_files = sorted(os.listdir(TOTALS_DIR)) 120 | totals_dates = [] 121 | for filename in totals_files: 122 | res = re.search(r"update-(\d+)-(\d+)-(\d+)\.gen\.bean", filename) 123 | if res: 124 | totals_dates.append( 125 | res.group(1) + "/" + res.group(2) + "/" + res.group(3) 126 | ) 127 | selected_file = option_menu( 128 | None, 129 | ["New", "Initial"] + totals_dates, 130 | icons=["calendar-plus", "calendar-minus"] 131 | + ["calendar"] * len(totals_dates), 132 | ) 133 | 134 | with col2: 135 | config = gen_accounts.parse_config(ACCOUNTS_CONFIG_FILE) 136 | cur_date = None 137 | if selected_file == "New": 138 | cur_date = datetime.today().date() 139 | elif selected_file == "Initial": 140 | cur_date = config.opening_balances_date 141 | else: 142 | cur_date = datetime.strptime(selected_file, "%Y/%m/%d") 143 | date = st.date_input( 144 | "Select date", 145 | cur_date, 146 | max_value=(datetime.today() + timedelta(days=7)).date(), 147 | min_value=config.opening_balances_date, 148 | disabled=(selected_file == "Initial"), 149 | ) 150 | filename = None 151 | values = {} 152 | if selected_file == "Initial": 153 | filename = os.path.join(TOTALS_DIR, "initial.gen.bean") 154 | else: 155 | filename = os.path.join( 156 | TOTALS_DIR, "update-" + date.strftime("%Y-%m-%d") + ".gen.bean" 157 | ) 158 | 159 | if os.path.exists(filename): 160 | values = {} 161 | with open(filename, "r") as f: 162 | for line in f: 163 | res = re.search( 164 | r".+\s+balance\s+\w+\:([\w\:]+)\s+([-\d\.]+)\s+(\w+).*", line 165 | ) 166 | if res: 167 | values[(res.group(1), res.group(3))] = float(res.group(2)) 168 | res_val = re.search( 169 | r".+\s+\"valuation\"\s+\w+\:([\w\:]+)\s+([-\d\.]+)\s+(\w+).*", 170 | line, 171 | ) 172 | if res_val: 173 | values[(res_val.group(1), res_val.group(3))] = float( 174 | res_val.group(2) 175 | ) 176 | else: 177 | if selected_file == "New": 178 | values = {} 179 | else: 180 | values = st.session_state.get("totals_values", {}) 181 | 182 | rows = [] 183 | for cfg in config.account_configs: 184 | account_type = cfg.type 185 | name = cfg.name 186 | currencies = cfg.currencies 187 | if account_type not in [ 188 | "cash", 189 | "opaque_funds", 190 | "opaque_funds_valuation", 191 | "liabilities", 192 | ]: 193 | continue 194 | for currency in currencies: 195 | rows.append( 196 | { 197 | "type": ACCOUNT_TYPE_DESC.get(account_type, "-"), 198 | "name": name, 199 | "currency": currency, 200 | "value": values.get((name, currency), None), 201 | } 202 | ) 203 | st.session_state["totals_values"] = values 204 | 205 | edited_rows = st.data_editor( 206 | rows, 207 | column_config={ 208 | "type": "Type", 209 | "name": "Name", 210 | "currency": "Currency", 211 | "value": st.column_config.NumberColumn("Value"), 212 | }, 213 | disabled=["type", "name", "currency"], 214 | use_container_width=True, 215 | height=560, 216 | ) 217 | 218 | with col3: 219 | if not os.path.exists(filename): 220 | st.subheader(f":green[{filename} (new)]") 221 | else: 222 | st.subheader(filename) 223 | 224 | st.markdown( 225 | "Don't forget to save the file after editing. This may take few seconds for a large ledger since it will " 226 | + "check which ```pad``` operations are necessary and which should be commented out." 227 | ) 228 | 229 | values = { 230 | (row["name"], row["currency"]): row["value"] 231 | for row in edited_rows 232 | if row["value"] is not None 233 | } 234 | file_contents = gen_accounts.gen_update_totals( 235 | config, date, values, is_initial_check=(selected_file == "Initial") 236 | ) 237 | st.code(file_contents) 238 | 239 | @st.dialog("Remove the file?") 240 | def delete_file_dialog(): 241 | if st.button("Yes"): 242 | os.remove(filename) 243 | trigger_fava_reload() 244 | st.rerun() 245 | if st.button("Cancel"): 246 | st.rerun() 247 | 248 | if st.button("Save", type="primary"): 249 | 250 | def comment_out_unused_pads(): 251 | entries, errors, options_map = loader.load_file(MAIN_LEDGER_FILE) 252 | comment_pad_accounts = set() 253 | for error in errors: 254 | if ( 255 | error.message == "Unused Pad entry" 256 | and filename in error.source["filename"] 257 | ): 258 | comment_pad_accounts.add(error.entry.account) 259 | file_contents_pad_commented = gen_accounts.gen_update_totals( 260 | config, 261 | date, 262 | values, 263 | is_initial_check=(selected_file == "Initial"), 264 | comment_accounts=comment_pad_accounts, 265 | ) 266 | with open(filename, "w") as file: 267 | file.write(file_contents_pad_commented) 268 | trigger_fava_reload() 269 | 270 | if not os.path.exists(filename): 271 | with st.spinner("Saving..."): 272 | with open(filename, "w") as file: 273 | file.write(file_contents) 274 | comment_out_unused_pads() 275 | st.text("File created!") 276 | else: 277 | write_file_dialog( 278 | filename, file_contents, on_confirm=comment_out_unused_pads 279 | ) 280 | if os.path.exists(filename): 281 | if st.button("Delete"): 282 | delete_file_dialog() 283 | 284 | 285 | def prices_page(): 286 | col1, col2 = st.columns([1, 4]) 287 | 288 | date = None 289 | prices_for_dates = st.session_state.get("prices_for_dates", defaultdict(str)) 290 | with col2: 291 | prices_config = None 292 | with open(PRICES_CONFIG_FILE, "r") as config: 293 | prices_config = yaml.safe_load(config) 294 | commodities_map = {} 295 | for c in prices_config.get("commodities") or []: 296 | for ind, val in c.items(): 297 | commodities_map[ind] = val 298 | 299 | date = st.date_input( 300 | "Select date", datetime.today().date(), max_value=datetime.today().date() 301 | ) 302 | date_str = str(date) 303 | if st.button("Fetch", type="primary"): 304 | with st.spinner("Fetching prices..."): 305 | try: 306 | command = [ 307 | "bean-price", 308 | MAIN_LEDGER_FILE, 309 | "-i", 310 | "-c", 311 | f"--date={date.strftime('%Y-%m-%d')}", 312 | ] 313 | st.code(" ".join(command), language="shell") 314 | 315 | beanprice_output = subprocess.check_output(command) 316 | processed_output = io.StringIO() 317 | for line in beanprice_output.decode("utf-8").split("\n"): 318 | res = re.search( 319 | r"^([\d-]+)\s+price\s+([\w-]+)\s+([\d\\.]+)\s+([\w-]+)", 320 | line, 321 | ) 322 | if res: 323 | price_date = res.group(1) 324 | commodity = res.group(2) 325 | value = res.group(3) 326 | currency = res.group(4) 327 | 328 | updated_value = Decimal(value) 329 | if ( 330 | commodity in commodities_map 331 | and "multiplier" in commodities_map[commodity] 332 | ): 333 | updated_value *= Decimal( 334 | commodities_map[commodity]["multiplier"] 335 | ) 336 | 337 | # Ignore zero values 338 | if updated_value > 0: 339 | processed_output.write( 340 | f"{price_date} price {commodity:20} {updated_value:.8f} {currency}\n" 341 | ) 342 | 343 | prices_for_dates[date_str] = processed_output.getvalue() 344 | st.session_state["prices_for_dates"] = prices_for_dates 345 | 346 | except Exception as e: 347 | st.code(str(e)) 348 | 349 | st.subheader("Processed output:") 350 | st.code(prices_for_dates[date_str]) 351 | 352 | filename = os.path.join( 353 | PRICES_DIR, "prices-" + date.strftime("%Y-%m-%d") + ".gen.bean" 354 | ) 355 | st.markdown(f"Save to ```{filename}```?") 356 | if st.button( 357 | "Save", type="primary", disabled=(prices_for_dates[date_str] == "") 358 | ): 359 | print("saving") 360 | print(prices_for_dates[date_str]) 361 | with open(filename, "w") as f: 362 | f.write(prices_for_dates[date_str]) 363 | st.markdown(f"Successfully saved into ```{filename}```") 364 | trigger_fava_reload() 365 | 366 | with col1: 367 | prices_files = sorted(os.listdir(PRICES_DIR)) 368 | prices_dates = [] 369 | for filename in prices_files: 370 | res = re.search(r"prices-(\d+)-(\d+)-(\d+)\.gen\.bean", filename) 371 | if res and res.group(1) == str(date.year): 372 | # prices_dates.append(res.group(1) + '/' + res.group(2) + '/' + res.group(3)) 373 | prices_dates.append( 374 | ( 375 | res.group(1) + "-" + res.group(2) + "-" + res.group(3), 376 | int(res.group(3)), 377 | ) 378 | ) 379 | heatmap = { 380 | "tooltip": { 381 | "position": "top", 382 | }, 383 | "calendar": [ 384 | { 385 | "orient": "vertical", 386 | "range": str(date.year), 387 | "cellSize": [20, "auto"], 388 | "dayLabel": {"show": True, "firstDay": 1, "color": "#ddd"}, 389 | "monthLabel": {"show": True, "color": "#ddd"}, 390 | # 'itemStyle': {'color' : '#333'} 391 | # 'yearLabel': { 'show': False } 392 | } 393 | ], 394 | "series": { 395 | "type": "heatmap", 396 | "coordinateSystem": "calendar", 397 | "symbolSize": 0, 398 | "label": { 399 | "show": True, 400 | "formatter": JsCode("function(p) {return p.data[1];}").js_code, 401 | "fontSize": 8, 402 | }, 403 | "data": prices_dates, 404 | }, 405 | } 406 | st_echarts(options=heatmap, height=640) 407 | 408 | 409 | def import_page(): 410 | selected_import_page = option_menu( 411 | None, 412 | ["Review data", "Upload files"], 413 | icons=["view-list", "file-earmark-arrow-up-fill"], 414 | orientation="horizontal", 415 | ) 416 | if selected_import_page == "Review data": 417 | components.iframe(f"http://{hostname}:{beancount_import_port}", height=540) 418 | st.page_link( 419 | f"http://{hostname}:{beancount_import_port}", 420 | label="open in new tab", 421 | icon=":material/arrow_outward:", 422 | ) 423 | else: 424 | st.markdown( 425 | "Define configuration of importers in `importers_config.yml` under Config tab first. " 426 | + "Then upload statement files (for example, ```csv```) here." 427 | ) 428 | importers_config = beancount_import_run.load_import_config_from_file( 429 | "importers_config.yml", "beancount_import_data", "beancount_import_output" 430 | ) 431 | columns = st.columns(3) 432 | col_ind = 0 433 | all_types = dict.fromkeys( 434 | c.get("type", "?") for c in importers_config["all"]["data_sources"] 435 | ) 436 | type_markers = "🔴🟣🟠🟢🟡🔵🟤" 437 | type_marker = {} 438 | for i, type in enumerate(all_types): 439 | type_marker[type] = type_markers[i % len(type_markers)] 440 | 441 | for config in importers_config["all"]["data_sources"]: 442 | with columns[col_ind].container(border=True): 443 | uploaded_file = st.file_uploader( 444 | f"{config.get('emoji', '📄')} **{config['account']}**\n\n" 445 | + f"{type_marker[config.get('type', '?')]} 💱 **{config.get('currency', '?')}**\n\n" 446 | + f"{config['directory']}", 447 | help=config.get("description"), 448 | ) 449 | if uploaded_file is not None: 450 | bytes_data = uploaded_file.getvalue() 451 | available_file_name = uploaded_file.name 452 | ind = 0 453 | while os.path.exists( 454 | os.path.join(config["directory"], available_file_name) 455 | ): 456 | ind += 1 457 | filename_and_ext = os.path.splitext(uploaded_file.name) 458 | available_file_name = ( 459 | f"{filename_and_ext[0]}_{ind}{filename_and_ext[1]}" 460 | ) 461 | with open( 462 | os.path.join(config["directory"], available_file_name), "wb" 463 | ) as f: 464 | f.write(bytes_data) 465 | 466 | @st.dialog("File uploaded") 467 | def file_uploaded(): 468 | st.write( 469 | f"Uploaded to ```{os.path.join(config['directory'], available_file_name)}```" 470 | ) 471 | if st.button("Great!"): 472 | st.rerun() 473 | 474 | file_uploaded() 475 | col_ind = (col_ind + 1) % 3 476 | 477 | 478 | def config_page(): 479 | selected_config = st.selectbox( 480 | "File", 481 | options=[ 482 | "accounts_config.yml", 483 | "prices_config.yml", 484 | "importers_config.yml", 485 | "main.bean", 486 | "accounts.bean", 487 | "commodities.bean", 488 | "manual_transactions.bean", 489 | ], 490 | label_visibility="collapsed", 491 | ) 492 | if selected_config == ACCOUNTS_CONFIG_FILE: 493 | col1, col2 = st.columns([1, 1]) 494 | # config = gen_accounts.parse_config(ACCOUNTS_CONFIG_FILE) 495 | with col1: 496 | with open(ACCOUNTS_CONFIG_FILE, "r") as f: 497 | accounts_config = f.read() 498 | text_edit_content = st_ace( 499 | accounts_config, 500 | auto_update=True, 501 | language="yaml", 502 | theme="nord_dark", 503 | height=600, 504 | tab_size=2, 505 | font_size=12, 506 | ) 507 | 508 | with col2: 509 | st.subheader(GENERATED_ACCOUNTS_FILE) 510 | st.markdown( 511 | "This editor is experimental, please save periodically / back up content / " 512 | + "don't type a lot at once or use an external editor in addition" 513 | ) 514 | 515 | result_content = "" 516 | error = False 517 | try: 518 | parsed_config = gen_accounts.parse_config_from_string(text_edit_content) 519 | result_content = gen_accounts.gen_accounts(parsed_config) 520 | except Exception as e: 521 | result_content = str(e) 522 | error = True 523 | 524 | with st.container(height=480, border=False): 525 | st.code(result_content, line_numbers=True) 526 | if st.button( 527 | f"Save file and update {GENERATED_ACCOUNTS_FILE}", 528 | type="primary", 529 | disabled=error, 530 | ): 531 | with open(ACCOUNTS_CONFIG_FILE, "w") as f: 532 | f.write(text_edit_content) 533 | with open(GENERATED_ACCOUNTS_FILE, "w") as f: 534 | f.write(result_content) 535 | st.text( 536 | f"Saved {ACCOUNTS_CONFIG_FILE} and updated {GENERATED_ACCOUNTS_FILE}" 537 | ) 538 | 539 | elif selected_config == "prices_config.yml": 540 | file_editor_with_save("prices_config.yml", {"height": 460}) 541 | elif selected_config == "importers_config.yml": 542 | file_editor_with_save("importers_config.yml", {"height": 460}) 543 | elif selected_config == "main.bean": 544 | file_editor_with_save("main.bean", {"language": "lisp", "height": 460}) 545 | elif selected_config == "accounts.bean": 546 | file_editor_with_save("accounts.bean", {"language": "lisp", "height": 460}) 547 | elif selected_config == "commodities.bean": 548 | file_editor_with_save("commodities.bean", {"language": "lisp", "height": 460}) 549 | elif selected_config == "manual_transactions.bean": 550 | file_editor_with_save( 551 | "manual_transactions.bean", {"language": "lisp", "height": 460} 552 | ) 553 | 554 | 555 | def logs_page(): 556 | if st.button("Trigger Fava reload", type="primary"): 557 | trigger_fava_reload() 558 | if st.button("Catch up with logs", type="primary"): 559 | # Don't do anything in particular but this will update the st.code element on the page 560 | pass 561 | st.code(open("lazy-beancount.log", "r").read(), line_numbers=True) 562 | 563 | 564 | pages = [ 565 | st.Page(fava_page, title="Fava", url_path="fava"), 566 | st.Page(totals_page, title="Totals", url_path="totals"), 567 | st.Page(import_page, title="Import", url_path="import"), 568 | st.Page(prices_page, title="Prices", url_path="prices"), 569 | st.Page(logs_page, title="Logs", url_path="logs"), 570 | st.Page(config_page, title="Config", url_path="config"), 571 | ] 572 | pg = st.navigation(pages) 573 | 574 | selected_page_index = 0 575 | for p in pages: 576 | if pg.title == p.title: 577 | break 578 | selected_page_index += 1 579 | selected_page = option_menu( 580 | None, 581 | [page.title for page in pages], 582 | icons=["coin", "pencil", "file-earmark-arrow-up", "graph-up", "file-text", "gear"], 583 | default_index=selected_page_index, 584 | orientation="horizontal", 585 | ) 586 | with st.sidebar: 587 | st.page_link( 588 | f"http://{hostname}:{fava_port}", label="Fava", icon=":material/arrow_outward:" 589 | ) 590 | st.page_link( 591 | f"http://{hostname}:{beancount_import_port}", 592 | label="Beancount Import", 593 | icon=":material/arrow_outward:", 594 | ) 595 | pg.run() 596 | if selected_page != pg.title: 597 | for p in pages: 598 | if p.title == selected_page: 599 | st.switch_page(p) 600 | --------------------------------------------------------------------------------