Tick data to excel with Date and Time

vippin_nair
vippin_nair edited December 2019 in Python client
Hi Team,

I am trying to store tick information with date and time in excel but unable to do the same.

I am using the below code:
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
I also tried XLWings
Sign In or Register to comment.