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 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212
|
# Configuration
ledger2beancount can use a configuration file. It will search for
the config file in the following locations (taking the first file
that is found):
* `.ledger2beancount.yaml` in the current working directory
* `ledger2beancount.yaml` in the current working directory
* `$XDG_CONFIG_HOME/ledger2beancount/config.yaml` (which is
typically `$HOME/.config/ledger2beancount/config.yaml`)
You can also pass an alternative config file via `--config/-c`. The
file must end in `.yml` or `.yaml`.
While the configuration file is optional, you may have to define a
number of variables for ledger2beancount to work correctly with your
ledger files:
* `ledger_indent` sets the indentation level used in your ledger file
(by default `4`).
* `date_format` has to be configured if you don't use the date format
`YYYY-MM-DD`.
* `decimal_comma` has to be set to `true` if you use commas as the
decimal separator (for example, `10,12 EUR` meaning 10 Euro and
12 cents).
* `commodity_map` defines mappings from ledger to beancount commodities.
You have to set this if you use commodity codes like `€` or `£` (to
map them to `EUR` and `GBP`, respectively).
Additionally, these options are useful to configure beancount:
* `operating_currencies`: a list of the currencies you frequently use.
* `beancount_header`: a file which is embedded at the beginning of
the converted beancount file which can include beancount `option`
statements, `plugin` directives, `query` information and more.
Other variables can be set to use various functionality offered by
ledger2beancount. All variables are described below. Please read
the [user guide](guide.md) to learn how to use these variables to
configure ledger2beancount for your needs.
## Input options
The following options may be needed for ledger2beancount to interpret
your ledger files correctly.
date_format
: The date format used in your ledger file (default: `%Y-%m-%d`).
date_format_no_year
: The date format for dates without the year when ledger's `Y`/`year`
directive is used (default: `%m-%d`).
ledger_indent
: Sets the indentation level used in your ledger file (default: `4`).
decimal_comma
: Parses amounts with the decimal comma (e.g. `10,00 EUR`). Set this
option to `true` if you use option `--decimal-comma` in ledger.
hledger
: Tells ledger2beancount whether to attempt to parse hledger-specific
features.
## Other options
beancount_indent
: Sets the indentation level for the generated beancount file (default: `2`).
operating_currencies
: A list of frequently used currencies. This is used by fava, the web
UI for beancount.
automatic_declarations
: Emit account and commodity declarations. (Default: `true`)
Note: the declarations done in ledger via `account` and
`commodity` declarations are always converted. If this option
is `true`, declarations are created for those which have not
been explicitly declared in ledger but used.
account_open_date
: The date used to open accounts (default: `1970-01-01`).
commodities_date
: The date used to create commodities (default: `1970-01-01`).
beancount_header
: Specifies a file which serves as a beancount "header", i.e. it's put
at the beginning of the converted beancount file. You can use such
a header to specify options for beancount, such as `option "title"`,
define `plugin` directives or beancount `query` information.
ignore_marker
: Specifies a marker that tells ledger2beancount to ignore a line if the
marker is found.
keep_marker
: Specifies a marker that tells ledger2beancount to take a line from the
input that is commented out, uncomment it and display it in the output.
convert_virtual
: Specifies whether virtual postings should be converted. If set to
`true`, virtual postings in brackets will be made into real accounts.
(Virtual postings in parentheses are always ignored, regardless of this
option.)
account_map
: Specifies a hash of account names to be mapped to other account names.
account_regex
: Specifies a hash of regular expressions to replace account names.
commodity_map
: Specifies a mapping of ledger commodities to beancount commodities.
metadata_map
: Specifies a mapping of ledger metadata keys to corresponding beancount keys.
payee_tag
: Specify a metadata tag (after the mapping done by `metadata_map`) used to set the payee.
payer_tag
: Specify a metadata tag (after the mapping done by `metadata_map`) used to set the payee.
narration_tag
: Specify a metadata tag (after the mapping done by `metadata_map`) used to set the narration.
payee_split
: Specifies a list of regular expressions to split ledger's payee field
into payee and narration. You have to use the named capture groups
`payee` and `narration`.
payee_match
: Specifies a list of regular expressions and corresponding payees. The
whole ledger payee becomes the narration and the matched payee from the
regular expression becomes the payee.
postdate_tag
: Specifies the metadata tag to be used to store posting dates. (Use the
empty string if you don't want the metadata to be added to beancount.)
auxdate_tag
: Specifies the metadata tag to be used to store auxiliary dates (also
known as effective dates; or `date2` in hledger). (Use the empty
string if you don't want the metadata to be added to beancount.)
code_tag
: Specifies the metadata tag to be used to store transaction codes.
(Use the empty string if you don't want the metadata to be added to
beancount.)
link_match
: Specifies a list of regular expressions that will cause a tag to be
rendered as a link.
link_tags
: Specifies a list of metadata tags whose values should be converted to
beancount links instead of metadata. Tags are case insensitive and
values must not contain whitespace.
currency_is_commodity
: Specifies a list of commodities that should be treated as commodities
rather than currencies even though they consist of 3 characters (which
is usually a characteristic of a currency). Expects beancount
commodities (i.e. after transformation and mapping).
commodity_is_currency
: Specifies a list of commodities that should be treated as currencies
(in the sense that cost is not retained). Expects beancount
commodities (i.e. after transformation and mapping).
default_commodity
: Specifies the commodity to be used if an amount without commodity is
found.
move_posting_tags
: Tells ledger2beancount to move posting-level tags to the transaction
itself to work around the lack of posting-level tags in beancount.
|