Code Monkey home page Code Monkey logo

reckon's Introduction

Reckon

Build Status

Reckon automagically converts CSV files for use with the command-line accounting tool Ledger. It also helps you to select the correct accounts associated with the CSV data using Bayesian machine learning.

Installation

Assuming you have Ruby and Rubygems installed on your system, simply run

gem install --user reckon

Example Usage

First, login to your bank and export your transaction data as a CSV file.

To see how the CSV parses:

reckon -f bank.csv -p

If your CSV file has a header on the first line, include --contains-header.

To convert to ledger format and label everything, do:

reckon -f bank.csv -o output.dat

To have reckon learn from an existing ledger file, provide it with -l:

reckon -f bank.csv -l 2010.dat -o output.dat

Learn more:

> reckon -h

Usage: Reckon.rb [options]

-f, --file FILE                  The CSV file to parse
-a, --account NAME               The Ledger Account this file is for
-v, --[no-]verbose               Run verbosely
-i, --inverse                    Use the negative of each amount
-p, --print-table                Print out the parsed CSV in table form
-o, --output-file FILE           The ledger file to append to
-l, --learn-from FILE            An existing ledger file to learn accounts from
    --ignore-columns 1,2,5
                                 Columns to ignore, starts from 1
    --money-column 2
                                 Column number of the money column, starts from 1
    --money-columns 2,3
                                 Column number of the money columns, starts from 1 (1 or 2 columns)
    --raw-money
                                 Don't format money column (for stocks)
    --date-column 3
                                 Column number of the date column, starts from 1
    --contains-header [N]
                                 Skip N header rows - default 1
    --csv-separator ','
                                 CSV separator (default ',')
    --comma-separates-cents
                                 Use comma to separate cents ($100,50 vs. $100.50)
    --encoding 'UTF-8'
                                 Specify an encoding for the CSV file
-c, --currency '$'               Currency symbol to use - default $ (ex £, EUR)
    --date-format FORMAT
                                 CSV file date format (see `date` for format)
    --ledger-date-format FORMAT
                                 Ledger date format (see `date` for format)
-u, --unattended                 Don't ask questions and guess all the accounts automatically. Use with --learn-from or --account-tokens options.
-t, --account-tokens FILE        YAML file with manually-assigned tokens for each account (see README)
    --table-output-file FILE
    --default-into-account NAME
                                 Default into account
    --default-outof-account NAME
                                 Default 'out of' account
    --fail-on-unknown-account
                                 Fail on unmatched transactions.
    --suffixed
                                 Append currency symbol as a suffix.
-h, --help                       Show this message
    --version                    Show version

If you find CSV files that it can't parse, send me examples or pull requests!

Unattended mode

You can run reckon in a non-interactive mode. To guess the accounts reckon can use an existing ledger file or a token file with keywords.

reckon --unattended -a Checking -l 2010.dat -f bank.csv -o ledger.dat

reckon --unattended -a Checking --account-tokens tokens.yaml -f bank.csv -o ledger.dat

In unattended mode, you can use STDIN to read your csv data, by specifying - as the argument to -f.

csv_file_generator | reckon --unattended -a Checking -l 2010.dat -o ledger.dat -f -

Account Tokens

The account tokens file provides a way to teach reckon about what tokens are associated with an account. As an example, this tokens.yaml file:

Expenses:
  Bank:
    - 'ING Direct Deposit'

Would tokenize to 'ING', 'Direct' and 'Deposit'. The matcher would then suggest matches to transactions that included those tokens. (ex 'Chase Direct Deposit')

Here's an example of tokens.yaml:

Income:
  Salary:
    - 'LÖN'
    - 'Salary'
Expenses:
  Bank:
    - 'Comission'
    - 'MasterCard'
  Rent:
    - '0011223344' # Landlord bank number
  Hosting:
    - /hosting/i # This regexp will catch descriptions such as WebHosting or filehosting
'[Internal:Transfer]': # Virtual account
  - '4433221100' # Your own account number

Reckon will use Income:Unknown or Expenses:Unknown if it can't match a transaction to an account.

You can override these names with the --default_outof_account and --default_into_account options.

Substring Match

If, in the above example, you'd prefer to match any transaction that contains the string 'ING Direct Deposit' you have to use a regex:

Expenses:
  Bank:
    - /ING Direct Deposit/

Contributing

We encourage you to contribute to Reckon! Here is some information to help you.

