I am enclosing a script I wrote to try to reconcile the differences between the prices and volumes obtained by the GetCurrent() methods which I now understand run on the bar event and are sized accordingly regardless of which event handler was used.
From the looks of it here is what I see:
Part 1: Volumes:
- Resting Volumes: GetCurrentBidVolume() and GetCurrentAskVolume() show the resting volumes as a snapshot in time and would be in line with what users see on a tool like the DOM. The limitation I see is that these values don't get refreshed every time there is an added contract, or a transacted contracted. It appears that these get updated kind of randomly every so often. So this alone will not show you the entire picture. Do you have any insight into the frequency of the updates to this?
- Volume[0]: This would be backwards looking and show the transacted volume that occurred during a period of time, specifically the bar being used 1 tick, 25 ticks, 50 ticks, etc.
- Market Update Volumes: If you run these on a 1 tick chart and do not enable tick replay, then the bid side or ask side will = the Volume[0] exactly. This will give you visibility into which side had the transaction on that specific trade. So this is backward looking and not forward looking.
Part 2: Prices
- Active Price Levels: I always assumed that GetCurrentBid() and GetCurrentAsk() would provide the most up to date price level in play. I suppose the limitation of this would be that this is only going to update and therefore be as granular as the bar size used. So 1 tick for example would be the most granular, but 100 tick for example would have a serious lag.
- Market Data Price Levels: I interpret this as backward looking at the most recent transacted price at the bid or ask level. From the documentation: "If used with TickReplay, please keep in mind Tick Replay ONLY replays the Last market data event, and only stores the best inside bid/ask price at the time of the last trade event. You can think of this as the equivalent of the bid/ask price at the time a trade was reported."
So in my mind, GetCurrentAsk() or GetCurrentBid() would be leading whereas anything derived from marketdata would be historic and therefore lagging. My testing confirms this at least for volumes and the prices appear to move first on the GetCurrent events and the OnMarketData prices lag. Please confirm that I did not miss anything, and that I have this right.
Overall, from this simple script I see that the market data volumes are transactional in nature and do not represent the forward looking resting volumes, and I believe the same is true for the prices.
So as my goal here is to see the resting volumes with the most granularity possible, I suppose in order to deconstruct this the best possible method would be the following:
1. Start with the bid or ask volume present when an order is submitted.
2. From this point forward run the market data volumes to see any new transacted volume since the entry. Subtract the starting volume - the total subtracted volume to get the current remaining volume.
3. On any new subsequent updates to GetCurrentBidVolume() or GetCurrentAskVolume() you would have to take the the total from 2 above which would be your queue position and then back out any incremental new volume that was added during this next update. The goal is really not so much to measure any incremental update to the bid or ask volumes from the GetCurrent method so much as keep a running total of all transacted volume since you marked your entry volume. When your queue position = 0 you should get filled.
In the past I was measuring only from the GetCurrent() volume methods and I was running a 50 -100 tick size so I likely missed some of the granularity. I believe I now have the approach to this.
Let me know your thoughts, as I want to make sure I have everything correct. If so, I will retest and report back in a few days.
Thanks,
Ian
Comment