OFX Import and negative prices on stock transactions

Charles Gagnon charlesg at unixrealm.com
Thu Feb 7 23:00:59 EST 2008


I know this has been discussed before. I found traces of the topic here 
and there but never really an answer. This was the latest: 
http://www.nabble.com/Bank-Interest-in-Wrong-Column-on-Reconcile-td13501251.html

I import OFX files from Interactive Brokers. I will have many stock 
transactions over time and I'm trying to make sure the process is fairly 
easy and mechanical. One thing I notice is the monthly reconciliation is 
that amounts appear to be reversed (showing as negative) making the 
whole transaction opposite what it should be. I included a seperate 
transaction at the end of the file. It should have shown as:

   Buy 60 units of ABAX at 37.80 = 2268 (in the buy column)
   Commission of 1.00
   TOTAL for transaction 2269

Instead, I get one transaction only (so the commission is rolled into 
the base price which) and it looks like:

   Buy 60 units of ABAX at -37.80 = 2269 (in the sell column)
   (the quantity shows up positive as it should it a BUY but the price 
is negative)

I am not sure what to do. Any ideas? If I need to parse my OFX in perl 
and pre-process it's worth the trouble of writing the perl but I need to 
know a bit more about how gnucash processes the OFX.

The one thing I noticed about the OFX is the 
"<BUYTYPE>BUYTOCOVER</BUYTYPE>". Not sure why IB marks them as buy to 
cover but it shouldn't really make a difference. It was a regular long, 
not a buy to cover.

Another quick general OFX question, does gnucash read the transaction ID 
to prevent duplicates? If I try to re-import the same file, will it 
detect already imported transactions or no? I am just trying to figure 
out at what frequency to do my imports and my reconciliation.

Thanks  in advance.

### extract from OFX file ###
            <BUYSTOCK>
                <INVBUY>
                 <INVTRAN>
                    
<FITID>20080115202000.000[-5:EST].xxxxxxxxxx.USD.002567105</FITID>
                    <DTTRADE>20080115202000.000[-5:EST]</DTTRADE>
                 </INVTRAN>
                <SECID>
                    <UNIQUEID>002567105</UNIQUEID>
                    <UNIQUEIDTYPE>CUSIP</UNIQUEIDTYPE>
                </SECID>
                <UNITS>60.0</UNITS>
                <UNITPRICE>37.8000</UNITPRICE>
                <COMMISSION>1.00</COMMISSION>
                <TOTAL>2269.00</TOTAL>
                <CURRENCY>
                    <CURRATE>1.0</CURRATE>
                    <CURSYM>USD</CURSYM>
                </CURRENCY>
                <SUBACCTSEC>CASH</SUBACCTSEC>
                <SUBACCTFUND>CASH</SUBACCTFUND>
                </INVBUY>
                <BUYTYPE>BUYTOCOVER</BUYTYPE>
              </BUYSTOCK>
### end ###

--
Charles Gagnon                   | My views are my views and they
http://unixrealm.com             | do not represent those of anybody
charlesg at unixrealm.com        | but me.



More information about the gnucash-user mailing list