hledger-lots#
Commands to apply FIFO(first-in-first-out) or AVERAGE COST accounting principles without manual management of lots. Useful for transactions involving buying and selling foreign currencies or stocks.
To find out more, visit https://github.com/edkedk99/hledger-lots
Usage:
hledger-lots [OPTIONS] COMMAND [ARGS]...
Options:
Name | Type | Description | Default |
---|---|---|---|
-f , --file |
text | Inform the journal file path. If "-", read from stdin. Without this flag read from $LEDGER_FILE or ~/.hledger.journal in this order or '-f-'. | <function <lambda> at 0x7fbfc0178860> |
--version |
boolean | Show the version and exit. | False |
--help |
boolean | Show this message and exit. | False |
Subcommands
hledger-lots buy#
Create a purchase transaction for a commodity by answering some prompts that tries to avoid errors with validation and using current journal data to filter possible answers and give informations that guides the user thru the process.
Transaction postings#
-
First posting: Negative amount on the cash account where the money was used to pay for the commodity
-
Second Posting: Positive amount of the commodity being bought with its cost using "@" symbol
Usage:
hledger-lots buy [OPTIONS]
Options:
Name | Type | Description | Default |
---|---|---|---|
--help |
boolean | Show this message and exit. | False |
hledger-lots list#
List indicators for all your commodities in a tabular format sorted from higher to lower XIRR. It is advised to use full-screen of the terminal. See the docs for a list of indicators and output examples.
It can output in three formats: plain, pretty and csv.
Usage:
hledger-lots list [OPTIONS]
Options:
Name | Type | Description | Default |
---|---|---|---|
-o , --output-format |
choice (plain | pretty | csv ) |
Format to output the report | plain |
--help |
boolean | Show this message and exit. | False |
hledger-lots prices#
Download market prices from Yahoo Finance and print as price directives. Use BASH redirection to append to the journal or copy/paste the data.
Setup#
Add a "yahoo_ticker" tag to the commodity directive with the value of the ticker in Yahoo Finance to download prices
Example#
commodity AAPL ; yahoo_ticker:AAPL
commodity "PETR4" ; yahoo_ticker:PETR4.SA
commodity BTC ; yahoo_ticker:BTC-USD
Usage:
hledger-lots prices [OPTIONS]
Options:
Name | Type | Description | Default |
---|---|---|---|
--help |
boolean | Show this message and exit. | False |
hledger-lots sell#
Create a transaction with automatic FIFO or AVERAGE COST for a commodity by answering some prompts that tries to avoid errors with validation and using current journal data to filter possible answers give informations that guides the user thru the process.
This command also add transaction's comment with some indicators. See an example on "Output examples" page of the docs.
Transaction postings#
-
First posting: Positive amount on the 'base-currency' in the account that receives the product of the sale.
-
Multiple lot postings: Each posting represents a lot you are selling for the cost price on purchasing date, according to FIFO accounting principles or one postings in case of AVERAGE COST method.
-
Revenue posting: posting that represent Capital Gain or Loss as the difference between the total cost and the amount received on the base-currency.
Usage:
hledger-lots sell [OPTIONS]
Options:
Name | Type | Description | Default |
---|---|---|---|
--help |
boolean | Show this message and exit. | False |
hledger-lots view#
Report lots for a commodity.
Show a report with lots for a commodity considering eventual past sale using FIFO or AVERAGE COST accounting principles.
Also show some indicators about the lots and performance if there is prices in the journal after the last purchase. See the docs for details
Usage:
hledger-lots view [OPTIONS] COMMODITY
Options:
Name | Type | Description | Default |
---|---|---|---|
--help |
boolean | Show this message and exit. | False |