Main Page | Class Hierarchy | Data Structures | File List | Data Fields | Globals

libofx.h File Reference


Detailed Description

Main header file containing the LibOfx API.

This file should be included for all applications who use this API. This header file will work with both C and C++ programs. The entire API is made of the following structures and functions.

All of the following ofx_proc_* functions are callbacks (Except ofx_proc_file which is the entry point). They must be implemented by your program, but can be left empty if not needed. They are called each time the associated structure is filled by the library.

Important note: The variables associated with every data element have a _valid companion. Always check that data_valid == true before using. Not only will you ensure that the data is meaningfull, but also that pointers are valid and strings point to a null terminated string. Elements listed as mandatory are for information purpose only, do not trust the bank not to send you non-conforming data...

Definition in file inc/libofx.h.

Go to the source code of this file.

Data Structures

struct  LibofxFileFormatInfo
struct  OfxStatusData
 An abstraction of an OFX STATUS element. More...

struct  OfxAccountData
 An abstraction of an account. More...

struct  OfxSecurityData
 An abstraction of a security, such as a stock, mutual fund, etc. More...

struct  OfxTransactionData
 An abstraction of a transaction in an account. More...

struct  OfxStatementData
 An abstraction of an account statement. More...

struct  OfxCurrency
 NOT YET SUPPORTED. More...


Defines

#define CFCT
#define true   1
#define false   0
#define OFX_ELEMENT_NAME_LENGTH   100
#define OFX_SVRTID2_LENGTH   36 + 1
#define OFX_CHECK_NUMBER_LENGTH   12 + 1
#define OFX_REFERENCE_NUMBER_LENGTH   32 + 1
#define OFX_FITID_LENGTH   255 + 1
#define OFX_TOKEN2_LENGTH   36 + 1
#define OFX_MEMO2_LENGTH   390 + 1
#define OFX_BALANCE_NAME_LENGTH   32 + 1
#define OFX_BALANCE_DESCRIPTION_LENGTH   80 + 1
#define OFX_CURRENCY_LENGTH   3 + 1 /* In ISO-4217 format */
#define OFX_BANKID_LENGTH   9
#define OFX_BRANCHID_LENGTH   22 + 1
#define OFX_ACCTID_LENGTH   22 + 1
#define OFX_ACCTKEY_LENGTH   22 + 1
#define OFX_BROKERID_LENGTH   22 + 1
#define OFX_ACCOUNT_ID_LENGTH   OFX_BANKID_LENGTH + OFX_BRANCHID_LENGTH + OFX_ACCTID_LENGTH + 1
#define OFX_ACCOUNT_NAME_LENGTH   255
#define OFX_MARKETING_INFO_LENGTH   360 + 1
#define OFX_TRANSACTION_NAME_LENGTH   32 + 1
#define OFX_UNIQUE_ID_LENGTH   32 + 1
#define OFX_UNIQUE_ID_TYPE_LENGTH   10 + 1
#define OFX_SECNAME_LENGTH   32 + 1
#define OFX_TICKER_LENGTH   32 + 1

Typedefs

typedef void * LibofxContextPtr

Enumerations

enum  LibofxFileFormat {
  AUTODETECT, OFX, OFC, QIF,
  UNKNOWN, LAST
}
enum  TransactionType {
  OFX_CREDIT, OFX_DEBIT, OFX_INT, OFX_DIV,
  OFX_FEE, OFX_SRVCHG, OFX_DEP, OFX_ATM,
  OFX_POS, OFX_XFER, OFX_CHECK, OFX_PAYMENT,
  OFX_CASH, OFX_DIRECTDEP, OFX_DIRECTDEBIT, OFX_REPEATPMT,
  OFX_OTHER
}
enum  InvTransactionType {
  OFX_BUYDEBT, OFX_BUYMF, OFX_BUYOPT, OFX_BUYOTHER,
  OFX_BUYSTOCK, OFX_CLOSUREOPT, OFX_INCOME, OFX_INVEXPENSE,
  OFX_JRNLFUND, OFX_JRNLSEC, OFX_MARGININTEREST, OFX_REINVEST,
  OFX_RETOFCAP, OFX_SELLDEBT, OFX_SELLMF, OFX_SELLOPT,
  OFX_SELLOTHER, OFX_SELLSTOCK, OFX_SPLIT, OFX_TRANSFER
}
enum  FiIdCorrectionAction { DELETE, REPLACE }

Functions

CFCT LibofxContextPtr libofx_get_new_context ()
 Initialise the library and return a new context.

