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 Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    666 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    377 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    110 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    575 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    580 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X