i'm working my way through a tdaameritrade_csv converter
(not pretty yet by far), but my lack of experience with
beancount, ledgers and the importers meant i had to wade
through some things to get to the point where i could get
output from my initial stab at a converter.

  the biggest issue is that there is no feedback when 
you make an error that prevents anything from loading 
at all.  so you are not sure if you screwed up something
basic or if your importer isn't working at all.

  if you specify a pattern that doesn't match the input 
file enough that bean-* can find it then you get nothing
back which says "no file found" you just get back this:


**** /home/me/fin/beancount/t.csv
;; -*- mode: beancount -*-
**** /home/me/fin/beancount/t.csv
;; -*- mode: beancount -*-

  to those who know what this means that's fine, but for
someone just kicking the tires and trying things out it
doesn't mean anything at all.

  so one thing i did was to add print statements to the
csvreader.py but in the end the most "keep my changes in
one place" way was to include the following in my __init__.py
(which is taken from csvreader.py).

=====

    def read_file(self, file):
        if not self.file_read_done:
            rdr = self.read_raw(file)
            print ("Version 0.0.5 \n After read_raw file : \n", rdr)
            rdr = rdr.skip(getattr(self, 'skip_head_rows', 0))                 
# chop unwanted header rows
            rdr = rdr.head(len(rdr) - getattr(self, 'skip_tail_rows', 0) - 1)  
# chop unwanted footer rows

            if hasattr(self, 'skip_comments'):
                rdr = rdr.skipcomments(self.skip_comments)
            rdr = rdr.rowslice(getattr(self, 'skip_data_rows', 0), None)
            rdr = self.prepare_raw_columns(rdr)
            print ("After prepare_raw_columns : \n", rdr)
            rdr = rdr.rename(self.header_map)
            print ("After rename : \n", rdr)
            rdr = self.convert_columns(rdr)
            print ("After convert_columns : \n", rdr)
            rdr = self.prepare_processed_columns(rdr)
            print ("After prepare_processed_columns : \n", rdr)
            self.rdr = rdr
            self.ifile = file
            self.file_read_done = True

=====

  which then told me that i wasn't even getting to the reading
part at all.  so i was able then to finally go back and find
my mistake (not matching the file header properly).


  so then i was able to start getting output that looked like:

**** /home/me/fin/beancount/test-trans.csv
Importer:    beancount_reds_importers.tdameritrade_csv.Importer
Account:     Assets:SB:TDA:MM

Version 0.0.5 
 After read_raw file : 
 +------------+----------------+-------------------------------------------+----
------+--------+-------+------------+---------+---------+--------------------+--
-------------------+------------------------+
| DATE       | TRANSACTION ID | DESCRIPTION                               | QUAN
TITY | SYMBOL | PRICE | COMMISSION | AMOUNT  | REG FEE | SHORT-TERM RDM FEE | FU
ND REDEMPTION FEE |  DEFERRED SALES CHARGE |
+============+================+===========================================+=====
=====+========+=======+============+=========+=========+====================+===
==================+========================+
| 01/02/2000 | 123456     | CHECK (WRITTEN AGAINST BROKERAGE ACCOUNT) |         
 |        |       |            | -123.12 |         |                    |       
              |                        |
+------------+----------------+-------------------------------------------+----------+--------+-------+------------+---------+---------+--------------------+---------------------+------------------------+
...
==========


  one other gotcha that took me awhile to figure out was:

# header looks like: DATE,TRANSACTION 
ID,DESCRIPTION,QUANTITY,SYMBOL,PRICE,COMMISSION,AMOUNT,REG FEE,SHORT-TERM RDM 
FEE,FUND REDEMPTION FEE, DEFERRED SALES CHARGE
# note that space on the beginning of that last field...

  which then needed the following to work:

            " DEFERRED SALES CHARGE":'defslschrg',


  which is great!  :)  progress...

  i have a long ways to go in understanding but at least now i can
see what my initial version is doing and keep poking around more
to figure out more.


  fin

-- 
You received this message because you are subscribed to the Google Groups 
"Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/7f1gaj-je6.ln1%40anthive.com.

Reply via email to