Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Trade fee formulas use a simple language (a simplified version of the PHP programming language) to specify how fees should be assessed in PropReports.  A  

A "Per Execution" formula will be applied to runs once for every "Regular" fill .  This means that the and the result is saved as the fee.  The formula will NOT run for any fill that is either canceled,  has has fees manually set or has a status that is not regular.

(warning) Important: Make sure the Formula Type is set to "Per Execution" when creating a plan.

Image Removed
Creating a Rule

Here's a sample rule:

    dst=ARCA,ARCAPOP;penny=true;liq=A => 0.003
The left-hand side (everything before =>) specifies the conditions to match. The rule above match any execution where route is ARCA or ARCAPOP and the liquidity flag is A and the price was less than $1.  

The right-hand side specifies the fee to assess if the conditions match.   Positive fees are charges, negative fees are rebates.  The rule above charges $3 / 1000 shares.

Leaving the condition blank will match every trade (useful as the last rule to provide a catch-all). For example, changing the example above as follows will charge all remaining executions $5 / 1000: 

    dst=ARCA,ARCA=,ARCAPOP;penny=true;liq=A => 0.003
    => 0.005 
Conditions 

Unless otherwise specified, conditions are not case sensitive and support a variety of operators: =, != (not equals), >=, >, <=, <

 

Name

Description

Example

afterHours

Execution occurred on or after 4pm EST

afterHours=true

contra

Contra value. The meaning of this field varies greatly by platform and destination.

contra=PFSI

curr

An ISO 4217 (3-character) currency of the trade. (v1.5.92.26 or greater)

curr=EUR

dst

Exchange, Route or ECN. Different platforms send can send different values for the same venue (e.g. Sterling: NSDQ vs Laser: ISLD). Furthermore, some platforms can indicate multiple values for the same destination (e.g. Sterling: ARCA, ARCA= to mean ARCA).

dst=ARCA

exch

Listing exchange for the security being traded (see list of exchange codes).

exch=NYQ

liq

Liquidity flag (see flags for various destinations). This value is case-sensitive.

liq=A

lot

Considers quantity of trade:   (ODD = if quantity < 100 on an execution) 
(EVEN = if quantity divisible by 100) 
(MIXED = if > 100 and not divisible by 100 evenly)

lot=odd 
lot=even 
lot=mixed

penny

Set to true if trade is sub-dollar

penny=true

price

Execution price.

price>2

qty

Quantity of the execution. (v1.5.92.18 or greater)

qty=100

side

Buy or sell

side=buy

source

Where PropReports received the trade from (see list of source ids).

source=1

subType

For equities, this will be either etf or blank

subType=etf

symbol

Ticker symbol of the security being traded

symbol=IBM

tape

Trade reporting facility indicator (e.g. A, B, or C).

tape=A

type

Type of instrument being traded (equity, option, future, index, fund, fx, bond)

type=option

underlyingSymbol

For options, the ticker symbol of the underlying security or index.

underlyingSymbol=YHOO

underlyingType

For options, the type of the underlying security (equity, future, index)

underlyingType=index

underlyingSubType

For options, the sub type of the underlying equity (etf or blank)

underlyingSubType=etf

 

OR-ing conditions

Sometimes you may want to match more than one set of conditions. For example, let's say you want to select trades where either the destination or contra are set to ARCA. Since version 1.5.92.18 you can specify a rule as follows (please note the use of parenthesis):

    (dst=ARCA),(contra=ARCA) => 0.003
Fees

Positive fees are charges, negative fees are rebates. There are four ways to assess a fee or rebate:

MethodExample
Per Share0.003     (1,000 shares @ $2 is charged 1,000 * 0.003 = $3.00).
Percentage of Value0.003%   (1,000 shares @ $2 is charged $2,000 * 0.003 = $6.00).

Fixed Amount per Execution (available in v1.5.92.51.3 or greater)

[10]       ($10 is charged)  
Pass Through (do not change)blank (the fee will be left as received from the data source)

You can also specify a minimum/maximum of two or three fees (available in PropReports v1.5.91.17 and greater):

ExampleDescription
max(0.003%, 0.003)Result will be the highest of :   (0.003 * trade value) or (0.003 * quantity)
min(0.003%, 0.003, 3)Result will be the lowest of :   (0.003 * trade value) or (0.003 * quantity) or 3
Blocks

To avoid repeating the same condition you can specify blocks.

Instead of:

dst=EDGA;liq=A => -0.002
dst=EDGA;liq=B => 0.0002

You can use:

dst=EDGA {
    liq=A => -0.002
    liq=B => 0.0002
}

Blocks can also be nested.  For example: 

dst=EDGA {
    penny=true {
        liq=A => -0.001%
        liq=B => 0.003%
    }
    liq=A => -0.002
    liq=B => 0.0002
}
Comments

Any lines that start with a '#' are ignored. Any text following a '#' at the end of a line will also be ignored. Comments are available in PropReports v1.5.91.17 and greater.

# this Comment line will be ignored
dst=EDGA;liq=A => -0.002

...

Image Added

The following variables are available when creating a Per Execution formula:

Variable Name

Description

$source

A numeric code indicating where the execution originated. See the list of source ids.

$date

The trade date in YYYY-MM-DD format (e.g. 2011-08-15).

$time

The trade time in HH:MM:SS format (e.g. 09:35:12). If the trade time is uknown, the variable is set to 00:00:00.

$type

B = Buy, S = Sell, T = Short, C = Cover. See side and intention codes for more information.

$quantity

Number of shares or contracts traded.

$symbolTicker symbol of the instrument being traded.
$multiplierThe multiplier (can be called "contract size" for options and "value multiplier" for futures) used when computing profit and loss.
$spotRateThe conversion rate from the trade currency to the account currency.
$pricePrice of the trade.
$valueValue of the trade in the currency of the account.
$contraMmidMPID / identifier of the counterparty.  Will always be in uppercase.
$exchangeName of the route, ECN or exchange. Will always be in uppercase.
$liquidityLiquidity flag.
$originalCommissionCommission as received from the data source.
$originalExchangeFeeExchange/ECN fee as received from the data source.
$originalSecFeeSEC transaction fee as received from the data source.
$originalTafTrade activity fee as received from the data source.
$originalNsccFee

National Securities Clearing Corporation fee as received from the data source.

$originalMiscellaneousFeeMiscellaneous fee as received from the data source. 
$originalClearingFeeOther clearing fee as received from the data source.
$orderQuantityTotal quantity for the order. Set to 0 for all but the last execution for the order. Note that if an order contains a fill with a manually set fee, this variable will always be set to 0 for that order.
$monthlyVolumeTotal cumulative quantity traded during the trade date month up to and including the execution being processed. Note that currently this lumps together volume across all instrument types.