public OptionContractTicker(
     MamdaOptionContract contract,
     MamdaOptionChainView view,
     OptionChainDisplay display)
 {
     myContract = contract;
     myView     = view;
     myDisplay  = display;
 }
        public static void Main(string[] args)
        {
            MamaTransport        baseTransport    = null;
            MamaTransport        optionTransport  = null;
            MamaTransport        dictTransport    = null;
            MamaQueue            defaultQueue     = null;
            MamaDictionary       dictionary       = null;
            CommandLineProcessor options = new CommandLineProcessor (args);

            if (options.hasLogLevel())
            {
                logLevel_ = options.getLogLevel();
                Mama.enableLogging(logLevel_);
            }

            try
            {
                // Initialize MAMA
                myBridge = new MamaBridge(options.getMiddleware());
                Mama.open ();

                // Initialize transports.  We're assuming that options and
                // underlyings might be on different transports.  Note:
                // some companies might use multiple transports for
                // underlyings (e.g., CTA and NASDAQ), which case it woud
                // be necessary to create three transports here and be
                // sure to pass the correct transport later.
                baseTransport = new MamaTransport();
                baseTransport.create(options.getTransport(), myBridge);
                optionTransport = baseTransport;
                defaultQueue = Mama.getDefaultEventQueue(myBridge);

                // The dictionary transport might be different from the
                // other transports (although in this example we're just
                // using the same transport name as the underlying).
                dictTransport = baseTransport;

                // Fetch and initialize the data dictionary
                MamaSource dictionarySource = new MamaSource();
                dictionarySource.symbolNamespace = options.getDictSource();
                dictionarySource.transport = baseTransport;
                dictionary = buildDataDictionary(dictTransport, defaultQueue, dictionarySource);
                MamdaQuoteFields.setDictionary(dictionary, null);
                MamdaTradeFields.setDictionary(dictionary, null);
                MamdaFundamentalFields.setDictionary(dictionary, null);
                MamdaOptionFields.setDictionary(dictionary, null);

                // Create listeners for each chain.  Two subscriptions are
                // necessary.
                foreach (string symbol in options.getSymbolList())
                {
                    // Create chain and listener objects.
                    MamdaTradeListener aBaseTradeListener = new MamdaTradeListener();
                    MamdaQuoteListener aBaseQuoteListener = new MamdaQuoteListener();
                    MamdaOptionChain anOptionChain = new MamdaOptionChain (symbol);
                    anOptionChain.setUnderlyingQuoteListener(aBaseQuoteListener);
                    anOptionChain.setUnderlyingTradeListener(aBaseTradeListener);
                    MamdaOptionChainListener  anOptionListener =
                        new MamdaOptionChainListener(anOptionChain);

                    // Set up the view (could be configurable, of course):
                    MamdaOptionChainView anOptionView =
                        new MamdaOptionChainView (anOptionChain);
                    anOptionView.setNumberOfExpirations(2);
                    anOptionView.setStrikeRangeNumber(4);
                    anOptionView.setJitterMargin(1.0);

                    // Create our handlers (the UnderlyingTicker and
                    // OptionChainDisplay could be a single class).
                    UnderlyingTicker  aBaseTicker =
                        new UnderlyingTicker(anOptionChain, false);
                    OptionChainDisplay  aDisplay =
                        new OptionChainDisplay(anOptionView);

                    // Create subscriptions for underlying and option chain:
                    MamdaSubscription  aBaseSubscription = new MamdaSubscription();
                    MamdaSubscription  anOptionSubscription =
                        new MamdaSubscription();

                    // Register for underlying quote and trade events.
                    aBaseTradeListener.addHandler(aBaseTicker);
                    aBaseQuoteListener.addHandler(aBaseTicker);
                    aBaseSubscription.addMsgListener(aBaseTradeListener);
                    aBaseSubscription.addMsgListener(aBaseQuoteListener);

                    aBaseSubscription.create(
                        baseTransport,
                        defaultQueue,
                        options.getSource(),
                        symbol,
                        null);
                    mamdaSubscriptions.Add(aBaseSubscription);
                    // Register for underlying option events.
                    anOptionListener.addHandler(aDisplay);
                    anOptionListener.addHandler(anOptionView);

                    // We set the timeout to 1 for this example because we
                    // currently use the timeout feature to determine when
                    // to say that we have received all of the initials.
                    // There will be a separate time interval for this in
                    // the future.
                    anOptionSubscription.setTimeout(1);
                    anOptionSubscription.addMsgListener(anOptionListener);
                    anOptionSubscription.addStaleListener(aDisplay);
                    anOptionSubscription.addErrorListener(aDisplay);
                    anOptionSubscription.setType(mamaSubscriptionType.MAMA_SUBSC_TYPE_GROUP);
                    anOptionSubscription.create(
                        optionTransport,
                        defaultQueue,
                        options.getSource(),
                        symbol,
                        null);
                     optionSubscriptions.Add(anOptionSubscription);
                }

                //Start dispatching on the default event queue
                Mama.start(myBridge);
                GC.KeepAlive(dictionary);

                Console.WriteLine("Press ENTER or Ctrl-C to quit...");
                Console.ReadLine();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
                Environment.Exit(1);
            }
        }
            public OptionContractTicker(
				MamdaOptionContract   contract,
				MamdaOptionChainView  view,
				OptionChainDisplay    display)
            {
                myContract            = contract;
                myView                = view;
                myDisplay             = display;
            }
 public OptionChainDisplay(MamdaOptionChainView view)
 {
     myView  = view;
 }
        public static void Main(string[] args)
        {
            MamaTransport        baseTransport   = null;
            MamaTransport        optionTransport = null;
            MamaTransport        dictTransport   = null;
            MamaQueue            defaultQueue    = null;
            MamaDictionary       dictionary      = null;
            CommandLineProcessor options         = new CommandLineProcessor(args);

            if (options.hasLogLevel())
            {
                logLevel_ = options.getLogLevel();
                Mama.enableLogging(logLevel_);
            }

            try
            {
                // Initialize MAMA
                myBridge = new MamaBridge(options.getMiddleware());
                Mama.open();

                // Initialize transports.  We're assuming that options and
                // underlyings might be on different transports.  Note:
                // some companies might use multiple transports for
                // underlyings (e.g., CTA and NASDAQ), which case it woud
                // be necessary to create three transports here and be
                // sure to pass the correct transport later.
                baseTransport = new MamaTransport();
                baseTransport.create(options.getTransport(), myBridge);
                optionTransport = baseTransport;
                defaultQueue    = Mama.getDefaultEventQueue(myBridge);

                // The dictionary transport might be different from the
                // other transports (although in this example we're just
                // using the same transport name as the underlying).
                dictTransport = baseTransport;

                // Fetch and initialize the data dictionary
                MamaSource dictionarySource = new MamaSource();
                dictionarySource.symbolNamespace = options.getDictSource();
                dictionarySource.transport       = baseTransport;
                dictionary = buildDataDictionary(dictTransport, defaultQueue, dictionarySource);
                MamdaQuoteFields.setDictionary(dictionary, null);
                MamdaTradeFields.setDictionary(dictionary, null);
                MamdaFundamentalFields.setDictionary(dictionary, null);
                MamdaOptionFields.setDictionary(dictionary, null);

                // Create listeners for each chain.  Two subscriptions are
                // necessary.
                foreach (string symbol in options.getSymbolList())
                {
                    // Create chain and listener objects.
                    MamdaTradeListener aBaseTradeListener = new MamdaTradeListener();
                    MamdaQuoteListener aBaseQuoteListener = new MamdaQuoteListener();
                    MamdaOptionChain   anOptionChain      = new MamdaOptionChain(symbol);
                    anOptionChain.setUnderlyingQuoteListener(aBaseQuoteListener);
                    anOptionChain.setUnderlyingTradeListener(aBaseTradeListener);
                    MamdaOptionChainListener anOptionListener =
                        new MamdaOptionChainListener(anOptionChain);

                    // Set up the view (could be configurable, of course):
                    MamdaOptionChainView anOptionView =
                        new MamdaOptionChainView(anOptionChain);
                    anOptionView.setNumberOfExpirations(2);
                    anOptionView.setStrikeRangeNumber(4);
                    anOptionView.setJitterMargin(1.0);

                    // Create our handlers (the UnderlyingTicker and
                    // OptionChainDisplay could be a single class).
                    UnderlyingTicker aBaseTicker =
                        new UnderlyingTicker(anOptionChain, false);
                    OptionChainDisplay aDisplay =
                        new OptionChainDisplay(anOptionView);

                    // Create subscriptions for underlying and option chain:
                    MamdaSubscription aBaseSubscription    = new MamdaSubscription();
                    MamdaSubscription anOptionSubscription =
                        new MamdaSubscription();

                    // Register for underlying quote and trade events.
                    aBaseTradeListener.addHandler(aBaseTicker);
                    aBaseQuoteListener.addHandler(aBaseTicker);
                    aBaseSubscription.addMsgListener(aBaseTradeListener);
                    aBaseSubscription.addMsgListener(aBaseQuoteListener);

                    aBaseSubscription.create(
                        baseTransport,
                        defaultQueue,
                        options.getSource(),
                        symbol,
                        null);
                    mamdaSubscriptions.Add(aBaseSubscription);
                    // Register for underlying option events.
                    anOptionListener.addHandler(aDisplay);
                    anOptionListener.addHandler(anOptionView);

                    // We set the timeout to 1 for this example because we
                    // currently use the timeout feature to determine when
                    // to say that we have received all of the initials.
                    // There will be a separate time interval for this in
                    // the future.
                    anOptionSubscription.setTimeout(1);
                    anOptionSubscription.addMsgListener(anOptionListener);
                    anOptionSubscription.addStaleListener(aDisplay);
                    anOptionSubscription.addErrorListener(aDisplay);
                    anOptionSubscription.setType(mamaSubscriptionType.MAMA_SUBSC_TYPE_GROUP);
                    anOptionSubscription.create(
                        optionTransport,
                        defaultQueue,
                        options.getSource(),
                        symbol,
                        null);
                    optionSubscriptions.Add(anOptionSubscription);
                }

                //Start dispatching on the default event queue
                Mama.start(myBridge);
                GC.KeepAlive(dictionary);

                Console.WriteLine("Press ENTER or Ctrl-C to quit...");
                Console.ReadLine();
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
                Environment.Exit(1);
            }
        }
            bool myGotRecap             = false;  // Updated when we get the first recap.

            public OptionChainDisplay(MamdaOptionChainView view)
            {
                myView = view;
            }