Click here to download Touch API

Introduction

You can create your trading strategy or select multiple strategies using Tradetron.To fire trade in our terminal using your strategies please use the APIs below.

Touch Functions

This function is called to set up ID. It is a one time process.

Sl No Parameter Sample Value Mandatory Description
1 entity_id TB0007 Y Touch client ID
2 Source M/W/N/I/R/O Y M Mobile Web
W Website
N Android
I IOS
O Operator Work Station
H Admi

Login

This is used to get the token & it will be used for the remaining function calls. If the token expires, you will have to login, authenticate & update the fresh token.

Sl No Parameter Description
1 Token To be used in the rest of the functions

Authorization

To authenticate, please provide the password & PAN number along with the token fetched from the login.

To use any of the below APIs, you will need to log in & authenticate first.

Sl No Parameter Sample Value Mandatory Description
1 device_id Imei no/mac addr Y
2 pan_no ABCDE1234F Y
3 pass Abc123 Y

Order Book

This allows the user to place & view orders to any exchange via touch broking.

Sl No Parameter Sample Value Mandatory Description
1 client_id TB0007 Y Touch client ID
2 sort_by order_date_time/last_updated_time N Default sort order is order_date_time

Order Details

This allows the user to place & view orders to any exchange via touch broking.

Sl No Parameter Sample/Possible Value Mandatory Description
1 client_id TB0007 Y Touch client ID
2 order_no 0123456789 y "Order Number for which details are required"
3 segment E/D/C/M y E Equity
D Derivative
C Currency
M Commodity

Trade book

This allows the user to fetch & views all the trade details for the current day across all platforms and exchanges in the current trading day.

Sl No Parameter Sample/Possible Value Mandatory Description
1 client_id TB0007 Y Touch client ID

Trade details

Sl No Parameter Sample/Possible Value Mandatory Description
1 client_id TB0007 Y Touch client ID
2 order_no 0123456789 y "Order Number for which details are required"
3 segment E/D/C/M y E Equity
D Derivative
C Currency
M Commodity
4 leg_no 1/2/3 N Leg no. Default value ‘1’

Holdings

This allows the user to fetch the equity holdings of the user.

Sl No Parameter Sample Value Mandatory Description
1 client_id TB0007 Y Touch client ID

Net Position

This allows the user to fetch the current open and closed positions for the current trading day. Note that the previous trading day’s closed positions will not be shown here.

Sl No Parameter Sample Value Mandatory Description
1 client_id TB0007 Y Touch client ID

Fund limit

This allows the user to show the balance available for capital or the commodity market.

Sl No Parameter Sample Value Mandatory Description
1 client_id TB0007 Y Touch client ID

Place order

This allows the user to place, modify or cancel an order to any exchange via Touch Broking.

Order entry

Sl No Parameter Sample Value Mandatory Description
1 client_id TB0007 Y Touch client ID
2 txn_type B/S Y B incase of buy position, S incase of sell position
3 exchange NSE/BSE/MCX Y
4 segment E/D/C/M Y E Equity
D Derivative
C Currency
M Commodity
5 product C/M/I/H/V/F/B Y C CNC
M Margin
I Intraday
H Normal – Hybrid
F MTF
B BO – Bracket Order
V CO – Cover Order
6 security_id Y Scrip ID
7 quantity Y Non-zero integer value
8 price Y Float value, cannot be zero when ORDER_TYPE is LMT/SL
9 validity IOC/DAY/GTC/GTD Y IOC Immediate or cancel
DAY Intraday
GTC Good till cancel
GTD Good till Date
10 order_type LMT/MKT/SL/SLM Y LMT Limit
MKT Market
SL Stoploss
SLM Stoploss-Market
11 off_mkt_flag false/true N "true for aftermarket order, false by default"
12 mkt_type NL/OL/AU/SP/A1/A2 N Default is NL
13 good_till_days_date 2021-03-21 (yyyy-MM-dd) N Mandatory when validity is GTD

Order modification

Sl No Parameter Sample Value Mandatory Description
1 client_id TB0007 Y Touch client ID
2 txn_type B/S
3 exchange NSE/BSE/MCX
4 segment E/D/C/M Y E Equity
D Derivative
C Currency
M Commodity
5 product C/M/I/H/V/F/B Y C CNC
M Margin
I Intraday
H Normal – Hybrid
F MTF
B BO – Bracket Order
V CO – Cover Order
6 security_id Y Scrip ID
7 quantity Y Non-zero integer value
8 price Y "Float value, cannot be zero when ORDER_TYPE is LMT/SL"
9 validity IOC/DAY/GTC/GTD Y IOC Immediate or cancel
DAY Intraday
GTC Good till cancel
GTD Good till Date
10 order_type LMT/MKT/SL/SLM Y LMT Limit
MKT Market
SL Stoploss
SLM Stoploss-Market
11 off_mkt_flag false/true Y "true for aftermarket order,false for normal order"
12 mkt_type NL/OL/AU/SP/A1/A2 Y
13 good_till_days_date 2021-03-21 (yyyy-MM-dd) N Mandatory when validity is GTD
14 order_no 1234567890 Y Order number
15 serial_no 1 Y Serial number
16 group_id 1 Y Group ID