CFCT int libofx_free_context (LibofxContextPtr)
 Free all ressources used by this context.

CFCT enum LibofxFileFormat libofx_get_file_format_from_str (const struct LibofxFileFormatInfo format_list[], const char *file_type_string)
CFCT const char * libofx_get_file_format_description (const struct LibofxFileFormatInfo format_list[], enum LibofxFileFormat file_format)
CFCT int libofx_proc_file (LibofxContextPtr libofx_context, const char *p_filename, enum LibofxFileFormat ftype)
 libofx_proc_file is the entry point of the library.

CFCT void ofx_set_status_cb (LibofxContextPtr ctx, LibofxProcStatusCallback cb, void *user_data)
CFCT void ofx_set_account_cb (LibofxContextPtr ctx, LibofxProcAccountCallback cb, void *user_data)
CFCT void ofx_set_security_cb (LibofxContextPtr ctx, LibofxProcSecurityCallback cb, void *user_data)
CFCT void ofx_set_transaction_cb (LibofxContextPtr ctx, LibofxProcTransactionCallback cb, void *user_data)
CFCT void ofx_set_statement_cb (LibofxContextPtr ctx, LibofxProcStatementCallback cb, void *user_data)
CFCT int libofx_proc_buffer (LibofxContextPtr ctx, const char *s, unsigned int size)

Variables

const struct LibofxFileFormatInfo LibofxImportFormatList []
const struct LibofxFileFormatInfo LibofxExportFormatList []
CFCT typedef int(* LibofxProcStatusCallback )(const struct OfxStatusData data, void *status_data)
 The callback function for the OfxStatusData stucture.

CFCT typedef int(* LibofxProcAccountCallback )(const struct OfxAccountData data, void *account_data)
 The callback function for the OfxAccountData stucture.

CFCT typedef int(* LibofxProcSecurityCallback )(const struct OfxSecurityData data, void *security_data)
 The callback function for the OfxSecurityData stucture.

CFCT typedef int(* LibofxProcTransactionCallback )(const struct OfxTransactionData data, void *transaction_data)
 The callback function for the OfxTransactionData stucture.

CFCT typedef int(* LibofxProcStatementCallback )(const struct OfxStatementData data, void *statement_data)
 The callback function for the OfxStatementData stucture.


Enumeration Type Documentation

enum FiIdCorrectionAction
 

Enumeration values:
DELETE  The transaction with a fi_id matching fi_id_corrected should be deleted
REPLACE  The transaction with a fi_id matching fi_id_corrected should be replaced with this one

Definition at line 367 of file inc/libofx.h.

enum InvTransactionType
 

Enumeration values:
OFX_BUYDEBT  Buy debt security
OFX_BUYMF  Buy mutual fund
OFX_BUYOPT  Buy option
OFX_BUYOTHER  Buy other security type
OFX_BUYSTOCK  Buy stock
OFX_CLOSUREOPT  Close a position for an option
OFX_INCOME  Investment income is realized as cash into the investment account
OFX_INVEXPENSE  Misc investment expense that is associated with a specific security
OFX_JRNLFUND  Journaling cash holdings between subaccounts within the same investment account
OFX_JRNLSEC  Journaling security holdings between subaccounts within the same investment account
OFX_MARGININTEREST  Margin interest expense
OFX_REINVEST  Reinvestment of income
OFX_RETOFCAP  Return of capital
OFX_SELLDEBT  Sell debt security. Used when debt is sold,ottom>< + 1
#define OFX_UNIQUE_ID_TYPE_LENGTH   10 + 1
#define OFX_SECNAME_LENGTH   32 + 1
#define OFX_TICKER_LENGTH   32 + 1

Typedefs

typedef void * LibofxContextPtr

Enumerations

enum  LibofxFileFormat {
  AUTODETECT, OFX, OFC, QIF,
  UNKNOWN, LAST
}
enum  TransactionType {
  OFX_CREDIT, OFX_DEBIT, OFX_INT, OFX_DIV,
  OFX_FEE, OFX_SRVCHG, OFX_DEP, OFX_ATM,
  OFX_POS, OFX_XFER, OFX_CHECK, OFX_PAYMENT,
  OFX_CASH, OFX_DIRECTDEP, OFX_DIRECTDEBIT, OFX_REPEATPMT,
  OFX_OTHER
}
enum  InvTransactionType {
  OFX_BUYDEBT, OFX_BUYMF, OFX_BUYOPT, OFX_BUYOTHER,
  OFX_BUYSTOCK, OFX_CLOSUREOPT, OFX_INCOME, OFX_INVEXPENSE,
  OFX_JRNLFUND, OFX_JRNLSEC, OFX_MARGININTEREST, OFX_REINVEST,
  OFX_RETOFCAP, OFX_SELLDEBT, OFX_SELLMF, OFX_SELLOPT,
  OFX_SELLOTHER, OFX_SELLSTOCK, OFX_SPLIT, OFX_TRANSFER
}
enum  FiIdCorrectionAction { DELETE, REPLACE }

