LibOFX

libofx-0.10.0/inc/libofx.h
Go to the documentation of this file.
1 /*-*-c-*-*******************************************************************
2 libofx.h - Main header file for the libofx API
3 -------------------
4 copyright : (C) 2002-2011 by Benoit Grégoire
5 email : benoitg@coeus.ca
6 ***************************************************************************/
26 /***************************************************************************
27 * *
28 * This program is free software; you can redistribute it and/or modify *
29 * it under the terms of the GNU General Public License as published by *
30 * the Free Software Foundation; either version 2 of the License, or *
31 * (at your option) any later version. *
32 * *
33 ***************************************************************************/
34
35 #ifndef LIBOFX_H
36 #define LIBOFX_H
37 #include <time.h>
38
39 #define LIBOFX_MAJOR_VERSION 0
40 #define LIBOFX_MINOR_VERSION 10
41 #define LIBOFX_MICRO_VERSION 0
42 #define LIBOFX_BUILD_VERSION 0
43 #define LIBOFX_VERSION_RELEASE_STRING "0.10.0"
44
45 #ifdef IN_LIBOFX
46 # include "config.h"
47 # ifdef HAVE_GCC_VISIBILITY_EXTS
48 # pragma GCC visibility push(default)
49 # endif
50 #endif
51
52 #ifdef __cplusplus
53 extern "C" {
54 #else
55 #define true 1
56 #define false 0
57 #endif
58
59 #define OFX_ELEMENT_NAME_LENGTH 100
60 #define OFX_SVRTID2_LENGTH (36 + 1)
61 #define OFX_CHECK_NUMBER_LENGTH (12 + 1)
62 #define OFX_REFERENCE_NUMBER_LENGTH (32 + 1)
63 #define OFX_FITID_LENGTH (255 + 1)
64 #define OFX_TOKEN2_LENGTH (36 + 1)
65 #define OFX_MEMO_LENGTH (255 + 1)
66 #define OFX_FIID_LENGTH (32 + 1)
67 #define OFX_MEMO2_LENGTH (390 + 1)
68 #define OFX_BALANCE_NAME_LENGTH (32 + 1)
69 #define OFX_BALANCE_DESCRIPTION_LENGTH (80 + 1)
70 #define OFX_CURRENCY_LENGTH (3 + 1) /* In ISO-4217 format */
71 #define OFX_BANKID_LENGTH (9 + 1)
72 #define OFX_BRANCHID_LENGTH (22 + 1)
73 #define OFX_ACCTID_LENGTH (22 + 1)
74 #define OFX_ACCTKEY_LENGTH (22 + 1)
75 #define OFX_BROKERID_LENGTH (22 + 1)
76 /* Must be MAX of <BANKID>+<BRANCHID>+<ACCTID>, <ACCTID>+<ACCTKEY> and <ACCTID>+<BROKERID> */
77 #define OFX_ACCOUNT_ID_LENGTH (OFX_BANKID_LENGTH + OFX_BRANCHID_LENGTH + OFX_ACCTID_LENGTH + 1)
78 #define OFX_ACCOUNT_NAME_LENGTH 255
79 #define OFX_MARKETING_INFO_LENGTH (360 + 1)
80 #define OFX_TRANSACTION_NAME_LENGTH (96 + 1)
81 #define OFX_UNIQUE_ID_LENGTH (32 + 1)
82 #define OFX_UNIQUE_ID_TYPE_LENGTH (10 + 1)
83 #define OFX_SECNAME_LENGTH (120 + 1)
84 #define OFX_TICKER_LENGTH (32 + 1)
85 #define OFX_ORG_LENGTH (32 + 1)
86 #define OFX_FID_LENGTH (32 + 1)
87 #define OFX_USERID_LENGTH (32 + 1)
88 #define OFX_USERPASS_LENGTH (32 + 1)
89 #define OFX_URL_LENGTH (500 + 1)
90 #define OFX_APPID_LENGTH (32)
91 #define OFX_APPVER_LENGTH (32)
92 #define OFX_HEADERVERSION_LENGTH (32)
93 #define OFX_CLIENTUID_LENGTH (36 + 1)
94 #define OFX_SECURITY_RATING_LENGTH (32 + 1)
95 #define OFX_FIASSET_CLASS_LENGTH (32 + 1)
96 #define OFX_LOANID_LENGTH (32 + 1)
97
98 /*
99 #define OFX_STATEMENT_CB 0;
100 #define OFX_ACCOUNT_CB 1;
101 #define OFX_TRACSACTION_CB 2;
102 #define OFX_SECURITY_CB 3;
103 #define OFX_STATUS_CB 4;
104 */
105
106 typedef void * LibofxContextPtr;
107
113 LibofxContextPtr libofx_get_new_context();
114
120 int libofx_free_context( LibofxContextPtr );
121
122 void libofx_set_dtd_dir(LibofxContextPtr libofx_context,
123 const char *s);
124
126 enum LibofxFileFormat
127 {
128 AUTODETECT,
129 OFX,
130 OFC,
131 QIF,
132 UNKNOWN,
133 LAST
134 };
135
136 struct LibofxFileFormatInfo
137 {
138 enum LibofxFileFormat format;
139 const char * format_name;
140 const char * description;
141 };
142
143
144 #ifndef OFX_AQUAMANIAC_UGLY_HACK1
145
146 const struct LibofxFileFormatInfo LibofxImportFormatList[] =
147 {
148 {AUTODETECT, "AUTODETECT", "AUTODETECT (File format will be automatically detected later)"},
149 {OFX, "OFX", "OFX (Open Financial eXchange (OFX or QFX))"},
150 {OFC, "OFC", "OFC (Microsoft Open Financial Connectivity)"},
151 {QIF, "QIF", "QIF (Intuit Quicken Interchange Format) NOT IMPLEMENTED"},
152 {LAST, "LAST", "Not a file format, meant as a loop breaking condition"}
153 };
154
155 const struct LibofxFileFormatInfo LibofxExportFormatList[] =
156 {
157 {QIF, "QIF", "QIF (Intuit Quicken Interchange Format) NOT IMPLEMENTED"},
158 {LAST, "LAST", "Not a file format, meant as a loop breaking condition"}
159 };
160
172 enum LibofxFileFormat libofx_get_file_format_from_str(const struct LibofxFileFormatInfo format_list[], const char * file_type_string);
173
185 const char * libofx_get_file_format_description(const struct LibofxFileFormatInfo format_list[], enum LibofxFileFormat file_format);
186
187 #endif
188
197 int libofx_proc_file(LibofxContextPtr libofx_context,
198 const char * p_filename,
199 enum LibofxFileFormat ftype);
200
201
214 struct OfxStatusData
215 {
220 char ofx_element_name[OFX_ELEMENT_NAME_LENGTH];
222 int ofx_element_name_valid;
223
228 int code;
229 const char* name;
230 const char* description;
231 int code_valid;
234 enum Severity
235 {
236 INFO,
237 WARN,
238 ERROR
239 } severity;
240 int severity_valid;
241
247 char* server_message;
249 int server_message_valid;
251 };
252
253
263 typedef int (*LibofxProcStatusCallback)(const struct OfxStatusData data, void * status_data);
264
276 struct OfxAccountData
277 {
278
290 char account_id[OFX_ACCOUNT_ID_LENGTH];
291
297 char account_name[OFX_ACCOUNT_NAME_LENGTH];
298 int account_id_valid;/* Use for both account_id and account_name */
299
302 enum AccountType
303 {
304 OFX_CHECKING,
305 OFX_SAVINGS,
306 OFX_MONEYMRKT,
307 OFX_CREDITLINE,
308 OFX_CMA,
309 OFX_CREDITCARD,
310 OFX_INVESTMENT,
311 OFX_401K
312 } account_type;
313 int account_type_valid;
314
316 char currency[OFX_CURRENCY_LENGTH];
317 int currency_valid;
318
320 char account_number[OFX_ACCTID_LENGTH];
321 int account_number_valid;
322
324 char bank_id[OFX_BANKID_LENGTH];
325 int bank_id_valid;
326
327 char broker_id[OFX_BROKERID_LENGTH];
328 int broker_id_valid;
329
330 char branch_id[OFX_BRANCHID_LENGTH];
331 int branch_id_valid;
332
333 };
334
349 typedef int (*LibofxProcAccountCallback)(const struct OfxAccountData data, void * account_data);
350
358 struct OfxSecurityData
359 {
362 enum SecurityType
363 {
364 OFX_DEBT_SECURITY,
365 OFX_FUND_SECURITY,
366 OFX_OPTION_SECURITY,
367 OFX_STOCK_SECURITY,
368 OFX_OTHER_SECURITY,
369 } security_type;
370 int security_type_valid;
371
379 char unique_id[OFX_UNIQUE_ID_LENGTH];
380 int unique_id_valid;
381
382 char unique_id_type[OFX_UNIQUE_ID_TYPE_LENGTH];
384 int unique_id_type_valid;
385
386 char secname[OFX_SECNAME_LENGTH];
387 int secname_valid;
388
394 char ticker[OFX_TICKER_LENGTH];
395 int ticker_valid;
396
397 double unitprice;
399 int unitprice_valid;
400
401 char rating[OFX_SECURITY_RATING_LENGTH];
402 int rating_valid;
403
404 time_t date_unitprice;
405 int date_unitprice_valid;
406
409 char currency[OFX_CURRENCY_LENGTH];
410 int currency_valid;
411
413 double currency_ratio;
414 int currency_ratio_valid;
415
419 int amounts_are_foreign_currency;
420 int amounts_are_foreign_currency_valid;
421
422 char memo[OFX_MEMO2_LENGTH];
423 int memo_valid;
424
427 char fiid[OFX_FIID_LENGTH];
428 int fiid_valid;
429
436 enum AssetClass
437 {
438 OFX_ASSET_CLASS_DOMESTICBOND,
439 OFX_ASSET_CLASS_INTLBOND,
440 OFX_ASSET_CLASS_LARGESTOCK,
441 OFX_ASSET_CLASS_SMALLSTOCK,
442 OFX_ASSET_CLASS_INTLSTOCK,
443 OFX_ASSET_CLASS_MONEYMRKT,
444 OFX_ASSET_CLASS_OTHER
445 } asset_class;
446 int asset_class_valid;
447
449 char fiasset_class[OFX_FIASSET_CLASS_LENGTH];
450 int fiasset_class_valid;
451
458 enum MutalFundType
459 {
460 OFX_MFTYPE_OPENEND,
461 OFX_MFTYPE_CLOSEEND,
462 OFX_MFTYPE_OTHER
463 } mutual_fund_type;
464 int mutual_fund_type_valid;
465
467 enum StockType
468 {
469 OFX_STOCKTYPE_COMMON,
470 OFX_STOCKTYPE_PREFERRED,
471 OFX_STOCKTYPE_CONVERTIBLE,
472 OFX_STOCKTYPE_OTHER
473 } stock_type;
474 int stock_type_valid;
475
478 double yield;
479 int yield_valid;
480
481 time_t yield_asof_date;
482 int yield_asof_date_valid;
483
490 double par_value;
491 int par_value_valid;
492
494 enum DebtType
495 {
496 OFX_DEBT_TYPE_COUPON,
497 OFX_DEBT_TYPE_ZERO
498 } debt_type;
499 int debt_type_valid;
500
507 enum DebtClass
508 {
509 OFX_DEBTCLASS_TREASURY,
510 OFX_DEBTCLASS_MUNICIPAL,
511 OFX_DEBTCLASS_CORPORATE,
512 OFX_DEBTCLASS_OTHER
513 } debt_class;
514 int debt_class_valid;
515
517 double coupon_rate;
518 int coupon_rate_valid;
519
521 time_t date_coupon;
522 int date_coupon_valid;
523
525 enum CouponFreq
526 {
527 OFX_COUPON_FREQ_MONTHLY,
528 OFX_COUPON_FREQ_QUARTERLY,
529 OFX_COUPON_FREQ_SEMIANNUAL,
530 OFX_COUPON_FREQ_ANNUAL,
531 OFX_COUPON_FREQ_OTHER
532 } coupon_freq;
533 int coupon_freq_valid;
534
536 double call_price;
537 int call_price_valid;
538
540 double yield_to_call;
541 int yield_to_call_valid;
542
544 time_t call_date;
545 int call_date_valid;
546
548 enum CallType
549 {
550 OFX_CALL_TYPE_CALL,
551 OFX_CALL_TYPE_PUT,
552 OFX_CALL_TYPE_PREFUND,
553 OFX_CALL_TYPE_MATURITY
554 } call_type;
555 int call_type_valid;
556
558 double yield_to_maturity;
559 int yield_to_maturity_valid;
560
562 time_t maturity_date;
563 int maturity_date_valid;
564
571 enum OptionType
572 {
573 OFX_OPTION_TYPE_CALL,
574 OFX_OPTION_TYPE_PUT
575 } option_type;
576 int option_type_valid;
577
579 double strike_price;
580 int strike_price_valid;
581
583 time_t date_expire;
584 int date_expire_valid;
585
587 double shares_per_cont;
588 int shares_per_cont_valid;
589
597 char unique_id2[OFX_UNIQUE_ID_LENGTH];
598 int unique_id2_valid;
599
602 char unique_id2_type[OFX_UNIQUE_ID_TYPE_LENGTH];
603 int unique_id2_type_valid;
604
605 };/* end struct OfxSecurityData */
606
620 typedef int (*LibofxProcSecurityCallback)(const struct OfxSecurityData data, void * security_data);
621
622 typedef enum
623 {
624 OFX_CREDIT,
625 OFX_DEBIT,
626 OFX_INT,
627 OFX_DIV,
628 OFX_FEE,
629 OFX_SRVCHG,
630 OFX_DEP,
631 OFX_ATM,
632 OFX_POS,
633 OFX_XFER,
634 OFX_CHECK,
635 OFX_PAYMENT,
636 OFX_CASH,
637 OFX_DIRECTDEP,
638 OFX_DIRECTDEBIT,
639 OFX_REPEATPMT,
640 OFX_OTHER
641 } TransactionType;
642
643 typedef enum
644 {
645 OFX_BUYDEBT,
646 OFX_BUYMF,
647 OFX_BUYOPT,
648 OFX_BUYOTHER,
649 OFX_BUYSTOCK,
650 OFX_CLOSUREOPT,
651 OFX_INCOME,
652 OFX_INVEXPENSE,
653 OFX_JRNLFUND,
654 OFX_JRNLSEC,
655 OFX_MARGININTEREST,
656 OFX_REINVEST,
657 OFX_RETOFCAP,
658 OFX_SELLDEBT,
659 OFX_SELLMF,
660 OFX_SELLOPT,
661 OFX_SELLOTHER,
662 OFX_SELLSTOCK,
663 OFX_SPLIT,
664 OFX_TRANSFER,
665 OFX_INVBANKTRAN
666 } InvTransactionType;
667
668 typedef enum
669 {
670 DELETE,
672 REPLACE
674 } FiIdCorrectionAction;
675
682 struct OfxTransactionData
683 {
684
690 char account_id[OFX_ACCOUNT_ID_LENGTH];
693 struct OfxAccountData * account_ptr;
695 int account_id_valid;
696
697 TransactionType transactiontype;
698 int transactiontype_valid;
699
703 InvTransactionType invtransactiontype;
704 int invtransactiontype_valid;
705
713 double units;
714 int units_valid;
715
716 double unitprice;
718 int unitprice_valid;
719
720 double amount;
724 int amount_valid;
725
726 char fi_id[OFX_FITID_LENGTH];
729 int fi_id_valid;
730
738 char unique_id[OFX_UNIQUE_ID_LENGTH];
739 int unique_id_valid;
740 char unique_id_type[OFX_UNIQUE_ID_TYPE_LENGTH];
742 int unique_id_type_valid;
743
744 struct OfxSecurityData *security_data_ptr;
745 int security_data_valid;
746
747 time_t date_posted;
752 int date_posted_valid;
753
754 time_t date_initiated;
760 int date_initiated_valid;
761
762 time_t date_funds_available;
765 int date_funds_available_valid;
766
770 char fi_id_corrected[OFX_FITID_LENGTH];
771 int fi_id_corrected_valid;
772
775 FiIdCorrectionAction fi_id_correction_action;
776 int fi_id_correction_action_valid;
777
780 char server_transaction_id[OFX_SVRTID2_LENGTH];
781 int server_transaction_id_valid;
782
786 char check_number[OFX_CHECK_NUMBER_LENGTH];
787 int check_number_valid;
788
791 char reference_number[OFX_REFERENCE_NUMBER_LENGTH];
792 int reference_number_valid;
793
794 long int standard_industrial_code;
796 int standard_industrial_code_valid;
797
798 char payee_id[OFX_SVRTID2_LENGTH];
799 int payee_id_valid;
800
801 char name[OFX_TRANSACTION_NAME_LENGTH];
803 int name_valid;
804
805 char memo[OFX_MEMO2_LENGTH];
806 int memo_valid;
807
808 double commission;
809 int commission_valid;
810
811 double fees;
812 int fees_valid;
813
814 double oldunits;
815 int oldunits_valid;
816
817 double newunits;
818 int newunits_valid;
819
821 double market_value;
822 int market_value_valid;
823
825 char currency[OFX_CURRENCY_LENGTH];
826 int currency_valid;
827
829 double currency_ratio;
830 int currency_ratio_valid;
831
835 int amounts_are_foreign_currency;
836 int amounts_are_foreign_currency_valid;
837
842 double accrued_interest;
843 int accrued_interest_valid;
844
845 double avg_cost_basis;
846 int avg_cost_basis_valid;
847
850 enum BuyType
851 {
852 OFX_BUY_TYPE_BUY,
853 OFX_BUY_TYPE_BUYTOCOVER,
854 OFX_BUY_TYPE_BUYTOOPEN,
855 OFX_BUY_TYPE_BUYTOCLOSE
856 } buy_type;
857 int buy_type_valid;
858
859 double denominator;
860 int denominator_valid;
861
862 time_t date_payroll;
863 int date_payroll_valid;
864
865 time_t date_purchase;
866 int date_purchase_valid;
867
868 double gain;
869 int gain_valid;
870
871 double cash_for_fractional;
872 int cash_for_fractional_valid;
873
875 enum IncomeType
876 {
877 OFX_CGLONG,
878 OFX_CGSHORT,
879 OFX_DIVIDEND,
880 OFX_INTEREST,
881 OFX_MISC
882 } income_type;
883 int income_type_valid;
884
886 enum Inv401kSource
887 {
888 OFX_401K_SOURCE_PRETAX,
889 OFX_401K_SOURCE_AFTERTAX,
890 OFX_401K_SOURCE_MATCH,
891 OFX_401K_SOURCE_PROFITSHARING,
892 OFX_401K_SOURCE_ROLLOVER,
893 OFX_401K_SOURCE_OTHERVEST,
894 OFX_401K_SOURCE_OTHERNONVEST
895 } inv_401k_source;
896 int inv_401k_source_valid;
897
898 double load;
899 int load_valid;
900
901 char loan_id[OFX_LOANID_LENGTH];
902 int loan_id_valid;
903
904 double loan_interest;
905 int loan_interest_valid;
906
907 double loan_principal;
908 int loan_principal_valid;
909
910 double markdown;
911 int markdown_valid;
912
913 double markup;
914 int markup_valid;
915
916 double numerator;
917 int numerator_valid;
918
920 enum OptAction
921 {
922 OFX_OPTACTION_EXERCISE,
923 OFX_OPTACTION_ASSIGN,
924 OFX_OPTACTION_EXPIRE
925 } opt_action;
926 int opt_action_valid;
927
928 double penalty;
929 int penalty_valid;
930
932 enum PosType
933 {
934 OFX_POSTYPE_LONG,
935 OFX_POSTYPE_SHORT
936 } pos_type;
937 int pos_type_valid;
938
940 int prior_year_contrib;
941 int prior_year_contrib_valid;
942
944 char related_fi_tid[OFX_FITID_LENGTH];
945 int related_fi_tid_valid;
946
948 enum RelatedType
949 {
950 OFX_RELTYPE_SPREAD,
951 OFX_RELTYPE_STRADDLE,
952 OFX_RELTYPE_NONE,
953 OFX_RELTYPE_OTHER
954 } related_type;
955 int related_type_valid;
956
958 enum OptionSecured
959 {
960 OFX_SECURED_NAKED,
961 OFX_SECURED_COVERED
962 } option_secured;
963 int option_secured_valid;
964
966 enum SellReason
967 {
968 OFX_SELLREASON_CALL,
969 OFX_SELLREASON_SELL,
970 OFX_SELLREASON_MATURITY
971 } sell_reason;
972 int sell_reason_valid;
973
976 enum SellType
977 {
978 OFX_SELL_TYPE_SELL,
979 OFX_SELL_TYPE_SELLSHORT,
980 OFX_SELL_TYPE_SELLTOOPEN,
981 OFX_SELL_TYPE_SELLTOCLOSE
982 } sell_type;
983 int sell_type_valid;
984
986 double shares_per_cont;
987 int shares_per_cont_valid;
988
990 double state_withholding;
991 int state_withholding_valid;
992
994 enum SubAcctType
995 {
996 OFX_SUBACCT_CASH,
997 OFX_SUBACCT_MARGIN,
998 OFX_SUBACCT_SHORT,
999 OFX_SUBACCT_OTHER
1000 } subacct_from, subacct_funding, subacct_security, subacct_to;
1001 int subacct_from_valid;
1002 int subacct_funding_valid;
1003 int subacct_security_valid;
1004 int subacct_to_valid;
1007 double taxes;
1008 int taxes_valid;
1009
1011 int tax_exempt;
1012 int tax_exempt_valid;
1013
1015 enum TransferAction
1016 {
1017 OFX_TFERACTION_IN,
1018 OFX_TFERACTION_OUT
1019 } transfer_action;
1020 int transfer_action_valid;
1021
1023 enum UnitType
1024 {
1025 OFX_UNITTYPE_SHARES,
1026 OFX_UNITTYPE_CURRENCY
1027 } unit_type;
1028 int unit_type_valid;
1029
1031 double withholding;
1032 int withholding_valid;
1033
1034 /*********** NOT YET COMPLETE!!! *********************/
1035 };
1036
1046 typedef int (*LibofxProcTransactionCallback)(const struct OfxTransactionData data, void * transaction_data);
1047
1057 struct OfxStatementData
1058 {
1059
1069 char currency[OFX_CURRENCY_LENGTH];
1070 int currency_valid;
1071
1072 char account_id[OFX_ACCOUNT_ID_LENGTH];
1074 struct OfxAccountData * account_ptr;
1076 int account_id_valid;
1077
1080 double ledger_balance;
1081 int ledger_balance_valid;
1082
1083 time_t ledger_balance_date;
1084 int ledger_balance_date_valid;
1085
1087 time_t date_asof;
1088 int date_asof_valid;
1089
1095 double available_balance;
1098 int available_balance_valid;
1099
1100 time_t available_balance_date;
1101 int available_balance_date_valid;
1102
1104 double margin_balance;
1105 int margin_balance_valid;
1106
1108 double short_balance;
1109 int short_balance_valid;
1110
1112 double buying_power;
1113 int buying_power_valid;
1114
1119 time_t date_start;
1120 int date_start_valid;
1121
1126 time_t date_end;
1127 int date_end_valid;
1128
1131 char marketing_info[OFX_MARKETING_INFO_LENGTH];
1132 int marketing_info_valid;
1133 };
1134
1142 typedef int (*LibofxProcStatementCallback)(const struct OfxStatementData data, void * statement_data);
1143
1147 struct OfxCurrency
1148 {
1149 char currency[OFX_CURRENCY_LENGTH];
1150 double exchange_rate;
1151 int must_convert;
1152 };
1153
1161 struct OfxPositionData
1162 {
1164 char account_id[OFX_ACCOUNT_ID_LENGTH];
1167 struct OfxAccountData * account_ptr;
1169 int account_id_valid;
1170
1179 char unique_id[OFX_UNIQUE_ID_LENGTH];
1180 int unique_id_valid;
1181 char unique_id_type[OFX_UNIQUE_ID_TYPE_LENGTH];
1183 int unique_id_type_valid;
1184
1187 enum HeldInAccountType
1188 {
1189 OFX_HELDINACCT_CASH,
1190 OFX_HELDINACCT_MARGIN,
1191 OFX_HELDINACCT_SHORT,
1192 OFX_HELDINACCT_OTHER
1193 } heldinaccount_type;
1194 int heldinaccount_type_valid;
1195
1197 enum PositionType
1198 {
1199 OFX_POSITION_SHORT,
1200 OFX_POSITION_LONG
1201 } position_type;
1202 int position_type_valid;
1203
1205 double units;
1206 int units_valid;
1207
1209 double unit_price;
1210 int unit_price_valid;
1211
1213 double market_value;
1214 int market_value_valid;
1215
1217 time_t date_unit_price;
1218 int date_unit_price_valid;
1219
1227 char memo[OFX_MEMO_LENGTH];
1228 int memo_valid;
1229
1231 enum Inv401kPosnSource
1232 {
1233 OFX_401K_POSN_SOURCE_PRETAX,
1234 OFX_401K_POSN_SOURCE_AFTERTAX,
1235 OFX_401K_POSN_SOURCE_MATCH,
1236 OFX_401K_POSN_SOURCE_PROFITSHARING,
1237 OFX_401K_POSN_SOURCE_ROLLOVER,
1238 OFX_401K_POSN_SOURCE_OTHERVEST,
1239 OFX_401K_POSN_SOURCE_OTHERNONVEST
1240 } inv_401k_source;
1241 int inv_401k_source_valid;
1242
1244 char currency[OFX_CURRENCY_LENGTH];
1245 int currency_valid;
1246
1248 double currency_ratio;
1249 int currency_ratio_valid;
1250
1254 int amounts_are_foreign_currency;
1255 int amounts_are_foreign_currency_valid;
1256
1258 struct OfxSecurityData *security_data_ptr;
1259 int security_data_valid;
1260
1261 };
1262
1270 typedef int (*LibofxProcPositionCallback)(const struct OfxPositionData data, void * position_data);
1271
1272
1279 void ofx_set_status_cb(LibofxContextPtr ctx,
1280 LibofxProcStatusCallback cb,
1281 void *user_data);
1282
1289 void ofx_set_account_cb(LibofxContextPtr ctx,
1290 LibofxProcAccountCallback cb,
1291 void *user_data);
1292
1299 void ofx_set_security_cb(LibofxContextPtr ctx,
1300 LibofxProcSecurityCallback cb,
1301 void *user_data);
1302
1309 void ofx_set_transaction_cb(LibofxContextPtr ctx,
1310 LibofxProcTransactionCallback cb,
1311 void *user_data);
1312
1319 void ofx_set_statement_cb(LibofxContextPtr ctx,
1320 LibofxProcStatementCallback cb,
1321 void *user_data);
1322
1329 void ofx_set_position_cb(LibofxContextPtr ctx,
1330 LibofxProcPositionCallback cb,
1331 void *user_data);
1332
1333
1337 /*int libofx_proc_buffer(LibofxContextPtr ctx,
1338 const char *s, unsigned int size);*/
1339
1340
1341 /* **************************************** */
1342
1348
1352 struct OfxFiServiceInfo
1353 {
1354 char fid[OFX_FID_LENGTH];
1355 char org[OFX_ORG_LENGTH];
1356 char url[OFX_URL_LENGTH];
1357 int accountlist;
1358 int statements;
1359 int billpay;
1360 int investments;
1361 };
1362
1372 struct OfxFiLogin
1373 {
1374 char fid[OFX_FID_LENGTH];
1375 char org[OFX_ORG_LENGTH];
1376 char userid[OFX_USERID_LENGTH];
1377 char userpass[OFX_USERPASS_LENGTH];
1378 char header_version[OFX_HEADERVERSION_LENGTH];
1379 char appid[OFX_APPID_LENGTH];
1380 char appver[OFX_APPVER_LENGTH];
1381 char clientuid[OFX_CLIENTUID_LENGTH];
1382 };
1383
1384 #define OFX_AMOUNT_LENGTH (32 + 1)
1385 #define OFX_PAYACCT_LENGTH (32 + 1)
1386 #define OFX_STATE_LENGTH (5 + 1)
1387 #define OFX_POSTALCODE_LENGTH (11 + 1)
1388 #define OFX_NAME_LENGTH (32 + 1)
1389
1390 struct OfxPayment
1391 {
1392 char amount[OFX_AMOUNT_LENGTH];
1393 char account[OFX_PAYACCT_LENGTH];
1394 char datedue[9];
1395 char memo[OFX_MEMO_LENGTH];
1396 };
1397
1398 struct OfxPayee
1399 {
1400 char name[OFX_NAME_LENGTH];
1401 char address1[OFX_NAME_LENGTH];
1402 char city[OFX_NAME_LENGTH];
1403 char state[OFX_STATE_LENGTH];
1404 char postalcode[OFX_POSTALCODE_LENGTH];
1405 char phone[OFX_NAME_LENGTH];
1406 };
1407
1419 char* libofx_request_statement( const struct OfxFiLogin* fi, const struct OfxAccountData* account, time_t date_from );
1420
1431 char* libofx_request_accountinfo( const struct OfxFiLogin* login );
1432
1433 char* libofx_request_payment( const struct OfxFiLogin* login, const struct OfxAccountData* account, const struct OfxPayee* payee, const struct OfxPayment* payment );
1434
1435 char* libofx_request_payment_status( const struct OfxFiLogin* login, const char* transactionid );
1436
1438
1439 extern int ofx_PARSER_msg;
1440 extern int ofx_DEBUG_msg;
1441 extern int ofx_DEBUG1_msg;
1442 extern int ofx_DEBUG2_msg;
1443 extern int ofx_DEBUG3_msg;
1444 extern int ofx_DEBUG4_msg;
1445 extern int ofx_DEBUG5_msg;
1446 extern int ofx_STATUS_msg;
1447 extern int ofx_INFO_msg;
1448 extern int ofx_WARNING_msg;
1449 extern int ofx_ERROR_msg;
1450 extern int ofx_show_position;
1452 #ifdef __cplusplus
1453 } // end of extern "C"
1454 #endif
1455
1456 #if defined(HAVE_GCC_VISIBILITY_EXTS) && defined(IN_LIBOFX)
1457 # pragma GCC visibility pop
1458 #endif
1459
1460 #endif // end of LIBOFX_H
OFX_RETOFCAP
Definition: libofx-0.10.0/inc/libofx.h:657
LibofxProcAccountCallback
int(* LibofxProcAccountCallback)(const struct OfxAccountData data, void *account_data)
The callback function for the OfxAccountData stucture.
Definition: libofx-0.10.0/inc/libofx.h:349
OfxAccountData
An abstraction of an account.
Definition: inc/libofx.h:276
OfxPayee
Definition: inc/libofx.h:1398
ofx_STATUS_msg
int ofx_STATUS_msg
Definition: build/libofx-0.10.0/lib/messages.cpp:37
OFX_REPEATPMT
Definition: libofx-0.10.0/inc/libofx.h:639
ofx_PARSER_msg
int ofx_PARSER_msg
Definition: build/libofx-0.10.0/lib/messages.cpp:30
libofx_request_statement
char * libofx_request_statement(const struct OfxFiLogin *fi, const struct OfxAccountData *account, time_t date_from)
Creates an OFX statement request in string form.
libofx_free_context
int libofx_free_context(LibofxContextPtr)
Free all ressources used by this context.
Definition: build/libofx-0.10.0/lib/context.cpp:174
OfxStatusData::Severity
Severity
Definition: inc/libofx.h:234
LibofxFileFormatInfo
Definition: inc/libofx.h:136
LibofxFileFormatInfo::format
enum LibofxFileFormat format
Definition: inc/libofx.h:138
OFX_CASH
Definition: libofx-0.10.0/inc/libofx.h:636
libofx_get_new_context
LibofxContextPtr libofx_get_new_context()
Initialise the library and return a new context.
Definition: build/libofx-0.10.0/lib/context.cpp:169
OFX_INT
Definition: libofx-0.10.0/inc/libofx.h:626
libofx_get_file_format_from_str
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.
Definition: build/libofx-0.10.0/lib/file_preproc.cpp:54
LibofxProcSecurityCallback
int(* LibofxProcSecurityCallback)(const struct OfxSecurityData data, void *security_data)
The callback function for the OfxSecurityData stucture.
Definition: libofx-0.10.0/inc/libofx.h:620
OFX_INVBANKTRAN
Definition: libofx-0.10.0/inc/libofx.h:665
OFX_CREDIT
Definition: libofx-0.10.0/inc/libofx.h:624
INFO
Definition: build/libofx-0.10.0/lib/messages.hh:32
ofx_DEBUG2_msg
int ofx_DEBUG2_msg
Definition: build/libofx-0.10.0/lib/messages.cpp:33
OFX
Definition: libofx-0.10.0/inc/libofx.h:129
OFX_BUYOPT
Definition: libofx-0.10.0/inc/libofx.h:647
OfxPositionData
An abstraction of a security position held in an account.
Definition: inc/libofx.h:1161
ofx_set_account_cb
void ofx_set_account_cb(LibofxContextPtr ctx, LibofxProcAccountCallback cb, void *user_data)
Definition: build/libofx-0.10.0/lib/context.cpp:202
LibofxFileFormatInfo::description
const char * description
Definition: inc/libofx.h:140
OfxTransactionData::OptionSecured
OptionSecured
Definition: inc/libofx.h:958
OfxSecurityData::MutalFundType
MutalFundType
Definition: inc/libofx.h:458
libofx_proc_file
int libofx_proc_file(LibofxContextPtr libofx_context, const char *p_filename, enum LibofxFileFormat ftype)
libofx_proc_file is the entry point of the library.
Definition: build/libofx-0.10.0/lib/file_preproc.cpp:67
OfxAccountData::currency
char currency[OFX_CURRENCY_LENGTH]
Definition: inc/libofx.h:316
ofx_DEBUG1_msg
int ofx_DEBUG1_msg
Definition: build/libofx-0.10.0/lib/messages.cpp:32
ofx_show_position
int ofx_show_position
Definition: build/libofx-0.10.0/lib/messages.cpp:41
LibofxProcTransactionCallback
int(* LibofxProcTransactionCallback)(const struct OfxTransactionData data, void *transaction_data)
The callback function for the OfxTransactionData stucture.
Definition: libofx-0.10.0/inc/libofx.h:1046
OFX_INVEXPENSE
Definition: libofx-0.10.0/inc/libofx.h:652
OFX_DEBIT
Definition: libofx-0.10.0/inc/libofx.h:625
OFX_FEE
Definition: libofx-0.10.0/inc/libofx.h:628
LibofxProcStatementCallback
int(* LibofxProcStatementCallback)(const struct OfxStatementData data, void *statement_data)
The callback function for the OfxStatementData stucture.
Definition: libofx-0.10.0/inc/libofx.h:1142
OfxTransactionData::UnitType
UnitType
Definition: inc/libofx.h:1023
OfxSecurityData::DebtClass
DebtClass
Definition: inc/libofx.h:507
OfxTransactionData::TransferAction
TransferAction
Definition: inc/libofx.h:1015
ofx_WARNING_msg
int ofx_WARNING_msg
Definition: build/libofx-0.10.0/lib/messages.cpp:39
ofx_INFO_msg
int ofx_INFO_msg
Definition: build/libofx-0.10.0/lib/messages.cpp:38
OfxSecurityData::currency
char currency[OFX_CURRENCY_LENGTH]
Definition: inc/libofx.h:409
OFX_ATM
Definition: libofx-0.10.0/inc/libofx.h:631
OfxSecurityData::StockType
StockType
Definition: inc/libofx.h:467
OFX_CHECK
Definition: libofx-0.10.0/inc/libofx.h:634
OfxPositionData::Inv401kPosnSource
Inv401kPosnSource
Definition: inc/libofx.h:1231
OfxTransactionData::BuyType
BuyType
Definition: inc/libofx.h:850
OfxPayment
Definition: inc/libofx.h:1390
OfxSecurityData::currency_ratio
double currency_ratio
Definition: inc/libofx.h:413
LAST
Definition: libofx-0.10.0/inc/libofx.h:133
OfxTransactionData::SellReason
SellReason
Definition: inc/libofx.h:966
ofx_set_status_cb
void ofx_set_status_cb(LibofxContextPtr ctx, LibofxProcStatusCallback cb, void *user_data)
Definition: build/libofx-0.10.0/lib/context.cpp:194
OFX_XFER
Definition: libofx-0.10.0/inc/libofx.h:633
OfxSecurityData::memo
char memo[OFX_MEMO2_LENGTH]
Definition: inc/libofx.h:422
OFX_POS
Definition: libofx-0.10.0/inc/libofx.h:632
OFX_JRNLFUND
Definition: libofx-0.10.0/inc/libofx.h:653
OFX_MARGININTEREST
Definition: libofx-0.10.0/inc/libofx.h:655
OFX_SELLDEBT
Definition: libofx-0.10.0/inc/libofx.h:658
libofx_get_file_format_description
const char * libofx_get_file_format_description(const struct LibofxFileFormatInfo format_list[], enum LibofxFileFormat file_format)
get_file_format_description returns a string description of a LibofxFileType.
Definition: build/libofx-0.10.0/lib/file_preproc.cpp:37
OFX_SPLIT
Definition: libofx-0.10.0/inc/libofx.h:663
ofx_ERROR_msg
int ofx_ERROR_msg
Definition: build/libofx-0.10.0/lib/messages.cpp:40
OFX_BUYSTOCK
Definition: libofx-0.10.0/inc/libofx.h:649
OFX_JRNLSEC
Definition: libofx-0.10.0/inc/libofx.h:654
ofx_set_position_cb
void ofx_set_position_cb(LibofxContextPtr ctx, LibofxProcPositionCallback cb, void *user_data)
Definition: build/libofx-0.10.0/lib/context.cpp:237
OFX_TRANSFER
Definition: libofx-0.10.0/inc/libofx.h:664
ofx_set_statement_cb
void ofx_set_statement_cb(LibofxContextPtr ctx, LibofxProcStatementCallback cb, void *user_data)
Definition: build/libofx-0.10.0/lib/context.cpp:229
TransactionType
TransactionType
Definition: libofx-0.10.0/inc/libofx.h:622
OfxSecurityData::CallType
CallType
Definition: inc/libofx.h:548
ofx_DEBUG3_msg
int ofx_DEBUG3_msg
Definition: build/libofx-0.10.0/lib/messages.cpp:34
REPLACE
Definition: libofx-0.10.0/inc/libofx.h:672
OfxTransactionData::IncomeType
IncomeType
Definition: inc/libofx.h:875
InvTransactionType
InvTransactionType
Definition: libofx-0.10.0/inc/libofx.h:643
OFX_INCOME
Definition: libofx-0.10.0/inc/libofx.h:651
OFX_SRVCHG
Definition: libofx-0.10.0/inc/libofx.h:629
ofx_DEBUG4_msg
int ofx_DEBUG4_msg
Definition: build/libofx-0.10.0/lib/messages.cpp:35
OfxSecurityData::shares_per_cont
double shares_per_cont
Definition: inc/libofx.h:587
OfxTransactionData::RelatedType
RelatedType
Definition: inc/libofx.h:948
OfxAccountData::AccountType
AccountType
Definition: inc/libofx.h:302
OFX_CLOSUREOPT
Definition: libofx-0.10.0/inc/libofx.h:650
OFX_PAYMENT
Definition: libofx-0.10.0/inc/libofx.h:635
UNKNOWN
Definition: libofx-0.10.0/inc/libofx.h:132
OfxTransactionData::PosType
PosType
Definition: inc/libofx.h:932
OfxSecurityData::SecurityType
SecurityType
Definition: inc/libofx.h:362
OfxStatusData
An abstraction of an OFX STATUS element.
Definition: inc/libofx.h:214
OfxTransactionData::SellType
SellType
Definition: inc/libofx.h:976
OfxSecurityData::DebtType
DebtType
Definition: inc/libofx.h:494
OFX_OTHER
Definition: libofx-0.10.0/inc/libofx.h:640
OfxSecurityData::amounts_are_foreign_currency
int amounts_are_foreign_currency
Definition: inc/libofx.h:419
FiIdCorrectionAction
FiIdCorrectionAction
Definition: libofx-0.10.0/inc/libofx.h:668
OFX_DEP
Definition: libofx-0.10.0/inc/libofx.h:630
ofx_DEBUG5_msg
int ofx_DEBUG5_msg
Definition: build/libofx-0.10.0/lib/messages.cpp:36
LibofxProcStatusCallback
int(* LibofxProcStatusCallback)(const struct OfxStatusData data, void *status_data)
The callback function for the OfxStatusData stucture.
Definition: libofx-0.10.0/inc/libofx.h:263
OfxTransactionData::OptAction
OptAction
Definition: inc/libofx.h:920
OfxPositionData::PositionType
PositionType
Definition: inc/libofx.h:1197
LibofxFileFormatInfo::format_name
const char * format_name
Definition: inc/libofx.h:139
DELETE
Definition: libofx-0.10.0/inc/libofx.h:670
OFX_BUYDEBT
Definition: libofx-0.10.0/inc/libofx.h:645
OfxFiServiceInfo
Information returned by the OFX Partner Server about a financial institution.
Definition: inc/libofx.h:1352
OFX_DIV
Definition: libofx-0.10.0/inc/libofx.h:627
ofx_set_security_cb
void ofx_set_security_cb(LibofxContextPtr ctx, LibofxProcSecurityCallback cb, void *user_data)
Definition: build/libofx-0.10.0/lib/context.cpp:211
OfxSecurityData
An abstraction of a security, such as a stock, mutual fund, etc.
Definition: inc/libofx.h:358
LibofxProcPositionCallback
int(* LibofxProcPositionCallback)(const struct OfxPositionData data, void *position_data)
The callback function for the OfxPositionData stucture.
Definition: libofx-0.10.0/inc/libofx.h:1270
OfxSecurityData::OptionType
OptionType
Definition: inc/libofx.h:571
OFX_SELLMF
Definition: libofx-0.10.0/inc/libofx.h:659
AUTODETECT
Definition: libofx-0.10.0/inc/libofx.h:128
ofx_set_transaction_cb
void ofx_set_transaction_cb(LibofxContextPtr ctx, LibofxProcTransactionCallback cb, void *user_data)
Definition: build/libofx-0.10.0/lib/context.cpp:220
OfxTransactionData
An abstraction of a transaction in an account.
Definition: inc/libofx.h:682
OfxPositionData::HeldInAccountType
HeldInAccountType
Definition: inc/libofx.h:1187
OfxCurrency
NOT YET SUPPORTED.
Definition: inc/libofx.h:1147
LibofxFileFormat
LibofxFileFormat
Definition: inc/libofx.h:126
OFX_BUYMF
Definition: libofx-0.10.0/inc/libofx.h:646
ERROR
Definition: build/libofx-0.10.0/lib/messages.hh:34
OFX_SELLOPT
Definition: libofx-0.10.0/inc/libofx.h:660
OFX_BUYOTHER
Definition: libofx-0.10.0/inc/libofx.h:648
OfxSecurityData::CouponFreq
CouponFreq
Definition: inc/libofx.h:525
OfxSecurityData::AssetClass
AssetClass
Definition: inc/libofx.h:436
OFX_REINVEST
Definition: libofx-0.10.0/inc/libofx.h:656
OFX_SELLSTOCK
Definition: libofx-0.10.0/inc/libofx.h:662
OFX_SELLOTHER
Definition: libofx-0.10.0/inc/libofx.h:661
OFX_DIRECTDEP
Definition: libofx-0.10.0/inc/libofx.h:637
OfxTransactionData::Inv401kSource
Inv401kSource
Definition: inc/libofx.h:886
OFC
Definition: libofx-0.10.0/inc/libofx.h:130
OfxStatementData
An abstraction of an account statement.
Definition: inc/libofx.h:1057
OfxTransactionData::SubAcctType
SubAcctType
Definition: inc/libofx.h:994
libofx_request_accountinfo
char * libofx_request_accountinfo(const struct OfxFiLogin *login)
Creates an OFX account info (list) request in string form.
QIF
Definition: libofx-0.10.0/inc/libofx.h:131
OFX_DIRECTDEBIT
Definition: libofx-0.10.0/inc/libofx.h:638
ofx_DEBUG_msg
int ofx_DEBUG_msg
Definition: build/libofx-0.10.0/lib/messages.cpp:31
OfxFiLogin
Information sufficient to log into an financial institution.
Definition: inc/libofx.h:1372