NexusFi: Find Your Edge


Home Menu

 





Parse incoming events in C#


Discussion in Platforms and Indicators

Updated
      Top Posters
    1. looks_one MXASJ with 2 posts (1 thanks)
    2. looks_two bukkan with 2 posts (1 thanks)
    3. looks_3 Big Mike with 1 posts (0 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
    1. trending_up 2,552 views
    2. thumb_up 2 thanks given
    3. group 1 followers
    1. forum 5 posts
    2. attach_file 2 attachments




 
Search this Thread

Parse incoming events in C#

  #1 (permalink)
 MXASJ 
Asia
 
Experience: Beginner
Platform: NinjaTrader, TOS
Posts: 796 since Jun 2009
Thanks Given: 109
Thanks Received: 800

Hi All,

This is something I should know, but I don't (yet) and would be greatful for some C# help.

From a broker connection I have set up to receive trade events only (think "last price") , I get a stream of data like the attached console window.

I need to parse it to make it useful, I believe.

Each event is always in the same format, starting with 'Tradeinfo:' and ending with 'Timestamp:'

Can anyone off the top of their head throw me a bone on the best way to deal with that kind of event? If it contains 11 variables like that and I only wanted to Console.WriteLine, say, 'price', 'size', and 'timestamp'?

Its basic C# stuff but I'm still learning the basics.

Of course if the answer is "Dude! Don't parse it, do xyz instead!" I'm open to ideas.

Thanks!

Attached Thumbnails
Click image for larger version

Name:	Console.JPG
Views:	201
Size:	34.1 KB
ID:	27478  
Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Better Renko Gaps
The Elite Circle
ZombieSqueeze
Platforms and Indicators
Are there any eval firms that allow you to sink to your …
Traders Hideout
Futures True Range Report
The Elite Circle
Exit Strategy
NinjaTrader
 

  #3 (permalink)
 bukkan 
Calcutta, India
 
Experience: Intermediate
Platform: ArthaChitra
Posts: 278 since Jun 2009
Thanks Given: 161
Thanks Received: 271


think good old split would do fine. and then

if (line.Contains("price")) //or line.StartsWith("price")
{
// do something;
}

Reply With Quote
Thanked by:
  #4 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,393 since Jun 2009
Thanks Given: 33,172
Thanks Received: 101,530

It isn't an index/array? like [0] is price, [1] time etc?

Mike

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
  #5 (permalink)
 bukkan 
Calcutta, India
 
Experience: Intermediate
Platform: ArthaChitra
Posts: 278 since Jun 2009
Thanks Given: 161
Thanks Received: 271

normally the data comes in a block. we have to split the same to lines. char(10) or char(13) are usually used to do this. then from that array we scrap the data.

Reply With Quote
  #6 (permalink)
 MXASJ 
Asia
 
Experience: Beginner
Platform: NinjaTrader, TOS
Posts: 796 since Jun 2009
Thanks Given: 109
Thanks Received: 800

Thanks guys,

After some RTFM time it turns out I can call the properties of that class directly (more or less), which is what I was hoping was the case.

Also had to read up a bit on the seconds-since-epoch time stamp thing but its all about continual learning, right?

Attached Thumbnails
Click image for larger version

Name:	Doh.JPG
Views:	206
Size:	29.1 KB
ID:	27544  
Started this thread Reply With Quote
Thanked by:





Last Updated on December 31, 2010


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts