Error fetching Volume data

adiaro20
I am running below code to fetch real-time data, the code is able to fetch all data except Volume.

tick_data[stock].append({
'instrument_token': tick.get('instrument_token', 'N/A'),
'last_price': tick.get('last_price', 'N/A'),
'buy_quantity': tick.get('depth', {}).get('buy', [{}])[0].get('quantity', 'N/A'),
'sell_quantity': tick.get('depth', {}).get('sell', [{}])[0].get('quantity', 'N/A'),
'bid_price': tick.get('depth', {}).get('buy', [{}])[0].get('price', 'N/A'),
'ask_price': tick.get('depth', {}).get('sell', [{}])[0].get('price', 'N/A'),
'bid_size': tick.get('depth', {}).get('buy', [{}])[0].get('orders', 'N/A'),
'ask_size': tick.get('depth', {}).get('sell', [{}])[0].get('orders', 'N/A'),
'trade_volume': tick.get('volume', 'N/A'),
'timestamp': tick.get('last_time', current_time.isoformat())

I don't know what is wrong, the volume field is empty/NA for all the stocks. Can anyone help ?
Sign In or Register to comment.