• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

OnMarketData & OnMarketDepth should be the same method

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

  • OnMarketData & OnMarketDepth should be the same method

    Hi! I hope you are having a good day.

    Ahm, i really don't know where to put this subject...
    I'm trying to establish a data structure from raw data.... and this raw data sometimes doesn't come in the right order


    Code:
    private void OnMarketData(object sender, MarketDataEventArgs obj)
            {
    
                lock(obj.Instrument.SyncMarketData)
                lock(obj.Instrument.SyncMarketDepth)
                {
    
                    if (obj.MarketDataType != MarketDataType.Last)
                        return;
    
    
                    double Position = 0;
                    MarketDataType MarketType = MarketDataType.Ask;
    
                    if (obj.Price >= obj.Ask)
                    {
                        MarketType = MarketDataType.Ask;
                        Position = obj.Price - obj.Ask;
                    }
                    else if (obj.Price <= obj.Bid)
                    {
                        MarketType = MarketDataType.Bid;
                        Position = obj.Bid - obj.Price;
                    }
    
    
                    try { Position = Position / TickSize; }
                    catch(Exception e) { Position = 0; }
    
    
                    Row row = new Row(obj) {
                        MarketType    = MarketType,
                        Position    = (int)Position
                    };
    
                    Registry.Add(row);
    
    
                    if (Printing)
                        Output(row);
    
                }
    
            }
    Code:
    private void OnMarketDepth(object sender, MarketDepthEventArgs obj)
            {
    
                lock(obj.Instrument.SyncMarketData)
                lock(obj.Instrument.SyncMarketDepth)
                {
    
                    Row row = new Row(obj);
                    Registry.Add(row);
    
                    if (Printing)
                        Output(row);
    
                }
    
            }
    It's basically the same code....
    I flagged the problem in the image, you can see that there are other cases, sometimes they share the DateTime, sometimes they don't, but the most important is that they are not capable to receive the events in the right order.
    Therefore you will have troubles to reconstruct this data.

    If you know how to solve this, or some kind of temporary solution.... I'm all ears(or.. eyes..)


    My regards.
    Fernando.-
    Attached Files
    Last edited by Fernand0; 10-14-2018, 02:44 PM.

  • Fernand0
    replied
    Originally posted by AndreaBhs View Post
    Dear Josh,

    So, about this question:

    "
    There are 100 contracts(ES) that disappear, ok, what happened? 100 contracts were hitted or a big player removed 100 contracts?"

    i'm able to check this for the first level of book ? or are there problems also in this case ?

    thank you, best regards.
    AndreaBhs




    You don't have the property MarketDepthEventArgs.Operation in Level 1.. so you can't. You can only know HOW MUCH the volume of Level 1 changed, but not WHY.

    Leave a comment:


  • AndreaBhs
    replied
    Dear Josh,

    So, about this question:

    "
    There are 100 contracts(ES) that disappear, ok, what happened? 100 contracts were hitted or a big player removed 100 contracts?"

    i'm able to check this for the first level of book ? or are there problems also in this case ?

    thank you, best regards.
    AndreaBhs




    Leave a comment:


  • NinjaTrader_JoshG
    replied
    AndreaBhs,

    Are Data.MarketDataType.Bid and Data.MarketDataType.Ask perfectly in sync with the trades event that occurs only for this level?
    That is correct.

    Leave a comment:


  • AndreaBhs
    replied
    Dear Josh,

    I want to clarify a question about OnMarketData method.

    I know that (
    e.MarketDataType == Data.MarketDataType.Last) will trigger when last trade occurs.
    While, before last trade occurs,
    (e.MarketDataType ==
    Data.MarketDataType.Bid) and (
    e.MarketDataType ==
    Data.MarketDataType.Ask) can change many times.

    With the OnMarketData method we can have accesso only to level 1 of the book.
    Are
    Data.MarketDataType.Bid and Data.MarketDataType.Ask
    perfectly in sync with the trades event that occurs only for this level?
    is it correct what I understood ?

    thank you, best regards

    AndreaBhs

    Leave a comment:


  • NinjaTrader_JoshG
    replied
    AndreaBhs,

    These are two separate threads and are not guaranteed to be updated synchronously. There is not a lot of demand for this item but we are tracking all feedback for a potential change in the future.

    Let me know if there is anything else I can do to assist.

    Leave a comment:


  • AndreaBhs
    replied
    Originally posted by Fernand0 View Post

    AndreaBhs

    No, sorry, OnMarketData keeps RECEIVING the data on time(sometimes), BUT there are a lot of cases where it's DELIVERED late.
    That discrepancy between the time of the event when it occurs and the time when you get the data shows that the sequence of events is not trustworthy.

    You can try with Simulated Data Feed, you won't find this problem, but as the name says, it's a simulation.

    The worst problem of this is for example when you want to use a RNN(Recurrent Neural Network), the data has to be in the right sequence, otherwise the system won't understand what's going on...


    Indeed, this is an issue that they should tackle as a PRIORITY.. but, it doesn't seem like they did, or will.


    My possibilities can't modify the configuration of this 2 methods(OnMarketData and OnMarketDepth). So I can't do anything at all.
    Just wait or find another platform, because we are in 2019 and Level 2 is no joke, it has been used for a while now, and NinjaTrader is failing at providing this paramount feature.
    Dear Fernand, thank you very much for your reply.
    I like Ninjatrader and Ninjascript, but this is not a little limitation.


    Hi Josh, I programmed in Ninjasript for a few months and it is one of the first things I noticed, no one else has requested this updates of OnMarketData method?

    thank you, regards




    Leave a comment:


  • Fernand0
    replied
    Originally posted by NinjaTrader_JoshG View Post
    Hello AndreaBhs,
    Welcome to the NinjaTrader forum.

    This is a threading limitation, and there are not any updates on this item at this time. I will go ahead and have a vote added to Fernand0's feature request on your behalf. We're taking all of the feedback provided regarding this change into consideration, however, there is no timeline on when or if this will be changed.
    Sorry Josh, but it's not good enough. This is not about "feedbacks" or "votes". This is a SERIOUS problem that other platforms don't have because they are aware of its importance.
    And while this has to be fixed, I see how NT Devs are more interested in releasing indicators to be bought........

    Leave a comment:


  • NinjaTrader_JoshG
    replied
    Hello AndreaBhs,
    Welcome to the NinjaTrader forum.

    This is a threading limitation, and there are not any updates on this item at this time. I will go ahead and have a vote added to Fernand0's feature request on your behalf. We're taking all of the feedback provided regarding this change into consideration, however, there is no timeline on when or if this will be changed.

    Leave a comment:


  • Fernand0
    replied
    Originally posted by AndreaBhs View Post
    Dear Support and Fernand0,
    are there some updates about this request?
    I found the same problem, OnMarketData and OnMarketDepth are not in sync.
    AndreaBhs

    No, sorry, OnMarketData keeps RECEIVING the data on time(sometimes), BUT there are a lot of cases where it's DELIVERED late.
    That discrepancy between the time of the event when it occurs and the time when you get the data shows that the sequence of events is not trustworthy.

    You can try with Simulated Data Feed, you won't find this problem, but as the name says, it's a simulation.

    The worst problem of this is for example when you want to use a RNN(Recurrent Neural Network), the data has to be in the right sequence, otherwise the system won't understand what's going on...

    Originally posted by AndreaBhs View Post
    it is a very important thing to know, otherwise is useless to have access to level 2.
    Indeed, this is an issue that they should tackle as a PRIORITY.. but, it doesn't seem like they did, or will.

    Originally posted by AndreaBhs View Post
    How can I resolve this ?
    My possibilities can't modify the configuration of this 2 methods(OnMarketData and OnMarketDepth). So I can't do anything at all.
    Just wait or find another platform, because we are in 2019 and Level 2 is no joke, it has been used for a while now, and NinjaTrader is failing at providing this paramount feature.
    Last edited by Fernand0; 03-20-2019, 07:22 AM.

    Leave a comment:


  • AndreaBhs
    replied
    Dear Support and Fernand0,
    are there some updates about this request?
    I found the same problem, OnMarketData and OnMarketDepth are not in sync.

    this matter that Fernand0 said:
    "
    There are 100 contracts(ES) that disappear, ok, what happened? 100 contracts were hitted or a big player removed 100 contracts?"

    it is a very important thing to know, otherwise is useless to have access to level 2.
    How can I resolve this ?
    thank you, best regards
    Andrea

    Leave a comment:


  • Fernand0
    replied
    Cool, hope it gets released fast, is really importan if you want to process DOM data
    Thanks again.

    Regards.
    Fernando.-

    Leave a comment:


  • NinjaTrader_JoshG
    replied

    Thanks for your patience.

    The internal tracking number for your feature request is SFT-3592. Please reference this internal tracking number if you ever have questions regarding this feature request.

    When a feature request is implemented, you'll find it in the release notes:

    http://ninjatrader.com/support/helpG...ease_notes.htm

    Leave a comment:


  • Fernand0
    replied
    thanks Josh

    Leave a comment:


  • NinjaTrader_JoshG
    replied
    Thanks for the details. I have submitted this as a feature request to the Development Team. I will follow here up with an internal tracking number for your reference as soon as it is created.

    Leave a comment:

Latest Posts

Collapse

Topics Statistics Last Post
Started by Botan626, Today, 04:43 AM
0 responses
2 views
0 likes
Last Post Botan626  
Started by xsgex, Yesterday, 09:46 PM
0 responses
3 views
0 likes
Last Post xsgex
by xsgex
 
Started by Steve L, Yesterday, 09:36 PM
0 responses
4 views
0 likes
Last Post Steve L
by Steve L
 
Started by krugman25, Yesterday, 09:34 PM
0 responses
4 views
0 likes
Last Post krugman25  
Started by indy73, Yesterday, 04:42 PM
0 responses
15 views
0 likes
Last Post indy73
by indy73
 
Working...
X