39 #define LIBOFX_MAJOR_VERSION 0
40 #define LIBOFX_MINOR_VERSION 10
41 #define LIBOFX_MICRO_VERSION 5
42 #define LIBOFX_BUILD_VERSION 0
43 #define LIBOFX_VERSION_RELEASE_STRING "0.10.5"
47 # ifdef HAVE_GCC_VISIBILITY_EXTS
48 # pragma GCC visibility push(default)
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)
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)
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)
106 typedef void * LibofxContextPtr;
122 void libofx_set_dtd_dir(LibofxContextPtr libofx_context,
144 #ifndef OFX_AQUAMANIAC_UGLY_HACK1
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"}
157 {
QIF,
"QIF",
"QIF (Intuit Quicken Interchange Format) NOT IMPLEMENTED"},
158 {
LAST,
"LAST",
"Not a file format, meant as a loop breaking condition"}
198 const char * p_filename,
220 char ofx_element_name[OFX_ELEMENT_NAME_LENGTH];
249 int server_message_valid;
298 int account_id_valid;
313 int account_type_valid;
321 int account_number_valid;
327 char broker_id[OFX_BROKERID_LENGTH];
330 char branch_id[OFX_BRANCHID_LENGTH];
370 int security_type_valid;
384 int unique_id_type_valid;
405 int date_unitprice_valid;
414 int currency_ratio_valid;
420 int amounts_are_foreign_currency_valid;
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
446 int asset_class_valid;
450 int fiasset_class_valid;
464 int mutual_fund_type_valid;
469 OFX_STOCKTYPE_COMMON,
470 OFX_STOCKTYPE_PREFERRED,
471 OFX_STOCKTYPE_CONVERTIBLE,
474 int stock_type_valid;
482 int yield_asof_date_valid;
496 OFX_DEBT_TYPE_COUPON,
509 OFX_DEBTCLASS_TREASURY,
510 OFX_DEBTCLASS_MUNICIPAL,
511 OFX_DEBTCLASS_CORPORATE,
514 int debt_class_valid;
518 int coupon_rate_valid;
522 int date_coupon_valid;
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
533 int coupon_freq_valid;
537 int call_price_valid;
541 int yield_to_call_valid;
552 OFX_CALL_TYPE_PREFUND,
553 OFX_CALL_TYPE_MATURITY
559 int yield_to_maturity_valid;
563 int maturity_date_valid;
573 OFX_OPTION_TYPE_CALL,
576 int option_type_valid;
580 int strike_price_valid;
584 int date_expire_valid;
588 int shares_per_cont_valid;
598 int unique_id2_valid;
603 int unique_id2_type_valid;
695 int account_id_valid;
704 int invtransactiontype_valid;
742 int unique_id_type_valid;
752 int date_posted_valid;
760 int date_initiated_valid;
765 int date_funds_available_valid;
771 int fi_id_corrected_valid;
776 int fi_id_correction_action_valid;
781 int server_transaction_id_valid;
787 int check_number_valid;
792 int reference_number_valid;
796 int standard_industrial_code_valid;
801 char name[OFX_TRANSACTION_NAME_LENGTH];
809 int commission_valid;
822 int market_value_valid;
830 int currency_ratio_valid;
836 int amounts_are_foreign_currency_valid;
843 int accrued_interest_valid;
846 int avg_cost_basis_valid;
853 OFX_BUY_TYPE_BUYTOCOVER,
854 OFX_BUY_TYPE_BUYTOOPEN,
855 OFX_BUY_TYPE_BUYTOCLOSE
860 int denominator_valid;
863 int date_payroll_valid;
866 int date_purchase_valid;
872 int cash_for_fractional_valid;
883 int income_type_valid;
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
896 int inv_401k_source_valid;
905 int loan_interest_valid;
908 int loan_principal_valid;
922 OFX_OPTACTION_EXERCISE,
923 OFX_OPTACTION_ASSIGN,
926 int opt_action_valid;
941 int prior_year_contrib_valid;
945 int related_fi_tid_valid;
951 OFX_RELTYPE_STRADDLE,
955 int related_type_valid;
963 int option_secured_valid;
972 int sell_reason_valid;
979 OFX_SELL_TYPE_SELLSHORT,
980 OFX_SELL_TYPE_SELLTOOPEN,
981 OFX_SELL_TYPE_SELLTOCLOSE
987 int shares_per_cont_valid;
991 int state_withholding_valid;
1000 } subacct_from, subacct_funding, subacct_security, subacct_to;
1012 int tax_exempt_valid;
1020 int transfer_action_valid;
1025 OFX_UNITTYPE_SHARES,
1026 OFX_UNITTYPE_CURRENCY
1028 int unit_type_valid;
1032 int withholding_valid;
1076 int account_id_valid;
1081 int ledger_balance_valid;
1084 int ledger_balance_date_valid;
1088 int date_asof_valid;
1098 int available_balance_valid;
1101 int available_balance_date_valid;
1105 int margin_balance_valid;
1109 int short_balance_valid;
1113 int buying_power_valid;
1120 int date_start_valid;
1132 int marketing_info_valid;
1169 int account_id_valid;
1180 int unique_id_valid;
1183 int unique_id_type_valid;
1193 } heldinaccount_type;
1194 int heldinaccount_type_valid;
1202 int position_type_valid;
1210 int unit_price_valid;
1214 int market_value_valid;
1218 int date_unit_price_valid;
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
1241 int inv_401k_source_valid;
1249 int currency_ratio_valid;
1255 int amounts_are_foreign_currency_valid;
1259 int security_data_valid;
1354 char fid[OFX_FID_LENGTH];
1355 char org[OFX_ORG_LENGTH];
1356 char url[OFX_URL_LENGTH];
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];
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)
1392 char amount[OFX_AMOUNT_LENGTH];
1393 char account[OFX_PAYACCT_LENGTH];
1395 char memo[OFX_MEMO_LENGTH];
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];
1435 char* libofx_request_payment_status(
const struct OfxFiLogin* login,
const char* transactionid );
1456 #if defined(HAVE_GCC_VISIBILITY_EXTS) && defined(IN_LIBOFX)
1457 # pragma GCC visibility pop
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.
int(* LibofxProcTransactionCallback)(const struct OfxTransactionData data, void *transaction_data)
The callback function for the OfxTransactionData structure.
void ofx_set_transaction_cb(LibofxContextPtr ctx, LibofxProcTransactionCallback cb, void *user_data)
LibofxContextPtr libofx_get_new_context()
Initialise the library and return a new context.
void ofx_set_account_cb(LibofxContextPtr ctx, LibofxProcAccountCallback cb, void *user_data)
int libofx_free_context(LibofxContextPtr)
Free all resources used by this context.
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(* LibofxProcAccountCallback)(const struct OfxAccountData data, void *account_data)
The callback function for the OfxAccountData structure.
int(* LibofxProcPositionCallback)(const struct OfxPositionData data, void *position_data)
The callback function for the OfxPositionData structure.
int libofx_proc_file(LibofxContextPtr libofx_context, const char *p_filename, enum LibofxFileFormat ftype)
libofx_proc_file is the entry point of the library.
int(* LibofxProcStatementCallback)(const struct OfxStatementData data, void *statement_data)
The callback function for the OfxStatementData structure.
void ofx_set_position_cb(LibofxContextPtr ctx, LibofxProcPositionCallback cb, void *user_data)
char * libofx_request_accountinfo(const struct OfxFiLogin *login)
Creates an OFX account info (list) request in string form.
char * libofx_request_statement(const struct OfxFiLogin *fi, const struct OfxAccountData *account, time_t date_from)
Creates an OFX statement request in string form.
int(* LibofxProcSecurityCallback)(const struct OfxSecurityData data, void *security_data)
The callback function for the OfxSecurityData structure.
int(* LibofxProcStatusCallback)(const struct OfxStatusData data, void *status_data)
The callback function for the OfxStatusData structure.
void ofx_set_security_cb(LibofxContextPtr ctx, LibofxProcSecurityCallback cb, void *user_data)
void ofx_set_statement_cb(LibofxContextPtr ctx, LibofxProcStatementCallback cb, void *user_data)
void ofx_set_status_cb(LibofxContextPtr ctx, LibofxProcStatusCallback cb, void *user_data)
An abstraction of an account.
char bank_id[OFX_BANKID_LENGTH]
char account_name[OFX_ACCOUNT_NAME_LENGTH]
char account_number[OFX_ACCTID_LENGTH]
char account_id[OFX_ACCOUNT_ID_LENGTH]
char currency[OFX_CURRENCY_LENGTH]
char currency[OFX_CURRENCY_LENGTH]
Information sufficient to log into an financial institution.
Information returned by the OFX Partner Server about a financial institution.
An abstraction of a security position held in an account.
char currency[OFX_CURRENCY_LENGTH]
char memo[OFX_MEMO_LENGTH]
struct OfxSecurityData * security_data_ptr
struct OfxAccountData * account_ptr
char unique_id_type[OFX_UNIQUE_ID_TYPE_LENGTH]
int amounts_are_foreign_currency
char account_id[OFX_ACCOUNT_ID_LENGTH]
char unique_id[OFX_UNIQUE_ID_LENGTH]
An abstraction of a security, such as a stock, mutual fund, etc.
char unique_id[OFX_UNIQUE_ID_LENGTH]
char fiid[OFX_FIID_LENGTH]
char unique_id2[OFX_UNIQUE_ID_LENGTH]
char currency[OFX_CURRENCY_LENGTH]
char fiasset_class[OFX_FIASSET_CLASS_LENGTH]
char secname[OFX_SECNAME_LENGTH]
int amounts_are_foreign_currency
char rating[OFX_SECURITY_RATING_LENGTH]
char unique_id2_type[OFX_UNIQUE_ID_TYPE_LENGTH]
char unique_id_type[OFX_UNIQUE_ID_TYPE_LENGTH]
char memo[OFX_MEMO2_LENGTH]
char ticker[OFX_TICKER_LENGTH]
An abstraction of an account statement.
char currency[OFX_CURRENCY_LENGTH]
time_t available_balance_date
time_t ledger_balance_date
struct OfxAccountData * account_ptr
char account_id[OFX_ACCOUNT_ID_LENGTH]
char marketing_info[OFX_MARKETING_INFO_LENGTH]
An abstraction of an OFX STATUS element.
int ofx_element_name_valid
An abstraction of a transaction in an account.
char fi_id[OFX_FITID_LENGTH]
char unique_id_type[OFX_UNIQUE_ID_TYPE_LENGTH]
time_t date_funds_available
int subacct_security_valid
FiIdCorrectionAction fi_id_correction_action
long int standard_industrial_code
@ OFX_SELLREASON_MATURITY
char currency[OFX_CURRENCY_LENGTH]
char unique_id[OFX_UNIQUE_ID_LENGTH]
char memo[OFX_MEMO2_LENGTH]
int amounts_are_foreign_currency
char related_fi_tid[OFX_FITID_LENGTH]
char account_id[OFX_ACCOUNT_ID_LENGTH]
int subacct_funding_valid
char name[OFX_TRANSACTION_NAME_LENGTH]
int transactiontype_valid
char fi_id_corrected[OFX_FITID_LENGTH]
double cash_for_fractional
char loan_id[OFX_LOANID_LENGTH]
char payee_id[OFX_SVRTID2_LENGTH]
char server_transaction_id[OFX_SVRTID2_LENGTH]
char check_number[OFX_CHECK_NUMBER_LENGTH]
char reference_number[OFX_REFERENCE_NUMBER_LENGTH]
struct OfxAccountData * account_ptr