charlotte nc
Experience: Advanced
Platform: My Own System
Broker: Optimus
Trading: Emini (ES, YM, NQ, ect.)
Posts: 408 since Jan 2015
Thanks Given: 90
Thanks Received: 1,148
|
I dabble in this space and have built some fairly granular micro structures using NinjaTrader with an extraction program I wrote in C# and some clean up / sequencing scripts in MS SQL. So if you don't mind getting into some basic coding and you don't mind doing the work yourself, you can get the following fairly easily.
Prerequisites are to download Ninjatrader 8 and then download market replay data for whatever instrument / period you want. Then write your code and output it to either the output window or write it to a text file, both are fairly easy.
1. Ninjatrader has a level 1 feed that gives you access to things like: Adds, Cancels (you have to do a little work to distinguish these), and Transactions. The transactions are granular but the basic volume updates come in aggregate, so you have to do a little work to un-bundle these to see the individual order updates, and make sense of everything. It's not as clean as the MBO feed, but it's directionally accurate and can be useful to help you get access to the data in whatever format you want it (By order, by price level, by tick aggregate, etc.). You can work from this event handler to access the level 1 feed: (Major Event Handler below)
protected override void OnMarketData(MarketDataEventArgs marketDataUpdate)
{
}
2. Within the OnMarketData feed you can pull the all the prices and all the level 1 volume updates from the Bid or Ask. These contain not just transactions but adds and cancels as well. So to the OP I believe this would solve your pain point of only seeing bid and ask data when a transaction is in play. This will give you everything.
Just set a variable for holding price updates and one for volume updates. For example
if( marketDataUpdate.MarketDataType == MarketDataType.Ask)
{
PriceVariable = marketDataUpdate.Price;
VolumeVariable = marketDataUpdate.Volume;
}
If you ran the code above wide open you would hit hundreds of thousands of rows over a period of just a few minutes. So you will likely want to build some logic to only output key updates at key intervals. I like to capture the starting volume and ending volume of every price level along with the total added volume total canceled volume and total transacted volume. But there are a ton of other things you can do as well.
3. If you want the transaction updates you can get them like this: (Bid Example below)
if (marketDataUpdate.MarketDataType == MarketDataType.Last )
{
#region Bid Update
if (marketDataUpdate.Price <= marketDataUpdate.Bid)
{
BidTransactionPrice = marketDataUpdate.Price;
BidTransactionVolume = marketDataUpdate.Volume;
}
}
4. If you want to cut down the noise and just get the price level changes you can create a basic if statement to measure a variable against the current new price and if it has changed to output it and if it is the same do nothing. This will print all the changes in sequence.
There are a number of ways to slice and dice this, but if you hack around for a bit you can do a quite a bit yourself. I have never found a source to buy fully developed analysis of the market microstructures so I started building them myself to help me learn what the hell was going on under the hood.
I am always willing to share a few lines of code here and there if there is any interest.
Best of luck!
Ian
In the analytical world there is no such thing as art, there is only the science you know and the science you don't know. Characterizing the science you don't know as "art" is a fools game. |
|