### Install Fava Source: https://github.com/beancount/fava/blob/main/docs/usage.md Install or upgrade Fava and its dependencies using pip. ```bash pip install --upgrade fava ``` -------------------------------- ### Start Fava Source: https://github.com/beancount/fava/blob/main/docs/usage.md Start the Fava web interface by providing the path to your Beancount ledger file. The interface will be available at http://localhost:5000. ```bash fava ledger.beancount ``` -------------------------------- ### Install and Run Fava Source: https://github.com/beancount/fava/blob/main/README.rst Install Fava using pip and run it with your Beancount ledger file. Access the web interface at http://localhost:5000. ```bash pip3 install fava fava ledger.beancount ``` -------------------------------- ### Install Fava with Excel Support Source: https://github.com/beancount/fava/blob/main/docs/usage.md Install Fava with optional dependencies required for exporting query results to Microsoft Excel or LibreOffice Calc. ```bash pip install --upgrade fava[excel] ``` -------------------------------- ### OAuth2 Proxy Configuration Example Source: https://github.com/beancount/fava/blob/main/contrib/docker/README.md Example configuration for the OAuth2 proxy, specifying cookie settings for security and session management. ```ini # cookie_name = "_oauth2_proxy" cookie_secret = "" # cookie_domain = "" # cookie_expire = "168h" # cookie_refresh = "" cookie_secure = true cookie_httponly = true ``` -------------------------------- ### OAuth2 Proxy Configuration Example Source: https://github.com/beancount/fava/blob/main/contrib/docker/README.md An example configuration file for oauth2_proxy, used to manage access to the Fava site. This configuration includes settings for redirect URL, upstream services, client ID, client secret, and email domain authorization. ```ini ## OAuth2 Proxy Config File ## https://github.com/bitly/oauth2_proxy ## : to listen on for HTTP/HTTPS clients # http_address = "127.0.0.1:4180" # https_address = ":443" ## TLS Settings # tls_cert_file = "" # tls_key_file = "" ## the OAuth Redirect URL. defaults to the "https://" + requested host header + "/oauth2/callback" redirect_url = "https://bean.xennet.org/oauth2/callback" ## the http url(s) of the upstream endpoint. If multiple, routing is based on path upstreams = [ "http://beancount:5000/" ] ## Log requests to stdout request_logging = true ## pass HTTP Basic Auth, X-Forwarded-User and X-Forwarded-Email information to upstream # pass_basic_auth = true ## pass the request Host Header to upstream ## when disabled the upstream Host is used as the Host Header # pass_host_header = true ## Email Domains to allow authentication for (this authorizes any email on this domain) ## for more granular authorization use `authenticated_emails_file` ## To authorize any email addresses use "*" # email_domains = [ # "yourcompany.com" # ] ## The OAuth Client ID, Secret client_id = "" client_secret = "" ## Pass OAuth Access token to upstream via "X-Forwarded-Access-Token" # pass_access_token = false ## Authenticated Email Addresses File (one email per line) authenticated_emails_file = "/etc/authenticated-emails" ## Htpasswd File (optional) ## Additionally authenticate against a htpasswd file. Entries must be created with "htpasswd -s" for SHA encryption ## enabling exposes a username/login signin form # htpasswd_file = "" ## Templates ## optional directory with custom sign_in.html and error.html # custom_templates_dir = "" ## Cookie Settings ## Name - the cookie name ## Secret - the seed string for secure cookies; should be 16, 24, or 32 bytes ## for use with an AES cipher when cookie_refresh or pass_access_token ## is set ## Domain - (optional) cookie domain to force cookies to (ie: .yourcompany.com) ## Expire - (duration) expire timeframe for cookie ## Refresh - (duration) refresh the cookie when duration has elapsed after cookie was initially set. ## Should be less than cookie_expire; set to 0 to disable. ``` -------------------------------- ### Beancount Query Language Example Source: https://github.com/beancount/fava/blob/main/src/fava/help/features.md Example of a Beancount Query Language (BQL) query that aggregates costs by payee and account. This format can be used to generate charts in Fava. ```sql SELECT payee, SUM(COST(position)) AS balance WHERE account ~ 'Expenses' GROUP BY payee, account ``` -------------------------------- ### Install Specific Beancount Version from Source Source: https://github.com/beancount/fava/blob/main/docs/development.md Install a specific version of Beancount directly from its GitHub repository using pip. This is useful if you require a newer version than the latest released one. ```bash pip install git+https://github.com/beancount/beancount@v2 ``` -------------------------------- ### Fava Custom Options Example Source: https://github.com/beancount/fava/blob/main/src/fava/help/options.md Add custom entries to your Beancount file to configure Fava's behavior. These options control settings like default files, auto-reloading, and currency column alignment. ```beancount 2016-06-14 custom "fava-option" "default-file" 2016-04-14 custom "fava-option" "auto-reload" "true" 2016-04-14 custom "fava-option" "currency-column" "100" ``` -------------------------------- ### Apache Reverse Proxy Configuration Source: https://github.com/beancount/fava/blob/main/contrib/deployment.rst Configure Apache to proxy requests to a locally running Fava instance. Ensure Fava is started with the --prefix option matching the proxy path. ```apache ProxyPass "/fava" "http://localhost:5000/fava" ``` -------------------------------- ### Custom Directive for Fava Sidebar Link Source: https://github.com/beancount/fava/blob/main/src/fava/help/features.md Example of a custom directive in a Beancount file to add a link to the Fava sidebar. This allows quick access to specific filtered views. ```beancount 2016-05-04 custom "fava-sidebar-link" "Income 2014" "../income_statement?time=2014" ``` -------------------------------- ### Clone Fava and Set Up Development Environment Source: https://github.com/beancount/fava/blob/main/docs/development.md Clone the Fava repository and set up a virtual environment with development dependencies using `make dev`. ```bash git clone https://github.com/beancount/fava.git cd fava # setup a virtual environment (at .venv) and install Fava and development # dependencies into it: make dev ``` -------------------------------- ### Running Fava with Prefix Source: https://github.com/beancount/fava/blob/main/contrib/deployment.rst Command to run Fava when deployed behind a reverse proxy. The --prefix option must match the proxy path. ```bash fava --prefix /fava /path/to/your/main.beancount ``` -------------------------------- ### Systemd Unit File for Fava Source: https://github.com/beancount/fava/blob/main/contrib/deployment.rst A systemd unit file to manage Fava as a system service, ensuring it runs automatically at boot. Configure the host, port, prefix, and beancount file path. ```systemd [Unit] Description=Fava Web UI for Beancount [Service] Type=simple ExecStart=/usr/bin/fava --host localhost --port 5000 --prefix /fava /path/to/your/main.beancount User=your-user ``` -------------------------------- ### Running Let's Encrypt Companion Container Source: https://github.com/beancount/fava/blob/main/contrib/docker/README.md Command to run the Let's Encrypt Nginx Proxy Companion container. This container automates the process of obtaining and renewing SSL certificates for Nginx, using docker-gen to detect changes. ```bash docker run --detach \ --name nginx-letsencrypt \ --env "NGINX_DOCKER_GEN_CONTAINER=nginx-gen" \ --volumes-from nginx \ --volume $(dirname $(realpath $0))/certs:/etc/nginx/certs:rw \ --volume /var/run/docker.sock:/var/run/docker.sock:ro \ jrcs/letsencrypt-nginx-proxy-companion ``` -------------------------------- ### Render Tree Table Data Source: https://github.com/beancount/fava/blob/main/src/fava/ext/fava_ext_test/templates/FavaExtTest.html Renders tree table data using the extension's example_tree method. The output is serialized to JSON. ```html {% set tree = extension.example_tree() %} {{tree|tojson}} ``` -------------------------------- ### Render Portfolio Accounts Table Source: https://github.com/beancount/fava/blob/main/src/fava/ext/fava_ext_test/templates/FavaExtTest.html Iterates through portfolio accounts and renders each as a JSON-serialized table. Requires an account filter to be set. ```html {% for portfolio in extension.portfolio_accounts(arg_filter) %} #### {{ portfolio.title }} {{portfolio.table|tojson}} {% endfor %} ``` -------------------------------- ### Build Fava Docker Image Source: https://github.com/beancount/fava/blob/main/contrib/docker/README.md Builds the Fava Docker image using the provided Dockerfile. Use the --no-cache flag to ensure the latest versions of Beancount and Fava are incorporated. ```docker docker build -t fava . ``` -------------------------------- ### Transaction Postings with Various Details Source: https://github.com/beancount/fava/blob/main/src/fava/help/beancount_syntax.md This snippet demonstrates various ways to specify postings, including simple units, cost basis, prices, and cost dates. ```beancount 2015-05-30 * "Example transaction with various postings" Account:Name 123.45 USD ; simple units Account:Name 10 GOOG {502.12 USD} ; with cost Account:Name 1000.00 USD @ 1.10 CAD ; with price Account:Name 10 GOOG {502.12 USD} @ 1.10 CAD ; with cost & price Account:Name 10 GOOG {502.12 USD, 2014-05-12} ; with cost date ! Account:Name 123.45 USD ; with flag ``` -------------------------------- ### Run Basic Fava Docker Container Source: https://github.com/beancount/fava/blob/main/contrib/docker/README.md Runs the Fava container in detached mode, mapping port 5000, and mounting a local Beancount file into the container. This command is used for basic local deployment. ```docker docker run --detach --name="beancount" --publish 5000:5000 \ --volume $(pwd)/example.beancount:/input.beancount \ --env BEANCOUNT_FILE=/input.beancount fava ``` -------------------------------- ### Running OAuth2 Proxy Docker Container Source: https://github.com/beancount/fava/blob/main/contrib/docker/README.md Command to run the OAuth2 proxy Docker container for Fava authentication. It links to the beancount container, maps configuration and email files, and sets environment variables for domain and Let's Encrypt. ```bash docker run --detach --link beancount --publish 4180:4180 \ --name beancount-oauth \ --volume $(pwd)/oauth2_proxy.cfg:/etc/oauth2_proxy.cfg \ --volume $(pwd)/authenticated-emails:/etc/authenticated-emails \ --env "VIRTUAL_HOST=" \ --env "LETSENCRYPT_HOST=" \ --env "LETSENCRYPT_EMAIL=" \ skippy/oauth2_proxy -config=/etc/oauth2_proxy.cfg \ -http-address="0.0.0.0:4180" -provider=google ``` -------------------------------- ### Render Account Name and Link Macro Source: https://github.com/beancount/fava/blob/main/src/fava/templates/macros/_account_macros.html Defines a Jinja2 macro to render an account name as a clickable link within Fava. It takes the ledger and account name as input. ```html {% macro account_name(ledger, account_name) -%} [{{ account_name }}]({{ url_for('account', name=account_name) }}) {%- endmacro %} ``` -------------------------------- ### Execute BQL Query for Postings Source: https://github.com/beancount/fava/blob/main/src/fava/ext/fava_ext_test/templates/FavaExtTest.html Executes a BQL query to count postings per account and serializes the result to JSON. This is useful for analyzing account activity. ```html {% set postings_per_account = 'SELECT account, count(account) ORDER BY account' %} {{ledger.query_shell.execute_query_serialised(g.filtered.entries_with_all_prices, postings_per_account)|tojson}} ``` -------------------------------- ### Opening and Closing Accounts Source: https://github.com/beancount/fava/blob/main/src/fava/help/beancount_syntax.md The 'open' directive is used to declare an account, optionally specifying currency constraints. The 'close' directive marks the end of an account's activity. ```beancount 2015-05-29 open Expenses:Restaurant ; Account with some currency constraints: 2015-05-29 open Assets:Checking USD,EUR ; ... 2016-02-23 close Assets:Checking ``` -------------------------------- ### Render Commodity Amount Source: https://github.com/beancount/fava/blob/main/src/fava/templates/macros/_commodity_macros.html Renders a formatted commodity amount, handling cases where the amount or its number is null. Includes currency symbol. ```html {% macro render_amount(ledger, amount, class="num") %} {% if amount is none or amount.number is none -%} {%- else -%} {{- amount.number|format_currency(amount.currency)|incognito }} {{ amount.currency -}} {%- endif %} {% endmacro %} ``` -------------------------------- ### Render Number with Fava Ledger Context Source: https://github.com/beancount/fava/blob/main/src/fava/templates/_journal_table.html Renders a number with currency, applying Fava's ledger context for precision and formatting. Used for displaying financial amounts in journal entries. ```html {% macro render_num(ledger, currency, number) %} {{ ledger.format_currency(number, currency) }} {% endmacro %} ``` -------------------------------- ### Render Chart Data Source: https://github.com/beancount/fava/blob/main/src/fava/ext/fava_ext_test/templates/FavaExtTest.html Renders chart data using the extension's chart_data method. Ensure the extension is properly configured. ```html {{extension.chart_data()|tojson}} ``` -------------------------------- ### Running Nginx Docker Container Source: https://github.com/beancount/fava/blob/main/contrib/docker/README.md Command to run the Nginx Docker container, which serves as the reverse proxy and handles SSL termination. It maps volumes for configuration, certificates, and static content. ```bash docker run --detach --publish 80:80 --publish 443:443 \ --name nginx \ --volume /etc/nginx/conf.d \ --volume /etc/nginx/vhost.d \ --volume /usr/share/nginx/html \ --volume $(pwd)/certs:/etc/nginx/certs:ro \ --volume $(pwd)/htpasswd:/etc/nginx/htpasswd:ro \ --label com.github.jrcs.letsencrypt_nginx_proxy_companion.nginx_proxy=true \ nginx ``` -------------------------------- ### Registering Fava Extensions Source: https://github.com/beancount/fava/blob/main/src/fava/help/extensions.md Use the `fava-extension` option in your Beancount file to load a Python module as an extension. An optional configuration string can be provided for extension-specific settings. ```beancount 2010-01-01 custom "fava-extension" "extension-name" "extension-with-options" "{'option': 'config_value'}" ``` -------------------------------- ### Account Link Macro Source: https://github.com/beancount/fava/blob/main/src/fava/templates/_journal_table.html Generates a hyperlink to an account within the Fava application. It takes the account name as input and constructs a URL using url_for. ```html {% macro _account_link(name) %}[{{ name }}]({{ url_for('index', account=name) }}){% endmacro %} ``` -------------------------------- ### Render Amount with Fava Ledger Context Source: https://github.com/beancount/fava/blob/main/src/fava/templates/_journal_table.html Renders a financial amount, including number and currency, using Fava's ledger context for accurate formatting. Useful for displaying balances and transaction amounts. ```html {% macro render_amount(ledger, amount, classes='') %} {{ ledger.format_amount(amount) }} {% endmacro %} ``` -------------------------------- ### Setting Root Account Names Source: https://github.com/beancount/fava/blob/main/src/fava/help/beancount_syntax.md Use the 'option' directive to customize the names of the five root accounts. This is useful for internationalization or personal preference. ```beancount option "name_assets" "Vermoegen" option "name_liabilities" "Verbindlichkeiten" option "name_income" "Einkommen" option "name_expenses" "Ausgaben" option "name_equity" "Eigenkapital" ``` -------------------------------- ### Running Docker-Gen Container Source: https://github.com/beancount/fava/blob/main/contrib/docker/README.md Command to run the docker-gen container, which automatically generates Nginx configuration based on Docker container metadata. It watches for changes and signals Nginx to reload. ```bash docker run --detach \ --name nginx-gen \ --volumes-from nginx \ --volume /var/run/docker.sock:/tmp/docker.sock:ro \ jwilder/docker-gen \ -notify-sighup nginx -watch -only-exposed -wait 5s:30s \ /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf ``` -------------------------------- ### Render Tags and Links Source: https://github.com/beancount/fava/blob/main/src/fava/templates/_journal_table.html Renders tags and links associated with a journal entry. Tags are prefixed with '#' and links with '^', sorted alphabetically. ```html {% macro _render_tags_links(entry) -%} {% for tag in entry.tags|sort %}#{{ tag }}{% endfor %} {% for link_ in entry.links|sort %}^{{ link_ }}{% endfor %} {%- endmacro %} ``` -------------------------------- ### Render Metadata Indicators Source: https://github.com/beancount/fava/blob/main/src/fava/templates/_journal_table.html Renders short indicators for metadata keys associated with an entry or posting. It iterates through metadata items and displays the first two characters of each key. ```html {% macro _render_metadata_indicators(metadata) -%} {% for key, value in metadata %} {{ key[:2] }} {% endfor %} {%- endmacro %} ``` -------------------------------- ### Render Metadata Source: https://github.com/beancount/fava/blob/main/src/fava/templates/_journal_table.html Renders metadata key-value pairs for a journal entry or posting. It handles different value types, including links for documents and URLs, and displays them in a readable format. ```html {% macro _render_metadata(metadata, entry_hash=None) -%} {% if metadata %} {% for key, value in metadata %} {{ key }}: {%- if key.startswith('document') %}[{{ value }}]({{ url_for('download_attachment', hash=entry_hash, filename=value) }}) {% elif value is string and (value.startswith('http://') or value.startswith('https://')) %}[{{ value }}]({{ value }}) {% else %} {{ value }} {% endif -%} {% endfor %} {% endif %} {% endmacro %} ``` -------------------------------- ### Beancount Options Syntax Source: https://github.com/beancount/fava/blob/main/src/fava/help/beancount_syntax.md Set ledger-wide options using the 'option' directive. ```Beancount option "title" "My Personal Ledger" ``` -------------------------------- ### Define Account Budgets with Custom Directives Source: https://github.com/beancount/fava/blob/main/src/fava/help/budgets.md Use the `custom` directive to specify budgets for different accounts with various frequencies (daily, weekly, monthly, quarterly, yearly). ```Beancount 2012-01-01 custom "budget" Expenses:Coffee "daily" 4.00 EUR 2013-01-01 custom "budget" Expenses:Books "weekly" 20.00 EUR 2014-02-10 custom "budget" Expenses:Groceries "monthly" 40.00 EUR 2015-05-01 custom "budget" Expenses:Electricity "quarterly" 85.00 EUR 2016-06-01 custom "budget" Expenses:Holiday "yearly" 2500.00 EUR ``` -------------------------------- ### Render Number with Currency Source: https://github.com/beancount/fava/blob/main/src/fava/templates/macros/_commodity_macros.html Renders a formatted number with its associated currency. Uses incognito formatting. ```html {% macro render_num(ledger, currency, number) -%} {{ number|format_currency(currency)|incognito }} {{ currency }} {%- endmacro %} ``` -------------------------------- ### Adding Notes to Accounts Source: https://github.com/beancount/fava/blob/main/src/fava/help/beancount_syntax.md Use the 'note' directive to attach a descriptive text to an account, useful for recording specific events or reasons related to the account's balance. ```beancount 2013-03-20 note Assets:Checking "Called to ask about rebate" ``` -------------------------------- ### Enable Link Documents Plugin Source: https://github.com/beancount/fava/blob/main/src/fava/help/features.md Enables the `link_documents` plugin to tag discovered document entries with `#linked` and link them to corresponding transactions, allowing for filtering in the Journal. ```beancount plugin "fava.plugins.link_documents" ``` -------------------------------- ### Balance Assertion Source: https://github.com/beancount/fava/blob/main/src/fava/help/beancount_syntax.md The 'balance' directive asserts that the total amount for a specific currency in an account should match the given value on a specific date. ```beancount 2015-06-01 balance Liabilities:CreditCard -634.30 USD ``` -------------------------------- ### Beancount Events Syntax Source: https://github.com/beancount/fava/blob/main/src/fava/help/beancount_syntax.md Record specific events with a date and a type, followed by key-value pairs. ```Beancount 2015-06-01 event "location" "New York, USA" 2015-06-01 event "address" "123 May Street" ``` -------------------------------- ### Query Cell Rendering Logic Source: https://github.com/beancount/fava/blob/main/src/fava/templates/_query_table.html Handles rendering of different data types within a query table cell. It supports commodities, account names, IDs, formatted currencies, uppercase strings, comma-separated lists, and empty values. ```html {% macro querycell(ledger, name, value, type_) %} {% set type = type_|string %} {% if type == "" %} {% for position in value|sort(attribute='units.currency') %} {{ commodity_macros.render_amount(ledger, position.units) }} {% endfor %} {% elif type == "" %} {% if name == "account" %} {{ account_macros.account_name(ledger, value) }} {% elif name == "id" %} [{{ value }}](#context-{{ value }}) {% else %} {{ value }} {% endif %} {% elif type == "" or type == "" %} {{ value|format_currency }} {% elif type == "" %} {{ commodity_macros.render_amount(ledger, value) }} {% elif type == "" %} {{ value|upper }} {% elif type == "" %} {{ value }} {% elif type == "" %} {{ value|join(',') }} {% elif type == "" %} {{ value or '' }} {% elif type == "" %} {{ commodity_macros.render_amount(ledger, value.units) }} {% else %} {{ value }} {% endif %} {% endmacro %} ``` -------------------------------- ### Declaring Commodity Metadata Source: https://github.com/beancount/fava/blob/main/src/fava/help/beancount_syntax.md The 'commodity' directive allows you to attach metadata like a display name and precision to a currency. This is optional but can enhance usability in tools like Fava. ```beancount 1998-07-22 commodity AAPL name: "Apple Computer Inc." precision: 3 ``` -------------------------------- ### Padding an Account Source: https://github.com/beancount/fava/blob/main/src/fava/help/beancount_syntax.md The 'pad' directive automatically inserts a transaction to make an account's balance match a specified value, often used to reconcile accounts. ```beancount 2015-06-01 pad Assets:Checking Equity:Opening-Balances ``` -------------------------------- ### Linking Documents to Accounts Source: https://github.com/beancount/fava/blob/main/src/fava/help/beancount_syntax.md The 'document' directive associates a file path with an account, typically used to link financial statements or receipts to specific account entries. ```beancount 2013-03-20 document Assets:Checking "path/to/statement.pdf" ``` -------------------------------- ### Basic Transaction Entry Source: https://github.com/beancount/fava/blob/main/src/fava/help/beancount_syntax.md A standard transaction includes a date, a flag, narration, and postings to at least two accounts. One posting is often inferred. ```beancount 2015-05-30 * "Some narration about this transaction" Liabilities:CreditCard -101.23 USD Expenses:Restaurant 101.23 USD 2015-05-30 ! "Cable Co" "Phone Bill" #tag ^link id: "TW378743437" Expenses:Home:Phone 87.45 USD Assets:Checking ; You may leave one amount out ``` -------------------------------- ### Enable Tag Discovered Documents Plugin Source: https://github.com/beancount/fava/blob/main/src/fava/help/features.md Enables the `tag_discovered_documents` plugin to automatically tag discovered document entries with `#discovered` for easier filtering in the Journal. ```beancount plugin "fava.plugins.tag_discovered_documents" ``` -------------------------------- ### Beancount Tag Management Source: https://github.com/beancount/fava/blob/main/src/fava/help/beancount_syntax.md Use pushtag and poptag to temporarily apply a tag to a block of entries. ```Beancount pushtag #trip-to-peru ; ... the given tag will be added to all entries in between the pushtag and poptag poptag #trip-to-peru ``` -------------------------------- ### Journal Table Contents Rendering Source: https://github.com/beancount/fava/blob/main/src/fava/templates/_journal_table.html Renders the main content of the journal table, iterating through entries and displaying details like date, type, payee, narration, and financial amounts. It supports conditional display of change and balance columns. ```html {% macro journal_table_contents(entries, show_change_and_balance=False, ledger=None) %} {% set ledger = ledger or g.ledger %} {% autoescape false %} {% for entry in entries %} {% if show_change_and_balance %} {% set index, entry, change, balance = entry %} {% else %} {% set index, entry = entry %} {% endif %} {% set type = entry.__class__.__name__.lower() %} {% set metadata_items = entry.meta|meta_items %} {% set entry_hash = entry|hash_entry -%} * [{{ entry.date }}](#context-{{ entry_hash }}) {% if type == 'transaction' %}{{ entry.flag }}{% else %}{{ short_type.get(type, type[:3]) }}{% endif %} {% if type == 'open' or type == 'close' %} {{ _account_link(entry.account) }} {% elif type == 'note' %} {{ entry.comment }} {% elif type == 'query' %} [{{ entry.name }}]({{ url_for('query', name=entry.name) }}) {% elif type == 'pad' %} {{ _account_link(entry.account) }} from {{ _account_link(entry.source_account) }} {% elif type == 'custom' %} **{{ entry.type }}**{%- for value in entry['values'] -%}  {% if value.dtype|string == "" %}{{ _account_link(value.value) }} {% elif value.dtype|string == "decimal" %}{{ render_amount(ledger, value.value) }} {%- elif value.dtype|string == "string" %}"{{ value.value }}" {%- elif value.dtype|string == "integer" %}{{ value.value }} {%- elif value.dtype|string == "date" %}{{ value.value }}{% endif -%} {%- endfor -%} {% elif type == 'document' %} {{ _account_link(entry.account) }} [{{ entry.filename|basename }}]({{ url_for('download_attachment', hash=entry_hash, filename=entry.filename) }}) {{ _render_tags_links(entry) }} {% elif type == 'balance' %} {{ _account_link(entry.account) }} {% if entry.diff_amount %} accumulated {{ (entry.amount.number + entry.diff_amount.number)|format_currency(entry.amount.currency) }} {{ entry.amount.currency }} {% endif %} {% elif type == 'transaction' %} **{{ entry.payee or '' }}**{% if entry.payee and entry.narration %}:{% endif %}{{ entry.narration or '' }} {{ _render_tags_links(entry) }} {% endif %} {{- _render_metadata_indicators(metadata_items) -}} {% for posting in entry.postings -%} {{- _render_metadata_indicators(posting.meta|meta_items) -}} {% endfor %} {% if type == 'balance' %} {{ render_amount(ledger, entry.amount, 'num bal' + (' pending' if entry.diff_amount else '')) }} {% if entry.diff_amount %} {{- render_num(ledger, entry.diff_amount.currency, entry.diff_amount.number) -}} {% else %} {% endif %} {% if not show_change_and_balance %} {% endif %} {% endif %} {% if show_change_and_balance %} {% if type == 'transaction' %} {%- for currency, number in change.items() %}{{ render_num(ledger, currency, number) }} {% endfor -%} {% endif %} {%- for currency, number in balance.items() %}{{ render_num(ledger, currency, number) }} {% endfor -%} {% endif %} {{ _render_metadata(metadata_items, entry_hash) }} {% if entry.postings %} {% for posting in entry.postings %} {{ posting.flag or '' }} {{ _account_link(posting.account) }} {# We want the output these amounts with the same precision as in the input file. For computed values this might give a lot of digits, so format the price using the DisplayContext for now.#} {% if posting.units %}{{ posting.units.number|incognito }} {{ posting.units.currency }}{% endif %} {{ posting.cost.number|incognito }} {{ posting.cost.currency }} {{- ', {}'.format(posting.cost.date) if posting.cost.date else '' }} {{- ', "{}"'.format(posting.cost.label) if posting.cost.label else '' }} {{ render_amount(ledger, posting.price) }} {{ _render_metadata(posting.meta|meta_items) }} {% endfor %}{% endif %} {% endfor %} {% endautoescape %} {%- endmacro %} ``` -------------------------------- ### Deprecated Query Table Macro Source: https://github.com/beancount/fava/blob/main/src/fava/templates/_query_table.html The `querytable` macro is deprecated and users should switch to frontend-rendered query results. It was used for displaying query contents or iterating through rows with specific types. ```html {% macro querytable(ledger, contents, types, rows, filter_empty=None, footer=None) %} The querytable macro is deprecated, please switch to the frontend-rendered query result. See fava.ext.fava_ext_test for an example of how to use them. {% if contents %} {{ contents }} {% elif types %} {% for name, type in types %} {% endfor %} {% for row in rows if filter_empty == None or not row[filter_empty].is_empty() %} {% for name, type in types %} {{ querycell(ledger, name, row[name], type) }} {% endfor %} {% endfor %} {% if footer %} {% for type, value in footer %} {{ querycell(ledger, '', value, type) }} {% endfor %} {% endif %} {{ name }} {% endif %} {% endmacro %} ``` -------------------------------- ### Beancount Comments Syntax Source: https://github.com/beancount/fava/blob/main/src/fava/help/beancount_syntax.md Add inline comments using a semicolon, or use any non-directive line as a comment. ```Beancount ; inline comments begin with a semi-colon * any line not starting with a valid directive is also ignored silently ``` -------------------------------- ### Recording Historical Prices Source: https://github.com/beancount/fava/blob/main/src/fava/help/beancount_syntax.md The 'price' directive records the historical price of one commodity in terms of another. This is essential for accurate valuation of assets over time. ```beancount 2015-04-30 price AAPL 125.15 USD 2015-05-30 price AAPL 130.28 USD ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.