=====================
   beancount: TODO
=====================

.. contents::
..
    1  Beancount (Accounting)
    2  Ideas
      2.1  Links
    3  Redesign
    4  Reporting


Beancount (Accounting)
======================

  - Add a "reason" field for @location, and display as trips, with
    some sort of meaning to them.

  - When using @@ the signs should match; warn if they don't

  - Postings that have a "!" flag should have at least their
    background red.

  - Have beancount-convert-ofx parse description NUM USD @ NUM and insert an
    appropriate line in the output, perhaps as a comment

  - beancount: Figure out problem with autopadding for beginning of a trip!

  - beancount: look at booking warnings in blais.ledger.

  - I'd love a way to filter down a journal by omitting all the small
    items and keeping just the larger ones, to get an automatic
    overview of the large amounts in a long series of transactions.
    All the small amounts could be lumped together under a special
    entry.

  - Add JavaScript menus in order to include everything from the
    top-level, so that it looks more like a real application, it'll
    look goodx (see if bean-suck still works on that).

  - Implement beginning balance sheet. Beginning and end of periods
    should be clearly indicated on both pages.

  - I need a TEXT version of the Balance Sheet, to paste in my TODO
    file.

  - You should more explicitly state the beginning and ending period
    on each statement pages (it is super important information).
    Just below the title.

  - Remove checks that are outside the postings dates, at
    render time

  - Add a pie chart to visualize the constitution of the Income
    Statement.

  - Make the conversions be applied everywhere consistently.

  - beancount: Enter trade costs with BOOK for all personal trading
    too, check that it works well. Check that capital gains
    calculations do not include commissions.

    * Add 1/rate syntax.
    * Add account numbers for classification and sorting.
    * Add a cash account flag in @defaccount, to generate the Cashflow Statement.

    * beancount: remove @checks that are outside of begin/end, it
      looks bad.

    * beancount: Make the --close place its Equity into
      RetainedEarnings rather than Opening Balances?
    * beancount: When you --close, make the balance transferred in
      RetainedEarnings rather than the OpeningBalances
    * Figure out what Yves means by "Retained Earnings", where do they
      show in my report?




app:

  - beancount: figure out how to render a wallet with 5 significant
    digits (for xrates in trades page).

price tables:

  - beancount: Make USD/CAD also specify CAD/USD in the price table;
    the lookup procedure should be able to compute the reverse prices.
  - beancount: Change the --conversion option to use rates from our
    price table instead.

graphs:

  - beancount: Generate a graph for the main kinds of account
    interchanges, by looking at the most significant transactions
    between the accounts. For example, ignore transactions which are
    too small in absolute value, or whose total is too small a portion
    of the total.


reports:

  - beancount: Available balance sheet reports should be: at begin, at
    end, both. Perhaps the "both" statement is only in report foramt.


trade booking:

  - beancount: figure out how to solve trades with share splits.



main focus:

- beancount: Add a page for the hedged values of everything.

- Finish the Capital Statement and Positions page

- Add a check to insure that parents do not contain mixed Dr and Cr
  account types as children.

- You need to write a test with dates that are close by between
  @checks and with @pad in between, for date inequalities.

- Add account numbers, to be able to sort in order of liquidity.

- 'Tag' should be renamed 'project' (pretty standard naming).





parser:

- Bug: A transaction without postings should barf.

- Bug: Invalid account names should only be reported once.

- Review the dates inequalities, incl + excl, like compsci

  * Clarify this for @check as well, it should probably be at the end
    of the day.

- make De and Cr just D and C

- Allow commas in amounts. I like commas sometimes.

- Maybe add a @defcomm directive, that checks validity for the
  commodities that are seen.

- IMPORTANT: Using the pickle, the errors only get reported when you
  parse initially. We must make the balance checks in a separate
  stage!!! Fix that, save the errors in the Ledger object and report
  them every time.

- Figure out why we get 1.0 USD when we import OFX, we should get 1.00 USD

- Accounts unused for the filtered postings could simply be removed.

- Add a syntax to convert between currencies without having to fetch
  the values by hand, e.g. "3467.02 USD in CAD".

- We may want to add a new syntax for comments that get parsed into
  entries, something like this::

    @comment <Account>
      bla bhlablablabl blabla
      bla bhlablablabl blabla
      bla bhlablablabl blabla

  This could get displayed in the register, to show significant events
  in the life of some accounts.

- Make @pad able to pad for a percentage of the total, so that we're
  able to use @pad instead of "distribution of expenses" entries.


capital gains:

- Capital gains should not count commissions nor on the buy nor on the
  sell side. How do we book them like this?  Create a small example.

- Make my Capital-Gains use the most appropriate syntax and make sure
  that the commissions aren't counted in (add a test).

    You need to do a test for capital gains.

