egh / ledger-autosync

Synchronize your ledger-cli files with your bank.
GNU General Public License v3.0
273 stars 42 forks source link

Very lossy OFX translation #13

Closed daniel-vainsencher closed 7 years ago

daniel-vainsencher commented 7 years ago

Maybe I'm doing something wrong. In a QFX file, the following OFX transaction:

  <INCOME>
    <INVTRAN>
      <FITID>CD-10-5WF36378-1-USD-06/20/2016-1
      <DTTRADE>20160620070000.000[-5:CDT]
    </INVTRAN>
    <SECID>
      <UNIQUEID>921943858
      <UNIQUEIDTYPE>CUSIP
    </SECID>
    <INCOMETYPE>DIV
    <TOTAL>1.45
    <SUBACCTSEC>CASH
    <SUBACCTFUND>CASH
  </INCOME>

is translated into the following hledger transaction:

2016/06/20 Assets:WealthFront: income
    ; ofxid: 10780.10-5WF36378.CD-10-5WF36378-1-USD-06_20_2016-1
    Assets:WealthFront                 0 "921943858" @ $0
    Assets:WealthFront                        -$0.00

I set the accounts using parameters, so ignore those. But the amount got changed from 1.45 to 0, and the fact that it is a dividend was lost. Note the transaction ID matches, so that is the same transaction.

Also, the end of the created hledger file has lines of the format: P 2016/10/06 12:00:00 78468R721 49.71

egh commented 7 years ago

Hi Daniel - I'm pretty sure this is the issue that was fixed in #9. I haven't released a new version yet, so you'd need to build from source to get the new version. But I'll release ASAP.

While you are here, would you mind asking a question? @jblachly has fixed ledger-autosync to output ticker symbols instead of CUSIP numbers, so in the future you will see FOO instead of "921943858" as the commodity. I'd like to make this the standard behavior. Will this be a big issue for you, if you have to go back and fix your ledger files?

jblachly commented 7 years ago

@daniel-vainsencher , @egh is right, commit associated w issue #9 should fix your problem with 0 "..number code.." @ $0 , and a pending commit will also replace the 78468R721 (or whatever) in the "P" lines, which are commodity price lines.

daniel-vainsencher commented 7 years ago

@egh @jblachly Awesome! Yes, I'm currently working of releases, so I can't test right away, we'll see if you get to the release or I move to the dev version first. To your question, re-exporting is not problem at all for me.

BTW, how about including the dividend indication? separate PR? I could do that if no one else is interested, but I won't get to it very soon.

egh commented 7 years ago

@daniel-vainsencher In master, dividends should be supported. Your data should export as something like:

2016/06/20 Transaction
    ; dividend_from: 921943858
    Assets                                     $1.45
    Income:Dividends                          -$1.45
jblachly commented 7 years ago

@daniel-vainsencher What do you mean by "the dividend indication"? Do you mean formatting correctly as in @egh 's comment -- if so, commit associated with #9 fixes that.

However, if you mean titling the transaction to something like "DIVIDEND RECEIVED", I see no field called <MEMO> in your OFX snippet. The converter looks for this to title the transaction.

You could add a check for this inside the small block of code that checks for type:income , incometype:div and write your own transaction description if none had been provided in an OFX <MEMO> field.

daniel-vainsencher commented 7 years ago

Was talking about getting the right accounts, as per @egh. Time to get master...

On Oct 28, 2016 6:04 AM, "James S Blachly, MD" notifications@github.com wrote:

@daniel-vainsencher https://github.com/daniel-vainsencher What do you mean by "the dividend indication"? Do you mean formatting correctly as in @egh https://github.com/egh 's comment -- if so, commit associated with

9 https://github.com/egh/ledger-autosync/pull/9 fixes that.

However, if you mean titling the transaction to something like "DIVIDEND RECEIVED", I see no field called in your OFX snippet. The converter looks for this to title the transaction.

You could add a check for this inside the small block of code that checks for type:income , incometype:div and write your own transaction description if none had been provided in an OFX field.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/egh/ledger-autosync/issues/13#issuecomment-256825231, or mute the thread https://github.com/notifications/unsubscribe-auth/ABcrVlKDJovo52z0-GKOBhlNQUeAVQLLks5q4WX7gaJpZM4Kg2qi .

egh commented 7 years ago

I've just released 0.3.x (had a little trouble getting it to work right :) so you should be able to upgrade using pip.

egh commented 7 years ago

@daniel-vainsencher Has this been fixed? Thanks!

egh commented 7 years ago

I'm going to close this, please feel free to reopen if it is still an issue.