UNPKG

ofx4js

Version:

A javascript OFX library, ported from OFX4J

212 lines (211 loc) 8.07 kB
import { InvestmentTransactionType } from "./TransactionType"; import { BaseInvestmentTransaction } from "./BaseInvestmentTransaction"; import { TransactionWithSecurity } from "./TransactionWithSecurity"; import { SellInvestmentTransaction } from "./SellInvestmentTransaction"; import { InvestmentTransaction } from "./InvestmentTransaction"; import { SecurityId } from "../../seclist/SecurityId"; import { OriginalCurrency } from "./OriginalCurrency"; import { SubAccountType } from "../accounts/SubAccountType"; import { Inv401KSource } from "../positions/Inv401KSource"; /** * Base class for all investment transactions for selling securities. * <br> * This class exposes a read-only view of the flattened aggregates that are * common to all sell investment transactions as a convenience to application * developers who may not find the ofx aggregation model intuitive. */ export declare abstract class BaseSellInvestmentTransaction extends BaseInvestmentTransaction implements TransactionWithSecurity { private sellInvestment; constructor(transactionType: InvestmentTransactionType); /** * Gets the sell investment transaction child aggregate. * * @return the sell investment transaction child aggregate */ getSellInvestment(): SellInvestmentTransaction; /** * Sets the sell investment transaction child aggregate. * * @param sellInvestment the sell investment transaction child aggregate */ setSellInvestment(sellInvestment: SellInvestmentTransaction): void; /** * Gets the investment transaction aggregate. * * @return the investment transaction aggregate */ getInvestmentTransaction(): InvestmentTransaction; /** * Gets the id of the security that was sold. This is a required field according to the OFX * spec. * @see "Section 13.9.2.4.3, OFX Spec" * * @return the security id of the security that was bought */ getSecurityId(): SecurityId; /** * Gets the number of units of the security that was sold. For security-based actions other * than stock splits, this is the quantity sold. For stocks, mutual funds, and others, this * is the number of shares. For bonds, this is the face value. For options, this is the number of * contacts. This is a required field according to the OFX spec. * @see "Section 13.9.2.4.3, OFX Spec" * * @return the number of units purchased. */ getUnits(): number; /** * Gets the price per commonly-quoted unit. For stocks, mutual funds, and others, this is the * share price. For bonds, this is the percentage of par. For options, this is the per share (not * per contact) price. This is a required field according to the OFX spec. * @see "Section 13.9.2.4.3, OFX Spec" * * @return the per unit price */ getUnitPrice(): number; /** * Gets the portion of the unit price that is attributed to the dealer markdown. This is an * optional field according to the OFX spec. * @see "Section 13.9.2.4.3, OFX Spec" * * @return the per unit markedown price */ getMarkdown(): number; /** * Gets the transaction commission for the sale. This is an optional field according to the * OFX spec. * @see "Section 13.9.2.4.3, OFX Spec" * * @return the transaction commision */ getCommission(): number; /** * Gets the taxes for the sale. This is an optional field according to the OFX spec. * @see "Section 13.9.2.4.3, OFX Spec" * * @return the transaction taxes */ getTaxes(): number; /** * Gets the fees for the sale. This is an optional field according to the OFX spec. * @see "Section 13.9.2.4.3, OFX Spec" * * @return the transaction fees */ getFees(): number; /** * Gets the load for the sale. This is an optional field according to the OFX spec. * @see "Section 13.9.2.4.3, OFX Spec" * * @return the load */ getLoad(): number; /** * Gets the withholding for the sale. This is an optional field according to the OFX spec. * @see "Section 13.9.2.4.3, OFX Spec" * * @return the withholding */ getWithholding(): number; /** * Gets whether the sale was tax exempt. This is an optional field according to the OFX spec. * @see "Section 13.9.2.4.3, OFX Spec" * * @return whether the transaction was tax exempt */ getTaxExempt(): boolean; /** * Gets the total for the sale. Should be equal to * (units * (unitPrice + markdown)) + (commision + fees + load + taxes + penalty + withholding + * statewithholding) according to the OFX spec. This is a required field according to the OFX * spec. * @see "Section 13.9.2.4.3, OFX Spec" * * @return the total */ getTotal(): number; /** * Gets the gain sale. This is aan optional field according to the OFX spec. * @see "Section 13.9.2.4.3, OFX Spec" * * @return the gain for the sale */ getGain(): number; /** * Gets the currency code for the transaction. Only one of currency code or original currency * info should be set according to the OFX spec. If neither are set, means the default currency. * @see "Section 13.9.2.4.3, OFX Spec" * * @return the currency code for the transaction. */ getCurrencyCode(): string; /** * Gets the origianl currency info for the transaction. * @see "Section 13.9.2.4.3, OFX Spec" * * @return the currency info for the transaction. */ getOriginalCurrencyInfo(): OriginalCurrency; /** * Gets the sub account type for the security (e.g. CASH, MARGIN, SHORT, OTHER). * @see "Section 13.9.2.4.3, OFX Spec" * * @return the sub account type */ getSubAccountSecurity(): string; /** * Gets the result of getSubAccountSecurity as one of the well-known types. * * @return the type of null if it wasn't one of the well known types. */ getSubAccountSecurityEnum(): SubAccountType; /** * Gets the sub account type that the money went to (e.g. CASH, MARGIN, SHORT, OTHER). * @see "Section 13.9.2.4.3, OFX Spec" * * @return the sub account fund */ getSubAccountFund(): string; /** * Gets the result of getSubAccountFund as one of the well-known types. * * @return the type of null if it wasn't one of the well known types. */ getSubAccountFundEnum(): SubAccountType; /** * Gets the loan id if this transaction was due to a loan or loan repayment on a 401k. This is an * optional field according to the OFX spec. * @see "Section 13.9.2.4.3, OFX Spec" * * @return the loan id */ getLoadId(): string; /** * Gets the state withholding for the sale. This is an optional field according to the OFX spec. * @see "Section 13.9.2.4.3, OFX Spec" * * @return the state withholding */ getStateWithholding(): number; /** * Gets the penalty for the sale. This is an optional field according to the OFX spec. * @see "Section 13.9.2.4.3, OFX Spec" * * @return the state withholding */ getPenalty(): number; /** * Gets the 401K source for the sale. Should be one of "PRETAX", "AFTERTAX", "MATCH", * "PROFITSHARING", "ROLLOVER", "OTHERVEST", "OTHERNONVEST". This is an optional field * according to the OFX spec. * @see "Section 13.9.2.4.3, OFX Spec" * * @return the 401k source */ get401kSource(): string; /** * Gets the 401k source as one of the well-known types. * * @return the 401k source or null if its not one of the well-known types */ get401kSourceEnum(): Inv401KSource; }