views:

- To create custom views, for example, weekly summaries, you could
  convert the ledger into another ledger, where entries would have
  been replaced by summary entries instead, and all the other
  functionalities would still work.

- Fun little project: Create a graphviz output from a Ledger, where
  transactions above a certain amount would generate a link between
  accounts. Note:  the threshold could be either for single
  transactions, or for aggregate amounts (absolute value).


checks:

- Detect and find potential duplicates.


import:

- Modify all import scripts so that they avoid reimporting already
  imported stuff. All the import scripts should take an existing
  Ledger file as input.

- The OFX importer needs to unescape &amp; and others.

- Write a generic import routine that will try to heuristically match
  partially completed transactions from an existing Ledger.


filtering:

- We need an option to automatically add opening balances entries when
  filtering by time... this is important, otherwise the balances are
  incorrect if you don't start at the very beginning.



scripts:

- Write a script to laod the data into an SQL database.

- Figure out how to show balance to market value.

- Figure out how to do stock splits properly.

- Output reports using the debits and credits format.

- Check time ranges should also output the ranges of transactions
  present in the file.

- Add a command to print the parsed transactions register in the order
  they were read in.

- Add declarations for important dates:

  * @date 2007-01-01  'Q1 07'
  * The date parsing should automatically recognize these

- Add directives specific to conversion scripts as well::

     @defvar ofx accid 000016726282       Assets:Current:RBC:Checking

     @defvar paypal acc_sales    Income:Book-Sales
     @defvar paypal acc_deposit  Assets:Current:PayPal
     @defvar paypal acc_fee      Expenses:Financial:Commissions:PayPal



tests:

- Test Wallet += None

- Write functional tests
- Write automated tests for everything.


doc/examples/demos:

- Make a presentation

- Write simple documentation, maybe tests should be part of the
  documentation?

- Create an 'examples' subdirectory, with typical use cases.

- Examples:

  - mortgage, buying a home
  - capital gains (with commissions correctly)
  - cie expenses, the way I'm doing it.
  - misc, e.g. credit card

- Include examples

- This is causing me a problem::

    2008-02-14 * FUNDS TRANSFER
      Assets:Current:RBC:Checking-US                                -89050.66 USD @ 0.9901 CAD
      Assets:Current:RBC:Savings                                     88169.06 CAD

  The costs are::

    2008-02-14 * FUNDS TRANSFER
      Assets:Current:RBC:Checking-US                                -88169.06 CAD
      Assets:Current:RBC:Savings                                     88169.06 CAD

  So when I show the balance sheet "at cost", it shows the account
  Assets:Current:RBC:Checking-US as having had some CAD debited from
  it.



serve:

- Implement buffered output for faster response using a separate
  thread and an iterator that yields from app.write when the data
  buffer is large enough.

- Make it possible to upload a new file to the server to be parsed.
  This way, I wouldn't even have to log in ssh in order to update the
  in-memory database...

- BUG: There is a JavaScrap bug with collapsing the tree nodes in the
  ranges page.

- We really should display the code/check number in the web register
  output.


reporting:

- Implement `--code-as-payee' combined with `--by-payee', this
  provides an interesting view.

  Implement a view ...

  * By code
  * By payee




Ideas
=====

- Create a script to support generating lists of file locations for
  navigating the input file in a certain order.

    Let's say that I would want to inspect the input for some
    arbitrary list of filtered transactions that relate to
    postings: all I have to do is write a script that outputs
    "errors" in a way that Emacs knows to parse, and then
    'next-error and 'previous-error takes my cursor there with
    a single keystroke!

- Not sure if we need this with the @imported directive, but how about
  a special field in the transaction's posting::

    Assets:Investments:HSBC-Broker           -100 IVV @@ 136.2901 USD  {HD7egE62}
    Income:Investment:Capital-Gains

  This special kind of id would get computed in a uniform way from the
  date and the account being imported, so that we could check if this
  posting or transaction had already been imported before.

- Add directives to support import::

   @imported <FROMDATE> <TODATE> <ACCOUNT>

  Using the intersection of these date intervals and the account name,
  you can determine what has already been imported and avoid importing
  twice.

  * We need central support for these tasks as well.
  * The conversion scripts should always parse a ledger file.

- You should be able to click on dates and see all postings by date
  too.

- You should be able to click on a payee to view its transactions.




Links
-----

Description of a data model very similar to my idea.
http://homepages.tcp.co.uk/~m-wigley/gc_wp_ded.html





Redesign
========

Here is an idea for a redesign:

  The Ledger object should always contain all the transactions.
  Instead of filtering the postings on input, you should create
  specialized iterator objects that are used to filter the postings on
  the fly. This would allow removing all the special shit that needs
  to be ordered correctly, that happens at load-time.






