LibOFX
|
An abstraction of a transaction in an account. More...
Data Fields | |
OFX mandatory elements | |
The OFX spec defines the following elements as mandatory. The associated variables should all contain valid data but you should not trust the servers. Check if the associated *_valid is true before using them. | |
char | account_id [OFX_ACCOUNT_ID_LENGTH] |
struct OfxAccountData * | account_ptr |
int | account_id_valid |
TransactionType | transactiontype |
int | transactiontype_valid |
InvTransactionType | invtransactiontype |
int | invtransactiontype_valid |
double | units |
int | units_valid |
double | unitprice |
int | unitprice_valid |
double | amount |
int | amount_valid |
char | fi_id [OFX_FITID_LENGTH] |
int | fi_id_valid |
OFX optional elements | |
The OFX spec defines the following elements as optional. If the associated *_valid is true, the corresponding element is present and the associated variable contains valid data. | |
char | unique_id [OFX_UNIQUE_ID_LENGTH] |
int | unique_id_valid |
char | unique_id_type [OFX_UNIQUE_ID_TYPE_LENGTH] |
int | unique_id_type_valid |
struct OfxSecurityData * | security_data_ptr |
int | security_data_valid |
time_t | date_posted |
int | date_posted_valid |
time_t | date_initiated |
int | date_initiated_valid |
time_t | date_funds_available |
int | date_funds_available_valid |
char | fi_id_corrected [OFX_FITID_LENGTH] |
int | fi_id_corrected_valid |
FiIdCorrectionAction | fi_id_correction_action |
int | fi_id_correction_action_valid |
char | server_transaction_id [OFX_SVRTID2_LENGTH] |
int | server_transaction_id_valid |
char | check_number [OFX_CHECK_NUMBER_LENGTH] |
int | check_number_valid |
char | reference_number [OFX_REFERENCE_NUMBER_LENGTH] |
int | reference_number_valid |
long int | standard_industrial_code |
int | standard_industrial_code_valid |
char | payee_id [OFX_SVRTID2_LENGTH] |
int | payee_id_valid |
char | name [OFX_TRANSACTION_NAME_LENGTH] |
int | name_valid |
char | memo [OFX_MEMO2_LENGTH] |
int | memo_valid |
double | commission |
int | commission_valid |
double | fees |
int | fees_valid |
double | oldunits |
int | oldunits_valid |
double | newunits |
int | newunits_valid |
double | market_value |
int | market_value_valid |
char | currency [OFX_CURRENCY_LENGTH] |
int | currency_valid |
double | currency_ratio |
int | currency_ratio_valid |
int | amounts_are_foreign_currency |
int | amounts_are_foreign_currency_valid |
Other OFX elements for investment transactions | |
OFX spec 2.1.1 section 13.9.2.4.2 elements that are not already defined. | |
enum | BuyType { OFX_BUY_TYPE_BUY, OFX_BUY_TYPE_BUYTOCOVER, OFX_BUY_TYPE_BUYTOOPEN, OFX_BUY_TYPE_BUYTOCLOSE, OFX_BUY_TYPE_BUY, OFX_BUY_TYPE_BUYTOCOVER, OFX_BUY_TYPE_BUYTOOPEN, OFX_BUY_TYPE_BUYTOCLOSE } |
enum | IncomeType { OFX_CGLONG, OFX_CGSHORT, OFX_DIVIDEND, OFX_INTEREST, OFX_MISC, OFX_CGLONG, OFX_CGSHORT, OFX_DIVIDEND, OFX_INTEREST, OFX_MISC } |
enum | Inv401kSource { OFX_401K_SOURCE_PRETAX, OFX_401K_SOURCE_AFTERTAX, OFX_401K_SOURCE_MATCH, OFX_401K_SOURCE_PROFITSHARING, OFX_401K_SOURCE_ROLLOVER, OFX_401K_SOURCE_OTHERVEST, OFX_401K_SOURCE_OTHERNONVEST, OFX_401K_SOURCE_PRETAX, OFX_401K_SOURCE_AFTERTAX, OFX_401K_SOURCE_MATCH, OFX_401K_SOURCE_PROFITSHARING, OFX_401K_SOURCE_ROLLOVER, OFX_401K_SOURCE_OTHERVEST, OFX_401K_SOURCE_OTHERNONVEST } |
enum | OptAction { OFX_OPTACTION_EXERCISE, OFX_OPTACTION_ASSIGN, OFX_OPTACTION_EXPIRE, OFX_OPTACTION_EXERCISE, OFX_OPTACTION_ASSIGN, OFX_OPTACTION_EXPIRE } |
enum | PosType { OFX_POSTYPE_LONG, OFX_POSTYPE_SHORT, OFX_POSTYPE_LONG, OFX_POSTYPE_SHORT } |
enum | RelatedType { OFX_RELTYPE_SPREAD, OFX_RELTYPE_STRADDLE, OFX_RELTYPE_NONE, OFX_RELTYPE_OTHER, OFX_RELTYPE_SPREAD, OFX_RELTYPE_STRADDLE, OFX_RELTYPE_NONE, OFX_RELTYPE_OTHER } |
enum | OptionSecured { OFX_SECURED_NAKED, OFX_SECURED_COVERED, OFX_SECURED_NAKED, OFX_SECURED_COVERED } |
enum | SellReason { OFX_SELLREASON_CALL, OFX_SELLREASON_SELL, OFX_SELLREASON_MATURITY, OFX_SELLREASON_CALL, OFX_SELLREASON_SELL, OFX_SELLREASON_MATURITY } |
enum | SellType { OFX_SELL_TYPE_SELL, OFX_SELL_TYPE_SELLSHORT, OFX_SELL_TYPE_SELLTOOPEN, OFX_SELL_TYPE_SELLTOCLOSE, OFX_SELL_TYPE_SELL, OFX_SELL_TYPE_SELLSHORT, OFX_SELL_TYPE_SELLTOOPEN, OFX_SELL_TYPE_SELLTOCLOSE } |
enum | SubAcctType { OFX_SUBACCT_CASH, OFX_SUBACCT_MARGIN, OFX_SUBACCT_SHORT, OFX_SUBACCT_OTHER, OFX_SUBACCT_CASH, OFX_SUBACCT_MARGIN, OFX_SUBACCT_SHORT, OFX_SUBACCT_OTHER } |
enum | TransferAction { OFX_TFERACTION_IN, OFX_TFERACTION_OUT, OFX_TFERACTION_IN, OFX_TFERACTION_OUT } |
enum | UnitType { OFX_UNITTYPE_SHARES, OFX_UNITTYPE_CURRENCY, OFX_UNITTYPE_SHARES, OFX_UNITTYPE_CURRENCY } |
enum | BuyType { OFX_BUY_TYPE_BUY, OFX_BUY_TYPE_BUYTOCOVER, OFX_BUY_TYPE_BUYTOOPEN, OFX_BUY_TYPE_BUYTOCLOSE, OFX_BUY_TYPE_BUY, OFX_BUY_TYPE_BUYTOCOVER, OFX_BUY_TYPE_BUYTOOPEN, OFX_BUY_TYPE_BUYTOCLOSE } |
enum | IncomeType { OFX_CGLONG, OFX_CGSHORT, OFX_DIVIDEND, OFX_INTEREST, OFX_MISC, OFX_CGLONG, OFX_CGSHORT, OFX_DIVIDEND, OFX_INTEREST, OFX_MISC } |
enum | Inv401kSource { OFX_401K_SOURCE_PRETAX, OFX_401K_SOURCE_AFTERTAX, OFX_401K_SOURCE_MATCH, OFX_401K_SOURCE_PROFITSHARING, OFX_401K_SOURCE_ROLLOVER, OFX_401K_SOURCE_OTHERVEST, OFX_401K_SOURCE_OTHERNONVEST, OFX_401K_SOURCE_PRETAX, OFX_401K_SOURCE_AFTERTAX, OFX_401K_SOURCE_MATCH, OFX_401K_SOURCE_PROFITSHARING, OFX_401K_SOURCE_ROLLOVER, OFX_401K_SOURCE_OTHERVEST, OFX_401K_SOURCE_OTHERNONVEST } |
enum | OptAction { OFX_OPTACTION_EXERCISE, OFX_OPTACTION_ASSIGN, OFX_OPTACTION_EXPIRE, OFX_OPTACTION_EXERCISE, OFX_OPTACTION_ASSIGN, OFX_OPTACTION_EXPIRE } |
enum | PosType { OFX_POSTYPE_LONG, OFX_POSTYPE_SHORT, OFX_POSTYPE_LONG, OFX_POSTYPE_SHORT } |
enum | RelatedType { OFX_RELTYPE_SPREAD, OFX_RELTYPE_STRADDLE, OFX_RELTYPE_NONE, OFX_RELTYPE_OTHER, OFX_RELTYPE_SPREAD, OFX_RELTYPE_STRADDLE, OFX_RELTYPE_NONE, OFX_RELTYPE_OTHER } |
enum | OptionSecured { OFX_SECURED_NAKED, OFX_SECURED_COVERED, OFX_SECURED_NAKED, OFX_SECURED_COVERED } |
enum | SellReason { OFX_SELLREASON_CALL, OFX_SELLREASON_SELL, OFX_SELLREASON_MATURITY, OFX_SELLREASON_CALL, OFX_SELLREASON_SELL, OFX_SELLREASON_MATURITY } |
enum | SellType { OFX_SELL_TYPE_SELL, OFX_SELL_TYPE_SELLSHORT, OFX_SELL_TYPE_SELLTOOPEN, OFX_SELL_TYPE_SELLTOCLOSE, OFX_SELL_TYPE_SELL, OFX_SELL_TYPE_SELLSHORT, OFX_SELL_TYPE_SELLTOOPEN, OFX_SELL_TYPE_SELLTOCLOSE } |
enum | SubAcctType { OFX_SUBACCT_CASH, OFX_SUBACCT_MARGIN, OFX_SUBACCT_SHORT, OFX_SUBACCT_OTHER, OFX_SUBACCT_CASH, OFX_SUBACCT_MARGIN, OFX_SUBACCT_SHORT, OFX_SUBACCT_OTHER } |
enum | TransferAction { OFX_TFERACTION_IN, OFX_TFERACTION_OUT, OFX_TFERACTION_IN, OFX_TFERACTION_OUT } |
enum | UnitType { OFX_UNITTYPE_SHARES, OFX_UNITTYPE_CURRENCY, OFX_UNITTYPE_SHARES, OFX_UNITTYPE_CURRENCY } |
double | accrued_interest |
int | accrued_interest_valid |
double | avg_cost_basis |
int | avg_cost_basis_valid |
enum OfxTransactionData::BuyType | buy_type |
int | buy_type_valid |
double | denominator |
int | denominator_valid |
time_t | date_payroll |
int | date_payroll_valid |
time_t | date_purchase |
int | date_purchase_valid |
double | gain |
int | gain_valid |
double | cash_for_fractional |
int | cash_for_fractional_valid |
enum OfxTransactionData::IncomeType | income_type |
int | income_type_valid |
enum OfxTransactionData::Inv401kSource | inv_401k_source |
int | inv_401k_source_valid |
double | load |
int | load_valid |
char | loan_id [OFX_LOANID_LENGTH] |
int | loan_id_valid |
double | loan_interest |
int | loan_interest_valid |
double | loan_principal |
int | loan_principal_valid |
double | markdown |
int | markdown_valid |
double | markup |
int | markup_valid |
double | numerator |
int | numerator_valid |
enum OfxTransactionData::OptAction | opt_action |
int | opt_action_valid |
double | penalty |
int | penalty_valid |
enum OfxTransactionData::PosType | pos_type |
int | pos_type_valid |
int | prior_year_contrib |
int | prior_year_contrib_valid |
char | related_fi_tid [OFX_FITID_LENGTH] |
int | related_fi_tid_valid |
enum OfxTransactionData::RelatedType | related_type |
int | related_type_valid |
enum OfxTransactionData::OptionSecured | option_secured |
int | option_secured_valid |
enum OfxTransactionData::SellReason | sell_reason |
int | sell_reason_valid |
enum OfxTransactionData::SellType | sell_type |
int | sell_type_valid |
double | shares_per_cont |
int | shares_per_cont_valid |
double | state_withholding |
int | state_withholding_valid |
enum OfxTransactionData::SubAcctType | subacct_from |
enum OfxTransactionData::SubAcctType | subacct_funding |
enum OfxTransactionData::SubAcctType | subacct_security |
enum OfxTransactionData::SubAcctType | subacct_to |
int | subacct_from_valid |
int | subacct_funding_valid |
int | subacct_security_valid |
int | subacct_to_valid |
double | taxes |
int | taxes_valid |
int | tax_exempt |
int | tax_exempt_valid |
enum OfxTransactionData::TransferAction | transfer_action |
int | transfer_action_valid |
enum OfxTransactionData::UnitType | unit_type |
int | unit_type_valid |
double | withholding |
int | withholding_valid |
An abstraction of a transaction in an account.
The OfxTransactionData stucture contains all available information about an actual transaction in an account.
Definition at line 682 of file inc/libofx.h.
The <BUYTYPE> element is mandatory for stock, fund, and option buys This enum combines stock, fund, and option buy types into one field
Definition at line 850 of file inc/libofx.h.
The <BUYTYPE> element is mandatory for stock, fund, and option buys This enum combines stock, fund, and option buy types into one field
Definition at line 850 of file libofx-0.10.0/inc/libofx.h.
Type of income for <INCOME> element
Definition at line 875 of file inc/libofx.h.
Type of income for <INCOME> element
Definition at line 875 of file libofx-0.10.0/inc/libofx.h.
<INV401KSOURCE> For 401(k) accounts, source of the money used for this security
Definition at line 886 of file inc/libofx.h.
<INV401KSOURCE> For 401(k) accounts, source of the money used for this security
Definition at line 886 of file libofx-0.10.0/inc/libofx.h.
For options, the action type
Definition at line 920 of file inc/libofx.h.
For options, the action type
Definition at line 920 of file libofx-0.10.0/inc/libofx.h.
How an option is securred
Definition at line 958 of file libofx-0.10.0/inc/libofx.h.
How an option is securred
Definition at line 958 of file inc/libofx.h.
Position type
Definition at line 932 of file libofx-0.10.0/inc/libofx.h.
Position type
Definition at line 932 of file inc/libofx.h.
Related option transaction type
Definition at line 948 of file libofx-0.10.0/inc/libofx.h.
Related option transaction type
Definition at line 948 of file inc/libofx.h.
Reason for the sell of a debt security
Definition at line 966 of file inc/libofx.h.
Reason for the sell of a debt security
Definition at line 966 of file libofx-0.10.0/inc/libofx.h.
The <SELLTYPE> element is mandatory for stock, fund, and option sells This enum combines stock, fund, and option sell types into one field
Definition at line 976 of file inc/libofx.h.
The <SELLTYPE> element is mandatory for stock, fund, and option sells This enum combines stock, fund, and option sell types into one field
Definition at line 976 of file libofx-0.10.0/inc/libofx.h.
Account types used for <SUBACCTFROM>, <SUBACCTFUND>, <SUBACCTSEC>, <SUBACCTTO>
Definition at line 994 of file inc/libofx.h.
Account types used for <SUBACCTFROM>, <SUBACCTFUND>, <SUBACCTSEC>, <SUBACCTTO>
Definition at line 994 of file libofx-0.10.0/inc/libofx.h.
Action for transfers
Definition at line 1015 of file inc/libofx.h.
Action for transfers
Definition at line 1015 of file libofx-0.10.0/inc/libofx.h.
Type of the units
Definition at line 1023 of file inc/libofx.h.
Type of the units
Definition at line 1023 of file libofx-0.10.0/inc/libofx.h.
char OfxTransactionData::account_id |
Use this for matching with the relevant account in your application
Definition at line 690 of file inc/libofx.h.
struct OfxAccountData * OfxTransactionData::account_ptr |
Pointer to the full account structure, see OfxAccountData
Definition at line 693 of file inc/libofx.h.
double OfxTransactionData::accrued_interest |
Accrued interest when trading debt
Definition at line 842 of file inc/libofx.h.
double OfxTransactionData::amount |
Total monetary amount of the transaction, signage will determine if money went in or out. amount is the total amount: -(units) * unitprice - various fees
Definition at line 720 of file inc/libofx.h.
int OfxTransactionData::amounts_are_foreign_currency |
Whether the amounts have already been converted to the default currency. An <ORIGCURRENCY> sets the flag to true, i.e. the amounts are reported in the foreign currency. A <CURRENCY> element sets the flag to false.
Definition at line 835 of file inc/libofx.h.
double OfxTransactionData::avg_cost_basis |
Average cost basis
Definition at line 845 of file inc/libofx.h.
double OfxTransactionData::cash_for_fractional |
Cash for fractional units (for stock splits)
Definition at line 871 of file inc/libofx.h.
char OfxTransactionData::check_number |
The check number is most likely an integer and can probably be converted properly with atoi(). However the spec allows for up to 12 digits, so it is not garanteed to work
Definition at line 786 of file inc/libofx.h.
double OfxTransactionData::commission |
Commission paid to broker (investment transactions only)
Definition at line 808 of file inc/libofx.h.
char OfxTransactionData::currency |
<CURSYM> The currency is a string in ISO-4217 format
Definition at line 825 of file inc/libofx.h.
double OfxTransactionData::currency_ratio |
ratio of <CURDEF> currency to <CURSYM> currency
Definition at line 829 of file inc/libofx.h.
time_t OfxTransactionData::date_funds_available |
Date the funds are available (not always provided) (ex: the date you are allowed to withdraw a deposit
Definition at line 762 of file inc/libofx.h.
time_t OfxTransactionData::date_initiated |
Date the transaction was initiated (ex: date you bought something in a store for credit card; trade date for stocks; day of record for stock split)
Mandatory for investment transactions
Definition at line 754 of file inc/libofx.h.
time_t OfxTransactionData::date_payroll |
For 401(k) accounts, date the funds were deducted from payroll
Definition at line 862 of file inc/libofx.h.
time_t OfxTransactionData::date_posted |
Date the transaction took effect (ex: date it appeared on your credit card bill). Setlement date; for stock split, execution date.
Mandatory for bank and credit card transactions
Definition at line 747 of file inc/libofx.h.
time_t OfxTransactionData::date_purchase |
The security's original purchase date
Definition at line 865 of file inc/libofx.h.
double OfxTransactionData::denominator |
For stock splits, split ratio denominator
Definition at line 859 of file inc/libofx.h.
double OfxTransactionData::fees |
Fees applied to trade (investment transactions only)
Definition at line 811 of file inc/libofx.h.
char OfxTransactionData::fi_id |
Generated by the financial institution (fi), unique id of the transaction, to be used to detect duplicate downloads
Definition at line 726 of file inc/libofx.h.
char OfxTransactionData::fi_id_corrected |
IMPORTANT: if fi_id_corrected is present, this transaction is meant to replace or delete the transaction with this fi_id. See OfxTransactionData::fi_id_correction_action to know what to do.
Definition at line 770 of file inc/libofx.h.
FiIdCorrectionAction OfxTransactionData::fi_id_correction_action |
The OfxTransactionData::FiIdCorrectionAction enum contains the action to be taken
Definition at line 775 of file inc/libofx.h.
double OfxTransactionData::gain |
For sales, the total gain
Definition at line 868 of file inc/libofx.h.
double OfxTransactionData::load |
load on the transaction (amount)
Definition at line 898 of file inc/libofx.h.
char OfxTransactionData::loan_id |
401(k): indicates the transaction is due to a loan or loan repayment
Definition at line 901 of file inc/libofx.h.
double OfxTransactionData::loan_interest |
401(k): how much of the load repayment was interest (amount)
Definition at line 904 of file inc/libofx.h.
double OfxTransactionData::loan_principal |
401(k): how much of the load repayment was principal (amount)
Definition at line 907 of file inc/libofx.h.
double OfxTransactionData::markdown |
Portion of the unit price attributed to dealer markdown (unitprice)
Definition at line 910 of file inc/libofx.h.
double OfxTransactionData::market_value |
Market value, should be UNITS*UNITPRICE
Definition at line 821 of file inc/libofx.h.
double OfxTransactionData::markup |
Portion of the unit price attributed to dealer markup (unitprice)
Definition at line 913 of file inc/libofx.h.
char OfxTransactionData::memo |
Extra information not included in name
Definition at line 805 of file inc/libofx.h.
char OfxTransactionData::name |
Can be the name of the payee or the description of the transaction
Definition at line 801 of file inc/libofx.h.
double OfxTransactionData::newunits |
Number of units held after stock split
Definition at line 817 of file inc/libofx.h.
double OfxTransactionData::numerator |
For stock splits, split ratio numerator
Definition at line 916 of file inc/libofx.h.
double OfxTransactionData::oldunits |
Number of units held before stock split
Definition at line 814 of file inc/libofx.h.
char OfxTransactionData::payee_id |
The identifier of the payee
Definition at line 798 of file inc/libofx.h.
double OfxTransactionData::penalty |
Amount withheld due to a penalty
Definition at line 928 of file inc/libofx.h.
int OfxTransactionData::prior_year_contrib |
401(k): whether this buy was made with prior year contribution
Definition at line 940 of file inc/libofx.h.
char OfxTransactionData::reference_number |
Might present in addition to or instead of a check_number. Not necessarily a number
Definition at line 791 of file inc/libofx.h.
char OfxTransactionData::related_fi_tid |
ID of related trade
Definition at line 944 of file inc/libofx.h.
int OfxTransactionData::security_data_valid |
A pointer to the security's data.
Definition at line 745 of file inc/libofx.h.
char OfxTransactionData::server_transaction_id |
Used for user initiated transaction such as payment or funds transfer. Can be seen as a confirmation number.
Definition at line 780 of file inc/libofx.h.
double OfxTransactionData::shares_per_cont |
For options, shares per contract
Definition at line 986 of file inc/libofx.h.
long int OfxTransactionData::standard_industrial_code |
The standard industrial code can have at most 6 digits
Definition at line 794 of file inc/libofx.h.
double OfxTransactionData::state_withholding |
Used for withholding state taxes on a withdrawal
Definition at line 990 of file inc/libofx.h.
int OfxTransactionData::subacct_from_valid |
acct the security or cash is being transferred from
Definition at line 1001 of file inc/libofx.h.
int OfxTransactionData::subacct_funding_valid |
acct the cash for the transaction came from
Definition at line 1002 of file inc/libofx.h.
int OfxTransactionData::subacct_security_valid |
acct for the security
Definition at line 1003 of file inc/libofx.h.
int OfxTransactionData::subacct_to_valid |
acct the security or cash is being transferred to
Definition at line 1004 of file inc/libofx.h.
int OfxTransactionData::tax_exempt |
Tax exempt transaction
Definition at line 1011 of file inc/libofx.h.
double OfxTransactionData::taxes |
Taxes on the trade
Definition at line 1007 of file inc/libofx.h.
int OfxTransactionData::transactiontype_valid |
Investment transaction type. You should read this if transactiontype == OFX_OTHER. See OFX spec 1.6 p.442 to 445 for details
Definition at line 698 of file inc/libofx.h.
char OfxTransactionData::unique_id |
The id of the security being traded. Mandatory for investment transactions
Definition at line 738 of file inc/libofx.h.
char OfxTransactionData::unique_id_type |
Usially "CUSIP" for FIs in north america
Definition at line 740 of file inc/libofx.h.
double OfxTransactionData::unitprice |
Value of each unit, 1.00 if the commodity is money
Definition at line 716 of file inc/libofx.h.
double OfxTransactionData::units |
Variation of the number of units of the commodity
Suppose units is -10, ave unitprice is 1. If the commodity is stock, you have 10 less stock, but 10 more dollars in you amccount (fees not considered, see amount). If commodity is money, you have 10 less dollars in your pocket, but 10 more in your account
Definition at line 713 of file inc/libofx.h.
double OfxTransactionData::withholding |
Federal tax withholding
Definition at line 1031 of file inc/libofx.h.