Functions

CFCT LibofxContextPtr libofx_get_new_context ()
 Initialise the library and return a new context.

CFCT int libofx_free_context (LibofxContextPtr)
 Free all ressources used by this context.

CFCT enum LibofxFileFormat libofx_get_file_format_from_str (const struct LibofxFileFormatInfo format_list[], const char *file_type_string)
CFCT const char * libofx_get_file_format_description (const struct LibofxFileFormatInfo format_list[], enum LibofxFileFormat file_format)
CFCT int libofx_proc_file (LibofxContextPtr libofx_context, const char *p_filename, enum LibofxFileFormat ftype)
 libofx_proc_file is the entry point of the library.

CFCT void ofx_set_status_cb (LibofxContextPtr ctx, LibofxProcStatusCallback cb, void *user_data)
CFCT void ofx_set_account_cb (LibofxContextPtr ctx, LibofxProcAccountCallback cb, void *user_data)
CFCT void ofx_set_security_cb (LibofxContextPtr ctx, LibofxProcSecurityCallback cb, void *user_data)
CFCT void ofx_set_transaction_cb (LibofxContextPtr ctx, LibofxProcTransactionCallback cb, void *user_data)
CFCT void ofx_set_statement_cb (LibofxContextPtr ctx, LibofxProcStatementCallback cb, void *user_data)
CFCT int libofx_proc_buffer (LibofxContextPtr ctx, const char *s, unsigned int size)

Variables

const struct LibofxFileFormatInfo LibofxImportFormatList []
const struct LibofxFileFormatInfo LibofxExportFormatList []
CFCT typedef int(* LibofxProcStatusCallback )(const struct OfxStatusData data, void *status_data)
 The callback function for the OfxStatusData stucture.

CFCT typedef int(* LibofxProcAccountCallback )(const struct OfxAccountData data, void *account_data)
 The callback function for the OfxAccountData stucture.

CFCT typedef int(* LibofxProcSecurityCallback )(const struct OfxSecurityData data, void *security_data)
 The callback function for the OfxSecurityData stucture.

CFCT typedef int(* LibofxProcTransactionCallback )(const struct OfxTransactionData data, void *transaction_data)
 The callback function for the OfxTransactionData stucture.

CFCT typedef int(* LibofxProcStatementCallback )(const struct OfxStatementData data, void *statement_data)
 The callback function for the OfxStatementData stucture.


Enumeration Type Documentation

enum FiIdCorrectionAction
 

Enumeration values:
DELETE  The transaction with a fi_id matching fi_id_corrected should be deleted
REPLACE  The transaction with a fi_id matching fi_id_corrected should be replaced with this one

Definition at line 367 of file inc/libofx.h.

enum InvTransactionType
 

Enumeration values:
OFX_BUYDEBT  Buy debt security
OFX_BUYMF  Buy mutual fund
OFX_BUYOPT  Buy option
OFX_BUYOTHER  Buy other security type
OFX_BUYSTOCK  Buy stock
OFX_CLOSUREOPT  Close a position for an option
OFX_INCOME  Investment income is realized as cash into the investment account
OFX_INVEXPENSE  Misc investment expense that is associated with a specific security
OFX_JRNLFUND  Journaling cash holdings between subaccounts within the same investment account
OFX_JRNLSEC  Journaling security holdings between subaccounts within the same investment account
OFX_MARGININTEREST  Margin interest expense
OFX_REINVEST  Reinvestment of income
OFX_RETOFCAP  Return of capital
OFX_SELLDEBT  Sell debt security. Used when debt is sold,ottom>< + 1
#define OFX_UNIQUE_ID_TYPE_LENGTH   10 + 1
#define OFX_SECNAME_LENGTH   32 + 1
#define OFX_TICKER_LENGTH   32 + 1

Typedefs

typedef void * LibofxContextPtr

Enumerations

