How to return local exchange time in time series?

I use the following code to get data:

df1=ek.get_timeseries('2330.TW',fields=["Open","High","Low","Close","Volume"], start_date = "2018-08-02T01:00:00" ,end_date='2018-10-27T23:00:00',interval='minute')

but it does not return the local time format , it should be Taiwan timezone, how to fix it ,

Thanks

Best Answer

  • BrianLeung
    Answer ✓

    Hi,

    Please try to convert the return dataframe to your desired timezone.

    import pytz

    eastern = pytz.timezone('Asia/Shanghai')

    df.index = df.index.tz_localize(pytz.utc).tz_convert(eastern)

    Thanks.

Answers