1
$\begingroup$

Having been influenced by de Prado's Advances in Machine learning book, I've set out to build the dollar bars (in which each bar represents a set dollar amount of transactions in the security) that he endorses as a superior data structure to conventional time-based bars, mostly for its more stationary, iid, and statistically useful properties.

Unfortunately, I just don't have the tick data necessary to really put the idea to use.

I do, however, have an abundance of 1-minute data, which has me wondering the most faithful method I might use to approximate true dollar bars.

My plan is to:

  • take the average of the OHLC of each minute bar,
  • multiply that by the volume of that bar,
  • assign that dollar value to the bar,
  • and then begin aggregating the bars to the desired dollar amount from the start of the original time series to its end.

I realize, though, that this might introduce slightly over/undershooting the target dollar amount for each bar, depending on that target dollar amount per bar. Is such an approach problematic or otherwise unworthy, given de Prado's intentions for the dollar bar? Is there a better way to go about it?

$\endgroup$

2 Answers 2

1
$\begingroup$

The following python package, mlfinlab, provides an implementation for both standard and information-driven bars. The good news is that you won't have to implement the techniques from scratch and they will also work on minute time stamps.

Regarding how to approximate the VWAP of a minute bar:

  1. Perhaps it's better to take the average (midpoint) of only the low and high. If you take the average of OHLC then you add additional assumptions about price evolution.

Applying dollar bars to minute data may make your data less heteroscedastic and you would probably see a return to normality in the returns. An empirical study would prove useful.

$\endgroup$
7
  • $\begingroup$ Thanks for this- I will take your advice re: using the average of HL instead of OHLC. I had actually begun using other mlfinlab functions on my own improvised dollar bar function, as I didn't see how mlfinlab's current get_dollar_bars() function would work with minute data as you say it would (their documentation specifies imported data be in the [date_time, price, volume] format, which would seem to not work with minute data in OHLC form. Are you sure minute data can in fact be used with that function? $\endgroup$
    – pmse234
    Commented Feb 5, 2020 at 7:10
  • $\begingroup$ Also- wouldn't less heteroscedastic data be advantageous anyway, especially given other mlfinlab functions like the one for Fractionally Differentiated features, which seek to make price series input more stationary (albeit without losing too much "memory")? $\endgroup$
    – pmse234
    Commented Feb 5, 2020 at 7:17
  • $\begingroup$ A1: So in the OHLC context you would create a new df which is date, close, volume. You would have to add the assumption that the last price in the minute bar is the "tick" price, this comes with the added assumption that the volume was executed at the close price. (Yes this isn't ideal but you are already using a time stamp which isn't ideal (minute OHLC)) $\endgroup$ Commented Feb 6, 2020 at 0:21
  • $\begingroup$ A2: Not sure I understand? Less heteroscedastic data is desireable, as per my comment. Did you mean to say the opposite? Currently, your statement is in agreement with mine. $\endgroup$ Commented Feb 6, 2020 at 0:23
  • $\begingroup$ My apologies; I misinterpreted- when you wrote: "Applying dollar bars to minute data may make your data less heteroscedastic," I don't know why I read that as sounding like a drawback. In any case, I am thankful that I can proceed with my minute data, and I thank you for your input! $\endgroup$
    – pmse234
    Commented Feb 6, 2020 at 8:05
0
$\begingroup$

I am no pro on the topic but i developed the following algorithm to solve exactly your problem. It might be a bit naive, but i'd still love to learn the ins and outs.

I am basically making an educated guess of the position in time of the open, high, low and close value of the candle: If open < close the order is [open, low, high, close] else [open, high, low, close].

I then estimate the timestamp by adding a quarter timeframe meaning 15 seconds for 1min bars to each "tick" after the open.

To calculate dollar bars i split the candles volume by 4.

Do you think this makes sense?

For implementing: pd.melt does the job :)

$\endgroup$

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.