Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 7 Next »

The following variables are available for creating recurring adjustments:

Variable Name

Description

$date

The date on which the adjustment will be posted. (e.g. 2011-08-15)

$totalShares

Monthly only: Total number of shares traded that month.

$totalExecutions

Monthly only: Total number of fills for the month.

$totalOrders

Monthly only: Total number of orders for the month.

$netProfitLoss

Monthly only: gross realized profit (or loss) minus direct trade fees for the month.

$unrealizedProfitLossDeltaMonthly only: Change in unrealized profit (or loss) from the previous month (v1.6.2.77+).

$unrealizedProfitLoss

Unrealized profit (or loss) for all open positions marked to the market for the adjustment date.

$longUnrealizedProfitLoss

Same as above for long positions.

$shortUnrealizedProfitLoss

Same as above for short positions.

$latestLongPositionValue

Market value of ALL open long positions for the adjustment date (will always be >= 0).

$latestShortPositionValue

Market value of ALL open short positions for the adjustment date (will always be >= 0).

$longPositionCountTotal number of long positions on the adjustment date (v1.5.96.17+).
$shortPositionCountTotal number of short positions on the adjustment date (v1.5.96.17+).

$profitLossByType

Break down of profit / loss information by instrument type:
INSTRUMENT_TYPE_EQUITY, INSTRUMENT_TYPE_OPTION, INSTRUMENT_TYPE_FUTURE,
INSTRUMENT_TYPE_CURRENCY_PAIR, INSTRUMENT_TYPE_MUTUAL_FUND, INSTRUMENT_TYPE_BOND

$profitLossByType[type]->realized

Monthly only: gross realized profit loss for the month.

$profitLossByType[type]->shortUnrealized

 

$profitLossByType[type]->longUnrealized

 

$profitLossByType[type]->longValue

 

$profitLossByType[type]->shortValue

 

$monthlyFees

Monthly only: total fee adjustments for the month. (Negative for debit, positive for credit)

$monthlyTotalsByCategory

Monthly only: total adjustments by category name for the month. (e.g. $monthlyTotalsByCategory["Misc"])

$totalsByCategory

Monthly only: total adjustments by category name since inception.

$equity

Cash in the account on the adjustment date. Note: if more than one recurring plan is assigned, this amount will
reflect the result of any previously applied plan (see order of recurring adjustments).

 

Examples of using variables to come up with specific values for options:

Values calculated

Description

Long Market Value for Options

$latestLongPositionValueOption = isset($profitLossByType[INSTRUMENT_TYPE_OPTION]) ? $profitLossByType[INSTRUMENT_TYPE_OPTION]->longValue : 0;

Short Market Value for Options

$latestShortPositionValueOption = isset($profitLossByType[INSTRUMENT_TYPE_OPTION]) ? $profitLossByType[INSTRUMENT_TYPE_OPTION]->shortValue : 0;

Total Absolute Value for Options

$totalAbsolutePositionValueOption = isset($profitLossByType[INSTRUMENT_TYPE_OPTION]) ? $profitLossByType[INSTRUMENT_TYPE_OPTION]-> longValue + $profitLossByType[INSTRUMENT_TYPE_OPTION]-> shortValue : 0;

Total Net Value for Options$totalNetPositionValueOption = isset($profitLossByType[INSTRUMENT_TYPE_OPTION]) ? $profitLossByType[INSTRUMENT_TYPE_OPTION]-> longValue - $profitLossByType[INSTRUMENT_TYPE_OPTION]-> shortValue : 0;

 

 

 

  • No labels