Patches/Pull Requests Process

  1. Fork the project.
  2. Make your feature addition or bug fix.
  3. Add tests for it. This is important so I don't break it in a future version unintentionally.
  4. Commit, do not mess with rakefile, version, or history.
    • (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
  5. Send me a pull request. Bonus points for topic branches.

Integration Tests

Reckon has integration test located in spec/integration. These are integration and regression tests for reckon.

Run all the tests:

./spec/integration/test.sh

Run a single test

./spec/integration/test.sh chase/account_tokens_and_regex

Add a new integration test

Each test has it's own directory, which you can add any files you want, but the following files are required:

  • test_args - arguments to add to the reckon command to test against, can specify --unattended, -f input.csv, etc
  • output.ledger - the expected ledger file output

If the result of running reckon with test_args does not match output.ledger, then the test fails.

Most tests will specify --unattended, otherwise reckon prompts for keyboard input.

The convention is to use input.csv as the input file, and tokens.yml as the tokens file, but it is not required.

Copyright

Copyright (c) 2013 Andrew Cantino (@cantino). See LICENSE for details.

Thanks to @BlackEdder for many contributions!

Currently maintained by @benprew. Thank you!

reckon's People

Contributors

benprew avatar bitdeli-chef avatar blackedder avatar cantino avatar copiousfreetime avatar johannesharms avatar mauromorales avatar mhoogendoorn avatar mrtazz avatar nathankot avatar oskarth avatar purcell avatar ridaayed avatar stephas avatar temporaer avatar vzctl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

reckon's Issues

Idea/discussion: csv parser

I've got two very different csv files that are currently not correctly analyzed. As you have noticed by my pull request I have been working toward getting one correctly identified, but it starts to feel a bit difficult/disjointed, so I was thinking about splitting the csv parsing into its own class. Do you think this would be a good idea? Would you accept patches moving in that direction?

Migrate CI system from travis-ci.org

Hey @cantino, travis-ci is updating their CI plans, and removing the free unlimited open source plan. Instead, they'll have a free plan that has limited credits which are not replenished.

Free Plan #

A ‘Free’ Plan, assigned automatically to every new sign up, is a Usage based plan without limits on users and comes with a trial pool of credits to be used. Once these credits are used they are not replenished. Request OSS Credits allowance or please consider one of our available plans.

Github Actions offers free CI for public repos, so I was thinking we should migrate reckon to use that.

I think I have permissions to setup github actions, but wanted to get your thoughts before setting that up.

Thanks

Problem with file in which every column is quoted.

I have a file with the following contents called test.csv. It is an example of what I get from my bank for credit card statements.

"30.03.2015";"29.03.2015";"09.04.2015";"BARAUSZAHLUNGSENTGELT";"5266 xxxx xxxx 9454";"";"0";"EUR";"0,00";"EUR";"-3,50";"0"

Trying to parse this with reckon using the command:

reckon -f test.csv --csv-separator ";" -p -v --comma-separates-cents

I get the following error:

/usr/lib/ruby/2.3.0/csv.rb:1883:in `block (2 levels) in shift': Illegal quoting in line 1. (CSV::MalformedCSVError)
    from /usr/lib/ruby/2.3.0/csv.rb:1845:in `each'
    from /usr/lib/ruby/2.3.0/csv.rb:1845:in `block in shift'
    from /usr/lib/ruby/2.3.0/csv.rb:1805:in `loop'
    from /usr/lib/ruby/2.3.0/csv.rb:1805:in `shift'
    from /usr/lib/ruby/2.3.0/csv.rb:1747:in `each'
    from /usr/lib/ruby/2.3.0/csv.rb:1761:in `to_a'
    from /usr/lib/ruby/2.3.0/csv.rb:1761:in `read'
    from /usr/lib/ruby/2.3.0/csv.rb:1307:in `parse'
    from /home/cp/.gem/ruby/2.3.0/gems/reckon-0.4.4/lib/reckon/csv_parser.rb:241:in `parse'
    from /home/cp/.gem/ruby/2.3.0/gems/reckon-0.4.4/lib/reckon/csv_parser.rb:11:in `initialize'
    from /home/cp/.gem/ruby/2.3.0/gems/reckon-0.4.4/lib/reckon/app.rb:18:in `new'
    from /home/cp/.gem/ruby/2.3.0/gems/reckon-0.4.4/lib/reckon/app.rb:18:in `initialize'
    from /home/cp/.gem/ruby/2.3.0/gems/reckon-0.4.4/bin/reckon:7:in `new'
    from /home/cp/.gem/ruby/2.3.0/gems/reckon-0.4.4/bin/reckon:7:in `<top (required)>'
    from /home/cp/.gem/ruby/2.3.0/bin/reckon:23:in `load'
    from /home/cp/.gem/ruby/2.3.0/bin/reckon:23:in `<main>'

It does work when I remove the quoting of the first column.

read from stdin

reckon is really nice, I had my banks' CSV export converted to ledger format in no time.

it would make my workflow a bit simpler if reckon supported passing in -f - to read the CSV from stdin.

Problems with my csv file

Hi,

I'm using fedora 18; The following is the output I get trying to run this script. I have two header lines in my csv and blank spaces, but even removing these produces that same error below.

Thanks for any help here.

Boyd

bkelly@x1 business $ reckon -f 201301_business.csv -p
What is the account name of this bank account in Ledger? |Assets:Bank:Checking|
I didn't find a high-likelyhood money column, but I'm taking my best guess with column 4.
/usr/local/share/gems/gems/reckon-0.3.4/lib/reckon/app.rb:191:in pretty_date_for': undefined methodstrftime' for nil:NilClass (NoMethodError)
from /usr/local/share/gems/gems/reckon-0.3.4/lib/reckon/app.rb:309:in block in each_row_backwards' from /usr/local/share/gems/gems/reckon-0.3.4/lib/reckon/app.rb:308:ineach'
from /usr/local/share/gems/gems/reckon-0.3.4/lib/reckon/app.rb:308:in each_row_backwards' from /usr/local/share/gems/gems/reckon-0.3.4/lib/reckon/app.rb:201:inblock in output_table'
from /usr/local/share/gems/gems/terminal-table-1.4.5/lib/terminal-table/table.rb:210:in yield_or_eval' from /usr/local/share/gems/gems/terminal-table-1.4.5/lib/terminal-table/table.rb:17:ininitialize'
from /usr/local/share/gems/gems/reckon-0.3.4/lib/reckon/app.rb:199:in new' from /usr/local/share/gems/gems/reckon-0.3.4/lib/reckon/app.rb:199:inoutput_table'
from /usr/local/share/gems/gems/reckon-0.3.4/bin/reckon:10:in <top (required)>' from /usr/local/bin/reckon:23:inload'
from /usr/local/bin/reckon:23:in `

'
bkelly@x1 business $

bkelly@x1 business $ cat 201301_business.csv
Following data is valid as of 20130228191027 (Year/Month/Day/Hour/Minute/Second)

First Bank Card,Transaction Type,Date Posted, Transaction Amount,Description

'123456789012345',DEBIT,20130115,-428.39,[CW]BMO MASTERCARD

fail on unknown accounts

it'd be nice to have a flag to make 'reckon --unattended' fail when encountering a line that cannot be associated with any account, instead of assigning those to an 'unknown' account.

Learn-from not working

Hi,

I am specifying a file to learn from with -l but nothing get classified even if transactions are similar.

How can I troubleshoot?

[FEATURE REQUEST] Use ledger files as input source in addition to csv's

I started off 2021 trying to figure out how to automate my finances more (you get major credit for that in 2020 btw).

All my banks export QIF files to quicken which I can then get into ledger format via ledger tools' qif2ledger. Rather than use a csv file as the input for reckon, would it be possible to use a ledger file and then just write out a new ledger file based on the predictions the gem makes?

What I'm looking for is to be able to almost automate this pipeline eventually: script something that downloads all my bank files (though I doubt I can pull that off security wise), then do something like:

DumbBunny_bank_MMYYYY.qif > qif2ledger > reckon -f ./file_name_to_convert.ledger --currency 'SGD ' -l ~/Documents/ledger/2021_perso.ledger -o file_name_to_convertMMYYYY.ledger --suffixed

I imagine since you're already using the ledger format on output it should not be that tricky, but the value to me of the reckon gem is really the classification rather than the csv conversion, so having another input format would be aces. The conversion of my banks nonsense to csv actually takes more time whereas I'd assume if something was already in ledger format parsing it would be easy comparatively and really, as I said, the classification is the big value for me here (though I appreciate the fact I can get the csv's converted. It ends up being extra fiddling though.

(or the alternative might be just lift the conversion code for qif2ledger n and have it work that way... =p ).

Happy New Year!

Ruby 2.0 compatibility

Fails on Ruby 2.0 because the method used to detect which csv library to use (csv, fastercsv) is a naive regex.

more complex transaction support

Does reckon support more complicated transactions like so?

2018/01/20 * Some Employer
    ; Person: Bob
    Income:Salary:Cash                              R-30000.00
    Expenses:Taxes:PAYE                               R3000.00
    Expenses:Taxes:UIF                                 R100.00
    Assets:MyBank:Checking                              R26900.00

Missing or stray quote in line error

Hello there,

I have this error:

/usr/lib/ruby/2.1.0/csv.rb:1846:in `block (2 levels) in shift': Missing or stray quote in line 1 (CSV::MalformedCSVError)
	from /usr/lib/ruby/2.1.0/csv.rb:1819:in `each'
	from /usr/lib/ruby/2.1.0/csv.rb:1819:in `block in shift'
	from /usr/lib/ruby/2.1.0/csv.rb:1779:in `loop'
	from /usr/lib/ruby/2.1.0/csv.rb:1779:in `shift'
	from /usr/lib/ruby/2.1.0/csv.rb:1721:in `each'
	from /usr/lib/ruby/2.1.0/csv.rb:1735:in `to_a'
	from /usr/lib/ruby/2.1.0/csv.rb:1735:in `read'
	from /usr/lib/ruby/2.1.0/csv.rb:1293:in `parse'
	from /home/user/.gem/ruby/2.1.0/gems/reckon-0.4.4/lib/reckon/csv_parser.rb:241:in `parse'
	from /home/user/.gem/ruby/2.1.0/gems/reckon-0.4.4/lib/reckon/csv_parser.rb:11:in `initialize'
	from /home/user/.gem/ruby/2.1.0/gems/reckon-0.4.4/lib/reckon/app.rb:18:in `new'
	from /home/user/.gem/ruby/2.1.0/gems/reckon-0.4.4/lib/reckon/app.rb:18:in `initialize'
	from /home/user/.gem/ruby/2.1.0/gems/reckon-0.4.4/bin/reckon:7:in `new'
	from /home/user/.gem/ruby/2.1.0/gems/reckon-0.4.4/bin/reckon:7:in `<top (required)>'
	from /home/user/.gem/ruby/2.1.0/bin/reckon:23:in `load'
	from /home/user/.gem/ruby/2.1.0/bin/reckon:23:in `<main>'

When parsing this file:

"transactionId";"localBankCode";"localAccountNumber";"remoteBankCode";"remoteAccountNumber";"date";"valutadate";"value_value";"value_currency";"localName";"remoteName";"remoteName1";"purpose";"purpose1";"purpose2";"purpose3";"purpose4";"purpose5";"purpose6";"purpose7";"purpose8";"purpose9";"purpose10";"purpose11";"category";"category1";"category2";"category3";"category4";"category5";"category6";"category7"
"";"123456789";"123456";"111111";"22222";"2017/05/03";"2015/06/08";"-40.44";"EUR";"JOHNY CASH";"SHOP CO";"";"SOMETHING";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";"";""

Any idea?

Debit/Credit Columns from SunTrust

This is from SunTrust. It has separate Debit and Credit columns which are not signed. Reckon will pick up either the Debit or Credit column, but I can't get it to recognize that Debit is checks and Credit is deposits.

Date,Check Number,Description,Debit,Credit,Running Balance
11/03/2014,0, AMEX EPayment ACH PMT A26,100.00,0,500.00
11/07/2014,0, AcadiaHealthcare PAYROLL ,0,100.00,600.00

reckon -f mwe.csv -v -p --contains-header --date-format '%d/%m/%Y' --ignore-columns 2,6

I didn't find a high-likelyhood money column, but I'm taking my best guess with column 4.
+------------+----------+-----------------------------------+
| Date | Amount | Description |
+------------+----------+-----------------------------------+
| 2014/03/11 | $0.00 | AMEX EPayment ACH PMT A26; 100.00 |
| 2014/07/11 | $100.00 | AcadiaHealthcare PAYROLL; 0 |
+------------+----------+-----------------------------------+

[FEATURE REQUEST] Ask for currency of Account and output in output file in standard format of xxxx TLA for currency

A figure this is a very small hygiene fix, but it would save a lot of time for international people or people with multiple currencies (eg. everyone outside the United States =p) if when you asked for the initial account that reckon is dealing with you also asked for a default currency (I would highly recommend either $ (the default) for people in the US/Canada) and the three letter shortforms for most major currencies (eg. CAD, USD, GBP, SGD etc).

Right now, I have to manually script changes to the file and convert every line with a $3500.00 etc to 3500.00 SGD rather than the default $3500.00 (my ledger account has 5 different currencies it deals with plus equities and RSUs so being able to have it output would be a huge time saver.

Seriously great gem. This is making my life with ledger a magnitude better given the ledger-tools suite is a bit tetchy with date formats and the like.

And thank you for spending the time to write this and blog on it! I would not hve run across this without the blog post. =]

Allow sorting of output fields

If would be great to be able to sort the fields that are put together as description.
I.e. my bank transactions csv file have the sender and description at fields 10+11, and I'd like to put all the other fields behind them, like

reckon --output-fields 10,11,6,4,8,1,3 ...

Problem reading csv file

Not sure if it's my CSV file but the error makes me think something else is wrong on my system:

I didn't find a high-likelyhood money column, but I'm taking my best guess with column 7.
/home/alex/.gem/ruby/2.2.0/gems/reckon-0.4.3/lib/reckon/money.rb:167:in `pretty_for': undefined method `strftime' for nil:NilClass (NoMethodError)
    from /home/alex/.gem/ruby/2.2.0/gems/reckon-0.4.3/lib/reckon/csv_parser.rb:43:in `pretty_date_for'
    from /home/alex/.gem/ruby/2.2.0/gems/reckon-0.4.3/lib/reckon/app.rb:212:in `block in each_row_backwards'
    from /home/alex/.gem/ruby/2.2.0/gems/reckon-0.4.3/lib/reckon/app.rb:210:in `each'
    from /home/alex/.gem/ruby/2.2.0/gems/reckon-0.4.3/lib/reckon/app.rb:210:in `each_row_backwards'
    from /home/alex/.gem/ruby/2.2.0/gems/reckon-0.4.3/lib/reckon/app.rb:201:in `block in output_table'
    from /home/alex/.gem/ruby/2.2.0/gems/terminal-table-1.5.2/lib/terminal-table/table.rb:216:in `yield_or_eval'
    from /home/alex/.gem/ruby/2.2.0/gems/terminal-table-1.5.2/lib/terminal-table/table.rb:17:in `initialize'
    from /home/alex/.gem/ruby/2.2.0/gems/reckon-0.4.3/lib/reckon/app.rb:199:in `new'
    from /home/alex/.gem/ruby/2.2.0/gems/reckon-0.4.3/lib/reckon/app.rb:199:in `output_table'
    from /home/alex/.gem/ruby/2.2.0/gems/reckon-0.4.3/bin/reckon:10:in `<top (required)>'
    from /home/alex/.gem/ruby/2.2.0/bin/reckon:23:in `load'
    from /home/alex/.gem/ruby/2.2.0/bin/reckon:23:in `<main>'

Let me know what else you'd like?

Error Importing

I get this when running the importing command

 ✘  ~/Documents/Org-Notes  reckon -f export.csv
What is the account name of this bank account in Ledger? |Assets:Bank:Checking|
I didn't find a high-likelyhood money column, but I'm taking my best guess with column 5.
/Users/dberrocal/.rvm/gems/ruby-2.3.0/gems/reckon-0.4.4/lib/reckon/money.rb:167:in `pretty_for': undefined method `strftime' for nil:NilClass (NoMethodError)
    from /Users/dberrocal/.rvm/gems/ruby-2.3.0/gems/reckon-0.4.4/lib/reckon/csv_parser.rb:43:in `pretty_date_for'
    from /Users/dberrocal/.rvm/gems/ruby-2.3.0/gems/reckon-0.4.4/lib/reckon/app.rb:237:in `block in each_row_backwards'
    from /Users/dberrocal/.rvm/gems/ruby-2.3.0/gems/reckon-0.4.4/lib/reckon/app.rb:235:in `each'
    from /Users/dberrocal/.rvm/gems/ruby-2.3.0/gems/reckon-0.4.4/lib/reckon/app.rb:235:in `each_row_backwards'
    from /Users/dberrocal/.rvm/gems/ruby-2.3.0/gems/reckon-0.4.4/lib/reckon/app.rb:97:in `walk_backwards'
    from /Users/dberrocal/.rvm/gems/ruby-2.3.0/gems/reckon-0.4.4/bin/reckon:19:in `<top (required)>'
    from /Users/dberrocal/.rvm/gems/ruby-2.3.0/bin/reckon:23:in `load'
    from /Users/dberrocal/.rvm/gems/ruby-2.3.0/bin/reckon:23:in `<main>'
    from /Users/dberrocal/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval'
    from /Users/dberrocal/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `<main>'

Reckon doesn't learn from multiple sources

I have a ledger file that I already use, and set the -l option for reckon to use. In addition, I also have a tokens.yaml file for the entries that reckon generally gets wrong. The expected behavior of reckon, ideally, would be that it checks against tokens.yaml file first. And if there's no match there, then against the -l option. But instead, reckon only checks one of those two.

Reckon doesn't understand the include directive of ledger; and also doesn't accept multiple ledger files for the -l option. Which is a bit annoying, because then I have to concatenate them myself before presenting to reckon. So, would be great if reckon can learn one of these two.

Error in reckon for the same format csv file

Reckon works with the files downloaded in previous months but then fails on the newly downloaded csv file from bank. The format pf the file is precisely same with 2 money columns. The error is cryptic and undecipherabl. I can't get an idea which line in csv is creating this issue. I checked the code and didn't find any clues either.

/usr/local/lib/ruby/gems/2.3.0/gems/reckon-0.4.4/lib/reckon/csv_parser.rb:47:in block in description_for': undefined methodempty?' for nil:NilClass (NoMethodError)
from /usr/local/lib/ruby/gems/2.3.0/gems/reckon-0.4.4/lib/reckon/csv_parser.rb:47:in reject' from /usr/local/lib/ruby/gems/2.3.0/gems/reckon-0.4.4/lib/reckon/csv_parser.rb:47:indescription_for'
from /usr/local/lib/ruby/gems/2.3.0/gems/reckon-0.4.4/lib/reckon/app.rb:241:in block in each_row_backwards' from /usr/local/lib/ruby/gems/2.3.0/gems/reckon-0.4.4/lib/reckon/app.rb:235:ineach'
from /usr/local/lib/ruby/gems/2.3.0/gems/reckon-0.4.4/lib/reckon/app.rb:235:in each_row_backwards' from /usr/local/lib/ruby/gems/2.3.0/gems/reckon-0.4.4/lib/reckon/app.rb:97:inwalk_backwards'
from /usr/local/lib/ruby/gems/2.3.0/gems/reckon-0.4.4/bin/reckon:19:in <top (required)>' from /usr/local/bin/reckon:23:inload'
from /usr/local/bin/reckon:23:in `

'

backtrace trying to run reckon -f

Hi!

Thanks for writing reckon. I have been using csv2ledger and would love to use the bayesian features of reckon. However, I am hitting a bug trying it out:

$ cat /tmp/demo.csv
Type,Trans Date,Post Date,Description,Amount
Sale,12/30/2012,01/01/2013,"PAYPAL",-32.00

$ reckon -f /tmp/demo.csv -p

What is the account name of this bank account in Ledger? |Assets:Bank:Checking| 
I didn't find a high-likelyhood money column, but I'm taking my best guess with column 5.
/Library/Ruby/Gems/1.8/gems/reckon-0.3.4/lib/reckon/app.rb:191:in `pretty_date_for': undefined method `strftime' for nil:NilClass (NoMethodError)
    from /Library/Ruby/Gems/1.8/gems/reckon-0.3.4/lib/reckon/app.rb:309:in `each_row_backwards'
    from /Library/Ruby/Gems/1.8/gems/reckon-0.3.4/lib/reckon/app.rb:308:in `each'
    from /Library/Ruby/Gems/1.8/gems/reckon-0.3.4/lib/reckon/app.rb:308:in `each_row_backwards'
    from /Library/Ruby/Gems/1.8/gems/reckon-0.3.4/lib/reckon/app.rb:201:in `output_table'
    from /Library/Ruby/Gems/1.8/gems/terminal-table-1.4.5/lib/terminal-table/table.rb:210:in `yield_or_eval'
    from /Library/Ruby/Gems/1.8/gems/terminal-table-1.4.5/lib/terminal-table/table.rb:17:in `initialize'
    from /Library/Ruby/Gems/1.8/gems/reckon-0.3.4/lib/reckon/app.rb:199:in `new'
    from /Library/Ruby/Gems/1.8/gems/reckon-0.3.4/lib/reckon/app.rb:199:in `output_table'
    from /Library/Ruby/Gems/1.8/gems/reckon-0.3.4/bin/reckon:10
    from /usr/bin/reckon:19:in `load'
    from /usr/bin/reckon:19

Missing or stray quote error

I get this when I run reckon:

jostein:~/Downloads$ reckon -f *csv -v -p --contains-header
What is the account name of this bank account in Ledger? |Assets:Bank:Checking|
/usr/lib64/ruby/1.9.1/csv.rb:1894:in block (2 levels) in shift': Missing or stray quote in line 1 (CSV::MalformedCSVError) from /usr/lib64/ruby/1.9.1/csv.rb:1887:ineach'
from /usr/lib64/ruby/1.9.1/csv.rb:1887:in block in shift' from /usr/lib64/ruby/1.9.1/csv.rb:1849:inloop'
from /usr/lib64/ruby/1.9.1/csv.rb:1849:in shift' from /usr/lib64/ruby/1.9.1/csv.rb:1791:ineach'
from /usr/lib64/ruby/1.9.1/csv.rb:1805:in to_a' from /usr/lib64/ruby/1.9.1/csv.rb:1805:inread'
from /usr/lib64/ruby/1.9.1/csv.rb:1379:in parse' from /usr/lib64/ruby/gems/1.9.1/gems/reckon-0.3.9/lib/reckon/csv_parser.rb:242:inparse'
from /usr/lib64/ruby/gems/1.9.1/gems/reckon-0.3.9/lib/reckon/csv_parser.rb:11:in initialize' from /usr/lib64/ruby/gems/1.9.1/gems/reckon-0.3.9/lib/reckon/app.rb:16:innew'
from /usr/lib64/ruby/gems/1.9.1/gems/reckon-0.3.9/lib/reckon/app.rb:16:in initialize' from /usr/lib64/ruby/gems/1.9.1/gems/reckon-0.3.9/bin/reckon:7:innew'
from /usr/lib64/ruby/gems/1.9.1/gems/reckon-0.3.9/bin/reckon:7:in <top (required)>' from /usr/bin/reckon:23:inload'
from /usr/bin/reckon:23:in `

'

--account-tokens issue

I wish I new ruby better (Learning) so that I could fix this issue myself and contribute back to this great Ledger tool.

I have the following test.yaml:

Expenses:
Dining:
Coffee:
- 'STARBUCKS'
- 'TIM HORTON'
Resturant:
- 'WENDY''S'
- 'SUBWAY'
- 'BARAKAT'

I have the following CSV:

01/09/2015,05354 SUBWAY,8.19,,1000.00
02/18/2015,WENDY'S #6338,8.55,,1000.00
02/25/2015,WENDY'S #6338,8.55,,1000.00
02/25/2015,WENDY'S #6338,9.14,,1000.00
02/27/2015,WENDY'S #6338,5.85,,1000.00
03/09/2015,WENDY'S #6338,17.70,,1000.00
03/16/2015,WENDY'S #6338,11.15,,1000.00
03/23/2015,WENDY'S,10.12,,1000.00

I run the following:

reckon --unattended -o test.dat -f test.csv --account Assets:Chequing --account-tokens test.yaml --ignore-columns 5

Reckon does not find a match for the SUBWAY and the last "WENDY'S" transaction.

The test.dat ledger generated:

2015/01/09 05354 SUBWAY;
Assets:Chequing $8.19
Income:Unknown -$8.19

2015/02/18 WENDY'S #6338;
Assets:Chequing $8.55
Expenses:Dining:Resturant -$8.55

2015/02/25 WENDY'S #6338;
Assets:Chequing $8.55
Expenses:Dining:Resturant -$8.55

2015/02/25 WENDY'S #6338;
Assets:Chequing $9.14
Expenses:Dining:Resturant -$9.14

2015/02/27 WENDY'S #6338;
Assets:Chequing $5.85
Expenses:Dining:Resturant -$5.85

2015/03/09 WENDY'S #6338;
Assets:Chequing $17.70
Expenses:Dining:Resturant -$17.70

2015/03/16 WENDY'S #6338;
Assets:Chequing $11.15
Expenses:Dining:Resturant -$11.15

2015/03/23 WENDY'S;
Assets:Chequing $10.12
Income:Unknown -$10.12

Is reckon failing to handle comments when learning?

Warning: unparsable entry due to more than one missing money value.
[{:name=>"Expenses:Food", :amount=>8.96}, {:name=>"Liabilities:Amex", :amount=>-8.96}, {:name=>"# END FINANCE SCRIPT OUTPUT Sun 02 Feb 2020 12:31:14 PM EST", :amount=>-0.0}, {:name=>"# FINANCE SCRIPT OUTPUT Sun 01 Mar 2020 07:18:00 AM EST", :amount=>-0.0}]

I have comments in my ledger files like

# END FINANCE SCRIPT OUTPUT Sun 02 Feb 2020 12:31:14 PM EST

and in previous versions I didn't have any problems but now when learning from such a file I get a bunch of warnings, and the guesses for accounts sometimes contain text from theses comments.

bug when asking for account name

v0.7.0 breaks when asking for account name:

/home/ben/.gem/ruby/3.0.0/gems/reckon-0.7.0/lib/reckon/options.rb:137:in `parse': uninitialized class variable @@cli in Reckon::Options (NameError)
        from /home/ben/.gem/ruby/3.0.0/gems/reckon-0.7.0/bin/reckon:7:in `<top (required)>'
        from /home/ben/.gem/ruby/3.0.0/bin/reckon:23:in `load'
        from /home/ben/.gem/ruby/3.0.0/bin/reckon:23:in `<main>'

Tokens YAML fails to match

albus:~ wcravens$ reckon --version
Reckon 0.4.4

I have the following test csv file

Transaction Date,Description,Amount,Category
07/06/2017,TRIPLE T CAR WASH CHAMPAIGN IL,$27.00,Automotive

I'm trying to parse it with the following command

reckon --unattended --account-tokens tokens_good.yaml \
--account "Liabilities:Credit Cards:Visa" \
-f testy.csv --contains-header --ignore-column 4 \
-i --date-format '%m/%d/%Y' -o output.dat

Using the following tokens_bad.yaml with implicit string doesn't work

Expenses:
  Automotive:
    Car Wash:
      - 'TRIPLE T CAR WASH CHAMPAIGN IL'

Results:

2017/07/06  TRIPLE T CAR WASH CHAMPAIGN IL
  Expenses:Unknown          $27.00
  Liabilities:Credit Cards:UIECU Visa         -$27.00

Using the following tokens_good.yaml with regex does work

Expenses:
  Automotive:
    Car Wash:
      - /TRIPLE T CAR WASH CHAMPAIGN IL/

Results:

2017/07/06  TRIPLE T CAR WASH CHAMPAIGN IL
  Expenses:Automotive:Car Wash          $27.00
  Liabilities:Credit Cards:UIECU Visa         -$27.00

Is this expected behavior or a bug? If a bug I will try and track down why. I did read about issue #52 which lead me to --ignore-column 4.

iso-8859-1 CSV with accented chars => invalid byte sequence in UTF-8 (ArgumentError)

Hi, the CSV file from my bank is iso 8859-1 and it has accented characters('cartão', 'história'), running Reckon on 1.9.3 got me this error:

reckon -f extrato-11-2012.csv -v -o 2012.dat 
What is the account name of this bank account in Ledger? |Assets:Bank:Checking| 
/home/buzaga/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/csv.rb:2058:in `=~': invalid byte sequence in UTF-8 (ArgumentError)
    from /home/buzaga/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/csv.rb:2058:in `init_separators'
    from /home/buzaga/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/csv.rb:1590:in `initialize'
    from /home/buzaga/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/csv.rb:1376:in `new'
from /home/buzaga/.rvm/rubies/ruby-1.9.3-p362/lib/ruby/1.9.1/csv.rb:1376:in `parse'
from /home/buzaga/.rvm/gems/ruby-1.9.3-p362/gems/reckon-0.3.4/lib/reckon/app.rb:338:in `parse'
    from /home/buzaga/.rvm/gems/ruby-1.9.3-p362/gems/reckon-0.3.4/lib/reckon/app.rb:14:in `initialize'
    from /home/buzaga/.rvm/gems/ruby-1.9.3-p362/gems/reckon-0.3.4/bin/reckon:7:in `new'
    from /home/buzaga/.rvm/gems/ruby-1.9.3-p362/gems/reckon-0.3.4/bin/reckon:7:in `<top (required)>'
    from /home/buzaga/.rvm/gems/ruby-1.9.3-p362/bin/reckon:23:in `load'
from /home/buzaga/.rvm/gems/ruby-1.9.3-p362/bin/reckon:23:in `<main>'

I ended resorting to Ruby 1.8.7 since it's not that picky with encodings and it seems it runs fine there

I've also tried hacking a bit on the Gem code trying to force UTF-8 on the content of the file
e.g.: data.force_encoding('utf-8', :invalid => :replace)
but it didn't change the error

feature: "unattended" mode

It would be great to add a mode that didn't prompt for entries that can't be automatically categorized. For example I could do:

reckon -f foo.csv -l journal.dat -o import.dat --default-category "Expense:Unknown" --unattended

My ruby foo isn't that great but if I might try to code this up later next week.

[BUG] Reckon appears not to be parsing ISO standard date yyyy-mm-dd?

I just converted a file from one of my banks to have a yyyy-mm-dd date field via excel. I get the following error(s) when trying to run against it:

🚀 reckon --contains-header -f csv92468-endFeb-prepped.csv -l ~/Dropbox/Apps/ledger/2020.ledger -o ./reckon_RBC_Visa_test-endFeb.ledger

Dates are in the format 2020-02-20 (seriously... =] Reconciling last month.)

Getting the following thrown error:

W, [2020-03-05T17:02:04.352498 #28186]  WARN -- : Skipping row: 'Visa, 4.51401E+15, 2020-02-20, , GOJEK SINGAPORE, 8.10 SGD @ .976500000000, -7.91, D' that doesn't have a valid date
W, [2020-03-05T17:02:04.357382 #28186]  WARN -- : Skipping row: 'Visa, 4.51401E+15, 2020-02-20, , GOJEK SINGAPORE, 6.00 SGD @ .976600000000, -5.86, D' that doesn't have a valid date
... 
Traceback (most recent call last):
        18: from /usr/local/lib/ruby/gems/2.7.0/bin/reckon:23:in `<main>'
        17: from /usr/local/lib/ruby/gems/2.7.0/bin/reckon:23:in `load'
        16: from /usr/local/lib/ruby/gems/2.7.0/gems/reckon-0.5.1/bin/reckon:19:in `<top (required)>'
        15: from /usr/local/lib/ruby/gems/2.7.0/gems/reckon-0.5.1/lib/reckon/app.rb:95:in `walk_backwards'
        14: from /usr/local/lib/ruby/gems/2.7.0/gems/reckon-0.5.1/lib/reckon/app.rb:158:in `each_row_backwards'
        13: from /usr/local/lib/ruby/gems/2.7.0/gems/reckon-0.5.1/lib/reckon/app.rb:158:in `each'
        12: from /usr/local/lib/ruby/gems/2.7.0/gems/reckon-0.5.1/lib/reckon/app.rb:159:in `block in each_row_backwards'
        11: from /usr/local/lib/ruby/gems/2.7.0/gems/reckon-0.5.1/lib/reckon/csv_parser.rb:45:in `date_for'
        10: from /usr/local/lib/ruby/gems/2.7.0/gems/reckon-0.5.1/lib/reckon/date_column.rb:43:in `for'
         9: from /usr/local/lib/ruby/gems/2.7.0/gems/chronic-0.10.2/lib/chronic.rb:90:in `parse'
         8: from /usr/local/lib/ruby/gems/2.7.0/gems/chronic-0.10.2/lib/chronic/parser.rb:61:in `parse'
         7: from /usr/local/lib/ruby/gems/2.7.0/gems/chronic-0.10.2/lib/chronic/parser.rb:244:in `tokens_to_span'
         6: from /usr/local/lib/ruby/gems/2.7.0/gems/chronic-0.10.2/lib/chronic/parser.rb:244:in `each'
         5: from /usr/local/lib/ruby/gems/2.7.0/gems/chronic-0.10.2/lib/chronic/parser.rb:247:in `block in tokens_to_span'
         4: from /usr/local/lib/ruby/gems/2.7.0/gems/chronic-0.10.2/lib/chronic/handler.rb:76:in `invoke'
         3: from /usr/local/lib/ruby/gems/2.7.0/gems/chronic-0.10.2/lib/chronic/handlers.rb:414:in `handle_r'
         2: from /usr/local/lib/ruby/gems/2.7.0/gems/chronic-0.10.2/lib/chronic/handlers.rb:526:in `get_anchor'
         1: from /usr/local/lib/ruby/gems/2.7.0/gems/chronic-0.10.2/lib/chronic/repeaters/repeater_time.rb:127:in `this'
/usr/local/lib/ruby/gems/2.7.0/gems/chronic-0.10.2/lib/chronic/repeaters/repeater_time.rb:111:in `next': Current time cannot be nil at this point (RuntimeError)

Unusual since we output a iso standard date in file, so not sure if it is getting confused somehow but it seemed a bit strange. Is it a bug?

thanks,
Daryl.

order of transactions

Does reckon care about the order of the transactions? I was debugging my monthly script and in the function that preprocesses the csv, the difference between success and failure was a |tac:

sed '1d' "$1" | sed 's/[#*]//' | tac > "$tmpfile"  # with the |tac i get the following error


Traceback (most recent call last):
    8: from /usr/local/bin/reckon:24:in `<main>'
    7: from /usr/local/bin/reckon:24:in `load'
    6: from /var/lib/gems/2.5.0/gems/reckon-0.5.2/bin/reckon:19:in `<top (required)>'
    5: from /var/lib/gems/2.5.0/gems/reckon-0.5.2/lib/reckon/app.rb:95:in `walk_backwards'
    4: from /var/lib/gems/2.5.0/gems/reckon-0.5.2/lib/reckon/app.rb:158:in `each_row_backwards'
    3: from /var/lib/gems/2.5.0/gems/reckon-0.5.2/lib/reckon/app.rb:158:in `each'
    2: from /var/lib/gems/2.5.0/gems/reckon-0.5.2/lib/reckon/app.rb:168:in `block in each_row_backwards'
    1: from /var/lib/gems/2.5.0/gems/reckon-0.5.2/lib/reckon/csv_parser.rb:56:in `description_for'
/var/lib/gems/2.5.0/gems/reckon-0.5.2/lib/reckon/csv_parser.rb:56:in `reject': undefined method    `empty?' for nil:NilClass (NoMethodError)

This is another issue that I don't believe I was experiencing in an earlier version of reckon.

Problem with importing CSV

The export from my bank (ABN NL) looks like this:

123456789   EUR 20160102    15,00   10,00   20160102    -5,00   DESCRIPTION
123456789   EUR 20160102    10,00   0,00    20160102    -10,00  DESCRIPTION

Imported as:

reckon -f FILE -p -c € --ignore-columns 4,5 --comma-separates-cents -v --date-format '%Y%m%d' --csv-separator '\t'
What is the account name of this bank account in Ledger? |Assets:Bank:Checking| 
I didn't find a high-likelyhood money column, but I'm taking my best guess with column 1.
/usr/local/lib/ruby/gems/2.2.0/gems/reckon-0.4.4/lib/reckon/csv_parser.rb:196:in `detect_columns': undefined method `[]' for nil:NilClass (NoMethodError)
    from /usr/local/lib/ruby/gems/2.2.0/gems/reckon-0.4.4/lib/reckon/csv_parser.rb:13:in `initialize'
    from /usr/local/lib/ruby/gems/2.2.0/gems/reckon-0.4.4/lib/reckon/app.rb:18:in `new'
    from /usr/local/lib/ruby/gems/2.2.0/gems/reckon-0.4.4/lib/reckon/app.rb:18:in `initialize'
    from /usr/local/lib/ruby/gems/2.2.0/gems/reckon-0.4.4/bin/reckon:7:in `new'
    from /usr/local/lib/ruby/gems/2.2.0/gems/reckon-0.4.4/bin/reckon:7:in `<top (required)>'
    from /usr/local/bin/reckon:23:in `load'
    from /usr/local/bin/reckon:23:in `<main>'

When using a real tab instead of \t, the error is this:

reckon -f FILE -p -c € --ignore-columns 4,5 --comma-separates-cents -v --date-format '%Y%m%d' --csv-separator ' ' 
What is the account name of this bank account in Ledger? |Assets:Bank:Checking| 
I didn't find a high-likelyhood money column, but I'm taking my best guess with column 5.
I'm having trouble parsing 123456789 with the desired format: %Y%m%d

spaces in tokens

right now if you add for example 'ING BE >Brussels' as a token to be assigned to a certain account, it seems it will also match other lines that contain for example just 'ING'. I think it would be useful to be more specific.

Silently misinterprets UK dates

Hi! I have several CSV files containing thousands of transactions with dates in the UK DD/MM/YYYY format, and have just spent the afternoon working through those transactions with reckon (which is a tremendous help, I might add).

However, I've discovered to my dismay that the dates have been silently messed up in a way which is going to be extremely difficult to fix without going through the whole process again. Here are the raw and generated dates for a couple of examples:

29/03/2013 -> 29/03/2013 CORRECT
12/07/2013 -> 07/12/2013 WRONG

It looks like any date which can be interpreted as a valid US-style "MM/DD/YYYY" date will be parsed as such, and "DD/MM/YYYY" is used as a fallback.

I would expect a hard error in the face of inconsistent input.

This is likely the fault of Ruby's liberal date parsing, but rather than risk users losing hours of time, perhaps it would be good to use a specific date format when parsing, and allow users to explicitly override it?

Support ISO 8601 formatting of dates in ledger file

2017-03-23 This should actually be the default In my opinion.
Don't know who invented that stupid slash format,
could have just used the ISO format in the first place.

For the time being my workaround is to reformat the file with ledger:

ledger -f reckon-output.ledger --date-format '%Y-%m-%d' print  > fixed.ledger

Unattended

Hello

The unattended option does not appear to be available with version 0.3.10?

thanks

Brian

Looking for a new maintainer for Reckon

I'm no longer actively using or developing reckon and do not intend to maintain it. If someone would be interested in taking ownership of the project and maintaining it, I'd be happy to pass the torch.

Tab completion for transactions

When putting in transactions reckon should support tab completion, either using readline or linenoise (whichever has better ruby support).

Runtime error

After a successful install, reckon raises a runtime error:

/Library/Ruby/Gems/2.0.0/gems/chronic-0.10.2/lib/chronic/repeaters/repeater_time.rb:111:in `next': Current time cannot be nil at this point (RuntimeError)

[Bug]? Reckon fails to run on ruby 2.7.0 on Catalina

Hola there!

I read your super interesting article about Reckon and using it with ledger and was trying to have a go. I installed reckon as per gem install --user reckon.
OS: OSX 10.15.3
ruby: ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-darwin19] (installed via homebrew
gem: version 3.1.2
shell: fish version 3.1.0

I am getting the following when I try to run the basic reckon command.

~ reckon --version
/usr/local/lib/ruby/gems/2.7.0/gems/reckon-0.5.0/lib/reckon.rb:13: warning: already initialized constant LOGGER
/usr/local/lib/ruby/gems/2.7.0/gems/reckon-0.5.0/lib/reckon.rb:13: warning: previous definition of LOGGER was here
**Traceback** (most recent call last):
        6: from /usr/local/lib/ruby/gems/2.7.0/bin/reckon:23:in `<main>'
        5: from /usr/local/lib/ruby/gems/2.7.0/bin/reckon:23:in `load'
        4: from /usr/local/lib/ruby/gems/2.7.0/gems/reckon-0.5.0/bin/reckon:4:in `<top (required)>'
        3: from /usr/local/Cellar/ruby/2.7.0/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
        2: from /usr/local/Cellar/ruby/2.7.0/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
        1: from /usr/local/lib/ruby/gems/2.7.0/gems/reckon-0.5.0/lib/reckon.rb:16:in `<top (required)>'
/usr/local/lib/ruby/gems/2.7.0/gems/reckon-0.5.0/lib/reckon.rb:16:in `require_relative': **cannot load such file -- /usr/local/lib/ruby/gems/2.7.0/gems/reckon-0.5.0/lib/reckon/version (LoadError)**
 ~ echo $PATH
/bin /sbin /usr/local/bin /usr/local/sbin /Users/daryl/.cargo/bin /usr/local/opt/ruby/bin /Users/daryl/.gem/ruby/2.7.0/bin /usr/local/lib/ruby/gems/2.7.0/bin /usr/bin /usr/sbin /Users/daryl/.fzf/bin
~ which reckon
/usr/local/lib/ruby/gems/2.7.0/bin/reckon

(I also receive the same message if I install it via the gem install --user reckon option though of course the error message points to not being able to find require_relative': cannot load such file -- /Users/daryl/.gem/ruby/2.7.0/gems/reckon-0.5.0/lib/reckon/version (LoadError)

I have completely uninstalled reckon and then tried reinstalling it but still getting the same error. After poking around a little I am a little confused because other commands installed the same way seem to work fine.

Any ideas as to what may be causing this? Bit stumped after checking paths etc at this point. Other gems I have seem to work fine :-/.

thanks!
Daryl.

Problem with mint file

Hi,

Has been a while since I've used this but getting error when processing a csv file. When I run with the -p option all seems ok; I get the table output. However removing the -p and using -o output.dat or anytthing else produces the following error:

 reckon --contains-header -f input.csv -a Mastercard --ignore-columns 2,5,6,7,8,9.10
I didn't find a high-likelyhood money column, but I'm taking my best guess with column 3.
+------------+--------+----------------------------------+
| 2015/09/23 | $4.43 | STARBUCKS B12 20251500 CHICAGO I |
+------------+--------+----------------------------------+
/usr/local/share/gems/gems/reckon-0.4.3/lib/reckon/app.rb:102:in block (2 levels) in walk_backwards': undefined methodcompletion=' for #HighLine::Question:0x0055cbe5808700 (NoMethodError)
from /usr/local/share/gems/gems/highline-1.6.15/lib/highline/question.rb:58:in initialize' from /usr/local/share/gems/gems/highline-1.6.15/lib/highline.rb:237:innew'
from /usr/local/share/gems/gems/highline-1.6.15/lib/highline.rb:237:in ask' from /usr/local/share/gems/gems/reckon-0.4.3/lib/reckon/app.rb:101:inblock in walk_backwards'
from /usr/local/share/gems/gems/reckon-0.4.3/lib/reckon/app.rb:219:in block in each_row_backwards' from /usr/local/share/gems/gems/reckon-0.4.3/lib/reckon/app.rb:218:ineach'
from /usr/local/share/gems/gems/reckon-0.4.3/lib/reckon/app.rb:218:in each_row_backwards' from /usr/local/share/gems/gems/reckon-0.4.3/lib/reckon/app.rb:82:inwalk_backwards'
from /usr/local/share/gems/gems/reckon-0.4.3/bin/reckon:19:in <top (required)>' from /usr/local/bin/reckon:23:inload'
from /usr/local/bin/reckon:23:in `

'

cat input.csv
Date,Description,Original Description,Amount,Transaction Type,Category,Account Name,Labels,Notes
9/23/2015,Starbucks,STARBUCKS B12 20251500 CHICAGO I,4.43,debit,Coffee Shops,MasterCard,,
9/23/2015,Starbucks,STARBUCKS B12 20251500 CHICAGO I,1.18,debit,Coffee Shops,MasterCard,,

with -p:

reckon --contains-header -f input.csv -a Mastercard --ignore-columns 2,5,6,7,8,9.10 -p
I didn't find a high-likelyhood money column, but I'm taking my best guess with column 3.
+------------+--------+----------------------------------+
| Date | Amount | Description |
+------------+--------+----------------------------------+
| 2015/09/23 | $4.43 | STARBUCKS B12 20251500 CHICAGO I |
| 2015/09/23 | $1.18 | STARBUCKS B12 20251500 CHICAGO I |
+------------+--------+----------------------------------+

Python 2.7.10 on Fedora 23

Reckon undefined method to_h when trying to parse csv file

Just installed on OS X 10.11.6

reckon --contains-header --account 'Liabilities:Credit Card:Chase United' -f Downloads/Chase7633_Activity_20160919.CSV -p

Gives Error:
I didn't find a high-likelyhood money column, but I'm taking my best guess with column 5.
/Library/Ruby/Gems/2.0.0/gems/terminal-table-1.7.2/lib/terminal-table/table.rb:248:in block (2 levels) in recalc_column_widths': undefined methodto_h' for [[10, [1]], [0, [0]]]:Array (NoMethodError)
from /Library/Ruby/Gems/2.0.0/gems/terminal-table-1.7.2/lib/terminal-table/table.rb:225:in each' from /Library/Ruby/Gems/2.0.0/gems/terminal-table-1.7.2/lib/terminal-table/table.rb:225:inblock in recalc_column_widths'
from /Library/Ruby/Gems/2.0.0/gems/terminal-table-1.7.2/lib/terminal-table/table.rb:223:in each' from /Library/Ruby/Gems/2.0.0/gems/terminal-table-1.7.2/lib/terminal-table/table.rb:223:inrecalc_column_widths'
from /Library/Ruby/Gems/2.0.0/gems/terminal-table-1.7.2/lib/terminal-table/table.rb:339:in column_widths' from /Library/Ruby/Gems/2.0.0/gems/terminal-table-1.7.2/lib/terminal-table/table.rb:97:incolumn_width'
from /Library/Ruby/Gems/2.0.0/gems/terminal-table-1.7.2/lib/terminal-table/separator.rb:7:in block in render' from /Library/Ruby/Gems/2.0.0/gems/terminal-table-1.7.2/lib/terminal-table/separator.rb:6:inmap'
from /Library/Ruby/Gems/2.0.0/gems/terminal-table-1.7.2/lib/terminal-table/separator.rb:6:in render' from /Library/Ruby/Gems/2.0.0/gems/terminal-table-1.7.2/lib/terminal-table/table.rb:142:inblock in render'
from /Library/Ruby/Gems/2.0.0/gems/terminal-table-1.7.2/lib/terminal-table/table.rb:142:in map' from /Library/Ruby/Gems/2.0.0/gems/terminal-table-1.7.2/lib/terminal-table/table.rb:142:inrender'
from /Library/Ruby/Gems/2.0.0/gems/reckon-0.4.4/lib/reckon/app.rb:24:in puts' from /Library/Ruby/Gems/2.0.0/gems/reckon-0.4.4/lib/reckon/app.rb:24:inputs'
from /Library/Ruby/Gems/2.0.0/gems/reckon-0.4.4/lib/reckon/app.rb:24:in interactive_output' from /Library/Ruby/Gems/2.0.0/gems/reckon-0.4.4/lib/reckon/app.rb:230:inoutput_table'
from /Library/Ruby/Gems/2.0.0/gems/reckon-0.4.4/bin/reckon:10:in <top (required)>' from /usr/local/bin/reckon:23:inload'
from /usr/local/bin/reckon:23:in `

'

My csv looks like
Type,Trans Date,Post Date,Description,Amount,Category,Memo
Sale,09/16/2016,09/18/2016,QT 880 08008807,-42.12,,null

[Feature Request] Note flag --add-notes in CLI to allow additional notes for each ledger entry

Would just like to tell you how much work you've saved me on importing bank statements (with 3 banks in various countries.). Love the gem.

One thing that would be helpful for me is that quite often the imported bank statements have nonsensical strings attached to them in the description fields or will be for someplace I don't go very often. It would be great if we could pass a flag that allows us to enter a note (or simply hit return to bypass that) and that got introduced into that entry.
eg.

Misc DR-Debit Card AJI-ICHI SINGAPORE 28 FEB 4934 9430378

Could not remember for the life of me what this charge was until I googled and found out it was a random dinner near the Observatory when I went to do some star gazing (and was underwhelming). Being able to add in a note to the effect of S Dinner @ Observatory outing for entries when I puzzle them out would be amazing and super helpful when going back and looking at things.

(I checked this time and it doesn't "appear" that that feature is available, but it woudl be very awesome to have added in if possible. Especially for reconciliation purposes.)

thanks!

--money-column

Could you please add a --money-column option?
cheers, Bart

problem of importing file

if i try to read the following file with this command:

reckon -f 00050550715.csv -a SG -p --contain-header 4 --ignore-columns 2,5 --csv-separator ';' --comma-separates-cents -c EUR --suffixed

file

="0234500012345678";21/11/2015;19/02/2016;36;19/02/2016;1234,37 EUR

Date de l'opération;Libellé;Détail de l'écriture;Montant de l'opération;Devise
19/02/2016;VIR RECU 508160;VIR RECU 1234567834S DE: Francois REF: 123457891234567894561231 PROVENANCE: DE Allemagne ;50,00;EUR
18/02/2016;COTISATION JAZZ;COTISATION JAZZ ;-8,10;EUR

I receive an error

C:/Ruby22/lib/ruby/2.2.0/csv.rb:1874:in block (2 levels) in shift': Illegal quoting in line 1. (CSV::MalformedCSVError) from C:/Ruby22/lib/ruby/2.2.0/csv.rb:1836:ineach'
from C:/Ruby22/lib/ruby/2.2.0/csv.rb:1836:in block in shift' from C:/Ruby22/lib/ruby/2.2.0/csv.rb:1796:inloop'
from C:/Ruby22/lib/ruby/2.2.0/csv.rb:1796:in shift' from C:/Ruby22/lib/ruby/2.2.0/csv.rb:1738:ineach'
from C:/Ruby22/lib/ruby/2.2.0/csv.rb:1752:in to_a' from C:/Ruby22/lib/ruby/2.2.0/csv.rb:1752:inread'
from C:/Ruby22/lib/ruby/2.2.0/csv.rb:1298:in parse' from C:/Ruby22/lib/ruby/gems/2.2.0/gems/reckon-0.4.4/lib/reckon/csv_parser.rb:241:inparse'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/reckon-0.4.4/lib/reckon/csv_parser.rb:11:in initialize' from C:/Ruby22/lib/ruby/gems/2.2.0/gems/reckon-0.4.4/lib/reckon/app.rb:18:innew'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/reckon-0.4.4/lib/reckon/app.rb:18:in initialize' from C:/Ruby22/lib/ruby/gems/2.2.0/gems/reckon-0.4.4/bin/reckon:7:innew'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/reckon-0.4.4/bin/reckon:7:in <top (required)>' from C:/Ruby22/bin/reckon:22:inload'
from C:/Ruby22/bin/reckon:22:in `

'

[Feature Request] Pipe ledger file input to the bayesian predictor (instead of csv)

I started off 2021 trying to figure out how to automate my finances more (you get major credit for that in 2020 btw).

All my banks export QIF files to quicken which I can then get into ledger format via ledger tools' qif2ledger. Rather than use a csv file as the input for reckon, would it be possible to use a ledger file and then just write out a new ledger file based on the predictions the gem makes?

What I'm looking for is to be able to almost automate this pipeline eventually: script something that downloads all my bank files (though I doubt I can pull that off security wise), then do something like:

rbc_bank_MMYYYY.qif > qif2ledger | reckon -f ./file_name_to_convert.ledger --currency 'SGD ' -l ~/Documents/ledger/2021_perso.ledger -o file_name_to_convertMMYYYY.ledger --suffixed

I imagine since you're already using the ledger format it should not be that tricky, but the value to me of the reckon gem is really the classification rather than the csv conversion, so having another input format would be aces.

Happy New Year!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.