LibOFX
OfxPositionData Struct Reference

An abstraction of a security position held in an account. More...

#include <libofx.h>

Data Fields

char account_id [OFX_ACCOUNT_ID_LENGTH]
 
struct OfxAccountDataaccount_ptr
 
int account_id_valid
 

OFX mandatory <INVPOS> 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.

enum  HeldInAccountType { OFX_HELDINACCT_CASH , OFX_HELDINACCT_MARGIN , OFX_HELDINACCT_SHORT , OFX_HELDINACCT_OTHER }
 
enum  PositionType { OFX_POSITION_SHORT , OFX_POSITION_LONG }
 
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
 
enum OfxPositionData::HeldInAccountType heldinaccount_type
 
int heldinaccount_type_valid
 
enum OfxPositionData::PositionType position_type
 
int position_type_valid
 
double units
 
int units_valid
 
double unit_price
 
int unit_price_valid
 
double market_value
 
int market_value_valid
 
time_t date_unit_price
 
int date_unit_price_valid
 

OFX optional <INVPOS> elements

The OFX spec defines the following elements as optional. The associated variables may contain valid data. Check if the associated *_valid is true before using them.

enum  Inv401kPosnSource {
  OFX_401K_POSN_SOURCE_PRETAX , OFX_401K_POSN_SOURCE_AFTERTAX , OFX_401K_POSN_SOURCE_MATCH , OFX_401K_POSN_SOURCE_PROFITSHARING ,
  OFX_401K_POSN_SOURCE_ROLLOVER , OFX_401K_POSN_SOURCE_OTHERVEST , OFX_401K_POSN_SOURCE_OTHERNONVEST
}
 
char memo [OFX_MEMO_LENGTH]
 
int memo_valid
 
enum OfxPositionData::Inv401kPosnSource inv_401k_source
 
int inv_401k_source_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
 
struct OfxSecurityDatasecurity_data_ptr
 
int security_data_valid
 

Detailed Description

An abstraction of a security position held in an account.

The OfxPositionData structure is used to hold the position information inside a OfxPositionContainer class for investment positions.

Definition at line 1161 of file libofx.h.

Member Enumeration Documentation

◆ HeldInAccountType

The HELDINACCT subaccount type, OFX entry will be one of CASH, MARGIN, SHORT, OTHER

Enumerator
OFX_HELDINACCT_CASH 

A cash account

OFX_HELDINACCT_MARGIN 

A margin account

OFX_HELDINACCT_SHORT 

A short account

OFX_HELDINACCT_OTHER 

An "other" account

Definition at line 1187 of file libofx.h.

◆ Inv401kPosnSource

<INV401KSOURCE> For 401(k) accounts, source of the money used for this security

Definition at line 1231 of file libofx.h.

◆ PositionType

The position type, either SHORT or LONG

Definition at line 1197 of file libofx.h.

Field Documentation

◆ account_id

char OfxPositionData::account_id[OFX_ACCOUNT_ID_LENGTH]

Account for the position Use this for matching with the relevant account in your application

Definition at line 1164 of file libofx.h.

◆ account_id_valid

int OfxPositionData::account_id_valid

Definition at line 1169 of file libofx.h.

◆ account_ptr

struct OfxAccountData* OfxPositionData::account_ptr

Pointer to the full account structure, see OfxAccountData

Definition at line 1167 of file libofx.h.

◆ amounts_are_foreign_currency

int OfxPositionData::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 1254 of file libofx.h.

Referenced by OfxPositionContainer::add_attribute().

◆ amounts_are_foreign_currency_valid

int OfxPositionData::amounts_are_foreign_currency_valid

Definition at line 1255 of file libofx.h.

◆ currency

char OfxPositionData::currency[OFX_CURRENCY_LENGTH]

<CURSYM> The currency is a string in ISO-4217 format

Definition at line 1244 of file libofx.h.

Referenced by OfxPositionContainer::add_attribute().

◆ currency_ratio

double OfxPositionData::currency_ratio

Ratio of <CURDEF> currency to <CURSYM> currency

Definition at line 1248 of file libofx.h.

Referenced by OfxPositionContainer::add_attribute().

◆ currency_ratio_valid

int OfxPositionData::currency_ratio_valid

Definition at line 1249 of file libofx.h.

◆ currency_valid

int OfxPositionData::currency_valid

Definition at line 1245 of file libofx.h.

◆ date_unit_price

time_t OfxPositionData::date_unit_price

Date and time of unit price and market value

Definition at line 1217 of file libofx.h.

Referenced by OfxPositionContainer::add_attribute().

◆ date_unit_price_valid

int OfxPositionData::date_unit_price_valid

Definition at line 1218 of file libofx.h.

◆ heldinaccount_type_valid

int OfxPositionData::heldinaccount_type_valid

Definition at line 1194 of file libofx.h.

◆ inv_401k_source_valid

int OfxPositionData::inv_401k_source_valid

Definition at line 1241 of file libofx.h.

◆ market_value

double OfxPositionData::market_value

Market value of this position

Definition at line 1213 of file libofx.h.

Referenced by OfxPositionContainer::add_attribute().

◆ market_value_valid

int OfxPositionData::market_value_valid

Definition at line 1214 of file libofx.h.

◆ memo

char OfxPositionData::memo[OFX_MEMO_LENGTH]

Position memo

Definition at line 1227 of file libofx.h.

Referenced by OfxPositionContainer::add_attribute().

◆ memo_valid

int OfxPositionData::memo_valid

Definition at line 1228 of file libofx.h.

◆ position_type_valid

int OfxPositionData::position_type_valid

Definition at line 1202 of file libofx.h.

◆ security_data_ptr

struct OfxSecurityData* OfxPositionData::security_data_ptr

Pointer to the security data, if found, for convenience of the libofx user A pointer to the security's data.

Definition at line 1258 of file libofx.h.

Referenced by OfxPositionContainer::gen_event().

◆ security_data_valid

int OfxPositionData::security_data_valid

Definition at line 1259 of file libofx.h.

◆ unique_id

char OfxPositionData::unique_id[OFX_UNIQUE_ID_LENGTH]

The id of the security held. Mandatory for investment positions

Definition at line 1179 of file libofx.h.

Referenced by OfxPositionContainer::add_attribute(), and OfxPositionContainer::gen_event().

◆ unique_id_type

char OfxPositionData::unique_id_type[OFX_UNIQUE_ID_TYPE_LENGTH]

Usially "CUSIP" for FIs in north america

Definition at line 1181 of file libofx.h.

Referenced by OfxPositionContainer::add_attribute().

◆ unique_id_type_valid

int OfxPositionData::unique_id_type_valid

Definition at line 1183 of file libofx.h.

◆ unique_id_valid

int OfxPositionData::unique_id_valid

Definition at line 1180 of file libofx.h.

◆ unit_price

double OfxPositionData::unit_price

Bonds=of par; options=premium per share of underlying stock; all others=price per share

Definition at line 1209 of file libofx.h.

Referenced by OfxPositionContainer::add_attribute().

◆ unit_price_valid

int OfxPositionData::unit_price_valid

Definition at line 1210 of file libofx.h.

◆ units

double OfxPositionData::units

Bonds=face value; options=contracts, all others=shares

Definition at line 1205 of file libofx.h.

Referenced by OfxPositionContainer::add_attribute().

◆ units_valid

int OfxPositionData::units_valid

Definition at line 1206 of file libofx.h.


The documentation for this struct was generated from the following file: