Get_quote Function usage

Hi sir,

i want to use current day live data . how can u use below function , it is giving me error
def get_quote(self,names):

can you show me sample command.

Hi @virender_singh

for live data both Historical and Live ltp, we can use below code

chart = tsl.get_historical_data(tradingsymbol = 'NIFTY',exchange = 'INDEX',timeframe="5")
ltp   = tsl.get_ltp_data(names = ['NIFTY 05 DEC 24000 CALL', 'NIFTY 05 DEC 24000 PUT'])
data  = tsl.get_historical_data(tradingsymbol = 'ACC'     ,exchange = 'NSE'  ,timeframe="15")

do use the latest codebase : Dhan_Tradehull_V2.py - Google Drive

1 Like

Also, do post all your queries on this thread: Learn Algo Trading with Python | Codes | Youtube Series

This helps me keep track of questions and ensures other traders benefit as well, as they might be facing similar issues.

.

Thanks for replying.
But if i want to capture total volume of a day till time and also want to know days high low. How can i do it ?

I am directly calling now marketfeed and storing in mongodb and calling from there.

But do you know any local way then storing to cloud.

Hi @virender_singh

use below code

quote_data = tsl.get_quote(names = ['NIFTY 26 DEC 23950 CALL'])

chart      = tsl.get_historical_data(tradingsymbol = 'NIFTY 26 DEC 23950 CALL',exchange = 'NFO',timeframe="5")
chart      = chart.set_index(chart['timestamp'])

todays_chart = chart['2024-12-24 09:15:00+05:30':]



day_high = quote_data['NIFTY 26 DEC 23950 CALL']['ohlc']['high']
day_low  = quote_data['NIFTY 26 DEC 23950 CALL']['ohlc']['low']
volume_of_a_day_till_time  = todays_chart['volume'].sum()


Also, this was a good question,

Also, do post all your queries on this thread: Learn Algo Trading with Python | Codes | Youtube Series

This helps me keep track of questions and ensures other traders benefit as well, as they might be facing similar issues.