fields used in stock splits
David Reiser <[email protected]> Tue, 1 Aug 2006 00:13:29 -0400
| Newsgroups | gmane.comp.finance.libofx.devel |
|---|---|
| Message-ID | <[email protected]> |
Can the ofx fields <NEWUNITS> and <OLDUNITS> be added to the data collection? patch attached. Newunits is the number of shares/units after a stock/fund split. Oldunits is the number before the split. With a little luck and help from downstream, the availability of these fields will allow gnucash to handle stock splits correctly (at least for my broker, TDAmeritrade). Thanks. -- David Reiser [email protected] ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Libofx-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/libofx-devel
splitunits.patch
(application/octet-stream, 2.5 KB)
Index: inc/libofx.h
===================================================================
RCS file: /cvsroot/libofx/libofx/inc/libofx.h,v
retrieving revision 1.26
diff -u -r1.26 libofx.h
--- inc/libofx.h 26 Mar 2006 04:49:50 -0000 1.26
+++ inc/libofx.h 1 Aug 2006 03:01:44 -0000
@@ -512,6 +512,11 @@
int commission_valid;
double fees;/**< Fees applied to trade (investment transactions only) */
int fees_valid;
+ double oldunits; /*number of units held before stock split */
+ int oldunits_valid;
+ double newunits; /*number of units held after stock split */
+ int newunits_valid;
+
/*********** NOT YET COMPLETE!!! *********************/
};
Index: lib/ofx_container_transaction.cpp
===================================================================
RCS file: /cvsroot/libofx/libofx/lib/ofx_container_transaction.cpp,v
retrieving revision 1.11
diff -u -r1.11 ofx_container_transaction.cpp
--- lib/ofx_container_transaction.cpp 28 Aug 2005 01:26:16 -0000 1.11
+++ lib/ofx_container_transaction.cpp 1 Aug 2006 03:01:45 -0000
@@ -371,6 +371,14 @@
data.fees=ofxamount_to_double(value);
data.fees_valid = true;
}
+ else if(identifier=="OLDUNITS"){
+ data.oldunits=ofxamount_to_double(value);
+ data.oldunits_valid = true;
+ }
+ else if(identifier=="NEWUNITS"){
+ data.newunits=ofxamount_to_double(value);
+ data.newunits_valid = true;
+ }
else{
/* Redirect unknown identifiers to the base class */
OfxTransactionContainer::add_attribute(identifier, value);
Index: ofxdump/ofxdump.cpp
===================================================================
RCS file: /cvsroot/libofx/libofx/ofxdump/ofxdump.cpp,v
retrieving revision 1.26
diff -u -r1.26 ofxdump.cpp
--- ofxdump/ofxdump.cpp 20 Jul 2006 04:41:16 -0000 1.26
+++ ofxdump/ofxdump.cpp 1 Aug 2006 03:01:46 -0000
@@ -142,6 +142,12 @@
if(data.units_valid==true){
cout<<" # of units: "<<setiosflags(ios::fixed)<<setiosflags(ios::showpoint)<<setprecision(2)<<data.units<<"\n";
}
+ if(data.oldunits_valid==true){
+ cout<<" # of units before split: "<<setiosflags(ios::fixed)<<setiosflags(ios::showpoint)<<setprecision(2)<<data.oldunits<<"\n";
+ }
+ if(data.newunits_valid==true){
+ cout<<" # of units after split: "<<setiosflags(ios::fixed)<<setiosflags(ios::showpoint)<<setprecision(2)<<data.newunits<<"\n";
+ }
if(data.unitprice_valid==true){
cout<<" Unit price: "<<setiosflags(ios::fixed)<<setiosflags(ios::showpoint)<<setprecision(2)<<data.unitprice<<"\n";
}