I dont think this is available via api. But it is very easy to compute.
I have this method in python that I use and works very well. You can refer to it and modify it to your needs. For eg you can add a fourth parameter for the category of trade - Intraday equity / Delivery equity / F&O - Futures / F&O - Options etc and change the calculations based on this fourth parameter.
I have this method in python that I use and works very well. You can refer to it and modify it to your needs. For eg you can add a fourth parameter for the category of trade - Intraday equity / Delivery equity / F&O - Futures / F&O - Options etc and change the calculations based on this fourth parameter.
def calcchgsOpt( buyprice , qty , sellprice ) :
calcparams = {}
calcparams[ 'buyprice' ] = buyprice
calcparams[ 'sellprice' ] = sellprice
calcparams[ 'qty' ] = qty
calcparams[ 'buyturnover' ] = Position[ 'price' ] * Position[ 'orderqty' ]
calcparams[ 'sellturnover' ] = tick[ 'last_price' ] * Position[ 'orderqty' ]
#Turnover
calcparams[ 'Turnover' ] = calcparams[ 'buyturnover' ] + calcparams[ 'sellturnover' ]
#brokerage
calcparams[ 'brokerage' ] = 40
#STT - 0.0625% on sell side (on premium)
calcparams[ 'STT' ] = calcparams[ 'sellturnover' ] * 0.0625 / 100
#ExcTranTax - 0.05% (on premium)
calcparams[ 'ExcTranTax' ] = np.round( calcparams[ 'Turnover' ] * 0.0505/100 , 2 )
#ClearingChg
#SEBIchg - Rs 10/ crore
calcparams[ 'SEBIchg' ] = np.round( calcparams[ 'Turnover' ] / 10000000 * 10 , 2 )
#GST
calcparams[ 'GST' ] = ( calcparams[ 'brokerage' ] + calcparams[ 'SEBIchg' ] + calcparams[ 'ExcTranTax' ] ) * 18 / 100
#StampDuty
calcparams[ 'StampDuty' ] = np.round( calcparams[ 'buyturnover' ] * .003 / 100 )
#TotalChg
calcparams[ 'TotalChg' ] = np.round( calcparams[ 'brokerage' ] + calcparams[ 'STT' ] + calcparams[ 'ExcTranTax' ] + calcparams[ 'SEBIchg' ] + calcparams[ 'GST' ] + calcparams[ 'StampDuty' ] , 2 )
#PtsBrkEvn
calcparams[ 'PtsBrkEvn' ] = np.round( calcparams[ 'TotalChg' ] / calcparams[ 'qty' ] , 2 )
#calcparams[ '' ]
print( f"buyprice: { calcparams[ 'buyprice' ]}" )
print( f"sellprice: { calcparams[ 'sellprice' ]} ({ sellprice - buyprice})" )
print( f"orderqty: { calcparams[ 'qty' ]}" )
print( f"buyturnover: { calcparams[ 'buyturnover' ]}" )
print( f"sellturnover: { calcparams[ 'sellturnover' ]}" )
print( f"Turnover: { calcparams[ 'Turnover' ]}" )
print( f"brokerage: { calcparams[ 'brokerage' ]}" )
print( f"STT: { calcparams[ 'STT' ] }" )
print( f"ExcTranTax: { calcparams[ 'ExcTranTax' ]}" )
print( f"SEBIchg: { calcparams[ 'SEBIchg' ]}" )
print( f"GST: { calcparams[ 'GST' ]}" )
print( f"StampDuty: { calcparams[ 'StampDuty' ] }" )
print( f"TotalChg: { calcparams[ 'TotalChg' ]}" )
print( f"PtsBrkEvn: { calcparams[ 'PtsBrkEvn' ]}" )
#print( f": { calcparams[ '' ]}" )
return ( calcparams )
# END def calcchgsOpt
if len( sys.argv ) < 4 :
print( "Insufficient command line parameters" )
print ( "" )
print( f"Usage: python3 { sys.argv[0] } <buy price> <order quantity> <sell price>" )
sys.exit()
This is what the output looks like: