It looks like you're new here. If you want to get involved, click one of these buttons!
ticks_storage = pd.DataFrame()
timeframe = 15
temp = {}
def on_ticks(ws, ticks):
for name in trd_portfolio:
token = trd_portfolio[name]['token']
for single_company in ticks:
if single_company['instrument_token'] == token:
temp[single_company['timestamp']] = single_company
df = pd.DataFrame.from_dict(temp, orient='index')
ohlc = df['last_price'].resample(str(timeframe)+'Min').ohlc()
print(ohlc)
tick=pd.DataFrame(ohlc)
tick.to_excel('Tick.xlsx', sheet_name='Tick', index=False)
Output has Open,High,Low and Close but not datetime