Given that it's possible to download hourly bars, usually with a UTC timestamp, from most brokers, it then becomes possible to create one's own daily bars. I am thinking of doing this and would like to hear opinions on whether it is advisable or not. Specifically, I want to take the UTC timestamp, parse it into both London and New York time taking into account daylight saving time during the summer months, and create daily bars that begin with the opening of the Asian session and end with the closing of the New York session, effectively having bars that run from approximately 5pm to 5pm New York time midweek, and starting at @ 10pm London time on Sundays for Monday's daily bar.

  • $\begingroup$ If you provide a sample of your prepared data I'll try to give you a working solution using Plotly: plot.ly/python/ohlc-charts $\endgroup$ Jul 6, 2018 at 1:06

2 Answers 2


I have implemented something similar to what you want to do. How to implement is highly dependent on what will you do with that OHLC daily data and how much data you are dealing with.

The most viable implementations for that I can see are:

1. MS Excel

If you are doing some spreadsheet analysis or something of the sort and you are only aggregating this data once a day, you can easily do that on MS Excel and it will probably be the easiest and hassle-free path to achieve your goal. (not entirely sure on how to deal with timezones here)

2. Python pandas

Another very easy solution to implement is to use the Python pandas library (https://pandas.pydata.org/ - which I am a huge fan of by the way), and use its aggregation functions. It already has 'OHLC' aggregation built into it (you will probably have to tweak it a little bit to adjust for the timezones - but it is definitely viable, Python has a library called 'pytz' that deals with timezones).

The advantage of using the pandas library is that it is super fast. So if you are dealing with lots of data and MS Excel is not performant enough, I would suggest this route.

3. General Purpose Coding

This was actually the route I personally chose, I did implement it with pandas before, but as I was doing really a LOT of those 'OHLC' aggregations on live streams, performance was not very good as it was always reaggregating the whole data (maybe there is a better way to implement this in pandas, but I don't know).

So to avoid reaggregating the data all the time, I did a somewhat optimized code to aggregate this data and built it exactly customized to my needs.

This is a lot more work intensive than other solutions, and I would only recommend it if you really need performance AND to work with live 'OHLC' aggregation (updating the OHLC aggregation for every tick data for example).

As for timezones I coded in Python and used 'pytz' library.

4. NinjaTrader

I don't know what you do with the 'OHLC' data, but in case you using it for visualizing purposes, I would recommend you to take a look at NinjaTrader. You can do some custom aggregations over there.

  • $\begingroup$ My question was aimed more at the informational advantage such bars could bring rather than the coding of the idea. $\endgroup$ Dec 9, 2017 at 19:18
  • $\begingroup$ +1 for pytz - excellent library for managing any timezone $\endgroup$ Jul 6, 2018 at 1:07

BL: Use open source tools, such as Plotly: https://plot.ly/python/ohlc-charts/

Summary: I think it is important to separate the question from the data preparation and the actual plotting. I would say it is inadvisable to do all the plotting work on your own, unless you're simply interested in the mechanics and the problem itself. If you have prepared the data already, libraries like Plotly will take care of the rest for you, also using pandas: https://plot.ly/python/ohlc-charts/


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.