XTS Order and LTP issue

Hi Team,

Unable to get ltp for stock and options. As well as not able to place order in stock and options too as per Pypi in XTS.

# Get LTP for multi-stocks
ltp_data = tsl.get_ltp(["YESBANK-EQ","ACC-EQ"])


#place an option order
order_id = tsl.order_placement(stock="NIFTY28APR21000PE",quantity=65,price=100,trigger_price=0,productType="MIS",order_type="Limit",transaction_type="BUY")
print(order_id)


Thanks
Sagar Jajal

Due to recent changes in regulations by Securities and Exchange Board of India, the APIs on the XTS platform have been discontinued from their end, and our accounts are currently not functioning as expected.

At present, the XTS terminal is not allowing the creation of new APIs, and we are also experiencing issues such as OTP delays and panel instability.

We are expecting an update from the XTS platform within the next 1–2 days. Once everything is resolved and the system is stable, we will proceed accordingly with the next steps.

@sagarjajal

I hope you are doing well.

We would like to inform you that the issue was identified to be related to IP configuration at the broker end. To resolve this, we recreated the APIs and successfully bound the system’s IP address with the broker.

Post this update, the login process is functioning correctly, and we are now able to fetch LTP and other required data without any issues.

Kindly let us know if any further checks or validations are required from our end.

Best regards,
Jigyanshu Sharma

Still unable to fetch the stocks data.

`nifty_ltp = tsl.get_ltp(“NIFTY”)
print(nifty_ltp)

ltp_data = tsl.get_ltp([“YESBANK-EQ”,“ACC-EQ”])
print(ltp_data)

Get daily OHLC data for NIFTY

historical_data= tsl.get_historical_data(“NIFTY”, timeframe=“day”, interval=30)
print(historical_data)

Get 5-minute OHLC data for equity

historical_data_5min = tsl.get_historical_data(“RELIANCE-EQ”, timeframe=“5minute”, interval=100)
print(historical_data_5min)

#place an order for NIFTY25MAR22000PE
order_id = tsl.order_placement(stock=“NIFTY26APR24000PE”,quantity=65,price=15,trigger_price=0,productType=“MIS”,order_type=“Limit”,transaction_type=“BUY”)
print(order_id)

Blockquote

`

able to get quote for Nifty and sensex but uanble to place order and get quote of for stocks

Hi @sagarjajal ,

Refer the above link to check the version of the XTS_TradeHull -

https://pypi.org/project/XTS-Tradehull/

Refer this code -


from XTS_Tradehull import Tradehull

tsl = Tradehull(interactive_key="your_interactive_key",interactive_secret="your_interactive_secret",market_key="your_market_key",market_secret="your_market_secret",client_code="your_client_code", root_url = 'root_url_provided_by_brocker')
quotes = tsl.get_quote("YESBANK-EQ")
order_id = tsl.split_order_placement("NSECM",'Limit','YESBANK-EQ',1,tsl.get_ltp('YESBANK-EQ')+0.01,0,'BUY')

Hi @sagarjajal ,

Kindly please upgrade the XTS_Tradehull

Refer the above link to check the version of the XTS_TradeHull -
https://pypi.org/project/XTS-Tradehull/#description

Use this code for the order Placement

from XTS_Tradehull import Tradehull
import pdb
import datetime
from datetime import timedelta
import pprint as pprint
import pandas as pd





pdb.set_trace()

# tsl = Tradehull(interactive_key="your_interactive_key",interactive_secret="your_interactive_secret",market_key="your_market_key",market_secret="your_market_secret",client_code="your_client_code", root_url = 'root_url_provided_by_brocker'
# )
tsl = Tradehull(interactive_key=".......",interactive_secret="..........",market_key=".........",market_secret="......",client_code="........", root_url = 'https://ttblaze.iifl.com')

# For the limit order
order_id = tsl.order_placement(stock='ADANIPORTS26APR1580CE', quantity=1, price=0.05, trigger_price=0, productType='MIS', order_type='Limit', transaction_type='BUY')


Use this code for calling the historical data

historical_data = tsl.get_historical_data(‘ADANIPORTS26APR1580CE’, timeframe=‘5minute’, interval=100)
print(historical_data)


please use the code in this format

from XTS_Tradehull import Tradehull
import pdb
from datetime import datetime
import pprint as pprint
import pandas as pd



tsl = Tradehull(
    interactive_key   ="Key",
    interactive_secret="Secret",
    market_key        ="Market",
    market_secret     ="Marsecret",
    client_code       ="code", 
    root_url          ='https://mtrade.arhamshare.com'
)

historical_data = tsl.get_historical_data("NIFTY", timeframe="5minute", interval=100)
print(historical_data)


historical_data_Adani = tsl.get_historical_data("ADANIPORTS26APR1580CE", timeframe="5minute", interval=100)
print(historical_data_Adani)