Order cancellation

Sl No Parameter Sample Value Mandatory Description
1 client_id TB0007 Y Touch client ID
2 txn_type B/S
3 exchange NSE/BSE/MCX
4 segment E/D/C/M Y E Equity
D Derivative
C Currency
M Commodity
5 product C/M/I/H/V/F/B Y C CNC
M Margin
I Intraday
H Normal – Hybrid
F MTF
B BO – Bracket Order
V CO – Cover Order
6 security_id Y Scrip ID
7 quantity Y Non-zero integer value
8 price Y "Float value, cannot be zero when ORDER_TYPE is LMT/SL"
9 validity IOC/DAY/GTC/GTD Y IOC Immediate or cancel
DAY Intraday
GTC Good till cancel
GTD Good till Date
10 order_type LMT/MKT/SL/SLM Y LMT Limit
MKT Market
SL Stoploss
SLM Stoploss-Market
11 off_mkt_flag false/true Y "true for aftermarket order,false for normal order"
12 mkt_type NL/OL/AU/SP/A1/A2 Y
13 good_till_days_date 2021-03-21 (yyyy-MM-dd) N Mandatory when validity is GTD
14 order_no 1234567890 Y Order number
15 serial_no 1 Y Serial number
16 group_id 1 Y Group ID

Cover order

This allows users to place, modify, or exit cover order via Touch Broking.

Cover Order entry

Sl No Parameter Sample Value Mandatory Description
1 client_id TB0007 Y Touch client ID
2 txn_type B/S
3 exchange NSE/BSE/MCX
4 segment E/D/C/M Y E Equity
D Derivative
C Currency
M Commodity
5 product C/M/I/H/V/F/B Y V CO – Cover Order
6 security_id Y Scrip ID
7 quantity Y Non-zero integer value
8 price Y "Float value, cannot be zero when ORDER_TYPE is LMT/SL"
9 validity IOC/DAY/GTC/GTD Y IOC Immediate or cancel
DAY Intraday
GTC Good till cancel
GTD Good till Date
10 order_type LMT/MKT/SL/SLM Y LMT Limit
MKT Market
SL Stoploss
SLM Stoploss-Market
11 trigger_price Y
12 off_mkt_flag false/true Y "true for aftermarket order,false for normal order"
13 mkt_type NL/OL/AU/SP/A1/A2 Y
14 good_till_days_date 2021-03-21 (yyyy-MM-dd) N Mandatory when validity is GTD

Cover Order modification

Sl No Parameter Sample Value Mandatory Description
1 client_id TB0007 Y Touch client ID
2 txn_type B/S
3 exchange NSE/BSE/MCX
4 segment E/D/C/M Y E Equity
D Derivative
C Currency
M Commodity
5 product C/M/I/H/V/F/B Y V CO – Cover Order
6 security_id Y Scrip ID
7 quantity Y Non-zero integer value
8 price Y "Float value, cannot be zero when ORDER_TYPE is LMT/SL"
9 validity IOC/DAY/GTC/GTD Y IOC Immediate or cancel
DAY Intraday
GTC Good till cancel
GTD Good till Date
10 order_type LMT/MKT/SL/SLM Y LMT Limit
MKT Market
SL Stoploss
SLM Stoploss-Market
11 trigger_price Y
12 off_mkt_flag false/true Y "true for aftermarket order,false for normal order"
13 mkt_type NL/OL/AU/SP/A1/A2 Y
14 good_till_days_date 2021-03-21 (yyyy-MM-dd) N Mandatory when validity is GTD
15 serial_no 1 y Serial number
16 leg_no 1/2 y Order leg number
17 group_id 1 Y Group Id

Cover Order exit

