Learn Algo Trading with Python | Codes | Youtube Series

Hi @iabhinavshukla ,

Refer the below thread:

Hi @Mehul_Sheth ,

tsl.get_intraday_data was a old method to get historical data… it gives data only for today, which makes problem if we want to create indicators on it.

Dhanhq was upgraded and now we can use get_historical_data which gives data for last 5 working days.

Retrieve historical or intraday data:

Get Historical Data

  • tsl.get_historical_data(tradingsymbol: str, exchange: str, timeframe: str, debug: str = “NO”)
    • Arguments:
      • tradingsymbol (str): The trading symbol for the instrument you want to fetch data for (e.g., ‘NIFTY’, ‘ACC’).
      • exchange (str): The exchange where the instrument is traded (e.g., ‘NSE’, ‘INDEX’).
      • timeframe (str): The timeframe for the data. It can be:
        • ‘1’ for 1-minute candles
        • ‘5’ for 5-minute candles
        • ‘15’ for 15-minute candles
        • ‘25’ for 25-minute candles
        • ‘60’ for 60-minute candles
        • ‘DAY’ for daily candles
      • debug (optional, str): Set to “YES” to enable detailed API response logging. Default is “NO”.
    • Sample Code:
data = tsl.get_historical_data(tradingsymbol='NIFTY', exchange='INDEX', timeframe="DAY") 
data = tsl.get_historical_data(tradingsymbol='ACC', exchange='NSE', timeframe="1")

@Tradehull_Imran , till friday it was running fine, now Getting below error:

Traceback (most recent call last):
File “MACD_strategy_Nifty_1min.py”, line 73, in
all_ltp = tsl.get_ltp_data(names = watchlist)
AttributeError: ‘numpy.bool_’ object has no attribute ‘get_ltp_data’

can u help me fix this issue…?

Hi @Sahil_Malhotra ,

Can you share your whole code to review the same?

Hi @Tradehull_Imran sir,

trying to fetch option chain data for ‘CRUDEOIL’

ATM_Strike, option_chain = tsl.get_option_chain(Underlying= ‘CRUDEOIL’, exchange = “MCX”, expiry= 0, num_strikes= 20)

getting this error :
Getting Error at Option Chain as No option chain data available for the CRUDEOIL

Hi, has there been any update on bracket order placement pls ? This is a much needed feature to ensure trades are well risk managed !

Hii @Tradehull_Imran sir,

Sir, can we get order book data in algo trading? Specifically, how many orders are placed at different levels for limit orders and market orders? If so, could you please provide more details?

By the way, sir, this has been an incredibly interesting journey—from staring at the laptop screen for 4–5 hours, dealing with losses, to transitioning into algo trading, which is more accurate, fast, disciplined, and efficient. Your guidance has truly made a difference, and we’re grateful for everything you’ve taught us.

With algo trading, it feels like we’ve moved from emotional decision-making to a structured, rule-based approach that eliminates impulsive trades and optimizes execution speed. The reliability of data-driven strategies has made the process smoother, reducing stress and increasing consistency.

Thank you for sharing your knowledge and helping us improve our trading approach!

Hi, Siddhesh, from where to download corresponding file

  1. TA_Lib-0.4.24-cp38-cp38-win_amd64.whl
  2. Twisted-20.3.0-cp38-cp38-win_amd64.whl
    for python-3.13.3-amd64
    please suggest.
    Thanks

Hi, Very Good Afternoon, Can you please confirm your code of Trailing_stop_loss, is functional.
I am a Non-Coder, trying to learn , Can you please help me out with some Functional Codes, especially Options trading, And Intraday trading of Equity segment, with your terms please.
Also please let me know about your success in implementing the Trailing stop loss code (Dt.07/02/2025)
VBR Prasad, 9949324446