Guide
Entering positions
A bot has a variety of parameters that can be used to determine when and what type of position should be opened.
The Trademade engine runs every few seconds to decide whether to open a new position.
See the config.yaml reference for more details on individual parameters.
Order entry process
When Trademade determines that a new position should be entered, it will select a contract based on the bot parameters. Once a specified contract has been selected, an order will be submitted.
The openOrderAlgo parameter allows you to specify the algorithm used to adjust the opening order price.
Trade Sizing
There are two configuration parameters that are used to control how many contracts Trademade will attempt to open for a trade. You must specify either quantity
or leverage
parameters when defining a bot.
Quantity
The quantity parameter specifies a how many contracts should be bought or sold when opening a new position.
Leverage
The leverage parameter will set the number of opening contracts based on your account's net liquidation value (NLV). Leverage is calculating by taking your NLV and multiplying that by the leverage
parameter, and then dividing that by the notional value of the contract. The result will be rounded to a whole number, which is the number of contracts to be opened.
For example:
- Your NLV is $300,000 and you want to open a 4x leveraged position on a Call Credit Spread.
- Trademade selects a 4450 call contract as the short leg for the CCS.
- 3x leverage would target $1,200,000 of notional value (4 x $300,000).
- A single 4450 contract carries $445,000 of notional value (4450 * 100).
- $1,200,000 / $445,000 = 2.7 contracts.
- Trademade will round 2.7, which will result in 3 contracts being opened for the position.
Days to expiration
Trademade can target the minimum and maximum days to expiration for a contract via the minDTE and maxDTE parameters. Trademade will always attempt to find a contract with the shortest DTE within the specified range.
Time
The openTime parameter specifies the time after which a bot will attempt to open a new position. The latestEntryTime parameter specifies the latest time after which the bot will not longer attempt to enter a new position. The combination of these two parameters provides a window during which new positions can be entered.
Strike selection
Trademade can target strikes for a given expiration in multiple ways:
Premium. The desired premium can be selected through the targetCredit (or targetDebit for debit position types) parameter.
Delta. Selecting a contract with the desired delta can be done through the targetDelta parameter.
Out of the money. Select a contract that is a set percentage out of the money using the targetOTM parameter.
Spreads
Spread parameters can be defined by the width and price properties.