After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 347741 - OFXdirectconnect should handle stock trade as well
OFXdirectconnect should handle stock trade as well
Status: RESOLVED OBSOLETE
Product: GnuCash
Classification: Other
Component: Import - AqBanking
unspecified
Other Mac OS
: Normal enhancement
: ---
Assigned To: gnucash-import-maint
gnucash-import-maint
Depends on:
Blocks:
 
 
Reported: 2006-07-17 06:25 UTC by David Reiser
Modified: 2018-06-29 21:10 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
trimmed ofx download with various securities transactions (6.11 KB, text/plain)
2006-07-17 19:23 UTC, David Reiser
Details

Description David Reiser 2006-07-17 06:25:46 UTC
The handling of stock trades doesn't work correctly in OFXDirectConnect.

When the Generic Import Transaction Matcher dialog comes up after a connection that downloads stock trades, the "Amount" column contains the dollar amount of the trade. The trade does not get associated with a stock account.

For an OFX import of nominally the same data, the Amount column contains the number of shares and the ticker symbol of the stock traded. These records then make it into the proper stock accounts.

There is another difference between the two methods. The import method has an additional column in the Transaction Matcher labelled "Account" which does not appear in the directconnect matcher.
Comment 1 David Reiser 2006-07-17 06:31:14 UTC
I don't think this should be in OFX import, since it's more likely to fall under HBCI, but HBCI doesn't appear as a category.
Comment 2 David Reiser 2006-07-17 19:23:29 UTC
Created attachment 69067 [details]
trimmed ofx download with various securities transactions
Comment 3 David Reiser 2006-07-17 19:26:48 UTC
StockBuySellSplit.ofx is a trimmed version of an ofx download. It contains investment transactions: a buy, a sell, a split, and a dividend. I left the balance information tagged fields, even though both aqbanking and ofx import ignore them. I think the tags are still balanced, and that the necessary CUSIP -> Ticker symbol information is still in the file.
Comment 4 Christian Stimming 2006-07-28 16:02:51 UTC
So do I understand correctly: The Aqbanking import of the download does *not* assign the stock trade data correctly in the respective gnucash transactions, but the Import-OFX module of gnucash does this correctly? That is very well possible, because coming from HBCI we didn't have stock trades available anyway. 

In this case you're basically asking for a new feature - the aqbanking import module of gnucash should also deal with stock trades, right? The conversion of the aqbanking AB_TRANSACTION into the gnucash Transaction currently always assumes a non-stock transaction. To change this, you can have a look in gnucash's import-export/hbci/gnc-hbci-gettrans.c line 318ff which stores the AB_TRANSACTION amount in the gnucash Transaction. If you tell me what other value I should store instead, and which parts/flags of the AB_TRANSACTION will tell me that, then I'd happily change the code and add this new feature.
Comment 5 David Reiser 2006-07-29 04:30:43 UTC
You understand correctly.

I can give you an example of the first half of what you asked for:

for the ofx stock transaction

<BUYSTOCK>
<INVBUY>
<INVTRAN>
<FITID>2324389909</FITID>
<DTTRADE>20060619102813</DTTRADE>
<MEMO>BUY TRADE</MEMO>
</INVTRAN>
<SECID>
<UNIQUEID>675232102</UNIQUEID>
<UNIQUEIDTYPE>CUSIP</UNIQUEIDTYPE>
</SECID>
<UNITS>100</UNITS>
<UNITPRICE>38</UNITPRICE>
<COMMISSION>9.99</COMMISSION>
<TOTAL>-3809.99</TOTAL>
<SUBACCTSEC>CASH</SUBACCTSEC>
<SUBACCTFUND>CASH</SUBACCTFUND>
</INVBUY>
<BUYTYPE>BUY</BUYTYPE>
</BUYSTOCK>

The entry that shows up in the amount column of the generic import transaction matcher dialog with hbci/ofxdirectconnect is "-3809.99".
For an ofx import of the same transaction, the amount column shows "100 OII". However the -3809.99 does make it to the appropriate place in the transaction split for the stock. (I don't think ofx imports generate a realized gain/loss split, though.)

Note that the ticker symbol "OII" has to come from either later in the ofx data stream or a matching process with the gnucash commodity data via lookup on the <UNIQUEID> data.

As for which parts of AB_TRANSACTION are involved -- that will take me a while, I haven't been able to follow AB_anything very well yet.

Getting stock splits correct will take a little more, because the Amount should be <NEWUNITS> - <OLDUNITS> in ofx tag speak.
Comment 6 David Reiser 2006-07-30 01:32:50 UTC
It looks to me like my request isn't possible at the moment.

AB_TRANSACTION_Value appears to hold the transaction total in currency units
and
AB_TRANSACTION_Units appears to hold the number of shares involved in an investment transaction

but I can't find anywhere that AB_TRANSACTION is using either data.unique_id or data.ticker from libofx to keep track of the security involved in the transaction. Time for a trip to AQbanking-devel...
Comment 7 Micha Lenk 2009-08-22 22:15:49 UTC
The situation might have changed. Online OFX import of Investment Statements has been discussed recently:

http://lists.gnucash.org/pipermail/gnucash-devel/2009-June/025521.html
http://lists.gnucash.org/pipermail/gnucash-devel/2009-June/025527.html
http://lists.gnucash.org/pipermail/gnucash-devel/2009-June/025532.html
http://lists.gnucash.org/pipermail/gnucash-devel/2009-June/025533.html

... and apparently lead to improvements within AqBanking. The release announcement for AqBanking 3.99.12rc6 states:

    [...] Verbessert wurde ausserdem der Support fuer Investment-
    Transaktionen im OFX-Parser (Patch von Stephen R. Besch).

Translation: [...] Additionally support for Investment Statements in AqBanking's OFX parser has been improved (patch by Stephen R. Besch).

---

This bug should definitely be triaged again with more current versions of Gnucash and AqBanking...
Comment 8 David Reiser 2009-09-19 04:50:40 UTC
Using aqbanking 4.1.5 from svn r1748, gwenhywfar 3.10.1 from svn r1590, and gnucash trunk from svn r18311 (Sept 11, 2009), at least stock sales in direct connect ofx sessions are not handled correctly. For the stock sale I imported yesterday via aqbanking ofxdirectconnect, I see no change from the behavior described in the original bug report.
Comment 9 John Ralls 2018-06-29 21:10:01 UTC
GnuCash bug tracking has moved to a new Bugzilla host. The new URL for this bug is https://bugs.gnucash.org/show_bug.cgi?id=347741. Please continue processing the bug there and please update any external references or bookmarks.