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 3,115 views
    2. thumb_up 2 thanks given
    3. group 1 followers
    1. forum 5 posts
    2. attach_file 2 attachments




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

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:	276
Size:	34.1 KB
ID:	27478  
Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
April CPI Preview: +3.7% YoY Expected at 8:30 AM ET -- C …
Traders Hideout
US Navy Blockade of Hormuz Starts Today -- Oil Surges 8p …
Prediction Markets & Event Contracts
Rubios Good News Within Hours and the 30-Day Math: Why H …
Prediction Markets & Event Contracts
Cboe Files for Near 24x5 Equities Trading -- December 20 …
Traders Hideout
Third Circuit Backs Kalshi in Landmark Ruling -- Predict …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
24 thanks
2026 Jlab journal
10 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Lady Vols Primer: Trading Volatility Journal
6 thanks
2026 Fire Horse
5 thanks
  #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,669 since Jun 2009
Thanks Given: 33,669
Thanks Received: 102,557

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 X 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: 801

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:	289
Size:	29.1 KB
ID:	27544  
Started this thread Reply With Quote
Thanked by:




Last Updated on December 31, 2010


© 2026 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 - Downloads - Top
no new posts