As someone who has contributed to literature, I am purposefully vague with the use of mid price. Not that I don't define it but that it is difficult to state which definition is the best in which context. Here are an example of a few definitions of mid price:
Last Trade: The physical price at which the most recent trade physically took place. This is ...
Question 1. Actually, the assumption of trade data format is that you have timestamp, size and price (not bid/ask) of trade. Sometimes, trades(ticks) are included to Level 1 data (also called BBO) which assumes bid and ask information. However, bars are constructed on trades, not quotes.
Question 2. Yes, T value is derived from equation 3. The process is ...
Data that includes the names of the parties is definitely not freely available, only exchanges would have it and they will share it only with their regulators.
Regarding data without names, that is called tick-data as LocalVolatility states. To the best of my knowledge, you need to pay for this data.
In other words, what you are looking for is a Tick data. It needs resources to catch this data and so it won't be available for free but its available on demand from some websites. I refer you two of them here
Intrinio and Tick Data
I don't use quantmod, but you can aggregate the data using R's tapply.
Assume you have your tick data, and these are sorted in time. Let's make up some data.
ticks <- cumprod(1 + rnorm(100020, sd = 0.001))
Compute the number of bars.
n <- ceiling(length(ticks)/500)
bars <- rep(1:n, each = 500)[seq_along(ticks)]
Compute open, high, low close for ...
You dont need to buy data if you need any stock from NYSE or NASDAQ. There are plenty options available as your tick time is not so small(1 hr).
1. As suggested by @ eSurfsnake you can try pulling hourly data from Quandl with API(Free).
2. Alphavanatge API is free for smaller tick time also. For your reference
Alpha vantage API Not working for NSE while ...
There is an open source hedge fund project which is implementing the ideas contained in the book and which has a github where you can see their code implementation of tick bars. Personally I always find it extremely enlightening to see code rather than mathematical symbolism, and maybe this will be the same for you. On the linked pages there are also links ...
In a dealer market the public is always overcharged when they try to buy, and receives less than value when they try to sell (the dealer makes a living from the difference). It is reasonable to assume the midpoint between these prices, i.e. between the bid and the ask, represents the unobservable "fair value" for a small amount of the asset. It is just an ...
Here's what I ended up using, thanks to Enrico.
My data had CL.ticks (DateTime and Open) e.g. CL.ticks <- CL[c("DateTime", "Open")]
Where DateTime is POSIXct
# Combine -----
tickCount = 500
ticks = CL.ticks$Open
## get num bars
n <- ceiling(length(ticks)/tickCount)
bars <- rep(1:n, each = tickCount)[seq_along(ticks)]
## make a bar
Try NSE: in the URL
Also replace demo apikey with your APIKey
I tried out Alphavantage a while ago. I was looking at it as a source of data for US and Canadian stocks. They use IEX for US stock data. There are a few other international symbols that do work because they seem to pass-through the request to Yahoo (or other free sources) and return that data back to you. I think they may also use that as a fall-back if ...
We have a (cheap) commercial solution that addresses Symbol mapping from RIC to BBG to ISIN CUSIP activ ICE you name it
We cover all markets and OTC. Problem is... the churn rate of new instruments and Corporate actions
Hence Magtia create a new mapping for ALL instruments ( Cash Deriv OTC) for each market EVERY day before each market opens .