A complete guide to Algorithmic Trading for Beginners🚀

API Trading / Algorithmic Trading is a tricky and a little difficult endeavor. Mastering this realm demands not just trading skills but also the ability to translate them into a workable program. While the intersection of trading and coding is niche, the interest is soaring.

To demystify API & Algo Trading, we’ve crafted a video series covering basics, coding strategies, and more.

We will be regularly updating this thread with our regular video links, take your feedback, and build India’s best community of algo trading enthusiasts.

We have released two sessions already :point_down:

  1. What is Algorithmic Trading ? Basics of APIs Explained in Hindi
  1. Beginners Guide to Installing DhanHQ APIs for API Trading
  1. Static Vs. Dynamic APIs Explained for Beginners
  1. How to Fetch Multiple Data at Once?
  1. How to Place Orders and Key Functions
  1. Time-Based Trading Strategies for Beginners

  1. Introducing Dhan Websockets for Super Traders

  1. How to use DhanHQ APIs for Order Execution & Candle Formation

  1. Build a Time-Based Straddle Strategy with DhanHQ APIs

  1. Build Algo Trading Strategies with Live Market Feed

Happy API Trading!

4 Likes

Thanks for this series. Kind request to make in English language also.

1 Like

Yes, its on our to-do list. For now, in a few weeks, we will add English subtitles to the videos.

The third video of our Get Started with API Trading video series is now live!

Static v/s Dynamic APIs explained! Watch now :point_down: :rocket:

1 Like

Hi Rahul
When would be next session uploaded?

sir plz take a live session so we can clarify doubts about learning API

Hi @ajaygupta19982

We will soon release the next video, contemplating the possibility of uploading multiple episodes on the same day to maintain your continuous learning experience. The entire series is set to launch within this week only.

2 Likes

Good suggestion. It’s in our to-do list & we will let you know once we decide on the intricacies.

1 Like

Hi @ajaygupta19982 @Trader_Rdx

We have released three more episodes on our YouTube channel.

How to Fetch Multiple Data at Once?

How to Place Orders and Key Functions with DhanHQ APIs

Time-Based Trading Strategies for Beginners

Enjoy Learning!

2 Likes

Sir,
When I run the code, it shows an error No module named ‘websockets’, full details as shown below

Traceback (most recent call last):
File “d:\py\sample_dhan.py”, line 1, in
from dhanhq import dhanhq
File “C:\Users\rajee\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\dhanhq_init_.py”, line 2, in
from dhanhq.marketfeed import DhanFeed
File “C:\Users\rajee\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\dhanhq\marketfeed.py”, line 9, in
import websockets
ModuleNotFoundError: No module named ‘websockets’

Install websockets as well
pip install websockets

Then it will work

Rahul, Please also let us know how to algo trading by considering MACD and signals

Is it feasible and supported by dhanhq api

thanks for the support

Yes its absolutely feasible. The baseline remains consistent, making this execution strategy both supported and practical.

For MACD signal generation we can’t share the code as we haven’t created any libraries for any indicators yet. As far as I understand, to get MACD signals you will need three things:

  • Historical data ( where we provide daily timeframe )
  • Indicator Scrip ( there might be open source codes available for it & you can customize as per your needs)
  • Live Market Feed ( you will get Live OHLC data using which you can get Live MACD values which can act as signals to place trades)

Request to community members as well if they know the open source codes for the indicators scrip, please do share the links.

Subject: A Heartfelt Thank You :pray:

Dear [Archit],

I hope this message finds you well.

I wanted to take a moment to express my deepest gratitude to you. Your guidance and expertise during the algo training sessions have been invaluable to me. I am incredibly thankful for the knowledge and skills you’ve imparted, which have not only enhanced my understanding but also contributed to my success.

Words cannot fully express how grateful I am for your patience, dedication, and support throughout this journey. Your encouragement has meant the world to me, and I feel truly blessed to have had the opportunity to learn from someone as knowledgeable and inspiring as you.

Thank you for believing in me and pushing me to strive for excellence. I am filled with a sense of accomplishment and confidence, all thanks to your exceptional mentorship.

Wishing you continued success and fulfillment in all your endeavors.

With heartfelt appreciation,

Ashutosh Singh :star2:

1 Like

You can use TALIPP Library for MACD Signal.
You need to store historical data in a dataframe and then using DhanAPI Market Feed monitor current price and wait for signal. You might also need Pandas library as well.

Someone please solve this issue, typed exactly what was given in video from Dhan, still showing me Error in python

1 Like

I am able to find the pip version but not python. Could someone please help me fix this?

Hello @Kelvin

Can you go to control panel, and check installed programs - if you can find Python installed there.