Esempio n. 1
0
 public void SetUp()
 {
     _level2Client = Level2ClientFactory.CreateNew();
     // ** IMPORTANT ** you should always subscribe to System event
     _level2Client.System += message => { };
     _level2Client.Connect();
 }
Esempio n. 2
0
        public async Task RunAsync()
        {
            // Step 1 - !!! Configure your credentials for IQConnect in user environment variable or app.config !!!
            //              Check the documentation for more information.

            // Step 2 - Run IQConnect launcher
            IQFeedLauncher.Start();

            // Step 3 - Use the appropriate factory to create the client
            var level2Client = Level2ClientFactory.CreateNew();

            // Step 4 - Connect it
            level2Client.Connect();

            // Step 5 - Register to appropriate events

            // ** IMPORTANT ** you should always subscribe to System event
            level2Client.System += Level2ClientOnSystem;
            level2Client.Error  += Level2ClientOnError;

            level2Client.Summary   += Level2ClientOnSummary;
            level2Client.Update    += Level2ClientOnSummary;
            level2Client.Timestamp += Level2ClientOnTimestamp;

            // Step 6 - Make your streaming Level 2 requests
            level2Client.ReqWatch("@ES#");

            Console.WriteLine("Watching @ES# for the next 30 seconds... Please be patient ;-)\n");
            await Task.Delay(TimeSpan.FromSeconds(30));

            // Step 7 - Unwatch and unregister events
            level2Client.ReqUnwatch("@ES#");

            level2Client.Summary   -= Level2ClientOnSummary;
            level2Client.Update    -= Level2ClientOnSummary;
            level2Client.Timestamp -= Level2ClientOnTimestamp;
        }