enum  LibofxFileFormat {
  AUTODETECT, OFX, OFC, QIF,
  UNKNOWN, LAST
}
enum  TransactionType {
  OFX_CREDIT, OFX_DEBIT, OFX_INT, OFX_DIV,
  OFX_FEE, OFX_SRVCHG, OFX_DEP, OFX_ATM,
  OFX_POS, OFX_XFER, OFX_CHECK, OFX_PAYMENT,
  OFX_CASH, OFX_DIRECTDEP, OFX_DIRECTDEBIT, OFX_REPEATPMT,
  OFX_OTHER
}
enum  InvTransactionType {
  OFX_BUYDEBT, OFX_BUYMF, OFX_BUYOPT, OFX_BUYOTHER,
  OFX_BUYSTOCK, OFX_CLOSUREOPT, OFX_INCOME, OFX_INVEXPENSE,
  OFX_JRNLFUND, OFX_JRNLSEC, OFX_MARGININTEREST, OFX_REINVEST,
  OFX_RETOFCAP, OFX_SELLDEBT, OFX_SELLMF, OFX_SELLOPT,
  OFX_SELLOTHER, OFX_SELLSTOCK, OFX_SPLIT, OFX_TRANSFER
}
enum  FiIdCorrectionAction { DELETE, REPLACE }

Functions

CFCT LibofxContextPtr libofx_get_new_context ()
 Initialise the library and return a new context.

CFCT int libofx_free_context (LibofxContextPtr)
 Free all ressources used by this context.

CFCT enum LibofxFileFormat libofx_get_file_format_from_str (const struct LibofxFileFormatInfo format_list[], const char *file_type_string)
CFCT const char * libofx_get_file_format_description (const struct LibofxFileFormatInfo format_list[], enum LibofxFileFormat file_format)
CFCT int libofx_proc_file (LibofxContextPtr libofx_context, const char *p_filename, enum LibofxFileFormat ftype)
 libofx_proc_file is the entry point of the library.

CFCT void ofx_set_status_cb (LibofxContextPtr ctx, LibofxProcStatusCallback cb, void *user_data)
CFCT void ofx_set_account_cb (LibofxContextPtr ctx, LibofxProcAccountCallback cb, void *user_data)
CFCT void ofx_set_security_cb (LibofxContextPtr ctx, LibofxProcSecurityCallback cb, void *user_data)
CFCT void ofx_set_transaction_cb (LibofxContextPtr ctx, LibofxProcTransactionCallback cb, void *user_data)
CFCT void ofx_set_statement_cb (LibofxContextPtr ctx, LibofxProcStatementCallback cb, void *user_data)
CFCT int libofx_proc_buffer (LibofxContextPtr ctx, const char *s, unsigned int size)

Variables

const struct LibofxFileFormatInfo LibofxImportFormatList []
const struct LibofxFileFormatInfo LibofxExportFormatList []
CFCT typedef int(* LibofxProcStatusCallback )(const struct OfxStatusData data, void *status_data)
 The callback function for the OfxStatusData stucture.

CFCT typedef int(* LibofxProcAccountCallback )(const struct OfxAccountData data, void *account_data)
 The callback function for the OfxAccountData stucture.

CFCT typedef int(* LibofxProcSecurityCallback )(const struct OfxSecurityData data, void *security_data)
 The callback function for the OfxSecurityData stucture.

CFCT typedef int(* LibofxProcTransactionCallback )(const struct OfxTransactionData data, void *transaction_data)
 The callback function for the OfxTransactionData stucture.

CFCT typedef int(* LibofxProcStatementCallback )(const struct OfxStatementData data, void *statement_data)
 The callback function for the OfxStatementData stucture.


Enumeration Type Documentation

enum FiIdCorrectionAction
 

Enumeration values:
DELETE  The transaction with a fi_id matching fi_id_corrected should be deleted
REPLACE  The transaction with a fi_id matching fi_id_corrected should be replaced with this one

Definition at line 367 of file inc/libofx.h.

enum InvTransactionType
 

Enumeration values:
OFX_BUYDEBT  Buy debt security
OFX_BUYMF  Buy mutual fund
OFX_BUYOPT  Buy option
OFX_BUYOTHER  Buy other security type
OFX_BUYSTOCK  Buy stock
OFX_CLOSUREOPT  Close a position for an option
OFX_INCOME  Investment income is realized as cash into the investment account
OFX_INVEXPENSE  Misc investment expense that is associated with a specific security
OFX_JRNLFUND  Journaling cash holdings between subaccounts within the same investment account
OFX_JRNLSEC  Journaling security holdings between subaccou