
Research
/Security News
Fake imToken Chrome Extension Steals Seed Phrases via Phishing Redirects
Mixed-script homoglyphs and a lookalike domain mimic imToken’s import flow to capture mnemonics and private keys.
utradeconnect
Advanced tools
uTrade Connect Python SDK uTrade Connect encompasses a suite of REST-like APIs designed to expose a broad
spectrum of functionalities crucial for the development of a comprehensive investment and trading platform. These capabilities include the real-time execution of orders,
efficient management of user portfolios, streaming of live market data via WebSockets,
and other features—all seamlessly accessible through a concise and well-structured HTTP API collection.
uTrade (c) 2023. All rights reserved. Licensed under the MIT License.
There are two methods to install uTrade Connect:
Using pip:
uTrade Connect is available on PyPI and can be installed using pip. Ensure you have Python 3.8 or above and internet access. Run the following command in your terminal:
pip install utradeconnect
Using the provided shell script:
Alternatively, you can use the runPackage.sh shell script provided in the project's root directory. This script creates a Python wheel for the project and installs it. To use this method, navigate to the project's root directory in your terminal and run the following command:
sh runPackage.sh
After installation, check the config.ini file in the project's root directory and ensure you add the root url, keep source as WEBAPI, and disable_ssl as true.
There are two methods to configure base parameters for uTrade Connect:
configure an .ini file named as config.ini in your application's working directory, the sample content is as below:
[user]
source=WEBAPI
[SSL]
disable_ssl=True
[root_url]
root="Provided Url"
broadcastMode=Full
uTrade Connect Objectconnect_object = UtradeConnect(
apiKey=<your_api_key>,
secretKey=<your_secret_key>,
source=<source>,
root=<provided_url>,
debug=<debug_mode_boolean>,
disable_ssl=<boolean>
)
API_KEY = "YOUR_API_KEY_HERE"
API_SECRET = "YOUR_API_SECRET_HERE"
source = "WEBAPI"
BASE_URL = "Provided Url"
To securely manage your API credentials, it is recommended to use a .env file in your project
Instantiate a UtradeConnect object by specifying your API appKey, secretKey, source, root[optional] as parameters when employing market APIs.
Conversely, if interactive APIs are preferred, furnish the requisite credentials for interactive functionality.
utradeConnect = UtradeConnect(api_key=API_KEY, secretKey=API_SECRET, source=source, root=BASE_URL)
response = utradeConnect.marketdata_login()
The acquisition of an
access tokenismandatory for client interactive login.
response = utradeConnect.interactive_login(accessToken)
150515121502150715101501
instruments = [
{"exchangeSegment": 1, "exchangeInstrumentID": 22},
{"exchangeSegment": 1, "exchangeInstrumentID": 2885},
]
response = utradeConnect.send_subscription(
instruments=instruments, eventCode=1501
)
instruments = [
{"exchangeSegment": 1, "exchangeInstrumentID": 22},
{"exchangeSegment": 1, "exchangeInstrumentID": 2885},
]
response = utradeConnect.get_quote(
instruments=instruments, eventCode=1501, publishFormat="JSON"
)
Interactive API. The resulting response will include an AppOrderId.
response = utradeConnect.place_order(
exchangeSegment="NSECM",
exchangeInstrumentID=2885,
productType="MIS",
orderType="LIMIT",
orderSide="BUY",
timeInForce="DAY",
disclosedQuantity=0,
orderQuantity=10,
limitPrice=300,
stopPrice=0,
orderUniqueIdentifier="123abc",
clientID="C1",
)
Interactive API. The resulting response will include an AppOrderId.
response = utradeConnect.place_order(
appOrderID = OrderID
clientID="C1",
)
Refer to the Python client postman documentation for the complete list of supported methods.
Transmission of events, including TouchLine, MarketData, CandleData, OpenInterest,
and Index, occurs through the socket. To capture these events, implementation of
the UtradeAPIMarketdataEvents interface is required. The relevant events will
be received through the methods that are specifically overridden within this
interface.
Marketdata socket
# Authenticate to obtain an authorization token if you are not currently logged in.
response = utradeConnect.marketdata_login()
# Store the token and userid
set_marketDataToken = response['result']['token']
set_muserID = response['result']['userID']
socketInstance = MDSocket_io(set_marketDataToken, set_muserID, base_url, broadcast_mode )
Connection
def on_connect():
print('Market Data Socket connected successfully!')
# Subscribe to instruments
response = utradeConnect.send_subscription(Instruments, 1501)
print("Subscription response: ", response)
Disconnection
def on_disconnect(data):
print('Market Data Socket disconnected!')
overridden methods
# Callback on receiving message
def on_message(data):
print('I received a message!')
# Callback for Touchline message with code 1501 FULL
def on_message1501_json_full(data):
print('I received a 1501 Touchline message!' , data)
# Callback for Market depth message with code 1502 FULL
def on_message1502_json_full(data):
print('I received a 1502 Market depth message!' , data)
# Callback for Candle data message with code 1505 FULL
def on_message1505_json_full(data):
print('I received a 1505 Candle data message!' , data)
# Callback for MarketStatus data message with code 1507 FULL
def on_message1507_json_full(data):
print('I received a 1507 MarketStatus data message!' , data)
# Callback for Open interest message with code 1510 FULL
def on_message1510_json_full(data):
print('I received a 1510 Open interest message!' , data)
# Callback for LTP message with code 1512 FULL
def on_message1512_json_full(data):
print('I received a 1512 Level1,LTP message!' , data)
# Callback for Instrument Property Change message with code 1105 FULL
def on_message1105_json_full(data):
print('I received a 1105, Instrument Property Change Event message!' , data)
Transmission of events, including Order, Trade Conversion, Position,
and Trade, occurs through the socket. To capture these events, implementation of
the UtradeAPIOrderdataEvents interface is required. The relevant events will
be received through the methods that are specifically overridden within this
interface.
Interactive socket
# Authenticate to obtain an authorization token if you are not currently logged in.
response = utradeConnect.interactive_login(ACCESS_TOKEN)
# Store the token and userid
set_interactiveToken = response['result']['token']
set_iuserID = response['result']['userID']
socketInstance = OrderSocket_io(set_interactiveToken, set_iuserID, base_url)
Connection
def on_connect():
print('Interactive socket connected successfully!')
Disconnection
def on_disconnect(data):
print('Interactive Socket disconnected!')
overridden methods
# Callback for receiving message
def on_message():
print('I received a message!')
# Callback for joined event
def on_joined(data):
print('Interactive socket joined successfully!' , data)
# Callback for error
def on_error(data):
print('Interactive socket error!' , data)
# Callback for order
def on_order(data):
print("Order placed!" , data)
# Callback for trade
def on_trade(data):
print("Trade Received!" , data)
# Callback for position
def on_position(data):
print("Position Retrieved!" , data)
# Callback for trade conversion event
def on_tradeconversion(data):
print("Trade Conversion Received!" , data)
Example code demonstrating how to use the uTrade API can be found in the utrade-python-api-sdk example directory.
runMarketExample.py: Examples of all the API calls for Interactive as well as Marketdata APIs.runOrderExample.py: Examples of all the API calls for Interactive as well as Marketdata APIs.runOrderSocketExample.py: Interactive Socket Streaming Example.runMarketSocketExample.py: Marketdata Socket Streaming Example.FAQs
A comprehensive Python SDK for the uTrade Connect trading platform.
We found that utradeconnect demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
Mixed-script homoglyphs and a lookalike domain mimic imToken’s import flow to capture mnemonics and private keys.

Security News
Latio’s 2026 report recognizes Socket as a Supply Chain Innovator and highlights our work in 0-day malware detection, SCA, and auto-patching.

Company News
Join Socket for live demos, rooftop happy hours, and one-on-one meetings during BSidesSF and RSA 2026 in San Francisco.