I'm doing intraday analysis on low volume stocks. There are just a few trades every day, but a whole host of bids and offers. In order to reduce the sparsity of the time series data I'd like to incorporate the trade, bid and offer price into a single price which I will apply standard time series analysis on. What are some good ways of doing this?
I've time segmented the measures into the standard open, high, low, close price measures. As a first approach I'm going to do analysis only on closing values from each time segment, meaning the last measured value for each measure. Thus I have close_bid
, close_offer
and close_trade
. I'm going to omit the close_
part from now on.
Due to the sparsity any of the prices can be missing (or None
is python speak).
The following (in Python code) is kind of what I'm thinking of doing:
def segment_and_merge_price_tics(price_tics, granularity)
previous_price = None
for t, bid, offer, trade in segment_price_tics(price_tics, granularity):
if trade is not None:
yield t, trade
elif (trade is not None) and (bid is not None):
yield t, (bid + offer)/2
else:
yield t, previous_price
previous_price = price
def segment_price_tics(price_tics, granularity):
# yields t, bid, offer and trade segmented based on granularity
In words: I am suggesting to simply use the average of the closing bid
and offer
price at time t
when there were no trades. I also give preference to actual trades versus bids and offers.
What other strategies are there? I also have access to the depth of the bids and offers. Meaning I know how many give the lowest offer and highest bid for each tic.
Another thing that just occurred to me is that I might want to give preference to latest close price, not categorically the trade price. What if a trade comes in early in the time segment, is it really right to give it preference if there came bid and ask prices in just at the end of the time segment?
Any thoughts are welcomed.