Learn Algo Trading with Python | Codes | Youtube Series

how to remove this expiry from code. the below 2 methods you shared didn’t worked for me.

reinstalled & un SSL Updated query.

hi @KalpaTrader

I will have to check this one to give a detailed answer, will update soon.

hi @Abhishek_Konda

to remove expired contracts goto Websocket.xlsx > Column A
and manually remove expired contracts there

@Tradehull_Imran :slight_smile: Everything is working great, but I get this error while executing Dhan_codebase_usage :slight_smile:

Got the instrument file
available_balance
Traceback (most recent call last):
File “C:\Users\zee2z\OneDrive\Desktop\Dhan\3. Session3 - Codebase\Dhan codebase\Dhan_Tradehull.py”, line 139, in order_placement
orderid = order[“data”][“orderId”]
TypeError: string indices must be integers
Traceback (most recent call last):
File “C:\Users\zee2z\OneDrive\Desktop\Dhan\3. Session3 - Codebase\Dhan codebase\Dhan_Tradehull.py”, line 139, in order_placement
orderid = order[“data”][“orderId”]
TypeError: string indices must be integers
Traceback (most recent call last):
File “C:\Users\zee2z\OneDrive\Desktop\Dhan\3. Session3 - Codebase\Dhan codebase\Dhan_Tradehull.py”, line 139, in order_placement
orderid = order[“data”][“orderId”]
TypeError: string indices must be integers

cheack code in line no. 25,26,42,47-49 that’s nifty old expiary. change or comment it then run.

1 Like

i had already changed

Hope you have subscribed for Data API also

yes subscribed, websocket is working fine, excel is updating also, but WHILE RUNNING CODEBASE,
I got these errors
Error at Gettting balance as string indices must be integers
or
ValueError: DataFrame constructor not properly called!

Sorry again repeating.
Hope you have subscribed to Data API and Trading API both.
(You need to subscribe both)

Can please take your file content screenshot and paste here without clientID and Token

Atleast it should show logged in and show the balance. If you put same ID and Token value like websocket file

Try to run it market hours @Zee2Zahid

wait for @Tradehull_Imran sir to reply your question

1 Like

Hi Sir
Session 4 updates.

hi @Zee2Zahid

Do send me complete zip of your folder, and share on the google drive link
share it with: tradehull_mentorship@tradehull.com

1 Like

Session 4 Files

2 Likes

Thank you🙏

Thank you, Sir! I reinstalled everything, updated the new websocket you provided, carefully watched session 3, and took the day off to set it up in the live market. Everything worked flawlessly!

2 Likes

@Zee2Zahid Well done !

hello sir my websocket file is not updating

C:\python\3. Session3 - Codebase\Dhan codebase>“Dhan_codebase usage - Copy.py”
-----Logged into Dhan-----
reading existing file all_instrument 2024-10-17.csv
Got the instrument file
available_balance 1000.0
[0] > ←[33;01mc:\python\3. session3 - codebase\dhan codebase\dhan_codebase usage - copy.py←[00m(←[36;01m24←[00m)()
→ previous_hist_data = tsl.get_historical_data(‘ACC’,‘NSE’,12)
(Pdb++) previous_hist_data = tsl.get_historical_data(‘ACC’,‘NSE’,12)
DataFrame constructor not properly called!
Traceback (most recent call last):
File “C:\Users\new\AppData\Local\Programs\Python\Python38\lib\cmd.py”, line 214, in onecmd
func = getattr(self, ‘do_’ + cmd)
AttributeError: ‘Pdb’ object has no attribute ‘do_previous_hist_data’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “C:\python\3. Session3 - Codebase\Dhan codebase\Dhan_Tradehull.py”, line 222, in get_historical_data
df = pd.DataFrame(ohlc[‘data’])
File “C:\Users\new\AppData\Local\Programs\Python\Python38\lib\site-packages\pandas\core\frame.py”, line 817, in init
raise ValueError(“DataFrame constructor not properly called!”)
ValueError: DataFrame constructor not properly called!
(Pdb++)