Getting Error at Option Chain as {'status': 'failure', 'remarks': {'error_code': None, 'error_type': None, 'error_message': None}, 'data': {'data': {'805': 'Too many requests. Further requests may result in the user being blocked.'}, 'status': 'failed'}}
Getting Error at Option Chain as {'status': 'failure', 'remarks': {'error_code': None, 'error_type': None, 'error_message': None}, 'data': {'data': {'805': 'Too many requests. Further requests may result in the user being blocked.'}, 'status': 'failed'}}
Getting Error at Option Chain as {'status': 'failure', 'remarks': {'error_code': None, 'error_type': None, 'error_message': None}, 'data': {'data': {'805': 'Too many requests. Further requests may result in the user being blocked.'}, 'status': 'failed'}}
@Tradehull_Imran As Iâm calling inside the loop for each index. Getting above. So, what should be the ideal time difference between the current call & next call? OR is there a specific limit for it?
Very Good Morning Sir,
Thank you very much for your code with EMA Strategy & Back testing code.
Such Codes from Coding Experts will be very much helpful to the Non-Coders like me in the Group sir.
As you have suggested âIn real time we need to use a while loop & in back testing where the data is already available we iterate the data using for loop. As time permits, will add more information, by late nightâŚâ
Truly speeking, if you can give the code with âwhileâ loop also, it will be really greatful.
Infact we appreciate all the Cooperative Coders, if they can provide âFULLY FUNCTIONAL ALGOSâ on this platform.
your tsl.cancel_all_orders() is not working ! This function too is so intermittent, sometimes it suddenly stops working which is riciculous. The entire stop loss and exit logic is based on this and it is not working, resulting in problems.
The output of the call is just an empty set as below:
op = tsl.cancel_all_orders()
print("tsl opp: ", op)
â tsl opp: {}
Can we get (2023-24) OHLC data 5 minute interval of Nifty in .csv ..?
And,
2025 Jan - Mar OHLC data 5 minute interval of Nifty in .csv ..?
Can you share that file here for all please.?
i didnt get this⌠still,
Real time example is with while loopâŚso which code are u asking with while loop?
Back testing is with for loop, the reason is that for any kind of looping, one need 3 input parameters, first where to start from, where to end , and increment factor⌠in a for loop all these three are mentioned in for statement, where as with while or do..while (an another form of looping) we need to mention these parameters at various stages in the loop, so it is easy to do with for loop. In real time, while is used because -
Because the market is running continuously.
You want to keep polling the API every few seconds or minutes to check for trade opportunities.
This creates an infinite loop that simulates continuous watching of the market during trading hours.
In back testing, you already have the full historical data in a DataFrame.-
You need to simulate what would happen if you were watching the market bar-by-bar.
So you loop for each row (or candle), one at a time, just like how the market would have behaved.
Hope, that why while and for is used is clear by nowâŚ
what does fully functional algos means in ur sense⌠does u mean with logging, multiple client handling, Excel entries etc etcâŚ
It will take time⌠I can help you in this piece by piece or with a simpler example like i did with this back testing one, you will have to assemble it in your code⌠I am running my algo on 2-3 accounts⌠I can share the code with simple breakout exampleâŚ
one more thing, I am not a good coder, but a good assembler and searcher(googler) ⌠I very well know which piece of code is required to get my job done, then this piece i get it using google, then simply changing the names of variables my job is done.
You can ask for anything, if I had it will surely shareâŚ
will it be ok if I share the 5 min data since 2020 till 07-Feb-2025..
get it from here -
Hope u know how to download from such sitesâŚ
Also, I will be having data for NIFTY, BNF, SNX, BANKEX, MIDCPNFTY since 2020- till apr 2025, in couple of days, mostly bt this week endâŚ
While testing the Algo âDownload_Historical_dataâ of Session 9, I am getting the error sir.
Plaese Suggest.`C:\Users\LENOVO PC\Desktop\RP\Dhan Algo\DHAN Advanced Algo Trading Series\Session 9\Session 9\Dhan Option Chain\Dhan Option Chain>py â1. Download_Historical_data.pyâ
Codebase Version 3
-----Logged into Dhan-----
This BOT Is Picking New File From Dhan
Got the instrument file
Traceback (most recent call last):
File â1. Download_Historical_data.pyâ, line 33, in
ATM_Strike = round(ATM_close/step)*step
NameError: name âATM_closeâ is not defined
C:\Users\LENOVO PC\Desktop\RP\Dhan Algo\DHAN Advanced Algo Trading Series\Session 9\Session 9\Dhan Option Chain\Dhan Option Chain>py â1. Download_Historical_data.pyâ
Codebase Version 3
-----Logged into Dhan-----
reading existing file all_instrument 2025-04-12.csv
Got the instrument file`
Kindly provide dhan trading symbol names to get index values for:
NIFTYAUTO
NIFTYIT
NIFTYFMCG
NIFTYMETAL
NIFTYPHARMA
NIFTYREALTY
NIFTYMEDIA
NIFTYHEALTHCARE
thanks for the reply, i have now switched to visual studio, i am now getting a different error as shown below in second screenshot. installation was successful for dhanhq as per steps followed in following api doc ( dhanhq ¡ PyPI )
Very Good Evening Sir, I would like to share my notes out of your Video series with all learners who are interested.
I need your verification of my âNOTESâ and permission for the same to share on this platform sir.
Herewith I am sending the abstract notes I have prepared from SESSION-10 and SESSION-11 sir. Please correct for any errors sir.
VBR Prasad
SESSION-10 - âRP-Tick by Tick data storageâ Part-1
âDt.03-04-2025âSESSION 10----
If you are a Scalper, you need Tick by Tick Data
Copy Files âOption_Selling_Algoâ and âLive_Trade_Dataâ files from Session 8
Rename the file âOption_Selling_Algoâ as âTick By Tick Data Storageâ
import pdb
import time
import datetime
import traceback
from Dhan_Tradehull import Tradehull
import pandas as pd
from pprint import pprint
import talib
import pandas_ta as ta
import xlwings as xw
import winsound
In Python: The Following Code line is called âLIST COMPREHENSIONâ, which offers a shorter syntax when you want to create a new list based on the values of an existing list. Example: Based on a list of fruits, you
[strike + x*50 for x in range(-20, 20)] # strike stands for strike, 50 stands for Nigty Lot size, âxâ stands for first number: -20
(pdb++) [strike + x*50 for x in range(-20, 20)]
(pdb++) strike + -20*50 # Gives the value at -20.
Now I want to rename the above line as below:
all_strike = [strike + number*50 for number in range(-20, 20)] # 2. finds all 40 strikes
all_ce_names = [strike for strike in all_strike]
(pdb++) all_ce_names = [strike for strike in all_strike]
all_ce_names = ["NIFTY 09 APR " + str(strike) for strike in all_strike] # Now I have added another string âNIFTY 10 APRâ to the above line of code.
(pdb++) all_ce_names = [âNIFTY 09 APRâ + str(strike) for strike in all_strike]
all_ce_names = [âNIFTY 09 APR " + str(strike) + " CALLâ for strike in all_strike] # Now I have added another string âCALLâ to the above line of code.
(pdb++) all_ce_names = [âNIFTY 10 APRâ + str(strike) for strike in all_strike]
SESSION-10 - PART-2 - âRP-How to deploy Algo on the Serverâ
âSession 10 â Part 2 ------
Deployment of Algo on server
Overheat of Laptop
Fluctuations in Internet Broad Band
You need peace after deploying Algo without any hurdles.
Whatâs a Server?
(Kampstaal)
There will be 7 passes to reach Server
Bnaks, Colleges, Hospitals and several companies use Server
Dhan also uses remote Server, located in Data Centres.
You also call it as Cloud.
Several Companies like AWS by Amazon, Google, Microsoft, Azure are all exmaples of Cloud Computing Platforms.
Now letâs start using AWS beloging to Amazon here.
Sign into the console.amazon
Search for lightstall
Browser window will open for lightstall
Click on âcreate instanceâ button, means a computer / server.amazon
Select your platform as Windows
Click on âWindows Server 2019â
Now select the size of Server you require.
Positively Select 2GB Memory , 60GB SSD Storage (90 days free), which costs $22/- per month.
Then Click on âCreate instanceâ button at the bottom
For the first time it takes few minutes to get your âServerâ ready.
Wait until it indicates the stage of âRunningâ.
Now click on the âServerâ window.
At the bottom of the window,
You will be provided with ID & Address, in the left side box.
You will be provide with Userbane & Password in the rigt side box.
Also don't forget to retrieve the default password and save it for further usage.
Next Step is to Connect Remote Desktop
Which gives you a box in which you have to fill all the credentials,
Save the connection settings.
Once again get the Remote Desktop, and click on âConnectâ.
It will ask for the password, which you have to fill in and get connected.
And click on âRemember meâ , to get automatically get connected.
Now your server is ready to use.
Downlod Google Chrome on your laptop and paste in the server
ChromeSetup box will appear on the Server desk
Right click and âRin it as Administratorâ
Now copy and install all files to run the algo
Install Python and required libraries, including sublime text
Copy and paste the required Session file to run your algo
You can procede to run your algo by using âcmdâ propt
After starting the algo, you can close your server, but remember your algo keeps running
NOTE: REMEMBER THE ALGO IN THE CLOSED SERVER WILL KEEP RUNNING, EVEN AFTER YOU CLOSE THE SERVER
if you want to open the server again at your convenient time, you can open it with your credentials
NOW LET US TAK ABOUT BILLING
Remember that as long as your Server is in the state of âRunningâ you will be billed
AWS will charge around Rs.3,500/- per month for a 4GB Memory Server
Say , if you want to save on the Monthly Flat charges of Rs.3,500, You can do it
Say if you can start and stop the Sever as per the trading hours:
Hourly Cost = Monthly Cost / Total Hours in a month = Rs.3500 / 720 Hours = Rs.4.86/- per Hours
Now if you calculate for actual usage hours:
Final Cost = Hourly Cost x Hours used = Rs.4.86 x 132 Hours = Rs.642/- per month # 22 Days x 6 hours per day = 132 Hours
Remember instead of paying RS.3,500/-, you can only pay Rs.642/- per month, provided you start and stop the server every day after market hours
This matters a lot to every small trader investing small capital initially
Remember to take a snapshot after stopping the server, which will be utilized to start on next days
EXAMPLE:
This is a one time process
Monday - Install --- Complete algo.. (Store ID and Password)
Monday : 3:30 pm : | stop the server and take snapshot
Choose 'Snapshots' from the available Menu and click on 'Create snapshot' and Name it
Monday : 4:00 pm : | Delete your server by Clicking on the top right hand corner, you can choose the delete option
Further Daily process:
Create instance from your snapshot
Now the server will start by filling our credentials
Use the server during the market hours and delete the srver
REMEMBER THAT THERE IS NO NEED TO TAKE SNAPSHOT EVERYDAY, THE SAME SNPSHOT WILL BE USEFUL EVERY DAY
THIS PROCEDURE SHOULD CONTINUE ON ALL TRADING DAYS, AS PER YOUR WISH
DO REMEMBER THAT YOU CAN CHOOSE A BETTER SUBSCRIPTION OF 8GB WILL BE BETTER, AS YOU CAN SAVE ON THE ABOVE METHOS
NOW LET US KNOW ABOUT HYPERCARE
develop the Algo
pdb level testing
Test the algo atleast for 14 consecutive days
If any error occurs during the testing period, resolve it start Re-Testing process