LibOFX
ofxdump.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  ofxdump.cpp
3  -------------------
4  copyright : (C) 2002 by Benoit GrĂ©goire
5  email : benoitg@coeus.ca
6 ***************************************************************************/
22 /***************************************************************************
23  * *
24  * This program is free software; you can redistribute it and/or modify *
25  * it under the terms of the GNU General Public License as published by *
26  * the Free Software Foundation; either version 2 of the License, or *
27  * (at your option) any later version. *
28  * *
29  ***************************************************************************/
30 #include <iostream>
31 #include <iomanip>
32 #include <cstdlib>
33 #include <cstring>
34 #include "libofx.h"
35 #include <stdio.h> /* for printf() */
36 #include <config.h> /* Include config constants, e.g., VERSION TF */
37 #include <errno.h>
38 
39 #include "cmdline.h" /* Gengetopt generated parser */
40 
41 
42 int ofx_proc_security_cb(struct OfxSecurityData data, void * security_data)
43 {
44  char dest_string[255];
45  std::cout << "ofx_proc_security():\n";
46  if (data.unique_id_valid == true)
47  {
48  std::cout << " Unique ID of the security: " << data.unique_id << "\n";
49  }
50  if (data.unique_id_type_valid == true)
51  {
52  std::cout << " Format of the Unique ID: " << data.unique_id_type << "\n";
53  }
54  if (data.unique_id2_valid == true)
55  {
56  std::cout << " Unique ID of the underlying security: " << data.unique_id2 << "\n";
57  }
58  if (data.unique_id2_type_valid == true)
59  {
60  std::cout << " Format of the underlying Unique ID: " << data.unique_id2_type << "\n";
61  }
62  if (data.security_type_valid == true)
63  {
64  if (data.security_type == OfxSecurityData::OFX_DEBT_SECURITY)
65  strncpy(dest_string, "DEBTINFO: Debt security", sizeof(dest_string));
66  else if (data.security_type == OfxSecurityData::OFX_FUND_SECURITY)
67  strncpy(dest_string, "MFINFO: Mutual fund security", sizeof(dest_string));
68  else if (data.security_type == OfxSecurityData::OFX_OPTION_SECURITY)
69  strncpy(dest_string, "OPTINFO: Option security", sizeof(dest_string));
70  else if (data.security_type == OfxSecurityData::OFX_STOCK_SECURITY)
71  strncpy(dest_string, "STOCKINFO: Stock security", sizeof(dest_string));
72  else if (data.security_type == OfxSecurityData::OFX_OTHER_SECURITY)
73  strncpy(dest_string, "OTHERINFO: Other type of security", sizeof(dest_string));
74  else
75  strncpy(dest_string, "ERROR: unrecognized", sizeof(dest_string));
76  std::cout << " Security type: " << dest_string << "\n";
77  }
78  if (data.secname_valid == true)
79  {
80  std::cout << " Name of the security: " << data.secname << "\n";
81  }
82  if (data.ticker_valid == true)
83  {
84  std::cout << " Ticker symbol: " << data.ticker << "\n";
85  }
86  if (data.rating_valid == true)
87  {
88  std::cout << " Rating of the security: " << data.rating << "\n";
89  }
90  if (data.unitprice_valid == true)
91  {
92  if (data.security_type_valid == true
93  && data.security_type == OfxSecurityData::OFX_DEBT_SECURITY)
94  std::cout << " Price (percent of par): " << std::setiosflags(std::ios::fixed) << std::setiosflags(std::ios::showpoint) << std::setprecision(4) << data.unitprice << "%\n";
95  else
96  std::cout << " Price of each unit of the security: " << std::setiosflags(std::ios::fixed) << std::setiosflags(std::ios::showpoint) << std::setprecision(2) << data.unitprice << "\n";
97  }
98  if (data.date_unitprice_valid == true)
99  {
100  strftime(dest_string, sizeof(dest_string), "%c %Z", localtime(&(data.date_unitprice)));
101  std::cout << " Date as of which the unitprice is valid: " << dest_string << "\n";
102  }
103  if (data.amounts_are_foreign_currency_valid == true)
104  {
105  std::cout << " Amounts are in foreign currency: " << (data.amounts_are_foreign_currency ? "Yes" : "No") << "\n";
106  }
107  if (data.currency_valid == true)
108  {
109  std::cout << " Currency: " << data.currency << "\n";
110  }
111  if (data.currency_ratio_valid == true)
112  {
113  std::cout << " Ratio of default currency to currency: " << data.currency_ratio << "\n";
114  }
115  if (data.memo_valid == true)
116  {
117  std::cout << " Extra security information (memo): " << data.memo << "\n";
118  }
119  if (data.asset_class_valid == true)
120  {
121  if (data.asset_class == OfxSecurityData::OFX_ASSET_CLASS_DOMESTICBOND)
122  strncpy(dest_string, "DOMESTICBOND: Domestic bond", sizeof(dest_string));
123  else if (data.asset_class == OfxSecurityData::OFX_ASSET_CLASS_INTLBOND)
124  strncpy(dest_string, "INTLBOND: International bond", sizeof(dest_string));
125  else if (data.asset_class == OfxSecurityData::OFX_ASSET_CLASS_LARGESTOCK)
126  strncpy(dest_string, "LARGESTOCK: Large cap stock", sizeof(dest_string));
127  else if (data.asset_class == OfxSecurityData::OFX_ASSET_CLASS_SMALLSTOCK)
128  strncpy(dest_string, "SMALLSTOCK: Small cap stock", sizeof(dest_string));
129  else if (data.asset_class == OfxSecurityData::OFX_ASSET_CLASS_INTLSTOCK)
130  strncpy(dest_string, "INTLSTOCK: International stock", sizeof(dest_string));
131  else if (data.asset_class == OfxSecurityData::OFX_ASSET_CLASS_MONEYMRKT)
132  strncpy(dest_string, "MONEYMRKT: Money market", sizeof(dest_string));
133  else if (data.asset_class == OfxSecurityData::OFX_ASSET_CLASS_OTHER)
134  strncpy(dest_string, "OTHER: Other", sizeof(dest_string));
135  else
136  strncpy(dest_string, "ERROR: unrecognized", sizeof(dest_string));
137  std::cout << " Asset class: " << dest_string << "\n";
138  }
139  if (data.fiasset_class_valid == true)
140  {
141  std::cout << " FI defined asset class: " << data.fiasset_class << "\n";
142  }
143  if (data.par_value_valid == true)
144  {
145  std::cout << " Par value: " << data.par_value << "\n";
146  }
147  if (data.debt_type_valid == true)
148  {
149  if (data.debt_type == OfxSecurityData::OFX_DEBT_TYPE_COUPON)
150  strncpy(dest_string, "COUPON: Coupon debt", sizeof(dest_string));
151  else if (data.debt_type == OfxSecurityData::OFX_DEBT_TYPE_ZERO)
152  strncpy(dest_string, "ZERO: Zero coupon debt", sizeof(dest_string));
153  else
154  strncpy(dest_string, "ERROR: unrecognized", sizeof(dest_string));
155  std::cout << " Debt type: " << dest_string << "\n";
156  }
157  if (data.debt_class_valid == true)
158  {
159  if (data.debt_class == OfxSecurityData::OFX_DEBTCLASS_TREASURY)
160  strncpy(dest_string, "TREASURY: Treasury debt", sizeof(dest_string));
161  else if (data.debt_class == OfxSecurityData::OFX_DEBTCLASS_MUNICIPAL)
162  strncpy(dest_string, "MUNICIPAL: Municipal debt", sizeof(dest_string));
163  else if (data.debt_class == OfxSecurityData::OFX_DEBTCLASS_CORPORATE)
164  strncpy(dest_string, "CORPORATE: Corporate debt", sizeof(dest_string));
165  else if (data.debt_class == OfxSecurityData::OFX_DEBTCLASS_OTHER)
166  strncpy(dest_string, "OTHER: Other debt class", sizeof(dest_string));
167  else
168  strncpy(dest_string, "ERROR: unrecognized", sizeof(dest_string));
169  std::cout << " Debt class: " << dest_string << "\n";
170  }
171  if (data.coupon_rate_valid == true)
172  {
173  std::cout << " Coupon rate: " << data.coupon_rate << "%\n";
174  }
175  if (data.date_coupon_valid == true)
176  {
177  strftime(dest_string, sizeof(dest_string), "%c %Z", localtime(&(data.date_coupon)));
178  std::cout << " Date for the next coupon: " << dest_string << "\n";
179  }
180  if (data.coupon_freq_valid == true)
181  {
182  if (data.coupon_freq == OfxSecurityData::OFX_COUPON_FREQ_MONTHLY)
183  strncpy(dest_string, "MONTHLY: Monthly coupon", sizeof(dest_string));
184  else if (data.coupon_freq == OfxSecurityData::OFX_COUPON_FREQ_QUARTERLY)
185  strncpy(dest_string, "QUARTERLY: Quarterly coupon", sizeof(dest_string));
186  else if (data.coupon_freq == OfxSecurityData::OFX_COUPON_FREQ_SEMIANNUAL)
187  strncpy(dest_string, "SEMIANNUAL: Semiannual coupon", sizeof(dest_string));
188  else if (data.coupon_freq == OfxSecurityData::OFX_COUPON_FREQ_ANNUAL)
189  strncpy(dest_string, "ANNUAL: Annual coupon", sizeof(dest_string));
190  else if (data.coupon_freq == OfxSecurityData::OFX_COUPON_FREQ_OTHER)
191  strncpy(dest_string, "OTHER: Other frequency", sizeof(dest_string));
192  else
193  strncpy(dest_string, "ERROR: unrecognized", sizeof(dest_string));
194  std::cout << " Coupon frequency: " << dest_string << "\n";
195  }
196  if (data.call_price_valid == true)
197  {
198  std::cout << " Call price (unit price): " << std::setiosflags(std::ios::fixed) << std::setiosflags(std::ios::showpoint) << std::setprecision(2) << data.call_price << "\n";
199  }
200  if (data.yield_to_call_valid == true)
201  {
202  std::cout << " Yield to next call (rate): " << data.yield_to_call << "%\n";
203  }
204  if (data.call_date_valid == true)
205  {
206  strftime(dest_string, sizeof(dest_string), "%c %Z", localtime(&(data.call_date)));
207  std::cout << " Date for the next call: " << dest_string << "\n";
208  }
209  if (data.call_type_valid == true)
210  {
211  if (data.call_type == OfxSecurityData::OFX_CALL_TYPE_CALL)
212  strncpy(dest_string, "CALL: Call", sizeof(dest_string));
213  else if (data.call_type == OfxSecurityData::OFX_CALL_TYPE_PUT)
214  strncpy(dest_string, "PUT: Put", sizeof(dest_string));
215  else if (data.call_type == OfxSecurityData::OFX_CALL_TYPE_PREFUND)
216  strncpy(dest_string, "PREFUND: Prefund", sizeof(dest_string));
217  else if (data.call_type == OfxSecurityData::OFX_CALL_TYPE_MATURITY)
218  strncpy(dest_string, "MATURITY: Maturity", sizeof(dest_string));
219  else
220  strncpy(dest_string, "ERROR: unrecognized", sizeof(dest_string));
221  std::cout << " Call type: " << dest_string << "\n";
222  }
223  if (data.yield_to_maturity_valid == true)
224  {
225  std::cout << " Yield to maturity (rate): " << data.yield_to_maturity << "%\n";
226  }
227  if (data.maturity_date_valid == true)
228  {
229  strftime(dest_string, sizeof(dest_string), "%c %Z", localtime(&(data.maturity_date)));
230  std::cout << " Maturity date: " << dest_string << "\n";
231  }
232  if (data.mutual_fund_type_valid == true)
233  {
234  if (data.mutual_fund_type == OfxSecurityData::OFX_MFTYPE_OPENEND)
235  strncpy(dest_string, "OPENEND: Open ended", sizeof(dest_string));
236  else if (data.mutual_fund_type == OfxSecurityData::OFX_MFTYPE_CLOSEEND)
237  strncpy(dest_string, "CLOSEEND: Closed ended", sizeof(dest_string));
238  else if (data.mutual_fund_type == OfxSecurityData::OFX_MFTYPE_OTHER)
239  strncpy(dest_string, "OTHER: Other type", sizeof(dest_string));
240  else
241  strncpy(dest_string, "ERROR: unrecognized", sizeof(dest_string));
242  std::cout << " Mutual fund type: " << dest_string << "\n";
243  if (data.stock_type_valid == true)
244  {
245  if (data.stock_type == OfxSecurityData::OFX_STOCKTYPE_COMMON)
246  strncpy(dest_string, "COMMON: Common stock", sizeof(dest_string));
247  else if (data.stock_type == OfxSecurityData::OFX_STOCKTYPE_PREFERRED)
248  strncpy(dest_string, "PREFERRED: Preferred stock", sizeof(dest_string));
249  else if (data.stock_type == OfxSecurityData::OFX_STOCKTYPE_CONVERTIBLE)
250  strncpy(dest_string, "CONVERTIBLE: Convertable stock", sizeof(dest_string));
251  else if (data.stock_type == OfxSecurityData::OFX_STOCKTYPE_OTHER)
252  strncpy(dest_string, "OTHER: Other type", sizeof(dest_string));
253  else
254  strncpy(dest_string, "ERROR: unrecognized", sizeof(dest_string));
255  std::cout << " Stock type: " << dest_string << "\n";
256  }
257  }
258  if (data.yield_valid == true)
259  {
260  std::cout << " Current yield (rate): " << data.yield << "%\n";
261  }
262  if (data.yield_asof_date_valid == true)
263  {
264  strftime(dest_string, sizeof(dest_string), "%c %Z", localtime(&(data.yield_asof_date)));
265  std::cout << " Date for which current yield is valid: " << dest_string << "\n";
266  }
267  if (data.option_type_valid == true)
268  {
269  if (data.option_type == OfxSecurityData::OFX_OPTION_TYPE_CALL)
270  strncpy(dest_string, "CALL: Call option", sizeof(dest_string));
271  else if (data.option_type == OfxSecurityData::OFX_OPTION_TYPE_PUT)
272  strncpy(dest_string, "PUT: Put option", sizeof(dest_string));
273  else
274  strncpy(dest_string, "ERROR: unrecognized", sizeof(dest_string));
275  std::cout << " Option type: " << dest_string << "\n";
276  }
277  if (data.strike_price_valid == true)
278  {
279  std::cout << " Strike price: " << data.strike_price << "\n";
280  }
281  if (data.date_expire_valid == true)
282  {
283  strftime(dest_string, sizeof(dest_string), "%c %Z", localtime(&(data.date_expire)));
284  std::cout << " Expiration date: " << dest_string << "\n";
285  }
286  if (data.shares_per_cont_valid == true)
287  {
288  std::cout << " Shares per contract: " << data.shares_per_cont << "\n";
289  }
290  std::cout << "\n";
291  return 0;
292 }
293 
294 int ofx_proc_transaction_cb(struct OfxTransactionData data, void * transaction_data)
295 {
296  char dest_string[255];
297  std::cout << "ofx_proc_transaction():\n";
298 
299  if (data.account_id_valid == true)
300  {
301  std::cout << " Account ID : " << data.account_id << "\n";
302  }
303 
304  if (data.transactiontype_valid == true)
305  {
306  if (data.transactiontype == OFX_CREDIT)
307  strncpy(dest_string, "CREDIT: Generic credit", sizeof(dest_string));
308  else if (data.transactiontype == OFX_DEBIT)
309  strncpy(dest_string, "DEBIT: Generic debit", sizeof(dest_string));
310  else if (data.transactiontype == OFX_INT)
311  strncpy(dest_string, "INT: Interest earned or paid (Note: Depends on signage of amount)", sizeof(dest_string));
312  else if (data.transactiontype == OFX_DIV)
313  strncpy(dest_string, "DIV: Dividend", sizeof(dest_string));
314  else if (data.transactiontype == OFX_FEE)
315  strncpy(dest_string, "FEE: FI fee", sizeof(dest_string));
316  else if (data.transactiontype == OFX_SRVCHG)
317  strncpy(dest_string, "SRVCHG: Service charge", sizeof(dest_string));
318  else if (data.transactiontype == OFX_DEP)
319  strncpy(dest_string, "DEP: Deposit", sizeof(dest_string));
320  else if (data.transactiontype == OFX_ATM)
321  strncpy(dest_string, "ATM: ATM debit or credit (Note: Depends on signage of amount)", sizeof(dest_string));
322  else if (data.transactiontype == OFX_POS)
323  strncpy(dest_string, "POS: Point of sale debit or credit (Note: Depends on signage of amount)", sizeof(dest_string));
324  else if (data.transactiontype == OFX_XFER)
325  strncpy(dest_string, "XFER: Transfer", sizeof(dest_string));
326  else if (data.transactiontype == OFX_CHECK)
327  strncpy(dest_string, "CHECK: Check", sizeof(dest_string));
328  else if (data.transactiontype == OFX_PAYMENT)
329  strncpy(dest_string, "PAYMENT: Electronic payment", sizeof(dest_string));
330  else if (data.transactiontype == OFX_CASH)
331  strncpy(dest_string, "CASH: Cash withdrawal", sizeof(dest_string));
332  else if (data.transactiontype == OFX_DIRECTDEP)
333  strncpy(dest_string, "DIRECTDEP: Direct deposit", sizeof(dest_string));
334  else if (data.transactiontype == OFX_DIRECTDEBIT)
335  strncpy(dest_string, "DIRECTDEBIT: Merchant initiated debit", sizeof(dest_string));
336  else if (data.transactiontype == OFX_REPEATPMT)
337  strncpy(dest_string, "REPEATPMT: Repeating payment/standing order", sizeof(dest_string));
338  else if (data.transactiontype == OFX_OTHER)
339  strncpy(dest_string, "OTHER: Other", sizeof(dest_string));
340  else
341  strncpy(dest_string, "Unknown transaction type", sizeof(dest_string));
342  std::cout << " Transaction type: " << dest_string << "\n";
343  }
344 
345 
346  if (data.date_initiated_valid == true)
347  {
348  strftime(dest_string, sizeof(dest_string), "%c %Z", localtime(&(data.date_initiated)));
349  std::cout << " Date initiated: " << dest_string << "\n";
350  }
351  if (data.date_posted_valid == true)
352  {
353  strftime(dest_string, sizeof(dest_string), "%c %Z", localtime(&(data.date_posted)));
354  std::cout << " Date posted: " << dest_string << "\n";
355  }
356  if (data.date_funds_available_valid == true)
357  {
358  strftime(dest_string, sizeof(dest_string), "%c %Z", localtime(&(data.date_funds_available)));
359  std::cout << " Date funds are available: " << dest_string << "\n";
360  }
361  if (data.amount_valid == true)
362  {
363  std::cout << " Total money amount: " << std::setiosflags(std::ios::fixed) << std::setiosflags(std::ios::showpoint) << std::setprecision(2) << data.amount << "\n";
364  }
365  if (data.units_valid == true)
366  {
367  if (data.invtransactiontype_valid)
368  {
369  std::cout << " # of units: " << std::setiosflags(std::ios::fixed) << std::setiosflags(std::ios::showpoint) << std::setprecision(4) << data.units;
370  strncpy(dest_string, " (bonds: face value; options: contracts; all others: shares)", sizeof(dest_string));
371  if (data.security_data_valid == true)
372  {
373  if (data.security_data_ptr->security_type_valid == true)
374  {
375  if (data.security_data_ptr->security_type == OfxSecurityData::OFX_DEBT_SECURITY)
376  strncpy(dest_string, " (face value)", sizeof(dest_string));
377  else if (data.security_data_ptr->security_type == OfxSecurityData::OFX_FUND_SECURITY ||
378  data.security_data_ptr->security_type == OfxSecurityData::OFX_STOCK_SECURITY ||
379  data.security_data_ptr->security_type == OfxSecurityData::OFX_OTHER_SECURITY)
380  strncpy(dest_string, " (shares)", sizeof(dest_string));
381  else if (data.security_data_ptr->security_type == OfxSecurityData::OFX_OPTION_SECURITY)
382  strncpy(dest_string, " (contracts)", sizeof(dest_string));
383  }
384  }
385  std::cout << dest_string;
386  }
387  else
388  std::cout << " # of units: " << std::setiosflags(std::ios::fixed) << std::setiosflags(std::ios::showpoint) << std::setprecision(2) << data.units;
389  std::cout << "\n";
390  }
391  if (data.oldunits_valid == true)
392  {
393  if (data.invtransactiontype_valid)
394  std::cout << " # of units before split: " << std::setiosflags(std::ios::fixed) << std::setiosflags(std::ios::showpoint) << std::setprecision(4) << data.oldunits << "\n";
395  else
396  std::cout << " # of units before split: " << std::setiosflags(std::ios::fixed) << std::setiosflags(std::ios::showpoint) << std::setprecision(2) << data.oldunits << "\n";
397  }
398  if (data.newunits_valid == true)
399  {
400  std::cout << " # of units after split: " << std::setprecision(4) << data.newunits << "\n";
401  }
402  if (data.unitprice_valid == true)
403  {
404  if (data.invtransactiontype_valid)
405  {
406  std::cout << " Unit price: " << std::setiosflags(std::ios::fixed) << std::setiosflags(std::ios::showpoint) << std::setprecision(4) << data.unitprice;
407  strncpy(dest_string, " (bonds: % of par; options: premium per share of underlying; all others: price per share)\n", sizeof(dest_string));
408  if (data.security_data_valid == true)
409  {
410  if (data.security_data_ptr->security_type_valid == true)
411  {
412  if (data.security_data_ptr->security_type == OfxSecurityData::OFX_DEBT_SECURITY)
413  {
414  strncpy(dest_string, "% (% of par)\n", sizeof(dest_string));
415  }
416  else if (data.security_data_ptr->security_type == OfxSecurityData::OFX_FUND_SECURITY ||
417  data.security_data_ptr->security_type == OfxSecurityData::OFX_STOCK_SECURITY ||
418  data.security_data_ptr->security_type == OfxSecurityData::OFX_OTHER_SECURITY)
419  strncpy(dest_string, " (price per share)\n", sizeof(dest_string));
420  else if (data.security_data_ptr->security_type == OfxSecurityData::OFX_OPTION_SECURITY)
421  strncpy(dest_string, " (premium per share of underlying)\n", sizeof(dest_string));
422  }
423  }
424  std::cout << dest_string;
425  }
426  else
427  std::cout << " Unit price: " << std::setiosflags(std::ios::fixed) << std::setiosflags(std::ios::showpoint) << std::setprecision(2) << data.unitprice << "\n";
428  }
429  if (data.fees_valid == true)
430  {
431  std::cout << " Fees: " << std::setiosflags(std::ios::fixed) << std::setiosflags(std::ios::showpoint) << std::setprecision(2) << data.fees << "\n";
432  }
433  if (data.commission_valid == true)
434  {
435  std::cout << " Commission: " << std::setiosflags(std::ios::fixed) << std::setiosflags(std::ios::showpoint) << std::setprecision(2) << data.commission << "\n";
436  }
437  if (data.amounts_are_foreign_currency_valid == true)
438  {
439  std::cout << " Amounts are in foreign currency: " << (data.amounts_are_foreign_currency ? "Yes" : "No") << "\n";
440  }
441  if (data.currency_valid == true)
442  {
443  std::cout << " Currency: " << data.currency << "\n";
444  }
445  if (data.currency_ratio_valid == true)
446  {
447  std::cout << " Ratio of default currency to currency: " << data.currency_ratio << "\n";
448  }
449  if (data.fi_id_valid == true)
450  {
451  std::cout << " Financial institution's ID for this transaction: " << data.fi_id << "\n";
452  }
453  if (data.fi_id_corrected_valid == true)
454  {
455  std::cout << " Financial institution ID replaced or corrected by this transaction: " << data.fi_id_corrected << "\n";
456  }
457  if (data.fi_id_correction_action_valid == true)
458  {
459  std::cout << " Action to take on the corrected transaction: ";
460  if (data.fi_id_correction_action == DELETE)
461  std::cout << "DELETE\n";
462  else if (data.fi_id_correction_action == REPLACE)
463  std::cout << "REPLACE\n";
464  else
465  std::cout << "ofx_proc_transaction(): This should not happen!\n";
466  }
467  if (data.invtransactiontype_valid == true)
468  {
469  std::cout << " Investment transaction type: ";
470  if (data.invtransactiontype == OFX_BUYDEBT)
471  strncpy(dest_string, "BUYDEBT (Buy debt security)", sizeof(dest_string));
472  else if (data.invtransactiontype == OFX_BUYMF)
473  strncpy(dest_string, "BUYMF (Buy mutual fund)", sizeof(dest_string));
474  else if (data.invtransactiontype == OFX_BUYOPT)
475  strncpy(dest_string, "BUYOPT (Buy option)", sizeof(dest_string));
476  else if (data.invtransactiontype == OFX_BUYOTHER)
477  strncpy(dest_string, "BUYOTHER (Buy other security type)", sizeof(dest_string));
478  else if (data.invtransactiontype == OFX_BUYSTOCK)
479  strncpy(dest_string, "BUYSTOCK (Buy stock)", sizeof(dest_string));
480  else if (data.invtransactiontype == OFX_CLOSUREOPT)
481  strncpy(dest_string, "CLOSUREOPT (Close a position for an option)", sizeof(dest_string));
482  else if (data.invtransactiontype == OFX_INCOME)
483  strncpy(dest_string, "INCOME (Investment income is realized as cash into the investment account)", sizeof(dest_string));
484  else if (data.invtransactiontype == OFX_INVEXPENSE)
485  strncpy(dest_string, "INVEXPENSE (Misc investment expense that is associated with a specific security)", sizeof(dest_string));
486  else if (data.invtransactiontype == OFX_JRNLFUND)
487  strncpy(dest_string, "JRNLFUND (Journaling cash holdings between subaccounts within the same investment account)", sizeof(dest_string));
488  else if (data.invtransactiontype == OFX_MARGININTEREST)
489  strncpy(dest_string, "MARGININTEREST (Margin interest expense)", sizeof(dest_string));
490  else if (data.invtransactiontype == OFX_REINVEST)
491  strncpy(dest_string, "REINVEST (Reinvestment of income)", sizeof(dest_string));
492  else if (data.invtransactiontype == OFX_RETOFCAP)
493  strncpy(dest_string, "RETOFCAP (Return of capital)", sizeof(dest_string));
494  else if (data.invtransactiontype == OFX_SELLDEBT)
495  strncpy(dest_string, "SELLDEBT (Sell debt security. Used when debt is sold, called, or reached maturity)", sizeof(dest_string));
496  else if (data.invtransactiontype == OFX_SELLMF)
497  strncpy(dest_string, "SELLMF (Sell mutual fund)", sizeof(dest_string));
498  else if (data.invtransactiontype == OFX_SELLOPT)
499  strncpy(dest_string, "SELLOPT (Sell option)", sizeof(dest_string));
500  else if (data.invtransactiontype == OFX_SELLOTHER)
501  strncpy(dest_string, "SELLOTHER (Sell other type of security)", sizeof(dest_string));
502  else if (data.invtransactiontype == OFX_SELLSTOCK)
503  strncpy(dest_string, "SELLSTOCK (Sell stock)", sizeof(dest_string));
504  else if (data.invtransactiontype == OFX_SPLIT)
505  strncpy(dest_string, "SPLIT (Stock or mutial fund split)", sizeof(dest_string));
506  else if (data.invtransactiontype == OFX_TRANSFER)
507  strncpy(dest_string, "TRANSFER (Transfer holdings in and out of the investment account)", sizeof(dest_string));
508  else if (data.invtransactiontype == OFX_INVBANKTRAN)
509  strncpy(dest_string, "INVBANKTRAN (Transfer cash in and out of the investment account)", sizeof(dest_string));
510  else
511  strncpy(dest_string, "ERROR, this investment transaction type is unknown. This is a bug in ofxdump", sizeof(dest_string));
512 
513  std::cout << dest_string << "\n";
514  }
515  if (data.unique_id_valid == true)
516  {
517  std::cout << " Unique ID of the security being traded: " << data.unique_id << "\n";
518  }
519  if (data.unique_id_type_valid == true)
520  {
521  std::cout << " Format of the Unique ID: " << data.unique_id_type << "\n";
522  }
523  if (data.server_transaction_id_valid == true)
524  {
525  std::cout << " Server's transaction ID (confirmation number): " << data.server_transaction_id << "\n";
526  }
527  if (data.check_number_valid == true)
528  {
529  std::cout << " Check number: " << data.check_number << "\n";
530  }
531  if (data.reference_number_valid == true)
532  {
533  std::cout << " Reference number: " << data.reference_number << "\n";
534  }
535  if (data.standard_industrial_code_valid == true)
536  {
537  std::cout << " Standard Industrial Code: " << data.standard_industrial_code << "\n";
538  }
539  if (data.payee_id_valid == true)
540  {
541  std::cout << " Payee_id: " << data.payee_id << "\n";
542  }
543  if (data.name_valid == true)
544  {
545  std::cout << " Name of payee or transaction description: " << data.name << "\n";
546  }
547  if (data.memo_valid == true)
548  {
549  std::cout << " Extra transaction information (memo): " << data.memo << "\n";
550  }
551  if (data.accrued_interest_valid == true)
552  {
553  std::cout << " Accrued Interest: " << std::setiosflags(std::ios::fixed) << std::setiosflags(std::ios::showpoint) << std::setprecision(2) << data.accrued_interest << "\n";
554  }
555  if (data.avg_cost_basis_valid == true)
556  {
557  std::cout << " Average cost basis: " << std::setiosflags(std::ios::fixed) << std::setiosflags(std::ios::showpoint) << std::setprecision(2) << data.avg_cost_basis << "\n";
558  }
559  if (data.buy_type_valid == true)
560  {
561  if (data.buy_type == OfxTransactionData::OFX_BUY_TYPE_BUY)
562  strncpy(dest_string, "BUY: Buy", sizeof(dest_string));
563  else if (data.buy_type == OfxTransactionData::OFX_BUY_TYPE_BUYTOCOVER)
564  strncpy(dest_string, "BUYTOCOVER: Buy to cover", sizeof(dest_string));
565  else if (data.buy_type == OfxTransactionData::OFX_BUY_TYPE_BUYTOOPEN)
566  strncpy(dest_string, "BUYTOOPEN: Buy to open", sizeof(dest_string));
567  else if (data.buy_type == OfxTransactionData::OFX_BUY_TYPE_BUYTOCLOSE)
568  strncpy(dest_string, "BUYTOCLOSE: Buy to close", sizeof(dest_string));
569  else
570  strncpy(dest_string,"ERROR: unrecognized", sizeof(dest_string));
571  std::cout << " Buy type: " << dest_string << "\n";
572  }
573  if (data.denominator_valid == true)
574  {
575  std::cout << " Stock split ratio denominator: " << data.denominator << "\n";
576  }
577  if (data.date_payroll_valid == true)
578  {
579  strftime(dest_string, sizeof(dest_string), "%c %Z", localtime(&(data.date_payroll)));
580  std::cout << " Date 401(k) funds were deducted from payroll: " << dest_string << "\n";
581  }
582  if (data.date_purchase_valid == true)
583  {
584  strftime(dest_string, sizeof(dest_string), "%c %Z", localtime(&(data.date_purchase)));
585  std::cout << " Original purchase date of the security: " << dest_string << "\n";
586  }
587  if (data.gain_valid == true)
588  {
589  std::cout << " Average cost basis: " << std::setiosflags(std::ios::fixed) << std::setiosflags(std::ios::showpoint) << std::setprecision(2) << data.gain << "\n";
590  }
591  if (data.cash_for_fractional_valid == true)
592  {
593  std::cout << " Average cost basis: " << std::setiosflags(std::ios::fixed) << std::setiosflags(std::ios::showpoint) << std::setprecision(2) << data.cash_for_fractional << "\n";
594  }
595  if (data.income_type_valid == true)
596  {
597  if (data.income_type == OfxTransactionData::OFX_CGLONG)
598  strncpy(dest_string, "CGLONG: Long term capital gains", sizeof(dest_string));
599  else if (data.income_type == OfxTransactionData::OFX_CGSHORT)
600  strncpy(dest_string, "CGSHORT: Short term capital gains", sizeof(dest_string));
601  else if (data.income_type == OfxTransactionData::OFX_DIVIDEND)
602  strncpy(dest_string, "DIVIDEND", sizeof(dest_string));
603  else if (data.income_type == OfxTransactionData::OFX_INTEREST)
604  strncpy(dest_string, "INTEREST", sizeof(dest_string));
605  else if (data.income_type == OfxTransactionData::OFX_MISC)
606  strncpy(dest_string, "MISC: Miscellaneous", sizeof(dest_string));
607  else
608  strncpy(dest_string,"ERROR: unrecognized", sizeof(dest_string));
609  std::cout << " Income type: " << dest_string << "\n";
610  }
611  if (data.inv_401k_source_valid == true)
612  {
613  if (data.inv_401k_source == OfxTransactionData::OFX_401K_SOURCE_PRETAX)
614  strncpy(dest_string, "PRETAX", sizeof(dest_string));
615  else if (data.inv_401k_source == OfxTransactionData::OFX_401K_SOURCE_AFTERTAX)
616  strncpy(dest_string, "AFTERTAX", sizeof(dest_string));
617  else if (data.inv_401k_source == OfxTransactionData::OFX_401K_SOURCE_MATCH)
618  strncpy(dest_string, "MATCH", sizeof(dest_string));
619  else if (data.inv_401k_source == OfxTransactionData::OFX_401K_SOURCE_PROFITSHARING)
620  strncpy(dest_string, "PROFITSHARING", sizeof(dest_string));
621  else if (data.inv_401k_source == OfxTransactionData::OFX_401K_SOURCE_ROLLOVER)
622  strncpy(dest_string, "ROLLOVER", sizeof(dest_string));
623  else if (data.inv_401k_source == OfxTransactionData::OFX_401K_SOURCE_OTHERVEST)
624  strncpy(dest_string, "OTHERVEST", sizeof(dest_string));
625  else if (data.inv_401k_source == OfxTransactionData::OFX_401K_SOURCE_OTHERNONVEST)
626  strncpy(dest_string, "OTHERNONVEST", sizeof(dest_string));
627  else
628  strncpy(dest_string,"ERROR: unrecognized", sizeof(dest_string));
629  std::cout << " Source of 401(k) money: " << dest_string << "\n";
630  }
631  if (data.load_valid == true)
632  {
633  std::cout << " Load (amount): " << std::setiosflags(std::ios::fixed) << std::setiosflags(std::ios::showpoint) << std::setprecision(2) << data.load << "\n";
634  }
635  if (data.loan_id_valid == true)
636  {
637  std::cout << " 401(k) loan id: " << data.loan_id << "\n";
638  }
639  if (data.loan_interest_valid == true)
640  {
641  std::cout << " 401(k) loan interest (amount): " << std::setiosflags(std::ios::fixed) << std::setiosflags(std::ios::showpoint) << std::setprecision(2) << data.loan_interest << "\n";
642  }
643  if (data.loan_principal_valid == true)
644  {
645  std::cout << " 401(k) loan principle (amount): " << std::setiosflags(std::ios::fixed) << std::setiosflags(std::ios::showpoint) << std::setprecision(2) << data.loan_principal << "\n";
646  }
647  if (data.markdown_valid == true)
648  {
649  std::cout << " Markdown (unitprice): " << std::setiosflags(std::ios::fixed) << std::setiosflags(std::ios::showpoint) << std::setprecision(2) << data.markdown << "\n";
650  }
651  if (data.markup_valid == true)
652  {
653  std::cout << " Markup (unitprice): " << std::setiosflags(std::ios::fixed) << std::setiosflags(std::ios::showpoint) << std::setprecision(2) << data.markup << "\n";
654  }
655  if (data.numerator_valid == true)
656  {
657  std::cout << " Stock split ratio numerator: " << data.numerator << "\n";
658  }
659  if (data.opt_action_valid == true)
660  {
661  if (data.opt_action == OfxTransactionData::OFX_OPTACTION_EXERCISE)
662  strncpy(dest_string, "EXERCISE", sizeof(dest_string));
663  else if (data.opt_action == OfxTransactionData::OFX_OPTACTION_ASSIGN)
664  strncpy(dest_string, "ASSIGN", sizeof(dest_string));
665  else if (data.opt_action == OfxTransactionData::OFX_OPTACTION_EXPIRE)
666  strncpy(dest_string, "EXPIRE", sizeof(dest_string));
667  else
668  strncpy(dest_string,"ERROR: unrecognized", sizeof(dest_string));
669  std::cout << " Option action: " << dest_string << "\n";
670  }
671  if (data.penalty_valid == true)
672  {
673  std::cout << " Penalty withheld (amount): " << std::setiosflags(std::ios::fixed) << std::setiosflags(std::ios::showpoint) << std::setprecision(2) << data.penalty << "\n";
674  }
675  if (data.pos_type_valid == true)
676  {
677  if (data.pos_type == OfxTransactionData::OFX_POSTYPE_LONG)
678  strncpy(dest_string, "LONG", sizeof(dest_string));
679  else if (data.pos_type == OfxTransactionData::OFX_POSTYPE_SHORT)
680  strncpy(dest_string, "SHORT", sizeof(dest_string));
681  else
682  strncpy(dest_string,"ERROR: unrecognized", sizeof(dest_string));
683  std::cout << " Position Type: " << dest_string << "\n";
684  }
685  if (data.prior_year_contrib_valid == true)
686  {
687  std::cout << " Prior year 401(k) contribution: " << (data.prior_year_contrib ? "Yes" : "No") << "\n";
688  }
689  if (data.related_fi_tid_valid == true)
690  {
691  std::cout << " Related transaction TID: " << data.related_fi_tid << "\n";
692  }
693  if (data.related_type_valid == true)
694  {
695  if (data.related_type == OfxTransactionData::OFX_RELTYPE_SPREAD)
696  strncpy(dest_string, "SPREAD", sizeof(dest_string));
697  else if (data.related_type == OfxTransactionData::OFX_RELTYPE_STRADDLE)
698  strncpy(dest_string, "STRADDLE", sizeof(dest_string));
699  else if (data.related_type == OfxTransactionData::OFX_RELTYPE_NONE)
700  strncpy(dest_string, "NONE", sizeof(dest_string));
701  else if (data.related_type == OfxTransactionData::OFX_RELTYPE_OTHER)
702  strncpy(dest_string, "OTHER", sizeof(dest_string));
703  else
704  strncpy(dest_string,"ERROR: unrecognized", sizeof(dest_string));
705  std::cout << " Related Option Type: " << dest_string << "\n";
706  }
707  if (data.option_secured_valid == true)
708  {
709  if (data.option_secured == OfxTransactionData::OFX_SECURED_NAKED)
710  strncpy(dest_string, "NAKED", sizeof(dest_string));
711  else if (data.option_secured == OfxTransactionData::OFX_SECURED_COVERED)
712  strncpy(dest_string, "COVERED: Cash covered", sizeof(dest_string));
713  else
714  strncpy(dest_string,"ERROR: unrecognized", sizeof(dest_string));
715  std::cout << " How is the option secured: " << dest_string << "\n";
716  }
717  if (data.sell_reason_valid == true)
718  {
719  if (data.sell_reason == OfxTransactionData::OFX_SELLREASON_CALL)
720  strncpy(dest_string, "CALL: the debt was called", sizeof(dest_string));
721  else if (data.sell_reason == OfxTransactionData::OFX_SELLREASON_SELL)
722  strncpy(dest_string, "SELL: the debt was sold", sizeof(dest_string));
723  else if (data.sell_reason == OfxTransactionData::OFX_SELLREASON_MATURITY)
724  strncpy(dest_string, "MATURITY: the debt reached maturity", sizeof(dest_string));
725  else
726  strncpy(dest_string,"ERROR: unrecognized", sizeof(dest_string));
727  std::cout << " Reason for the debt sell: " << dest_string << "\n";
728  }
729  if (data.sell_type_valid == true)
730  {
731  if (data.sell_type == OfxTransactionData::OFX_SELL_TYPE_SELL)
732  strncpy(dest_string, "SELL: Sell", sizeof(dest_string));
733  else if (data.sell_type == OfxTransactionData::OFX_SELL_TYPE_SELLSHORT)
734  strncpy(dest_string, "SELLSHORT: Sell short", sizeof(dest_string));
735  else if (data.sell_type == OfxTransactionData::OFX_SELL_TYPE_SELLTOOPEN)
736  strncpy(dest_string, "SELLTOOPEN: Sell to open", sizeof(dest_string));
737  else if (data.sell_type == OfxTransactionData::OFX_SELL_TYPE_SELLTOCLOSE)
738  strncpy(dest_string, "SELLTOCLOSE: Sell to close", sizeof(dest_string));
739  else
740  strncpy(dest_string,"ERROR: unrecognized", sizeof(dest_string));
741  std::cout << " Sell type: " << dest_string << "\n";
742  }
743  if (data.shares_per_cont_valid == true)
744  {
745  std::cout << " Shares per option contract: " << data.shares_per_cont << "\n";
746  }
747  if (data.state_withholding_valid == true)
748  {
749  std::cout << " State taxes withheld: " << std::setiosflags(std::ios::fixed) << std::setiosflags(std::ios::showpoint) << std::setprecision(2) << data.state_withholding << "\n";
750  }
751  if (data.subacct_from_valid == true)
752  {
753  if (data.subacct_from == OfxTransactionData::OFX_SUBACCT_CASH)
754  strncpy(dest_string, "CASH", sizeof(dest_string));
755  else if (data.subacct_from == OfxTransactionData::OFX_SUBACCT_MARGIN)
756  strncpy(dest_string, "MARGIN", sizeof(dest_string));
757  else if (data.subacct_from == OfxTransactionData::OFX_SUBACCT_SHORT)
758  strncpy(dest_string, "SHORT", sizeof(dest_string));
759  else if (data.subacct_from == OfxTransactionData::OFX_SUBACCT_OTHER)
760  strncpy(dest_string, "OTHER", sizeof(dest_string));
761  else
762  strncpy(dest_string,"ERROR: unrecognized", sizeof(dest_string));
763  std::cout << " From sub account type: " << dest_string << "\n";
764  }
765  if (data.subacct_funding_valid == true)
766  {
767  if (data.subacct_funding == OfxTransactionData::OFX_SUBACCT_CASH)
768  strncpy(dest_string, "CASH", sizeof(dest_string));
769  else if (data.subacct_funding == OfxTransactionData::OFX_SUBACCT_MARGIN)
770  strncpy(dest_string, "MARGIN", sizeof(dest_string));
771  else if (data.subacct_funding == OfxTransactionData::OFX_SUBACCT_SHORT)
772  strncpy(dest_string, "SHORT", sizeof(dest_string));
773  else if (data.subacct_funding == OfxTransactionData::OFX_SUBACCT_OTHER)
774  strncpy(dest_string, "OTHER", sizeof(dest_string));
775  else
776  strncpy(dest_string,"ERROR: unrecognized", sizeof(dest_string));
777  std::cout << " Funding sub account type: " << dest_string << "\n";
778  }
779  if (data.subacct_security_valid == true)
780  {
781  if (data.subacct_security == OfxTransactionData::OFX_SUBACCT_CASH)
782  strncpy(dest_string, "CASH", sizeof(dest_string));
783  else if (data.subacct_security == OfxTransactionData::OFX_SUBACCT_MARGIN)
784  strncpy(dest_string, "MARGIN", sizeof(dest_string));
785  else if (data.subacct_security == OfxTransactionData::OFX_SUBACCT_SHORT)
786  strncpy(dest_string, "SHORT", sizeof(dest_string));
787  else if (data.subacct_security == OfxTransactionData::OFX_SUBACCT_OTHER)
788  strncpy(dest_string, "OTHER", sizeof(dest_string));
789  else
790  strncpy(dest_string,"ERROR: unrecognized", sizeof(dest_string));
791  std::cout << " Security sub account type: " << dest_string << "\n";
792  }
793  if (data.subacct_to_valid == true)
794  {
795  if (data.subacct_to == OfxTransactionData::OFX_SUBACCT_CASH)
796  strncpy(dest_string, "CASH", sizeof(dest_string));
797  else if (data.subacct_to == OfxTransactionData::OFX_SUBACCT_MARGIN)
798  strncpy(dest_string, "MARGIN", sizeof(dest_string));
799  else if (data.subacct_to == OfxTransactionData::OFX_SUBACCT_SHORT)
800  strncpy(dest_string, "SHORT", sizeof(dest_string));
801  else if (data.subacct_to == OfxTransactionData::OFX_SUBACCT_OTHER)
802  strncpy(dest_string, "OTHER", sizeof(dest_string));
803  else
804  strncpy(dest_string,"ERROR: unrecognized", sizeof(dest_string));
805  std::cout << " To sub account type: " << dest_string << "\n";
806  }
807  if (data.taxes_valid == true)
808  {
809  std::cout << " Tax on the trade (amount): " << std::setiosflags(std::ios::fixed) << std::setiosflags(std::ios::showpoint) << std::setprecision(2) << data.taxes << "\n";
810  }
811  if (data.tax_exempt_valid == true)
812  {
813  std::cout << " Tax exempt: " << (data.tax_exempt ? "Yes" : "No") << "\n";
814  }
815  if (data.transfer_action_valid == true)
816  {
817  if (data.transfer_action == OfxTransactionData::OFX_TFERACTION_IN)
818  strncpy(dest_string, "IN", sizeof(dest_string));
819  else if (data.transfer_action == OfxTransactionData::OFX_TFERACTION_OUT)
820  strncpy(dest_string, "OUT", sizeof(dest_string));
821  else
822  strncpy(dest_string,"ERROR: unrecognized", sizeof(dest_string));
823  std::cout << " Action for the transfer: " << dest_string << "\n";
824  }
825  if (data.unit_type_valid == true)
826  {
827  if (data.unit_type == OfxTransactionData::OFX_UNITTYPE_SHARES)
828  strncpy(dest_string, "SHARES", sizeof(dest_string));
829  else if (data.unit_type == OfxTransactionData::OFX_UNITTYPE_CURRENCY)
830  strncpy(dest_string, "CURRENCY", sizeof(dest_string));
831  else
832  strncpy(dest_string,"ERROR: unrecognized", sizeof(dest_string));
833  std::cout << " Type of the Units value: " << dest_string << "\n";
834  }
835  if (data.withholding_valid == true)
836  {
837  std::cout << " Federal tax withheld (amount): " << std::setiosflags(std::ios::fixed) << std::setiosflags(std::ios::showpoint) << std::setprecision(2) << data.withholding << "\n";
838  }
839  if (data.security_data_valid == true)
840  {
841  ofx_proc_security_cb(*(data.security_data_ptr), NULL );
842  }
843  std::cout << "\n";
844  return 0;
845 }//end ofx_proc_transaction()
846 
847 int ofx_proc_position_cb(struct OfxPositionData data, void * position_data)
848 {
849  char dest_string[255];
850  std::cout << "ofx_proc_position():\n";
851  if (data.account_id_valid == true)
852  {
853  std::cout << " Account ID: " << data.account_id << "\n";
854  }
855  if (data.unique_id_valid == true)
856  {
857  std::cout << " Unique ID of the security: " << data.unique_id << "\n";
858  }
859  if (data.unique_id_type_valid == true)
860  {
861  std::cout << " Format of the Unique ID: " << data.unique_id_type << "\n";
862  }
863  if (data.heldinaccount_type_valid == true)
864  {
865  if (data.heldinaccount_type == OfxPositionData::OFX_HELDINACCT_CASH)
866  strncpy(dest_string, "CASH: Cash subaccount", sizeof(dest_string));
867  else if (data.heldinaccount_type == OfxPositionData::OFX_HELDINACCT_MARGIN)
868  strncpy(dest_string, "MARGIN: Margin subaccount", sizeof(dest_string));
869  else if (data.heldinaccount_type == OfxPositionData::OFX_HELDINACCT_SHORT)
870  strncpy(dest_string, "SHORT: Short subaccount", sizeof(dest_string));
871  else if (data.heldinaccount_type == OfxPositionData::OFX_HELDINACCT_OTHER)
872  strncpy(dest_string, "OTHER: Other subaccount", sizeof(dest_string));
873  else
874  strncpy(dest_string, "ERROR: unrecognized", sizeof(dest_string));
875  std::cout << " Held in account type: " << dest_string << "\n";
876  }
877  if (data.position_type_valid == true)
878  {
879  if (data.position_type == OfxPositionData::OFX_POSITION_SHORT)
880  strncpy(dest_string, "SHORT: Short (writer for options, short for all others)", sizeof(dest_string));
881  else if (data.position_type == OfxPositionData::OFX_POSITION_LONG)
882  strncpy(dest_string, "LONG: Long (holder for options, long for all others)", sizeof(dest_string));
883  else
884  strncpy(dest_string, "ERROR: unrecognized", sizeof(dest_string));
885  std::cout << " Position type: " << dest_string << "\n";
886  }
887  if (data.units_valid == true)
888  {
889  std::cout << " Units: " << std::setprecision(4) << data.units;
890  strncpy(dest_string, " (bonds: face value; options: contracts; all others: shares)\n", sizeof(dest_string));
891  if (data.security_data_valid == true)
892  {
893  if (data.security_data_ptr->security_type_valid == true)
894  {
895  if (data.security_data_ptr->security_type == OfxSecurityData::OFX_DEBT_SECURITY)
896  strncpy(dest_string, " (face value)\n", sizeof(dest_string));
897  else if (data.security_data_ptr->security_type == OfxSecurityData::OFX_FUND_SECURITY ||
900  strncpy(dest_string, " (shares)\n", sizeof(dest_string));
901  else if (data.security_data_ptr->security_type == OfxSecurityData::OFX_OPTION_SECURITY)
902  strncpy(dest_string, " (contracts)\n", sizeof(dest_string));
903  }
904  }
905  std::cout << dest_string;
906  }
907  if (data.unit_price_valid == true)
908  {
909  if (data.security_data_valid == true)
910  {
911  std::cout << " Unit price: " << std::setiosflags(std::ios::fixed) << std::setiosflags(std::ios::showpoint) << std::setprecision(4) << data.unit_price;
912  strncpy(dest_string, " (bonds: % of par; options: premium per share of underlying; all others: price per share)\n", sizeof(dest_string));
913  if (data.security_data_ptr->security_type_valid == true)
914  {
915  if (data.security_data_ptr->security_type == OfxSecurityData::OFX_DEBT_SECURITY)
916  strncpy(dest_string, "% (% of par)\n", sizeof(dest_string));
917  else if (data.security_data_ptr->security_type == OfxSecurityData::OFX_FUND_SECURITY ||
920  strncpy(dest_string, " (price per share)\n", sizeof(dest_string));
921  else if (data.security_data_ptr->security_type == OfxSecurityData::OFX_OPTION_SECURITY)
922  strncpy(dest_string, " (premium per share of underlying)\n", sizeof(dest_string));
923  }
924  std::cout << dest_string;
925  }
926  else
927  std::cout << " Unit price: " << std::setiosflags(std::ios::fixed) << std::setiosflags(std::ios::showpoint) << std::setprecision(2) << data.unit_price << "\n";
928  }
929  if (data.market_value_valid == true)
930  {
931  std::cout << " Market Value: " << data.market_value << "\n";
932  }
933  if (data.amounts_are_foreign_currency_valid == true)
934  {
935  std::cout << " Amounts are in foreign currency: " << (data.amounts_are_foreign_currency ? "Yes" : "No") << "\n";
936  }
937  if (data.currency_valid == true)
938  {
939  std::cout << " Currency: " << data.currency << "\n";
940  }
941  if (data.currency_ratio_valid == true)
942  {
943  std::cout << " Ratio of default currency to currency: " << data.currency_ratio << "\n";
944  }
945  if (data.date_unit_price_valid == true)
946  {
947  strftime(dest_string, sizeof(dest_string), "%c %Z", localtime(&(data.date_unit_price)));
948  std::cout << " Date of unit price: " << dest_string << "\n";
949  }
950  if (data.memo_valid == true)
951  {
952  std::cout << " Extra position information (memo): " << data.memo << "\n";
953  }
954  if (data.inv_401k_source_valid == true)
955  {
956  if (data.inv_401k_source == OfxPositionData::OFX_401K_POSN_SOURCE_PRETAX)
957  strncpy(dest_string, "PRETAX", sizeof(dest_string));
958  else if (data.inv_401k_source == OfxPositionData::OFX_401K_POSN_SOURCE_AFTERTAX)
959  strncpy(dest_string, "AFTERTAX", sizeof(dest_string));
960  else if (data.inv_401k_source == OfxPositionData::OFX_401K_POSN_SOURCE_MATCH)
961  strncpy(dest_string, "MATCH", sizeof(dest_string));
962  else if (data.inv_401k_source == OfxPositionData::OFX_401K_POSN_SOURCE_PROFITSHARING)
963  strncpy(dest_string, "PROFITSHARING", sizeof(dest_string));
964  else if (data.inv_401k_source == OfxPositionData::OFX_401K_POSN_SOURCE_ROLLOVER)
965  strncpy(dest_string, "ROLLOVER", sizeof(dest_string));
966  else if (data.inv_401k_source == OfxPositionData::OFX_401K_POSN_SOURCE_OTHERVEST)
967  strncpy(dest_string, "OTHERVEST", sizeof(dest_string));
968  else if (data.inv_401k_source == OfxPositionData::OFX_401K_POSN_SOURCE_OTHERNONVEST)
969  strncpy(dest_string, "OTHERNONVEST", sizeof(dest_string));
970  else
971  strncpy(dest_string,"ERROR: unrecognized", sizeof(dest_string));
972  std::cout << " Source of 401(k) money: " << dest_string << "\n";
973  }
974  if (data.security_data_valid == true)
975  {
976  ofx_proc_security_cb(*(data.security_data_ptr), NULL );
977  }
978  std::cout << "\n";
979  return 0;
980 }// end of ofx_proc_position()
981 
982 int ofx_proc_statement_cb(struct OfxStatementData data, void * statement_data)
983 {
984  char dest_string[255];
985  std::cout << "ofx_proc_statement():\n";
986  if (data.currency_valid == true)
987  {
988  std::cout << " Default Currency: " << data.currency << "\n";
989  }
990  if (data.account_id_valid == true)
991  {
992  std::cout << " Account ID: " << data.account_id << "\n";
993  }
994  if (data.date_asof_valid == true)
995  {
996  strftime(dest_string, sizeof(dest_string), "%c %Z", localtime(&(data.date_asof)));
997  std::cout << " Statement as-of date: " << dest_string << "\n";
998  }
999  if (data.date_start_valid == true)
1000  {
1001  strftime(dest_string, sizeof(dest_string), "%c %Z", localtime(&(data.date_start)));
1002  std::cout << " Start date of this statement: " << dest_string << "\n";
1003  }
1004  if (data.date_end_valid == true)
1005  {
1006  strftime(dest_string, sizeof(dest_string), "%c %Z", localtime(&(data.date_end)));
1007  std::cout << " End date of this statement: " << dest_string << "\n";
1008  }
1009  if (data.ledger_balance_valid == true)
1010  {
1011  std::cout << " Ledger balance: " << std::setiosflags(std::ios::fixed) << std::setiosflags(std::ios::showpoint) << std::setprecision(2) << data.ledger_balance << "\n";
1012  }
1013  if (data.ledger_balance_date_valid == true)
1014  {
1015  strftime(dest_string, sizeof(dest_string), "%c %Z", localtime(&(data.ledger_balance_date)));
1016  std::cout << " Ledger balance date: " << dest_string << "\n";
1017  }
1018  if (data.available_balance_valid == true)
1019  {
1020  std::cout << " Available balance: " << std::setiosflags(std::ios::fixed) << std::setiosflags(std::ios::showpoint) << std::setprecision(2) << data.available_balance << "\n";
1021  }
1022  if (data.available_balance_date_valid == true)
1023  {
1024  strftime(dest_string, sizeof(dest_string), "%c %Z", localtime(&(data.available_balance_date)));
1025  std::cout << " Available balance date: " << dest_string << "\n";
1026  }
1027  if (data.margin_balance_valid == true)
1028  {
1029  std::cout << " Margin balance: " << std::setiosflags(std::ios::fixed) << std::setiosflags(std::ios::showpoint) << std::setprecision(2) << data.margin_balance << "\n";
1030  }
1031  if (data.short_balance_valid == true)
1032  {
1033  std::cout << " Short balance: " << std::setiosflags(std::ios::fixed) << std::setiosflags(std::ios::showpoint) << std::setprecision(2) << data.short_balance << "\n";
1034  }
1035  if (data.buying_power_valid == true)
1036  {
1037  std::cout << " Buying power: " << std::setiosflags(std::ios::fixed) << std::setiosflags(std::ios::showpoint) << std::setprecision(2) << data.buying_power << "\n";
1038  }
1039  if (data.marketing_info_valid == true)
1040  {
1041  std::cout << " Marketing information: " << data.marketing_info << "\n";
1042  }
1043  std::cout << "\n";
1044  return 0;
1045 }//end ofx_proc_statement()
1046 
1047 int ofx_proc_account_cb(struct OfxAccountData data, void * account_data)
1048 {
1049  std::cout << "ofx_proc_account():\n";
1050  if (data.account_id_valid == true)
1051  {
1052  std::cout << " Account ID: " << data.account_id << "\n";
1053  std::cout << " Account name: " << data.account_name << "\n";
1054  }
1055  if (data.account_type_valid == true)
1056  {
1057  std::cout << " Account type: ";
1058  switch (data.account_type)
1059  {
1061  std::cout << "CHECKING\n";
1062  break;
1064  std::cout << "SAVINGS\n";
1065  break;
1067  std::cout << "MONEYMRKT\n";
1068  break;
1070  std::cout << "CREDITLINE\n";
1071  break;
1073  std::cout << "CMA\n";
1074  break;
1076  std::cout << "CREDITCARD\n";
1077  break;
1079  std::cout << "INVESTMENT\n";
1080  break;
1081  default:
1082  std::cout << "ofx_proc_account() WRITEME: This is an unknown account type!";
1083  }
1084  }
1085  if (data.currency_valid == true)
1086  {
1087  std::cout << " Default Currency: " << data.currency << "\n";
1088  }
1089 
1090  if (data.bank_id_valid)
1091  std::cout << " Bank ID: " << data.bank_id << std::endl;;
1092 
1093  if (data.branch_id_valid)
1094  std::cout << " Branch ID: " << data.branch_id << std::endl;
1095 
1096  if (data.account_number_valid)
1097  std::cout << " Account #: " << data.account_number << std::endl;
1098 
1099  std::cout << "\n";
1100  return 0;
1101 }//end ofx_proc_account()
1102 
1103 
1104 
1105 int ofx_proc_status_cb(struct OfxStatusData data, void * status_data)
1106 {
1107  std::cout << "ofx_proc_status():\n";
1108  if (data.ofx_element_name_valid == true)
1109  {
1110  std::cout << " Ofx entity this status is relevant to: " << data.ofx_element_name << " \n";
1111  }
1112  if (data.severity_valid == true)
1113  {
1114  std::cout << " Severity: ";
1115  switch (data.severity)
1116  {
1117  case OfxStatusData::INFO :
1118  std::cout << "INFO\n";
1119  break;
1120  case OfxStatusData::WARN :
1121  std::cout << "WARN\n";
1122  break;
1123  case OfxStatusData::ERROR :
1124  std::cout << "ERROR\n";
1125  break;
1126  default:
1127  std::cout << "WRITEME: Unknown status severity!\n";
1128  }
1129  }
1130  if (data.code_valid == true)
1131  {
1132  std::cout << " Code: " << data.code << ", name: " << data.name << "\n Description: " << data.description << "\n";
1133  }
1134  if (data.server_message_valid == true)
1135  {
1136  std::cout << " Server Message: " << data.server_message << "\n";
1137  }
1138  std::cout << "\n";
1139  return 0;
1140 }
1141 
1142 
1143 int main (int argc, char *argv[])
1144 {
1145  int rc = 0;
1146  gengetopt_args_info args_info;
1147 
1148  /* let's call our cmdline parser */
1149  if (cmdline_parser (argc, argv, &args_info) != 0)
1150  exit(1) ;
1151 
1152  // if (args_info.msg_parser_given)
1153  // std::cout << "The msg_parser option was given!" << std::endl;
1154 
1155  // std::cout << "The flag is " << ( args_info.msg_parser_flag ? "on" : "off" ) <<
1156  // "." << std::endl ;
1157 
1158  ofx_PARSER_msg = bool(args_info.msg_parser_flag);
1159  ofx_DEBUG_msg = bool(args_info.msg_debug_flag);
1160  ofx_WARNING_msg = bool(args_info.msg_warning_flag);
1161  ofx_ERROR_msg = bool (args_info.msg_error_flag);
1162  ofx_INFO_msg = bool(args_info.msg_info_flag);
1163  ofx_STATUS_msg = bool(args_info.msg_status_flag);
1164 
1165  bool skiphelp = false;
1166 
1167  if (args_info.list_import_formats_given)
1168  {
1169  skiphelp = true;
1170  std::cout << "The supported file formats for the 'input-file-format' argument are:" << std::endl;
1171  for (int i = 0; LibofxImportFormatList[i].format != LAST; i++)
1172  {
1173  std::cout << " " << LibofxImportFormatList[i].description << std::endl;
1174  }
1175  }
1176 
1177  LibofxContextPtr libofx_context = libofx_get_new_context();
1178 
1179  //char **inputs ; /* unnamed options */
1180  //unsigned inputs_num ; /* unnamed options number */
1181  if (args_info.inputs_num > 0)
1182  {
1183  //const char* filename = args_info.inputs[0];
1184 
1185  ofx_set_statement_cb(libofx_context, ofx_proc_statement_cb, 0);
1186  ofx_set_account_cb(libofx_context, ofx_proc_account_cb, 0);
1187  ofx_set_transaction_cb(libofx_context, ofx_proc_transaction_cb, 0);
1188  ofx_set_security_cb(libofx_context, ofx_proc_security_cb, 0);
1189  ofx_set_status_cb(libofx_context, ofx_proc_status_cb, 0);
1190  ofx_set_position_cb(libofx_context, ofx_proc_position_cb, 0);
1191 
1192  enum LibofxFileFormat file_format = libofx_get_file_format_from_str(LibofxImportFormatList, args_info.import_format_arg);
1194  if (args_info.inputs_num > 1)
1195  {
1196  std::cout << "Sorry, currently, only the first file is processed as the library can't deal with more right now. The following files were ignored:" << std::endl;
1197  for ( unsigned i = 1 ; i < args_info.inputs_num ; ++i )
1198  {
1199  std::cout << "file: " << args_info.inputs[i] << std::endl ;
1200  }
1201  }
1202  rc = libofx_proc_file(libofx_context, args_info.inputs[0], file_format);
1203  }
1204  else
1205  {
1206  if ( !skiphelp )
1208  }
1209 
1210  libofx_free_context(libofx_context);
1211  cmdline_parser_free(&args_info);
1212  return rc;
1213 }
Main header file containing the LibOfx API.
void ofx_set_transaction_cb(LibofxContextPtr ctx, LibofxProcTransactionCallback cb, void *user_data)
Definition: context.cpp:216
LibofxContextPtr libofx_get_new_context()
Initialise the library and return a new context.
Definition: context.cpp:165
int ofx_WARNING_msg
Definition: messages.cpp:39
void ofx_set_account_cb(LibofxContextPtr ctx, LibofxProcAccountCallback cb, void *user_data)
Definition: context.cpp:198
int libofx_free_context(LibofxContextPtr)
Free all resources used by this context.
Definition: context.cpp:170
enum LibofxFileFormat libofx_get_file_format_from_str(const struct LibofxFileFormatInfo format_list[], const char *file_type_string)
libofx_get_file_type returns a proper enum from a file type string.
int ofx_PARSER_msg
Definition: messages.cpp:30
@ REPLACE
Definition: libofx.h:672
@ DELETE
Definition: libofx.h:670
int libofx_proc_file(LibofxContextPtr libofx_context, const char *p_filename, enum LibofxFileFormat ftype)
libofx_proc_file is the entry point of the library.
LibofxFileFormat
Definition: libofx.h:127
@ LAST
Definition: libofx.h:133
void ofx_set_position_cb(LibofxContextPtr ctx, LibofxProcPositionCallback cb, void *user_data)
Definition: context.cpp:233
int ofx_ERROR_msg
Definition: messages.cpp:40
@ OFX_XFER
Definition: libofx.h:633
@ OFX_POS
Definition: libofx.h:632
@ OFX_DIRECTDEP
Definition: libofx.h:637
@ OFX_PAYMENT
Definition: libofx.h:635
@ OFX_CASH
Definition: libofx.h:636
@ OFX_CREDIT
Definition: libofx.h:624
@ OFX_ATM
Definition: libofx.h:631
@ OFX_OTHER
Definition: libofx.h:640
@ OFX_INT
Definition: libofx.h:626
@ OFX_CHECK
Definition: libofx.h:634
@ OFX_SRVCHG
Definition: libofx.h:629
@ OFX_DEBIT
Definition: libofx.h:625
@ OFX_DIRECTDEBIT
Definition: libofx.h:638
@ OFX_FEE
Definition: libofx.h:628
@ OFX_DEP
Definition: libofx.h:630
@ OFX_DIV
Definition: libofx.h:627
@ OFX_REPEATPMT
Definition: libofx.h:639
@ OFX_SELLOTHER
Definition: libofx.h:661
@ OFX_MARGININTEREST
Definition: libofx.h:655
@ OFX_BUYOPT
Definition: libofx.h:647
@ OFX_CLOSUREOPT
Definition: libofx.h:650
@ OFX_JRNLFUND
Definition: libofx.h:653
@ OFX_INVBANKTRAN
Definition: libofx.h:665
@ OFX_BUYMF
Definition: libofx.h:646
@ OFX_SPLIT
Definition: libofx.h:663
@ OFX_REINVEST
Definition: libofx.h:656
@ OFX_INVEXPENSE
Definition: libofx.h:652
@ OFX_SELLSTOCK
Definition: libofx.h:662
@ OFX_RETOFCAP
Definition: libofx.h:657
@ OFX_BUYSTOCK
Definition: libofx.h:649
@ OFX_BUYOTHER
Definition: libofx.h:648
@ OFX_SELLDEBT
Definition: libofx.h:658
@ OFX_BUYDEBT
Definition: libofx.h:645
@ OFX_INCOME
Definition: libofx.h:651
@ OFX_TRANSFER
Definition: libofx.h:664
@ OFX_SELLMF
Definition: libofx.h:659
@ OFX_SELLOPT
Definition: libofx.h:660
int ofx_INFO_msg
Definition: messages.cpp:38
int ofx_DEBUG_msg
Definition: messages.cpp:31
void ofx_set_security_cb(LibofxContextPtr ctx, LibofxProcSecurityCallback cb, void *user_data)
Definition: context.cpp:207
void ofx_set_statement_cb(LibofxContextPtr ctx, LibofxProcStatementCallback cb, void *user_data)
Definition: context.cpp:225
int ofx_STATUS_msg
Definition: messages.cpp:37
void ofx_set_status_cb(LibofxContextPtr ctx, LibofxProcStatusCallback cb, void *user_data)
Definition: context.cpp:190
int cmdline_parser(int argc, char **argv, struct gengetopt_args_info *args_info)
void cmdline_parser_print_help(void)
void cmdline_parser_free(struct gengetopt_args_info *args_info)
The header file for the command line option parser generated by GNU Gengetopt version 2....
int main(int argc, char *argv[])
Definition: ofxdump.cpp:1143
const char * description
Definition: libofx.h:140
enum LibofxFileFormat format
Definition: libofx.h:138
An abstraction of an account.
Definition: libofx.h:277
char bank_id[OFX_BANKID_LENGTH]
Definition: libofx.h:324
char account_name[OFX_ACCOUNT_NAME_LENGTH]
Definition: libofx.h:297
@ OFX_CREDITCARD
Definition: libofx.h:309
@ OFX_CREDITLINE
Definition: libofx.h:307
@ OFX_INVESTMENT
Definition: libofx.h:310
char account_number[OFX_ACCTID_LENGTH]
Definition: libofx.h:320
char account_id[OFX_ACCOUNT_ID_LENGTH]
Definition: libofx.h:290
char currency[OFX_CURRENCY_LENGTH]
Definition: libofx.h:316
An abstraction of a security position held in an account.
Definition: libofx.h:1162
char currency[OFX_CURRENCY_LENGTH]
Definition: libofx.h:1244
char memo[OFX_MEMO_LENGTH]
Definition: libofx.h:1227
@ OFX_HELDINACCT_OTHER
Definition: libofx.h:1192
@ OFX_HELDINACCT_CASH
Definition: libofx.h:1189
@ OFX_HELDINACCT_MARGIN
Definition: libofx.h:1190
@ OFX_HELDINACCT_SHORT
Definition: libofx.h:1191
struct OfxSecurityData * security_data_ptr
Definition: libofx.h:1258
double units
Definition: libofx.h:1205
char unique_id_type[OFX_UNIQUE_ID_TYPE_LENGTH]
Definition: libofx.h:1181
int amounts_are_foreign_currency
Definition: libofx.h:1254
char account_id[OFX_ACCOUNT_ID_LENGTH]
Definition: libofx.h:1164
double currency_ratio
Definition: libofx.h:1248
time_t date_unit_price
Definition: libofx.h:1217
char unique_id[OFX_UNIQUE_ID_LENGTH]
Definition: libofx.h:1179
double unit_price
Definition: libofx.h:1209
double market_value
Definition: libofx.h:1213
An abstraction of a security, such as a stock, mutual fund, etc.
Definition: libofx.h:359
time_t maturity_date
Definition: libofx.h:562
time_t yield_asof_date
Definition: libofx.h:481
char unique_id[OFX_UNIQUE_ID_LENGTH]
Definition: libofx.h:379
double currency_ratio
Definition: libofx.h:413
char unique_id2[OFX_UNIQUE_ID_LENGTH]
Definition: libofx.h:597
time_t call_date
Definition: libofx.h:544
time_t date_unitprice
Definition: libofx.h:404
double strike_price
Definition: libofx.h:579
char currency[OFX_CURRENCY_LENGTH]
Definition: libofx.h:409
char fiasset_class[OFX_FIASSET_CLASS_LENGTH]
Definition: libofx.h:449
double yield_to_call
Definition: libofx.h:540
char secname[OFX_SECNAME_LENGTH]
Definition: libofx.h:386
int amounts_are_foreign_currency
Definition: libofx.h:419
double yield
Definition: libofx.h:478
char rating[OFX_SECURITY_RATING_LENGTH]
Definition: libofx.h:401
double call_price
Definition: libofx.h:536
char unique_id2_type[OFX_UNIQUE_ID_TYPE_LENGTH]
Definition: libofx.h:602
time_t date_coupon
Definition: libofx.h:521
@ OFX_OTHER_SECURITY
Definition: libofx.h:368
@ OFX_STOCK_SECURITY
Definition: libofx.h:367
@ OFX_DEBT_SECURITY
Definition: libofx.h:364
@ OFX_OPTION_SECURITY
Definition: libofx.h:366
@ OFX_FUND_SECURITY
Definition: libofx.h:365
double yield_to_maturity
Definition: libofx.h:558
time_t date_expire
Definition: libofx.h:583
double par_value
Definition: libofx.h:490
char unique_id_type[OFX_UNIQUE_ID_TYPE_LENGTH]
Definition: libofx.h:382
double unitprice
Definition: libofx.h:397
double shares_per_cont
Definition: libofx.h:587
char memo[OFX_MEMO2_LENGTH]
Definition: libofx.h:422
double coupon_rate
Definition: libofx.h:517
char ticker[OFX_TICKER_LENGTH]
Definition: libofx.h:394
An abstraction of an account statement.
Definition: libofx.h:1058
double margin_balance
Definition: libofx.h:1104
double ledger_balance
Definition: libofx.h:1080
time_t date_asof
Definition: libofx.h:1087
double buying_power
Definition: libofx.h:1112
char currency[OFX_CURRENCY_LENGTH]
Definition: libofx.h:1069
time_t available_balance_date
Definition: libofx.h:1100
time_t ledger_balance_date
Definition: libofx.h:1083
double short_balance
Definition: libofx.h:1108
time_t date_end
Definition: libofx.h:1126
char account_id[OFX_ACCOUNT_ID_LENGTH]
Definition: libofx.h:1072
time_t date_start
Definition: libofx.h:1119
double available_balance
Definition: libofx.h:1095
char marketing_info[OFX_MARKETING_INFO_LENGTH]
Definition: libofx.h:1131
An abstraction of an OFX STATUS element.
Definition: libofx.h:215
int ofx_element_name_valid
Definition: libofx.h:222
char * server_message
Definition: libofx.h:247
const char * description
Definition: libofx.h:230
const char * name
Definition: libofx.h:229
int code_valid
Definition: libofx.h:231
An abstraction of a transaction in an account.
Definition: libofx.h:683
char fi_id[OFX_FITID_LENGTH]
Definition: libofx.h:726
char unique_id_type[OFX_UNIQUE_ID_TYPE_LENGTH]
Definition: libofx.h:740
time_t date_funds_available
Definition: libofx.h:762
int subacct_security_valid
Definition: libofx.h:1003
FiIdCorrectionAction fi_id_correction_action
Definition: libofx.h:775
long int standard_industrial_code
Definition: libofx.h:794
@ OFX_SELLREASON_MATURITY
Definition: libofx.h:970
char currency[OFX_CURRENCY_LENGTH]
Definition: libofx.h:825
char unique_id[OFX_UNIQUE_ID_LENGTH]
Definition: libofx.h:738
char memo[OFX_MEMO2_LENGTH]
Definition: libofx.h:805
int security_data_valid
Definition: libofx.h:745
int amounts_are_foreign_currency
Definition: libofx.h:835
char related_fi_tid[OFX_FITID_LENGTH]
Definition: libofx.h:944
double denominator
Definition: libofx.h:859
char account_id[OFX_ACCOUNT_ID_LENGTH]
Definition: libofx.h:690
time_t date_purchase
Definition: libofx.h:865
double state_withholding
Definition: libofx.h:990
double oldunits
Definition: libofx.h:814
int subacct_funding_valid
Definition: libofx.h:1002
double withholding
Definition: libofx.h:1031
int subacct_from_valid
Definition: libofx.h:1001
double commission
Definition: libofx.h:808
int prior_year_contrib
Definition: libofx.h:940
double numerator
Definition: libofx.h:916
double newunits
Definition: libofx.h:817
char name[OFX_TRANSACTION_NAME_LENGTH]
Definition: libofx.h:801
time_t date_posted
Definition: libofx.h:747
double penalty
Definition: libofx.h:928
double currency_ratio
Definition: libofx.h:829
int transactiontype_valid
Definition: libofx.h:698
time_t date_payroll
Definition: libofx.h:862
char fi_id_corrected[OFX_FITID_LENGTH]
Definition: libofx.h:770
time_t date_initiated
Definition: libofx.h:754
double cash_for_fractional
Definition: libofx.h:871
char loan_id[OFX_LOANID_LENGTH]
Definition: libofx.h:901
double loan_principal
Definition: libofx.h:907
char payee_id[OFX_SVRTID2_LENGTH]
Definition: libofx.h:798
double unitprice
Definition: libofx.h:716
char server_transaction_id[OFX_SVRTID2_LENGTH]
Definition: libofx.h:780
double accrued_interest
Definition: libofx.h:842
double shares_per_cont
Definition: libofx.h:986
double markdown
Definition: libofx.h:910
double loan_interest
Definition: libofx.h:904
char check_number[OFX_CHECK_NUMBER_LENGTH]
Definition: libofx.h:786
char reference_number[OFX_REFERENCE_NUMBER_LENGTH]
Definition: libofx.h:791
double avg_cost_basis
Definition: libofx.h:845
Where the command line options are stored.
int msg_status_flag
Output status messages (default=on).
unsigned int list_import_formats_given
Whether list-import-formats was given.
unsigned inputs_num
unnamed options number
int msg_parser_flag
Output file parsing messages (default=off).
int msg_debug_flag
Output messages meant for debugging (default=off).
char ** inputs
unnamed options (options without names)
int msg_info_flag
Output informational messages about the progress of the library (default=on).
int msg_warning_flag
Output warning messages about abnormal conditions and unknown constructs (default=on).
int msg_error_flag
Output error messages (default=on).
char * import_format_arg
Force the file format of the file(s) specified (default='AUTODETECT').