Is there any way to get the information faster changing the code below (or attached)?
The problem is that I'm getting the volume of each level one at a time and this process is too slow
********** CODE ************************************************** *****
protected override void OnMarketDepth(MarketDepthEventArgs e)
{
if (e.Operation == Operation.Update)
{
if (e.MarketDataType == MarketDataType.Ask && e.Position == 0) VolAskL0 = e.Volume;
if (e.MarketDataType == MarketDataType.Ask && e.Position == 1) VolAskL1 = e.Volume;
if (e.MarketDataType == MarketDataType.Ask && e.Position == 2) VolAskL2 = e.Volume;
if (e.MarketDataType == MarketDataType.Ask && e.Position == 3) VolAskL3 = e.Volume;
if (e.MarketDataType == MarketDataType.Ask && e.Position == 4) VolAskL4 = e.Volume;
if (e.MarketDataType == MarketDataType.Bid && e.Position == 0) VolBidL0 = e.Volume;
if (e.MarketDataType == MarketDataType.Bid && e.Position == 1) VolBidL1 = e.Volume;
if (e.MarketDataType == MarketDataType.Bid && e.Position == 2) VolBidL2 = e.Volume;
if (e.MarketDataType == MarketDataType.Bid && e.Position == 3) VolBidL3 = e.Volume;
if (e.MarketDataType == MarketDataType.Bid && e.Position == 4) VolBidL4 = e.Volume;
VolAskTot = VolAskL0 + VolAskL1 + VolAskL2 + VolAskL3 + VolAskL4;
VolBidTot = VolBidL0 + VolBidL1 + VolBidL2 + VolBidL3 + VolBidL4;
Print("ASK Levels | L0:" + VolAskL0 + " | L1: " + VolAskL1 + " | L2: " + VolAskL2 + " | L3: " + VolAskL3 + " | L4: " + VolAskL4 + " | TOT: " + VolAskTot);
Print("BID Levels | L0:" + VolBidL0 + " | L1: " + VolBidL1 + " | L2: " + VolBidL2 + " | L3: " + VolBidL3 + " | L4: " + VolBidL4 + " | TOT: " + VolBidTot);
}
}
Comment