For example, when an order comes through and GetCurrentAskVolume() is not changing, I'm expecting OnMarketDepth to show the size changing (+ or - due to adds/cancels) with each transaction, not a stream of changes "long" after the fact. Instead, what I see is OnMarketData for 20 transactions, then followed by 20+ OnMarketDepth transactions, as opposed to OnMarketData, OnMarketDepth, OnMarketData, OnMarketDepth etc. Granted, all of this is occurring within the same second, but I still would think it's a parallel stream where I would get data from both methods as they occurred. Below is the basic code I'm using.
protectedoverridevoid OnMarketDepth(MarketDepthEventArgs e)
{
if (file != null) {
if (Historical) return;
if (e.MarketDataType == MarketDataType.Ask && e.Position == 0)
{
idx++;
aa = a;
a = e.Volume;
d = a - aa;
if(d > 0)
{
sw.WriteLine(a + "," + aa "," + d) } } } }
protectedoverridevoid OnMarketData(MarketDataEventArgs e)
{
if (file != null) {
if (Historical) return;
idx++;
aa1 = a1;
a1 = GetCurrentAskVolume();
d1 = a1 - aa1;
if(d1 > 0)
{
sw.WriteLine("" + "," + "" + "," + "" + "," + a1 + "," + aa1 "," + d1) } } } }
Comment