Sl No Parameter Sample Value Mandatory Description
1 client_id TB0007 Y Touch client ID
2 txn_type B/S
3 exchange NSE/BSE/MCX
4 segment E/D/C/M Y E Equity
D Derivative
C Currency
M Commodity
5 product C/M/I/H/V/F/B Y V CO – Cover Order
6 security_id Y Scrip ID
7 quantity Y Non-zero integer value
8 price Y "Float value, cannot be zero when ORDER_TYPE is LMT/SL"
9 validity IOC/DAY/GTC/GTD Y IOC Immediate or cancel
DAY Intraday
GTC Good till cancel
GTD Good till Date
10 order_type LMT/MKT/SL/SLM Y LMT Limit
MKT Market
SL Stoploss
SLM Stoploss-Market
11 off_mkt_flag false/true Y "true for aftermarket order,false for normal order"
12 mkt_type NL/OL/AU/SP/A1/A2 Y
13 good_till_days_date 2021-03-21 (yyyy-MM-dd) N Mandatory when validity is GTD
14 serial_no 1 y Serial number
15 leg_no 1/2 y Order leg number
16 group_id 1 Y Group Id

Bracket order

This allows users to place, modify, or exit bracket order via Touch Broking.

Bracket order entry

Sl No Parameter Sample Value Mandatory Description
1 client_id TB0007 Y Touch client ID
2 txn_type B/S
3 exchange NSE/BSE/MCX
4 segment E/D/C/M Y E Equity
D Derivative
C Currency
M Commodity
5 product B Y B BO – Bracket Order
6 security_id Y Scrip ID
7 quantity Y Non-zero integer value
8 price Y "Float value, cannot be zero when ORDER_TYPE is LMT/SL"
9 validity IOC/DAY/GTC/GTD Y IOC Immediate or cancel
DAY Intraday
GTC Good till cancel
GTD Good till Date
10 order_type LMT/MKT/SL/SLM Y LMT Limit
MKT Market
SL Stoploss
SLM Stoploss-Market
11 off_mkt_flag false/true Y "true for aftermarket order,false for normal order"
12 mkt_type NL/OL/AU/SP/A1/A2 Y
13 good_till_days_date 2021-03-21 (yyyy-MM-dd) N Mandatory when validity is GTD
14 profit_value y Profit price value
15 stoploss_value y Stoploss price value

Bracket order modification

Sl No Parameter Sample Value Mandatory Description
1 client_id TB0007 Y Touch client ID
2 txn_type B/S
3 exchange NSE/BSE/MCX
4 segment E/D/C/M Y E Equity
D Derivative
C Currency
M Commodity
5 product B Y B BO – Bracket Order
6 security_id Y Scrip ID
7 quantity Y Non-zero integer value
8 price Y "Float value, cannot be zero when ORDER_TYPE is LMT/SL"
9 validity IOC/DAY/GTC/GTD Y IOC Immediate or cancel
DAY Intraday
GTC Good till cancel
GTD Good till Date
10 order_type LMT/MKT/SL/SLM Y LMT Limit
MKT Market
SL Stoploss
SLM Stoploss-Market
11 off_mkt_flag false/true Y "true for aftermarket order,false for normal order"
12 mkt_type NL/OL/AU/SP/A1/A2 Y
13 good_till_days_date 2021-03-21 (yyyy-MM-dd) N Mandatory when validity is GTD
14 algo_order_no y Algo order number
15 order_no 1234567890 y Order number
16 serial_no 1 y Serial number
17 leg_no 1/2/3' y Order leg number
16 group_id 1 y Group Id

Bracket order exit

Sl No Parameter Sample Value Mandatory Description
1 client_id TB0007 Y Touch client ID
2 txn_type B/S Y
3 exchange NSE/BSE/MCX Y
4 segment E/D/C/M Y E Equity
D Derivative
C Currency
M Commodity
5 product B Y B BO - Bracket Order
6 security_id Y Scrip ID
7 quantity Y Non-zero integer value
8 price Y "Float value, cannot be zero when ORDER_TYPE is LMT/SL"
9 validity IOC/DAY/GTC/GTD Y IOC Immediate or cancel
DAY Intraday
GTC Good till cancel
GTD Good till Date
10 order_type LMT/MKT/SL/SLM Y LMT Limit
MKT Market
SL Stoploss
SLM Stoploss-Market
11 off_mkt_flag false/true Y "true for aftermarket order,false for normal order"
12 mkt_type NL/OL/AU/SP/A1/A2 Y
13 good_till_days_date 2021-03-21 (yyyy-MM-dd) N Mandatory when validity is GTD
14 algo_order_no y Algo order number
15 order_no 1234567890 y Order number
16 serial_no 1 y Serial number
17 leg_no 1/2/3' y Order leg number
16 group_id 1 y Group ID

Convert to delivery

This allows the user to convert an open position from one product type to another.

