[Feature Request] Nsetools_get_quote is not fetching Delivery data and Delivery %

Added this new feature.

Do note - same can be achievable using Bhavcopy function as shown here NSEPy Functions - Unofficed

I modified the nse_quote() function to

def nse_quote(symbol,section=""):
#https://forum.unofficed.com/t/nsetools-get-quote-is-not-fetching-delivery-data-and-delivery-can-you-include-this-as-part-of-feature-request/1115/4    
    symbol = nsesymbolpurify(symbol)

    if(section==""):
        if any(x in symbol for x in fnolist()):
            payload = nsefetch('https://www.nseindia.com/api/quote-derivative?symbol='+symbol)
        else:
            payload = nsefetch('https://www.nseindia.com/api/quote-equity?symbol='+symbol)
        return payload
    
    if(section!=""):
        payload = nsefetch('https://www.nseindia.com/api/quote-equity?symbol='+symbol+'&section='+section)            
        return payload

Now, if you do

print(nse_quote("INFY","trade_info"))

You get the desired info -

{'noBlockDeals': True, 'bulkBlockDeals': [{'name': 'Session I'}, {'name': 'Session II'}], 'marketDeptOrderBook': {'totalBuyQuantity': 0, 'totalSellQuantity': 1060, 'bid': [{'price': 0, 'quantity': 0}, {'price': 0, 'quantity': 0}, {'price': 0, 'quantity': 0}, {'price': 0, 'quantity': 0}, {'price': 0, 'quantity': 0}], 'ask': [{'price': 1227.55, 'quantity': 1060}, {'price': 0, 'quantity': 0}, {'price': 0, 'quantity': 0}, {'price': 0, 'quantity': 0}, {'price': 0, 'quantity': 0}], 'tradeInfo': {'totalTradedVolume': 5680192, 'totalTradedValue': 69680.62, 'totalMarketCap': 50902831.74, 'ffmc': 43796057.9853049, 'impactCost': 0.01}, 'valueAtRisk': {'securityVar': 10.67, 'indexVar': 0, 'varMargin': 10.67, 'extremeLossMargin': 3.5, 'adhocMargin': 0, 'applicableMargin': 14.17}}, 'securityWiseDP': {'quantityTraded': 5680192, 'deliveryQuantity': 3669872, 'deliveryToTradedQuantity': 64.61, 'seriesRemarks': None, 'secWiseDelPosDate': '26-APR-2023 EOD'}}
1 Like