If you are someone who has worked on automating a trading strategy across different stock brokers, then you would know that the trading symbols used by stock brokers differs from one broker to another. This is mostly applicable for derivative symbols. Let us take a look at an example.
Example
Let’s consider the derivative we want to trade is a call option of BANKNIFTY with a strike price of 40000 and expiry date of 30-Dec-2021. Now the symbol that is used to identify this derivative contract, differs from broker to broker. See below table:
Broker | Symbol |
ZERODHA | BANKNIFTY21DEC40000CE |
UPSTOX | BANKNIFTY21DEC40000CE |
ALICEBLUE | BANKNIFTY DEC 40000.0 CE |
FINVASIA | BANKNIFTY21DEC40000CE |
AUTOTRADER | BANKNIFTY_30-DEC-2021_CE_40000 |
The different broker mapping for the above BANKNIFTY option example can be seen here.
If we use these broker specific symbols in our strategy code, then changing a broker would require changing strategy code to use symbol format as per new broker. To overcome this problem, we built independent instrument format (highlighted above).
If we use these broker specific symbols in our strategy code, then changing a broker would require changing strategy code to use symbol format as per new broker. To overcome this problem, we built independent instrument format (highlighted above).
How does it work?
We use a simple and standard format to create symbols, which will be explained later. Our users use this symbol in their strategy code. Our systems internally have mappings that help it pick up broker specific symbol.
We have even created a free to use public tool for searching instruments (symbols).
You can use this tool to search for trading symbols of brokers like Supports leading Indian Stock Brokers etc.
Now let us understand it starting from code.
placeOrder("PSEUDO_ACC_ID", "NSE", "BANKNIFTY_30-DEC-2021_CE_40000", "BUY", "LIMIT", "INTRADAY", 25, 230.55, 0);
- The API user uses broker independent symbol in his strategy code
- Our system checks which trading account is mapped to “PSEUDO_ACC_ID”
- From the trading account, our system finds out which stock broker it belongs to
- The system then looks internal mapping table to find broker specific symbol
As a result, changing stock brokers does not require changing instrument symbols in strategy code.
Broker Independent Symbol Format
Type | Format | Example |
Equity | SYMBOL | SBIN |
Future | SYMBOL_DD-MMM-YYYY_FUT | BANKNIFTY_25-JUN-2020_FUT |
Option | SYMBOL_DD-MMM-YYYY_[CE/PE]_STRIKE | BANKNIFTY_28-MAY-2020_CE_25000 |