Sl No Parameter Sample Value Mandatory Description
1 client_id TB0007 Y Touch client ID
2 exchange NSE/BSE/MCX
3 segment E/D/C/M Y E Equity
D Derivative
C Currency
M Commodity
4 security_id Y Scrip ID
5 quantity Y Non-zero integer value
6 price Y "Float value, cannot be zero when ORDER_TYPE is LMT/SL"
7 txn_type B/S Y
8 mkt_type NL/OL/AU/SP/A1/A2 Y
9 product_from C/M/I/H/V/F/B Y C CNC
M Margin
I Intraday
H Normal – Hybrid
F MTF
B BO – Bracket Order
V CO – Cover Order
10 product_to C/M/I/H/V/F/B/td> Y C CNC
M Margin
I Intraday
H Normal – Hybrid
F MTF
B BO – Bracket Order
V CO – Cover Order

Market status

Sl No Parameter Sample Value Mandatory Description
1 exchange NSE/BSE/MCX
2 segment E/D/C/M Y E Equity
D Derivative
C Currency
M Commodity
3 mkt_type NL/OL/AU/SP/A1/A2 Y If this parameter is not passed, then this API will give the status of all the market type
INTRODUCTION
from touch_api import touchFunctions



#TOUCH FUNCTIONS
user1 = touchFunctions.TouchFunctions(
entity_id = "[your_entity_id]", #Enter your Touch ID here
source = "I"
)







#LOGIN
response = user1.login()
print (response)
token = "[your_token_id]" #from Response

#AUTHORIZATION
response = user1.password_auth(
pwd = "[your_password]",
pan_no = "[your_PAN_no]",
device_id = "",
token = token)
print (response)



#ORDER BOOK
response = user1.order_book(
token = token,
data = {
"client_id" : "[your_client_id]",
"sort_by" : "order_date_time"
}
)
print(response)
#ORDER DETAILS
response = user1.order_details(
token = token,
data = {
"client_id" : "[your_client_id]",
"order_no" : "[your_order_no]",
"segment" : "E"
}
)
print(response)
#TRADE BOOK
response = user1.trade_book(
token = token,
data = {
"client_id" : "[your_client_id]"
}
)
print(response)
#TRADE DETAILS
response = user1.trade_details(
token = token,
data = {
"client_id" : "[your_client_id]",
"order_no" : "[your_order_no]",
"segment" : "E",
"leg_no" : "1"
}
)
print(response)
#HOLDINGS
response = user1.holdings(
token = token,
data = {
"client_id" : "[your_client_id]" } ) print(response)
#NET POSITION
response = user1.net_position(
token = token,
data = {
"client_id" : "[your_client_id]" } ) print(response)
#FUND LIMIT
response = user1.fund_limit(
token = token,
data = {
"client_id" : "[your_client_id]"
}
)
print(response)

#ORDER ENTRY
response = user1.order_entry(
token = token,
data = {
"client_id" : "[your_client_id]",
"txn_type" : "B",
"exchange" : "NSE",
"segment" : "E",
"product" : "C",
"security_id" : "[your_security_id]",
"quantity" : 1,
"price" : "1.2",
"validity" : "IOC",
"order_type" : "LMT",
"off_mkt_flag" : "0", # False by default
"mkt_type" : "NL",
"good_till_days_date" : "2019-03-29", #(Mandatory when validity is GTD)
}
)
print(response)























#ORDER MODIFICATION
response = user1.order_modification(
token = token,
data = {
"client_id" : "[your_client_id]",
"txn_type" : "B",
"exchange" : "NSE",
"segment" : "E",
"product" : "C",
"security_id" : "[your_security_id]",
"quantity" : 1,
"price" : "1.2",
"validity" : "IOC",
"order_type" : "LMT",
"off_mkt_flag" : "0",
"mkt_type" : "NL",
"good_till_days_date" : "2019-03-29", #(Mandatory when validity is GTD)
"order_no" : "[your_order_no]",
"serial_no" : "1",
"group_id" : ""
}
)
print(response)



























#ORDER CANCELLATION
response = user1.order_cancellation(
token = token,
data = {
"client_id" : "[your_client_id]",
"txn_type" : "B",
"exchange" : "NSE",
"segment" : "E",
"product" : "C",
"security_id" : "[your_security_id]",
"quantity" : 1,
"price" : "1.2",
"validity" : "IOC",
"order_type" : "LMT",
"off_mkt_flag" : "0",
"mkt_type" : "NL",
"good_till_days_date" : "2019-03-29", #(Mandatory when validity is GTD)
"order_no" : "[your_order_no]",
"serial_no" : "1",
"group_id" : ""
}
)
print(response)




























