NexusFi: Find Your Edge


Home Menu

 





Parse incoming events in C#


Discussion in Platforms and Indicators

Updated
      Top Posters
    1. looks_one bukkan with 2 posts (1 thanks)
    2. looks_two MXASJ with 2 posts (1 thanks)
    3. looks_3 Quick Summary with 1 posts (0 thanks)
    4. looks_4 Big Mike with 1 posts (0 thanks)
    1. trending_up 2,564 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:	205
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
Quantum physics & Trading dynamics
The Elite Circle
Cheap historycal L1 data for stocks
Stocks and ETFs
MC PL editor upgrade
MultiCharts
NT7 Indicator Script Troubleshooting - Camarilla Pivots
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,470 since Jun 2009
Thanks Given: 33,249
Thanks Received: 101,669

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

Mike



Join the free Markets Chat beta: one platform, all the trade rooms!

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:	209
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