API Parameters
The standard, broker independent values you pass to every AutoTrader API function.
These are the standard parameters you pass to AutoTrader API functions. AutoTrader hides each broker's order, position, trade and margin formats behind one common format. You send values in this standard format, and the software converts them to the format your broker needs.
Every trading platform has its own format for orders, positions, trades and margins. AutoTrader’s job is to hide those differences and give you a single standard format. You pass values in the standard format defined by the AutoTrader team, and the software converts them internally for your trading platform.
The AutoTrader API is offered in multiple programming languages. The descriptions below are generic and apply to all of them, so there may be small differences. Please also check the language-specific examples for your client setup.
Order Id
Data type: Text or String
An order id uniquely identifies an order. In AutoTrader you deal with 3 types of order ids.
- Publisher Id — Used in languages like AmiBroker AFL or MetaTrader MQL, where direct HTTP REST communication is not possible. This id is generated by the API functions, and AutoTrader maps it to the actual order. It may not be unique across different users, because it is generated on the client side.
- System Id — When AutoTrader receives a new order, it assigns a new id. This id is unique across all users of the AutoTrader platform.
- Platform Id — The id given to the order by your stock broker’s trading platform.
Account
Data type: Text or String
A nickname (also known as a pseudo account) you have given for your broker account. The system maps it internally to an actual trading account. Taking a nickname instead of the real broker account lets you switch broker accounts from the system without changing your code. See how to create a nickname.
Note: You can rename a nickname later from the Trading Accounts screen. The nickname is the name your code passes here, so if you rename it, update the name in your code to match. If you do not, your orders will fail.
Variety
Data type: Text or String or Enumeration
Variety represents the kind of an order. There are 3 varieties.
| Value | Meaning |
|---|---|
| REGULAR | A regular order |
| BO | A bracket order |
| CO | A cover order |
Exchange
Data type: Text or String or Enumeration
An exchange represents the Indian stock exchange on which the order symbol is traded. Pass the standard code for the relevant exchange and market segment, for example the cash segment, the F&O segment or the commodity segment.
Symbol
Data type: Text or String
A symbol represents a stock or derivative contract. The symbol must be a broker independent symbol. You can use this Indian API stock symbol search tool.
Trade Type
Data type: Text or String or Enumeration
Represents a trade type, sometimes called transaction type. The valid trade types are:
| Value | Meaning |
|---|---|
| BUY | A buy order |
| SELL | A sell order |
| SHORT | A sell order (added for charting software support — only allowed in csv format used by Desktop client) |
| COVER | A buy order (added for charting software support — only allowed in csv format used by Desktop client) |
Order Type
Data type: Text or String or Enumeration
Represents an order type. There are 4 valid order types.
| Value | Meaning |
|---|---|
| LIMIT | A limit order |
| MARKET | A market order |
| STOP_LOSS | A stoploss order |
| SL_MARKET | A stoploss market order |
Product Type
Data type: Text or String or Enumeration
Represents a product type. There are 3 valid product types.
| Value | Meaning |
|---|---|
| INTRADAY | An intraday or MIS order |
| DELIVERY | A delivery order |
| NORMAL | A normal order |
Validity
Data type: Text or String or Enumeration
Represents order validity. There are 2 valid values.
| Value | Meaning |
|---|---|
| DAY | Order is valid for the day (this is the default) |
| IOC | Immediate or cancel |
Note: Do not confuse Validity with Product Type. They are different things.
Quantity
Data type: Numeric or Integer
AutoTrader passes the quantity as it is to the trading platform.
The confusion usually happens for derivatives: should you pass quantity as a multiple of lot size, or as a number of lots? All trading platforms supported by AutoTrader take quantity in multiple of lot size.
Example: To buy 1 lot of NIFTY Future (assuming a lot size of 75), enter the quantity as:
= (#lots * lots_size) = (1 * 75) = 75
Disclosed Quantity
Data type: Numeric or Integer
Represents a disclosed quantity. It is optional and defaults to zero.
Price
Data type: Decimal or Float
Represents the order price. For a market order, this price defaults to zero.
Note: Price is automatically rounded to the nearest tick price, so you need not worry about price being a multiple of tick size. Example: a price of 50.54 with a tick size of 0.05 becomes 50.55.
Trigger Price
Data type: Decimal or Float
Represents a trigger price. It is used in a stoploss order or a cover order.
Note: Trigger price is automatically rounded to the nearest tick price, so you need not worry about it being a multiple of tick size. Example: a price of 50.54 with a tick size of 0.05 becomes 50.55.
Target (Bracket Order)
Data type: Decimal or Float
Represents the target of a bracket order.
Stoploss (Bracket Order)
Data type: Decimal or Float
Represents the stoploss of a bracket order.
Trailing Stoploss (Bracket Order)
Data type: Decimal or Float
Represents the trailing stoploss of a bracket order. In most cases it should be an absolute value.
Some brokers work a little differently. Their system takes trailing stoploss in number of ticks. So if a stock or derivative has a tick size of 0.05 and you want a trailing stoploss of 1/-, on such a system you would enter 20, calculated as 1 divided by 0.05.
But because AutoTrader is broker independent, it takes trailing stoploss as an absolute value (for example, 1/- as explained above). Even for accounts on those brokers, enter the value as absolute, not in number of ticks. The system reads the tick size and converts it into number of ticks for you.
AMO
Data type: Text or String or Boolean
Indicates whether an order is an After Market Order.
| Value | Meaning |
|---|---|
| TRUE | The order is an AMO |
| FALSE | The order is not an AMO (this is the default) |
Validate
Data type: Boolean
This parameter is only used in AmiBroker. When set to True, the system will not accept back to back BUY or back to back SELL orders. It treats them as duplicate orders caused by a known limitation of AmiBroker. When you get a signal in AmiBroker, it stays active until the candle completes. Every time the strategy runs during this active state, it sees the signal is active and places an order, which results in duplicate orders.
AmiBroker experts can set it to False and manage the signal in their own strategy code. This simple flag was built for beginners.
OrderStatus
Data type: Text or String or Enumeration
Represents order status in a broker-independent way. Broker-specific statuses are not uniform, so AutoTrader parses them into a standard status.
| Value | Meaning |
|---|---|
| OPEN | Open |
| COMPLETE | Complete |
| CANCELLED | Cancelled |
| REJECTED | Rejected |
| TRIGGER_PENDING | Trigger pending |
| UNKNOWN | Unknown (when the system cannot determine the type from the raw order status received from the stock broker) |
MarginCategory
Data type: Text or String or Enumeration
Represents margin category.
| Value | Meaning |
|---|---|
| EQUITY | Margin for the Equity section of your account |
| COMMODITY | Margin for the Commodity section of your account |
| ALL | Combined margin for Equity and Commodity |
PositionCategory
Data type: Text or String or Enumeration
Represents position category.
| Value | Meaning |
|---|---|
| DAY | Snapshot of the buying and selling activity for that particular day |
| NET | Actual or current net position |
PositionType
Data type: Text or String or Enumeration
Represents position type.
| Value | Meaning |
|---|---|
| MIS | MIS or intraday position |
| CNC | CNC or delivery position |
| NRML | Normal position position |
| BO | BracketOrder position |
| CO | CoverOrder position |
PositionState
Data type: Text or String or Enumeration
Represents the state of the position, which can be either OPEN or CLOSED.
| Value | Meaning |
|---|---|
| OPEN | The position is open |
| CLOSED | The position is closed |
PositionDirection
Data type: Text or String or Enumeration
Represents the direction of the position.
| Value | Meaning |
|---|---|
| LONG | A long position |
| SHORT | A short position |
| NEUTRAL | A neutral position |
Related pages
Next steps
Thanks for the feedback. Still stuck? Contact support.
Last updated 23 June 2026