#CO ORDER ENTRY
response = user1.co_order_entry(
token = token,
data = {
"client_id" : "[your_client_id]",
"txn_type" : "B",
"exchange" : "NSE",
"segment" : "E",
"product" : "C",
"security_id" : "[your_security_id]",
"quantity" : 1,
"price" : "1.2",
"validity" : "IOC",
"order_type" : "LMT",
"trigger_price" : 0.0,
"off_mkt_flag" : "0",
"mkt_type" : "NL",
"good_till_days_date" : "2019-03-29", #(Mandatory when validity is GTD)
}
)
print(response)


















#CO ORDER MODIFY
response = user1.co_order_modify(
token = token,
data = {
"client_id" : "[your_client_id]",
"txn_type" : "B",
"exchange" : "NSE",
"segment" : "E",
"product" : "C",
"security_id" : "[your_security_id]",
"quantity" : 1,
"price" : "1.2",
"validity" : "IOC",
"order_type" : "LMT",
"trigger_price" : 0.0,
"off_mkt_flag" : "0",
"mkt_type" : "NL",
"good_till_days_date" : "2019-03-29", #(Mandatory when validity is GTD)
"serial_no" : "1",
"leg_no" : "1",
"group_id" : ""
}
)
print(response)



















#CO ORDER EXIT
response = user1.co_order_exit(
token = token,
data = {
"client_id" : "[your_client_id]",
"txn_type" : "B",
"exchange" : "NSE",
"segment" : "E",
"product" : "C",
"security_id" : "[your_security_id]",
"quantity" : 1,
"price" : "1.2",
"validity" : "IOC",
"order_type" : "LMT",
"off_mkt_flag" : "0",
"mkt_type" : "NL",
"good_till_days_date" : "2019-03-29", #(Mandatory when validity is GTD)
"serial_no" : "1",
"leg_no" : "1",
"group_id" : ""
}
)
print(response)























#BO ORDER ENTRY
response = user1.bo_order_entry(
token = token,
data = {
"client_id" : "[your_client_id]",
"txn_type" : "B",
"exchange" : "NSE",
"segment" : "E",
"product" : "C",
"security_id" : "[your_security_id]",
"quantity" : 1,
"price" : "1.2",
"validity" : "IOC",
"order_type" : "LMT",
"off_mkt_flag" : "0",
"mkt_type" : "NL",
"good_till_days_date" : "2019-03-29", #(Mandatory when validity is GTD)
"profit_value" : 1.2,
"stoploss_value" : 1.3,
}
)
print(response)




















#BO ORDER MODIFY
response = user1.bo_order_modify(
token = token,
data = {
"client_id" : "[your_client_id]",
"txn_type" : "B",
"exchange" : "NSE",
"segment" : "E",
"product" : "C",
"security_id" : "[your_security_id]",
"quantity" : 1,
"price" : "1.2",
"validity" : "IOC",
"order_type" : "LMT",
"trigger_price" : 0.0,
"off_mkt_flag" : "0",
"mkt_type" : "NL",
"good_till_days_date" : "2019-03-29", #(Mandatory when validity is GTD)
"algo_order_no" : "0",
"order_no" : "[your_order_no]",
"serial_no" : "1",
"leg_no" : "1",
"group_id" : ""
}
)
print(response)



















#BO ORDER EXIT
response = user1.bo_order_exit(
token = token,
data = {
"client_id" : "[your_client_id]",
"txn_type" : "B",
"exchange" : "NSE",
"segment" : "E",
"product" : "C",
"security_id" : "[your_security_id]",
"quantity" : 1,
"price" : "1.2",
"validity" : "IOC",
"order_type" : "LMT",
"off_mkt_flag" : "0",
"mkt_type" : "NL",
"good_till_days_date" : "2019-03-29", #(Mandatory when validity is GTD)
"algo_order_no" : "0",
"order_no" : "[your_order_no]",
"serial_no" : "1",
"leg_no" : "1",
"group_id" : "" } ) print(response)






















#CONVERT TO DELIVERY
response = user1.conv_to_del(
token = token,
data = {
"client_id" : "[your_client_id]",
"exchange" : "NSE",
"segment" : "E",
"security_id" : "[your_security_id]",
"quantity" : 1,
"txn_type" : "B",
"mkt_type" : "NL",
"product_from" : "C",
"product_to" : "M"
}
)
print(response)




















#MARKET STATUS
response = user1.market_status(
token = token,
data = {
"exchange" : "NSE",
"segment" : "E",
"mkt_type" : "NL" #(Not mandatory)
}
)
print(response)