d:\Algo Dev Mentorship Program\Session 1’; & ‘c:\Users\user\AppData\Local\Programs\Python\Python312\python.exe’ ‘c:\Users\user.cursor\extensions\ms-python.debugpy-2025.18.0-win32-x64\bundled\libs\debugpy\launcher’ ‘62513’ ‘–’ ‘d:\Algo Dev Mentorship Program\Session 1\Broker Connection\XTS\Newcode.py’
Market and Interactive login successful
picking new file from XTS
Got exception in get_instrument_file as: cannot access local variable ‘response’ where it is not associated with a value
Got the instrument file
date open … volume oi
0 2026-01-14 09:19:59 25648.55 … 0.0 0.0
1 2026-01-14 09:24:59 25684.20 … 0.0 0.0
2 2026-01-14 09:29:59 25704.60 … 0.0 0.0
3 2026-01-14 09:34:59 25737.70 … 0.0 0.0
4 2026-01-14 09:39:59 25733.95 … 0.0 0.0
… … … … … …
4818 2026-04-24 10:49:59 23933.40 … 0.0 0.0
4819 2026-04-24 10:54:59 23920.85 … 0.0 0.0
4820 2026-04-24 10:59:59 23943.35 … 0.0 0.0
4821 2026-04-24 11:04:59 23925.55 … 0.0 0.0
4822 2026-04-24 11:09:05 23925.10 … 0.0 0.0

[4823 rows x 7 columns]
Got exception in get_historical_data as: ‘Description’
Empty DataFrame
Columns:
Index:
PS D:\Algo Dev Mentorship Program\Session 1>

  1. Got exception in get_instrument_file as: cannot access local variable ‘response’ where it is not associated with a value
  2. Then it says got the instrument file
  3. Able to fetch data for Nifty and Sensex
  4. Unable to fetch data for stock


Here at your end instrument file is not downloaded
check the response of the Interactive keys either they are active or not.

interactive keys are active. I double checked with my broker.

Unable to get prices of stocks only, where as i can fetch data for Index i.e. Nifty and sensex.

Unable to place order as well.

pls advise

Hi Sir,

Could you please check which segments are currently active at your end, specifically for ,BSEFO ?

Additionally, we need to verify the interactive login what response we are getting as well, to ensure everything is functioning correctly.

All segments are active.

Interactive login is workling fine, that i confirmed with broker.

Hi Sir,

As observed, the market login and interactive login are working correctly on our end. We are successfully able to:

Fetch the instrument file
Retrieve quotes, LTP, and historical data
Proceed with order placement without any issues

However, in your API setup, it appears that the interactive login is not completing successfully. Due to this, errors are occurring while accessing the instrument file and related functionalities.

For your reference, below is the exact code snippet being used from our end:

from XTS_Tradehull import Tradehull
import pdb
import datetime
from datetime import timedelta
import pprint as pprint
import pandas as pd

tsl = Tradehull(
interactive_key=“YOUR_INTERACTIVE_API_KEY”,
interactive_secret=“YOUR_INTERACTIVE_SECRET”,
market_key=“YOUR_MARKET_API_KEY”,
market_secret=“YOUR_MARKET_SECRET”,
client_code=“YOUR_CLIENT_CODE”,
root_url=“https://ttblaze.iifl.com
)

pdb.set_trace()

quote_data = tsl.get_quote(‘YESBANK-EQ’)
print(quote_data)

ltp_nifty = tsl.get_ltp(“NIFTY”)
print(“NIFTY LTP:”, ltp_nifty)

ltp_yesbank = tsl.get_ltp(“YESBANK-EQ”)
print(“YESBANK LTP:”, ltp_yesbank)

Additionally, we inspected the internal object state for debugging:

tsl.xts1.dict

Snapshot:

{
‘debug’: False,
‘apiKey’: ‘',
‘secretKey’: '
’,
‘source’: ‘WEBAPI’,
‘disable_ssl’: True,
‘root’: ‘https://ttblaze.iifl.com’,
‘timeout’: 7,
‘token’: ‘',
‘userID’: '
’,
‘vendorClient’: True
}

This confirms that:

Base configuration is correct
Token is being generated
Market data APIs are functioning

However, the interactive session is not getting established properly, which is likely the root cause of the issue.

Request you to please:

Recheck the interactive API credentials (key & secret)
Ensure that interactive trading API access is enabled for the account
Validate the interactive login flow from your end

Please let us know if any further details are required.

Best regards,
Jigyanshu Sharma

Hi,

I have opened account in Dhan and everything is working fine in there except long term historical data.

I am unable to fetch details for that.

Thank you

Hi @sagarjajal
try with this updated version

pip install Dhan-Tradehull==3.2.2

Now its done
Done.
Thank you