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. |
$unrealizedProfitLossDelta | Monthly 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). |
$longPositionCount | Total number of long positions on the adjustment date (v1.5.96.17+). |
$shortPositionCount | Total number of short positions on the adjustment date (v1.5.96.17+). |
$profitLossByType | Break down of profit / loss information by instrument type: |
$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 |
$mostRecentTradeDate | The most recent date with trading activity up to and including $date. Journal fills and Canceled fills are excluded. |
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; |