예제 #1
0
        // When a spread is created, updated or deleted.
        private void OnSpreadDefinitionNotification(object sender, InstrumentCatalogEventArgs e)
        {
            Console.WriteLine("=== OnSpreadDefinitionNotification " + e?.Event + " " + e?.Message);
            switch (e.Event)
            {
            case ProductDataEvent.Found:
                Console.WriteLine("   Here are all the current spread definitions");
                foreach (var sp in e.InstrumentCatalog.InstrumentList)
                {
                    Console.WriteLine("   Spread " + sp.Name);
                }

                if (!subscriptionReady)
                {
                    subscriptionReady = true;
                    var newInst     = CreateSpread();
                    var updatedInst = UpdateSpread(newInst);
                    DeleteSpread(updatedInst);
                }
                break;

            case ProductDataEvent.InstrumentDeleted:
                foreach (var sp in e.Deleted)
                {
                    Console.WriteLine("   Spread " + sp.Name + " was deleted.");
                }
                break;

            case ProductDataEvent.InstrumentUpdated:
                foreach (var sp in e.Updated)
                {
                    Console.WriteLine("   Spread " + sp.Name + " was updated.");
                }
                break;

            case ProductDataEvent.InstrumentCreated:
                foreach (var sp in e.Added)
                {
                    Console.WriteLine("   Spread " + sp.Name + " was created.");
                }
                break;
            }
        }
        private void instrumentsUpdated(object sender, InstrumentCatalogEventArgs e)
        {
            InstrumentCatalog instrumentCatalog = sender as InstrumentCatalog;

            updateInstrumentTreeViewNodes(instrumentCatalog);
        }