Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

why is market data showing negative prices

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    why is market data showing negative prices

    I have this simple logic to print out the market data and it shows negative prices and proper prices for Ask. I am using IB as data provider

    the data is
    123.26'5
    -9223372036854780.00'0
    -9223372036854780.00'0
    123.26'5
    -9223372036854780.00'0
    123.26'5
    -9223372036854780.00'0
    -9223372036854780.00'0
    123.26'6
    -9223372036854780.00'0
    123.26'6
    -9223372036854780.00'0
    -9223372036854780.00'0
    -9223372036854780.00'0
    123.26'7
    -9223372036854780.00'0
    123.26'7
    -9223372036854780.00'0
    -9223372036854780.00'0
    -9223372036854780.00'0
    -9223372036854780.00'0
    -9223372036854780.00'0
    -9223372036854780.00'0
    Code:
    protected override void OnMarketData(MarketDataEventArgs marketDataUpdate)
    		{
    			Print(SuperDom.Instrument.MasterInstrument.FormatPrice(marketDataUpdate.Ask));
    //            if (limitprice > 0 && marketDataUpdate.Ask < limitprice)
    //            {
    				
    //                Print(DateTime.Now + SuperDom.Instrument.FullName + limitprice + "Crossed below ask" +  String.Format("{0:0.0000}",SuperDom.Instrument.MasterInstrument.FormatPrice(marketDataUpdate.Ask)));       
    //            }
    			
    		}

    #2
    Hello,

    I believe this is caused by the syntax you are using and also by the syntax that is missing.

    Because you are not filtering what event specifically you want to print, you are printing the Ask object from Last, Ask and Bid events which it is only valid for Last events.

    I believe what you are instead looking for would be one of the following:

    Code:
    if(marketDataUpdate.MarketDataType == MarketDataType.Last)
    {
    	Print("Last: " + marketDataUpdate.Price + " Ask: " + marketDataUpdate.Ask+ " Bid: " + marketDataUpdate.Bid);
    }
    			
    if(marketDataUpdate.MarketDataType == MarketDataType.Ask)
    {
    	Print("Ask: " + marketDataUpdate.Price);
    }
    
    if(marketDataUpdate.MarketDataType == MarketDataType.Bid)
    {
    	Print("Bid: " + marketDataUpdate.Price);
    }
    I look forward to being of further assistance.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by kinfxhk, 07-13-2026, 10:18 AM
    0 responses
    24 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 07-13-2026, 09:50 AM
    0 responses
    14 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 07-13-2026, 07:21 AM
    0 responses
    21 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by kinfxhk, 07-11-2026, 02:11 AM
    0 responses
    20 views
    0 likes
    Last Post kinfxhk
    by kinfxhk
     
    Started by SalmaTrader, 07-07-2026, 10:26 PM
    0 responses
    135 views
    0 likes
    Last Post SalmaTrader  
    Working...
    X