Announcement
Collapse
No announcement yet.
Partner 728x90
Collapse
NinjaTrader
OnMarketData & OnMarketDepth should be the same method
Collapse
X
-
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.
- Likes 1
-
Originally posted by NinjaTrader_JoshG View Postit's noted in the help guide these are not guaranteed to be in order.
Thats why the title is "OnMarketData & OnMarketDepth should be the same method", to eradicate differences, a change is a change, the level should not matter
Originally posted by NinjaTrader_JoshG View PostAlso, "Transact" is not a documented operation. Why are you concerned with this operation?
There are 100 contracts(ES) that disappear, ok, what happened? 100 contracts were hitted or a big player removed 100 contracts?
Leave a comment:
-
Thanks for the details.
Let me rephrase my question, 'what order do you believe is the proper order?' These two methods are called on updates to level 1 and level 2 data, and it's noted in the help guide these are not guaranteed to be in order.
Also, "Transact" is not a documented operation. Why are you concerned with this operation?
Leave a comment:
-
Originally posted by NinjaTrader_JoshG View PostI have some follow up questions for you so that I can better understand what you are trying to accomplish.
why things have order? well for start.. because otherwise it would be a chaos... the data don't need just an structure.. it needs order too
Originally posted by NinjaTrader_JoshG View PostFirst, why are you locking at all?
Originally posted by NinjaTrader_JoshG View PostWhat is the correct order for these methods to be called?
If you check the Print, just keep the "time" test. The others were sketchs...
Code:private DateTime time = DateTime.Now; private void Output(Row row) // TODO keep finding errors { if (time > row.Time) Print("ERROR: running late"); Print(string.Format("{0:HH/mm/ss.fff} {1}[{2:00}]: {3:0.00} -> {4:000} ({5})", row.Time, row.MarketType, row.Position, row.Price, row.Volume, row.Procedure).Replace("/", ":")); time = row.Time; }
Of course most of the time it works fine, but there are exceptions. If you keep the indicator running eventually you will see the msg "ERROR: .." in the Output
Originally posted by NinjaTrader_JoshG View Post- What is obj.Instrument.Sync.MarketData and obj.Instrument.Sync.MarketDepth?
Code:protected override void OnMarketDepth(MarketDepthEventArgs e) { // protect e.Instrument.MarketDepth.Asks and e.Instrument.MarketDepth.Bids against in-flight changes lock (e.Instrument.SyncMarketDepth) {
Last edited by Fernand0; 10-16-2018, 01:43 PM.
Leave a comment:
-
Thanks for sending that in. I have some follow up questions for you so that I can better understand what you are trying to accomplish.
First, why are you locking at all?
they are not capable to receive the events in the right order.
lock(obj.Instrument.SyncMarketData)
lock(obj.Instrument.SyncMarketDepth)
Leave a comment:
-
I never got your email. Can you please send it in again? PlatformSupport(AT)NinjaTrader(DOT)com
Please be sure to put "RE:Josh" in the subject line.
Leave a comment:
-
the strange thing is that this works...
https://ninjatrader.com/support/foru...34#post1035534
but that's on simulated data feed... and for some reason the remove Price is "0.00"
Leave a comment:
-
Originally posted by NinjaTrader_JoshG View PostAre you able to reproduce the same thing after removing this part from your code?
Code:lock(obj.Instrument.SyncMarketData) lock(obj.Instrument.SyncMarketDepth)
I think i sent the code with 1 lock, Depth lock in both. Anyway, it's the same, put the lock of Data in the MarketData, the Depth in the MarketDepth, the other way around, both or none.
The result is the same, the OnMarketData() sent the information after the Operation.Remove of OnMarketDepth()
Leave a comment:
-
Are you able to reproduce the same thing after removing this part from your code?
Code:lock(obj.Instrument.SyncMarketData) lock(obj.Instrument.SyncMarketDepth)
Leave a comment:
-
Hello Chelsea.
Originally posted by NinjaTrader_ChelseaB View PostThere is some undocumented code you are using.
Code:private void Output(Row row) { Print(string.Format("{0:HH/mm/ss.fff} {1}[{2:00}]: {3:0.00} -> {4:000} ({5})", row.Time, row.MarketType, row.Position, row.Price, row.Volume, row.Procedure).Replace("/", ":")); }
And the image that i'm uploading is without any locks... i tried with just the Depth lock... i tried all the combinations...
Why the Customer Service always thinks that is a user problem?
NinjaTrader_ChelseaB I'm sending the code(is not long or complex) by email with the subject "ATTN: Chelsea B". And if you want you can test it yourself just changing the locks and checking the Row class.Last edited by Fernand0; 10-15-2018, 08:39 AM.
Leave a comment:
-
Hello Fernand0,
There is some undocumented code you are using.
Further, the code provided does not seem complete for what is printing.
What is Output()?
Is this a method you have created for printing?
Are you willing to share this method (or an export of a complete example script that demonstrates the behavior)?
Are you finding that if you use all documented code and use the MarketDataEventArgs without locking these the same behavior can be demonstrated?
Leave a comment:
-
-
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); } }
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.-Last edited by Fernand0; 10-14-2018, 02:44 PM.Tags: None
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by giulyko00, Today, 12:03 PM
|
0 responses
2 views
0 likes
|
Last Post
by giulyko00
Today, 12:03 PM
|
||
Started by AttiM, 02-14-2024, 05:20 PM
|
12 responses
213 views
0 likes
|
Last Post
by DrakeiJosh
Today, 11:17 AM
|
||
Started by cre8able, 02-11-2023, 05:43 PM
|
3 responses
238 views
0 likes
|
Last Post
by rhubear
Today, 10:46 AM
|
||
Started by frslvr, 04-11-2024, 07:26 AM
|
8 responses
117 views
1 like
|
Last Post Today, 10:30 AM | ||
Started by stafe, 04-15-2024, 08:34 PM
|
10 responses
47 views
0 likes
|
Last Post
by stafe
Today, 10:29 AM
|
Leave a comment: