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 Mindset, Today, 06:46 AM
    0 responses
    9 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, Yesterday, 05:21 PM
    0 responses
    14 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    15 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    82 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    48 views
    0 likes
    Last Post PaulMohn  
    Working...
    X